guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
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
OR
OR
Need to group the records like all the A records should come first followed by C and than D
Please advise. |
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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)
//* |
|
|