View previous topic :: View next topic
|
Author |
Message |
udaydara
New User
Joined: 08 Mar 2009 Posts: 10 Location: Hyderabad
|
|
|
|
Hi,
I am trying to split a variable block record into different variables by using PARSE ,but getting a different value in one of the field(VAR3)
My input file (with hex on)
Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
UDAY1111111 p-k 02YN ¬0714 ±AAA3AAA3
ECCEFFFFFFF409691FFED00125FFFF000008CCCFCCCF0444000004444444440000044444
4418111111101702F02852001F071400000F111311130000000000000000000000000000
|
Trace ouput for REXX code is
Code: |
*-* PARSE VAR RESULT.I VAR1 +4 VAR2 +30 VAR3 +2 VAR4
>>> "UDAY"
>>> "1111111 ?p-k?02YN????¬0714????"
>>> "?:"
>>> "AAA3AAA3? ????? ?????
00000100"
|
VAR3 is hexadecimal value X'008F' at 35th & 36th position .but im getting "?:" value.
Can i use the PARSE statement for spliting a record into variables of different data types?IF yes/no please help me
Is there any other method of doing the same.
I am expecting hexa decimal value at 35th and 36th positions of Input file to be in VAR3 variable. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
You are getting the hex!
after parsing use the C2X function to convert to a displayable format
for example C2X("0") ==> F0 |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
I guess you did not bother to notice, that your input file display
Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
UDAY1111111 p-k 02YN ¬0714 ±AAA3AAA3
ECCEFFFFFFF409691FFED00125FFFF000008CCCFCCCF0444000004444444440000044444
4418111111101702F02852001F071400000F111311130000000000000000000000000000 |
represents all 'unprintable characters' as space - very helpful.
whereas REXX TRACE option at least differentiates between spaces and 'unprintable':
Code: |
*-* PARSE VAR RESULT.I VAR1 +4 VAR2 +30 VAR3 +2 VAR4
>>> "UDAY"
>>> "1111111 ?p-k?02YN????¬0714????"
>>> "?:"
>>> "AAA3AAA3? ????? ?????
00000100"
|
The PARSE instruction works as documented
The data is there, you just need to convert the binary values (or HEX).
H2C might be a good place to start - reading in the documentation. |
|
Back to top |
|
|
|