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

Select records in a file.


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

New User


Joined: 28 Sep 2007
Posts: 71
Location: India.

PostPosted: Fri Sep 25, 2009 12:37 pm
Reply with quote

Hi,

I have an input file which looks like the one below.

5T37 4373950054835 LE 0102....07821448033509
7T37 4373950054835 LE 01020152S000003
7T37 4373950054835 LE 01020165S000002
7T37 4373950054835 LE 01022600S000002
7T37 4373950054835 LE 01022972S000003
7T37 4373950054835 LE 01023777S000002
7T37 4373950054835 LE 01023955S000003
5T37 4373950054835 LE 0103....07821455033509
7T37 4373950054835 LE 01030152S000001
7T37 4373950054835 LE 01030165S000001
7T37 4373950054835 LE 01032600S000001
7T37 4373950054835 LE 01032972S000001
5T37 4373950054835 LE 0202....07821462033509
7T37 4373950054835 LE 02020152S000007
7T37 4373950054835 LE 02020165S000005
7T37 4373950054835 LE 02022600S000005
5T37 4373950022023 JC 0200....03540701033449
7T37 4373950022023 JC 02000152S000009
7T37 4373950022023 JC 02002972S000009
7T37 4373950022023 JC 02003955S000009
7T37 4373950022023 JC 02004048S000009
7T37 4373950022023 JC 02004129S000009
5T37 4373950022023 JC 0300....01001129033449
7T37 4373950022023 JC 03000152S000008

Here, in the output file I should have the records starting with '5T' and then followed by records starting with '7T'. but only a maximum of 3 '7T' records can follow the '5T' records.

Any idea would be of really a great Help.

Thanks,
Sathya.
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Fri Sep 25, 2009 2:06 pm
Reply with quote

Below sortstep will give you desired result. I have assumed LRECL=80

Code:

//STEP010 EXEC PGM=SORT                                 
//DFSMSG  DD SYSOUT=*                                   
//SYSPRINT DD SYSOUT=*                                   
//SYSOUT DD SYSOUT=*                                     
//SORTIN DD *
5T37 4373950054835 LE 0102....07821448033509
7T37 4373950054835 LE 01020152S000003
7T37 4373950054835 LE 01020165S000002
7T37 4373950054835 LE 01022600S000002
7T37 4373950054835 LE 01022972S000003
7T37 4373950054835 LE 01023777S000002
7T37 4373950054835 LE 01023955S000003
5T37 4373950054835 LE 0103....07821455033509
7T37 4373950054835 LE 01030152S000001
7T37 4373950054835 LE 01030165S000001
7T37 4373950054835 LE 01032600S000001
7T37 4373950054835 LE 01032972S000001
5T37 4373950054835 LE 0202....07821462033509
7T37 4373950054835 LE 02020152S000007
7T37 4373950054835 LE 02020165S000005
7T37 4373950054835 LE 02022600S000005
5T37 4373950022023 JC 0200....03540701033449
7T37 4373950022023 JC 02000152S000009
7T37 4373950022023 JC 02002972S000009
7T37 4373950022023 JC 02003955S000009
7T37 4373950022023 JC 02004048S000009
7T37 4373950022023 JC 02004129S000009
5T37 4373950022023 JC 0300....01001129033449
7T37 4373950022023 JC 03000152S000008
//SORTOUT DD SYSOUT=*
//SYSIN DD *                                                       
  OPTION COPY                                                       
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'5T'),PUSH=(81:SEQ=8))
  OUTFIL INCLUDE=(81,8,ZD,LE,4),BUILD=(1,80)                       
/*                                                                 
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 0
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top