|
View previous topic :: View next topic
|
| Author |
Message |
ksouren007
New User
Joined: 30 Jun 2010 Posts: 85 Location: Toronto, ON
|
|
|
|
Hi,
I have a following requirement for which I'm looking for a Sort-ICETOOL or similar solution.
I/P File: FB:LRECL80
| Code: |
Record Type HICN# CONTRACT# PBP#
DTL HICN1 CONTRACT1 PBP1
PRM HICN1
SUP HICN1
SUP HICN1
DTL HICN2 CONTRACT2 PBP2
PRM HICN2
SUP HICN2 |
1. Records will be in a clubbed format i.e. First detail(DTL) type records, then Primary(PRM), and then Supplementary(SUP) type records. So, records in BOLD constitute one complete (clubbed) set of records for a single member, and the normal font are for the second member.
2. Since, The DTL type records have CONTRACT# and PBP# so corresponding Primary and Supplementary records will have spaces for these two fields.
Now, the requirement is to cascade the CONTRACT# and PBP# for a member, from its DTL type records, to its corresponding Primary and supplemental records. That is, the outcome should be as below:
O/P File: FB LRECL 80
| Code: |
Record Type HICN# CONTRACT# PBP#
DTL HICN1 CONTRACT1 PBP1
PRM HICN1 CONTRACT1 PBP1
SUP HICN1 CONTRACT1 PBP1
SUP HICN1 CONTRACT1 PBP1
DTL HICN2 CONTRACT2 PBP2
PRM HICN2 CONTRACT2 PBP2
SUP HICN2 CONTRACT2 PBP2 |
Can this be achieved through Sort utility avoiding a Module where I keep on replicating Contract#+PBP# until Records Type+HICN changes?
Please advise.
Code'd |
|
| Back to top |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Try this
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
//S1 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD *
DTL HICN1 CONTRACT1 PBP1
PRM HICN1
SUP HICN1
SUP HICN1
DTL HICN2 CONTRACT2 PBP2
PRM HICN2
SUP HICN2
//SORTOUT DD SYSOUT=*,
// DCB=(RECFM=FB,LRECL=80)
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(11,13,CH,NE,C' '),
PUSH=(30:11,14))
OUTREC BUILD=(1:1,10,30,14,80:X) |
Output
| Code: |
DTL HICN1 CONTRACT1 PBP1
PRM HICN1 CONTRACT1 PBP1
SUP HICN1 CONTRACT1 PBP1
SUP HICN1 CONTRACT1 PBP1
DTL HICN2 CONTRACT2 PBP2
PRM HICN2 CONTRACT2 PBP2
SUP HICN2 CONTRACT2 PBP2
|
|
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| Code: |
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'DTL'),
PUSH=(11:11,14)) |
PUSH is like OVERLAY.
For the record defining the GROUP, the information being PUSHed can be PUSHed over itself when it is to be located in that position in all records. No need for BUILD here. |
|
| Back to top |
|
 |
ksouren007
New User
Joined: 30 Jun 2010 Posts: 85 Location: Toronto, ON
|
|
|
|
| Thanks a lot to both of you! The GROUP,BEGIN clause worked great! |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|