View previous topic :: View next topic
|
Author |
Message |
shitij
New User
Joined: 09 Sep 2005 Posts: 31 Location: Delhi
|
|
|
|
Hi,
I am Unpacking the COMP-3 fields to Numeric Fields (I have tried alphanumeric also).
The problem is as follows:
I have declared as:
WS-020-INFILE-PACKED17 PIC 9(017) COMP-3.
WS-020-OUTFILE-PACKED17 PIC X(017).
The movement is:
MOVE WS-020-INFILE-PACKED17 TO WS-020-OUTFILE-UNPACKED17.
Now, WS-020-INFILE-PACKED17 is all spaces in the file.
In the DISPLAYS , I get:
WS-020-INFILE-PACKED17 40404040404040404
WS-020-OUTFILE-UNPACKED17 40404040404040404
May I know why spaces are not coming and what should I do to not get the HEX values (for spaces) but get the spaces. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Because the X'404040' becomes X'F4F0F4F004' which becomes X'F4F0F4F0F4' which is 40404. |
|
Back to top |
|
|
Mickeydusaor
Active User
Joined: 24 May 2006 Posts: 258 Location: Salem, Oregon
|
|
|
|
Change this, but you will need to enlarge the picture size
WS-020-OUTFILE-PACKED17 PIC X(017).
WS-020-OUTFILE-PACKED17 PIC 9(017). |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
I believe this
Quote: |
Change this, but you will need to enlarge the picture size
WS-020-OUTFILE-PACKED17 PIC X(017).
WS-020-OUTFILE-PACKED17 PIC 9(017). |
is typo'ed.
If you have these fields
Quote: |
WS-020-INFILE-PACKED17 PIC 9(017) COMP-3.
WS-020-OUTFILE-PACKED17 PIC X(017). |
and want leading spaces before the actual digits, change WS-020-OUTFILE-PACKED17 PIC X(017) to WS-020-OUTFILE-PACKED17 PIC ZZZZZZZZZZZZZZZZ9. If you want leading zeros, use the PIC 9(17) recommended previoiusly. It would also be a good idea to make the field name more informative. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
You can try:
Code: |
WS
WS-020-INFILE-PACKED17 PIC 9(017) COMP-3.
WS-020-INFILE-X REDEFINES
WS-020-INFILE-PACKED17 PIC X(009).
WS-020-OUTFILE-PACKED17 PIC X(017).
PD
IF WS-020-INFILE-PACKED17 IS NOT NUMERIC
AND
WS-020-INFILE-X = SPACES
MOVE SPACES TO WS-020-OUTFILE-PACKED17
ELSE
MOVE WS-020-INFILE-PACKED17 TO WS-020-OUTFILE-PACKED17
END-IF |
This assumes SPACES is the only non-packed value you'll have in your IP. |
|
Back to top |
|
|
|