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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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