View previous topic :: View next topic
|
Author |
Message |
zaphany
New User
Joined: 16 May 2006 Posts: 11
|
|
|
|
Dear all, I was just wondering if there is a better way to move a hex value to X field, considering the length of the hex value is 512 and which X(256) is expected from it?
Code: |
01 FILLER
* WX-INPUT is something like A7F233D6C4
* somehow by a routine, it can convert to WX-OUTPUT = X'A7F233D6C4'
05 WX-INPUT X(512)
05 WX-OUTPUT X(256)
|
Please help!
[/code] |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Do you mean that you want to convert from a display form of an hex to an actual hex?
From C'A7F233D6C4' which is X'C1F7C6F2F3F3C4F6C3F4' to X'A7F233D6C4' which is C'x2.PD' where the '.' is unprintable...... |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Code: |
03 WS-PACKED-V9 PIC 9(16)V9 COMP-3.
03 WS-PACKED-X REDEFINES WS-PACKED-V9
PIC X(09).
03 WS-PACKED REDEFINES WS-PACKED-V9
PIC 9(17) COMP-3.
03 WS-DISPLAY-V9 PIC 9(16)V9.
03 WS-DISPLAY-X REDEFINES WS-DISPLAY-V9
PIC X(17).
03 WS-DISPLAY REDEFINES WS-DISPLAY-V9
PIC 9(17).
MOVE 'A7F233D6C4' TO WS-DISPLAY-X (1:10).
MOVE ZERO TO WS-DISPLAY-X (11:).
INSPECT WS-DISPLAY-X CONVERTING 'ABCDEF' TO X'FAFBFCFDFEFF'.
MOVE WS-DISPLAY-V9 TO WS-PACKED-V9.
|
At this point, WS-PACKED-X = X'A7F233D6C40000000F'
Note that both NUMERIC fields must be unsigned.
HTH....
Regards,
Bill |
|
Back to top |
|
|
zaphany
New User
Joined: 16 May 2006 Posts: 11
|
|
|
|
Thanks a lot.
So due to the limitation of Comp field, I guess my 512 string need to be chopped and run few times to get the result, right? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
One easy way to do what you need is to define an array that contains all of the 2-byte values (representing from x'00' to x'FF') and then use the "hex-value" in each "input" byte as the displacement into the array to get the corresponding expanded value.
For example a one would return the 2-byte value F1. |
|
Back to top |
|
|
zaphany
New User
Joined: 16 May 2006 Posts: 11
|
|
|
|
Thanks a lot for all your help |
|
Back to top |
|
|
|