Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Select records in a file.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Select records in a file.
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us