Re: convert packed CHAR to unpacked DIGIT
- From: "slade2" <jacksleight@xxxxxxxxxxx>
- Date: 15 Apr 2005 19:57:01 -0700
Try something like this:
(IBM mainframe COBOLII or later)
01 ws-a pic x(5).
01 ws-b.
05 ws-a5 pic x(5).
05 fil pic x(1) value X'0C'.
01 ws-b-c3 redefines
ws-b pic s9(11) comp-3.
01 ws-c-9 pic s9(11).
01 ws-c-x redefines
ws-c-9.
05 ws-c-ans pic x(10).
05 fil pic x(1).
move ws-a to ws-a5
move ws-b-c3 to ws-c-9
display 'this s/b the ans ==>' ws-c-ans '<=='
All the usual caveats and copouts apply.
ssb wrote:
> Hi,
>
> Input record has a field of size 5 bytes containing packed numbers.
But
> this field is defined as CHARACTER.
>
> E.g. WS-A PIC X(5) '1212343455'
>
> My task is to display '1212343455' on a report. Obviously, it
requires
> converting packed to unpacked numbers.
>
> I tried doing something like this:
>
> MOVE X(5) TO 9(9) COMP-3.
> REDEFINE 9(9) COMP-3 AS 9(10)
>
> Any suggestions/help..? Thanks.
.
- Follow-Ups:
- Re: convert packed CHAR to unpacked DIGIT
- From: slade2
- Re: convert packed CHAR to unpacked DIGIT
- References:
- convert packed CHAR to unpacked DIGIT
- From: ssb
- convert packed CHAR to unpacked DIGIT
- Prev by Date: Re: convert packed CHAR to unpacked DIGIT
- Next by Date: Re: Editors
- Previous by thread: Re: convert packed CHAR to unpacked DIGIT
- Next by thread: Re: convert packed CHAR to unpacked DIGIT
- Index(es):