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

Interim Sort in file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 1702
Location: Australia

PostPosted: Wed Oct 31, 2012 10:24 am
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: 1702
Location: Australia

PostPosted: Wed Oct 31, 2012 10:44 am
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 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 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
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