HP3000-L Archives

February 1999, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Joe Geiser <[log in to unmask]>
Reply To:
Joe Geiser <[log in to unmask]>
Date:
Tue, 2 Feb 1999 08:19:30 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (29 lines)
Brad Feazell asks:

> I'm receiving a number, 55, into a pic x(8) field then moving
> the number to
> a pic 9(8) field which results in 55000000 received. I'm
> doing some division
> on the receiving field to get back to 55 but I feel certain
> there's a more
> direct way to do it. Maybe someone can enlighten me?

Your receiving field (the X(8) field) should be:

  FIELD-A        PIC X(8)  JUSTIFY RIGHT.

MOVE INPUT-FLD TO FIELD-A.

Providing that both INPUT-FLD is also of the datatype "X", it should justify
itself to the right, pad with blank to the left.  When moving to the numeric
field, it should (after possibly complaining of Illegal ASCII digits for
spaces), convert the spaces to zeros.

The more elegant way to do this is to accept this value directly into a PIC
9(8) field or PIC S9(8) field - which would make it numeric and right
justify it for you without the additional step, and add the optional sign to
boot.

Best Regards,
Joe (who still remembers his COBOL when he needs to ;)

ATOM RSS1 RSS2