IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

To extract records with specific byte count


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vinu78

Active User


Joined: 02 Oct 2008
Posts: 179
Location: India

PostPosted: Wed May 05, 2010 8:33 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed May 05, 2010 9:17 pm
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed May 05, 2010 10:03 pm
Reply with quote

Hi Kolusu... This was very smart.. I liked it.. You are great.. icon_smile.gif
Back to top
View user's profile Send private message
vinu78

Active User


Joined: 02 Oct 2008
Posts: 179
Location: India

PostPosted: Wed May 05, 2010 10:30 pm
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed May 05, 2010 10:33 pm
Reply with quote

What about a blank in 1 with no blanks after, shouldn't that pass also?
Code:
000000000111111111122222222223
123456789012345678901234567890
 8768B7HC16Y9X3333334564568824
Back to top
View user's profile Send private message
vinu78

Active User


Joined: 02 Oct 2008
Posts: 179
Location: India

PostPosted: Wed May 05, 2010 10:35 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed May 05, 2010 10:50 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top