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
 

 

Interim Sort in file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
raj_mainframe08

New User


Joined: 11 Sep 2007
Posts: 65
Location: Gurgaon

PostPosted: Wed Oct 31, 2012 8:58 am    Post subject: Interim Sort in file
Reply with quote

Following are the records in the Input File

Code:

HEADER 
11111111
22222222
33333333
11111111
22222222
11111111
99999999
TRAILER
HEADER 
99999999
11111111
33333333
22222222
11111111
99999999
33333333
TRAILER


My requirement is to separatly SORT the reocords between First HEADER and TRAILER Group and then separatly sort records between Second HEADER and TRAILER Group. Thus the output file should look like

Code:

HEADER   
11111111 
11111111 
11111111 
22222222 
22222222 
33333333 
99999999 
TRAILER   
HEADER   
11111111 
11111111 
22222222 
33333333 
33333333 
99999999 
99999999 
TRAILER   


Please let me know how to do that.

Here is what i got so far. The file length is 80. If i write the below statement

Code:

INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,6,CH,EQ,C'HEADER'),
             PUSH=(81:ID=8))                         
SORT FIELDS=(81,8,ZD,A,1,8,CH,A)                     
OUTREC BUILD=(1,80)                                   


I am getting below output
Code:

HEADER 
TRAILER
11111111
11111111
11111111
22222222
22222222
33333333
99999999
HEADER 
TRAILER
11111111
11111111
22222222
33333333
33333333
99999999
99999999


Basically i have achieved the required results but it also sorting TRAILER which i don't want.
Back to top
View user's profile Send private message

gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Wed Oct 31, 2012 10:24 am    Post subject:
Reply with quote

Hi,

try this
Code:
SORT FIELDS=(81,9,BI,A)                                     
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,6,CH,EQ,C'HEADER'),       
            PUSH=(81:ID=8)),                               
      IFTHEN=(WHEN=(1,6,CH,EQ,C'HEADER'),                   
             OVERLAY=(89:X'00')),                           
      IFTHEN=(WHEN=(1,7,CH,EQ,C'TRAILER'),                 
             OVERLAY=(89:X'FF'))                           
 OUTREC BUILD=(1,80)                                       



Gerry
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Wed Oct 31, 2012 10:44 am    Post subject:
Reply with quote

Hi,

sorry, sort fields should be
Code:
  SORT FIELDS=(81,9,BI,A,1,8,BI,A)



Gerry
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 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
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm


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