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

ICETOOL/Joinkeys Solution for Group By Replication


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

New User


Joined: 30 Jun 2010
Posts: 85
Location: Toronto, ON

PostPosted: Wed Mar 05, 2014 4:04 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Mar 05, 2014 4:39 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Mar 05, 2014 5:07 pm
Reply with quote

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
View user's profile Send private message
ksouren007

New User


Joined: 30 Jun 2010
Posts: 85
Location: Toronto, ON

PostPosted: Wed Mar 05, 2014 7:48 pm
Reply with quote

Thanks a lot to both of you! The GROUP,BEGIN clause worked great!
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 Shift left VB record without x00 endi... DFSORT/ICETOOL 11
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
No new posts how to calculate SUM for VB file usin... JCL & VSAM 1
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
Search our Forums:

Back to Top