IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

Sort record between tags


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

Moderator


Joined: 14 Oct 2005
Posts: 1206
Location: Bangalore,India

PostPosted: Tue May 07, 2013 10:44 pm
Reply with quote

Hi All,

I have one i/p with variable length which have records between tag:

Code:
CP
1234 DTl
1 provider 12/03/2012
123  Access 1/2/2012  I N
C#P
AP
1234 ABC
1 provider 12/03/2012
A#P
CP
1234 DTl
1 provider 12/03/2012
123  Access 1/2/2012  I N
C#P
DP
1 provider 12/03/2012
D#P
CP
123 DTl
1 provider 12/03/2012
123 DTl
C#P
DP
1 provider 12/03/2012 1/4/2012
D#P
AP
1234 ABC
A#P
CP
123 DTl
1 provider 12/03/2012
123 DTl
C#P

Output shd be
Code:
AP
1234 ABC
1 provider 12/03/2012
A#P
AP
1234 ABC
A#P
CP
1234 DTl
1 provider 12/03/2012
123  Access 1/2/2012  I N
C#P
CP
1234 DTl
1 provider 12/03/2012
123  Access 1/2/2012  I N
C#P
CP
123 DTl
1 provider 12/03/2012
123 DTl
C#P
CP
123 DTl
1 provider 12/03/2012
123 DTl
C#P
DP
1 provider 12/03/2012
D#P
DP
1 provider 12/03/2012 1/4/2012
D#P


Here every record is in multiple lines . All the record are in between tags
Code:
AP
A#P

OR
Code:

CP
C#P

OR
Code:

DP
D#P


Need to group the records like all the A records should come first followed by C and than D
Please advise.
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Member


Joined: 14 Mar 2007
Posts: 10695
Location: italy

PostPosted: Tue May 07, 2013 10:48 pm
Reply with quote

are the tags fixed or <arbitrary>
since there is no record type to be analyzed You will have to specify each group limit by hand
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1206
Location: Bangalore,India

PostPosted: Tue May 07, 2013 10:53 pm
Reply with quote

Hello enrico,

Yes there are only three tags. A D and C only.Its variable length file and no specific record type. Just wanted to similar record type group together
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue May 07, 2013 11:42 pm
Reply with quote

guptae wrote:
Hello enrico,

Yes there are only three tags. A D and C only.Its variable length file and no specific record type. Just wanted to similar record type group together


You need to provide more than that. Assuming your group indicators AP,CP,DP and A#P, C#P, D#P start at position 5 here is a JCL & sort control which will give you the desired results.
Code:

//STEP0200 EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD DISP=SHR,DSN=Your Input VB file
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                       
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,2X,5)),           
  IFTHEN=(WHEN=GROUP,BEGIN=(7,2,SS,EQ,C'AP,CP,DP'),   
  END=(7,3,SS,EQ,C'A#P,C#P,D#P'),PUSH=(5:7,2))         
  SORT FIELDS=(5,2,CH,A),EQUALS                       
  OUTREC BUILD=(1,4,7)                                 
//*
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts COBOL VS SORT Utility for file format... COBOL Programming 6
This topic is locked: you cannot edit posts or make replies. Splice JCL into one record for DD sta... SYNCSORT 2
No new posts XML Parsing in COBOL creating "h... COBOL Programming 0
No new posts Copying data from prev record using SORT SYNCSORT 19
No new posts Combining more 4 files with sorted or... DFSORT/ICETOOL 3

Back to Top