View previous topic :: View next topic
|
Author |
Message |
vinu78
Active User
Joined: 02 Oct 2008 Posts: 179 Location: India
|
|
|
|
My requirement is as follows:
Need to extract only 17 byte alpha-numeric data (without spaces) which comes in pos 1-30.
In the below example, we are extracting only 1st and 6th record because only those 2 records have exact 17 bytes alpha-numeric without spaces in between them.
Input
Code: |
1B7HC16Y9X3333339
2001 PONTIAC FIREBIRD
2G2GGIK81333666
4Y756JUKOD6767666653666
1990 BENZ CORVETTE
1C7HBAS805L510444
1975 INTERNATIONAL MODEL 1111
8VRTT 43333666789
|
Output
Code: |
1B7HC16Y9X3333339
1C7HBAS805L510444 |
The above record comes in Fixed Byte file of LRECL 100.
Thanks
Vinu |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Vinu78,
Use the following DFSORT JCL
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Your input fb 100 byte file,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OMIT COND=(1,17,SS,EQ,C' ',OR,18,13,CH,GT,C' ')
SORT FIELDS=COPY
//* |
|
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Hi Kolusu... This was very smart.. I liked it.. You are great.. |
|
Back to top |
|
|
vinu78
Active User
Joined: 02 Oct 2008 Posts: 179 Location: India
|
|
|
|
Thanks so much Kolusu. That was a great logic. It worked fine.
Could you please guide me what exactly will 18,13,CH,GT,C' ' does.
I ran it and got the desired results but was not able to get what it does.
Will it look for any character greater than SPACES and omit it.
Whether GT C' ' means valid charcters and numbers ?
Thanks
Vinu |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
What about a blank in 1 with no blanks after, shouldn't that pass also?
Code: |
000000000111111111122222222223
123456789012345678901234567890
8768B7HC16Y9X3333334564568824 |
|
|
Back to top |
|
|
vinu78
Active User
Joined: 02 Oct 2008 Posts: 179 Location: India
|
|
|
|
Yes Craig. That issue can come.. Till now my input doesn't have that scenario. however as you told, that scnenario can come (may be 17 byte alpha-numeric can start from 2nd or 3rd or 4th byte so on till 13th byte) |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
vinu78 wrote: |
Thanks so much Kolusu. That was a great logic. It worked fine.
Could you please guide me what exactly will 18,13,CH,GT,C' ' does.
I ran it and got the desired results but was not able to get what it does.
Will it look for any character greater than SPACES and omit it.
Whether GT C' ' means valid charcters and numbers ?
Thanks
Vinu |
Yes it will check 13 bytes from position 18 and if it find any hex value greater than space(x'40') it will be eliminated . However if your input has binary zeroes (x'00') in any of the 13 bytes then the condition will fail because x'00' is < x'40' |
|
Back to top |
|
|
|