View previous topic :: View next topic |
Author |
Message |
sivafdms Intermediate
Joined: 29 May 2007 Posts: 165 Topics: 77
|
Posted: Wed Jun 25, 2014 12:51 am Post subject: Search Part of Hexdecimal string and copy |
|
|
In my input file a 4byte hexdeciaml string starting from 2 column. I need to copy all records for which second PD digit is greater than '12'.
input file
Code: |
000001 P *16 @029
D2115FF007FFF0044444
7023C1604C0290F00000
---------------------------
000002 P 36 å 023
D2112FF040FFF0044444
7034C3607C0230F00000
---------------------------
000003 P %57 *027
D2136FF005FFF0044444
7031C5774C0270F00000
---------------------------
000004 P @19 *033
D2117FF005FFF0044444
7023C1979C0330F00000
---------------------------
000005 P 69 ð022
D2112FF008FFF0044444
7043C6904C0220F00000
|
Output file should contain below recs.
Code: |
000002 P 36 å 023
D2112FF040FFF0044444
7034C3607C0230F00000
---------------------------
000003 P %57 *027
D2136FF005FFF0044444
7031C5774C0270F00000
---------------------------
000005 P 69 ð022
D2112FF008FFF0044444
7043C6904C0220F00000
|
I tried below sortcard but it is not working as desired
Code: |
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(03,02,PD0,GT,X'12')
END
/*
|
Thanks,
Siva |
|
Back to top |
|
 |
William Collins Supermod
Joined: 03 Jun 2012 Posts: 437 Topics: 0
|
Posted: Wed Jun 25, 2014 3:11 am Post subject: |
|
|
Code: | //SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(03,01,CH,GT,X'12') |
You had specified a length for the field of two bytes, the value you are comparing to is only one. Why use PD0 and X'cc'? So I went for CH and the X'12'. Experiment. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
|
Posted: Wed Jun 25, 2014 10:46 am Post subject: |
|
|
sivafdms,
You cannot use PD0 in this case as the hex values looks like this in hex for position 3 and length 2 bytes
Code: |
X'1213'
X'1314'
X'1331'
X'1213'
X'1413'
|
PD0 ignores the leading and trailing , so you are left with
Code: |
X'21'
X'31'
X'33'
X'21'
X'41'
|
And all of them are greater than X'12', so it copied all the records.
You need to use Williams suggestion of validating just 1 byte with hex format like he has shown. _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
|
|