Tony,
It is quite simple to create a pseudo key to use as matching key for splice. I assumed that your input is RECFM=FB and LRECL=80. The group starts with "H" and you can have a max of 3 detailed records which start with T21,T22, T23. However if you have more you can adjust the solution accordingly. Use the following JCL which will give you the desired results. The output will be a 320 byte file with records combined. //STEP0100 EXEC PGM=ICETOOL //TOOLMSG DD SYSOUT=* //DFSMSG DD SYSOUT=* //IN DD * H01 T21 H02 T21 T22 H03 T21 H04 T21 H05 T21 T22 T23 H06 H07 H08 //OUT DD SYSOUT=* //TOOLIN DD * SPLICE FROM(IN) TO(OUT) ON(321,8,CH) WITHANY - WITH(81,80) WITH(161,80) WITH(241,80) USING(CTL1) //* //CTL1CNTL DD * OPTION COPY INREC IFOUTLEN=328,IFTHEN=(WHEN=INIT,BUILD=(331:1,80)), IFTHEN=(WHEN=GROUP,BEGIN=(331,1,CH,EQ,C'H'),PUSH=(321:ID=8)), IFTHEN=(WHEN=(331,1,CH,EQ,C'H'),OVERLAY=(001:331,80)), IFTHEN=(WHEN=(331,3,CH,EQ,C'T21'),OVERLAY=(081:331,80)), IFTHEN=(WHEN=(331,3,CH,EQ,C'T22'),OVERLAY=(161:331,80)), IFTHEN=(WHEN=(331,3,CH,EQ,C'T23'),OVERLAY=(241:331,80)) OUTFIL BUILD=(1,320) //* Further if you have any questions please let me know Thanks, Kolusu DFSORT Development IBM Corporation From: "Tony's Basement Computer" <[email protected]> To: [email protected] Date: 09/15/2014 11:32 AM Subject: Another DF/SORT quest. (splice?) Sent by: IBM Mainframe Discussion List <[email protected]> I'm trying to develop a seemingly simple SPLICE operation where all the input comes from a single dataset. I want to combine several records types into 1 record containing the fields from each input record type. For example I have an input file where various types can appear in a header-trailer1 or header-trailer1-trailer2 or header only sequence of records. There is no key, only the type to work with. The input sequence of record can look like any of the following: H02 T21 or H02 T21 T22 or H03 T21 or H04 T21 H02 T21 T22 T23 or H02 only H03 only H04 only My output should look like: H02 fields + t21 fields H02 fields + t21 fields + t22 fields H03 fields + t21 fields H04 fields + t21 fields H02 _ t21 + t22 + t23 H02 H03 H04 No sorting is needed, the records are in the desired sequence already. Only the combining of fields is necessary. I've done quite a bit of reading in the DF/SORT APG but could not find a relevant example. I've considered SPLICE but lack a key. I tried WHEN=GROUP but I don't see a method to create a combined record. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
