Tony,

You do NOT need 2 passes of the data to get the desired results as it can 
be done in a single pass as shown below.

The output from this job will be 

80 bytes from position 01 of the header record   + 
10 bytes from position 10 of detail record 1     +
10 bytes from position 20 of detail record 2     +
10 bytes from position 30 of detail record 3     +
10 bytes from position 40 of detail record 4     +
10 bytes from position 50 of detail record 5 

A total of130 bytes record is built.

//STEP0100 EXEC PGM=SORT 
//SYSOUT   DD SYSOUT=* 
//SORTIN   DD * 
HEADER-REC 1......HAS 3 DETAIL RECORDS 
----+----1----+----2----+----3----+----4----+----5----+----6----+----7
DETAIL  .DATA11 
DETAIL             DATA12 
DETAIL  .........             DATA13 
HEADER-REC 2......HAS 5 DETAIL RECORDS 
DETAIL  .DATA21 
DETAIL             DATA22 
DETAIL                        DATA23 
DETAIL                                 DATA24 
DETAIL                                           DATA25 
HEADER-REC 3......HAS NO DETAIL RECORDS 
HEADER-REC 4......HAS 1 DETAIL RECORDS 
DETAIL  .DATA41 
//SORTOUT  DD SYSOUT=* 
//SYSIN    DD * 
  OPTION COPY 
  INREC IFOUTLEN=138,IFTHEN=(WHEN=INIT,BUILD=(141:1,80)), 
  IFTHEN=(WHEN=GROUP,BEGIN=(141,10,CH,EQ,C'HEADER-REC'), 
  PUSH=(01:141,80,131:ID=8,SEQ=1)), 
  IFTHEN=(WHEN=GROUP,BEGIN=(139,1,ZD,EQ,2), 
  PUSH=(081:150,10),RECORDS=5), 
  IFTHEN=(WHEN=GROUP,BEGIN=(139,1,ZD,EQ,3), 
  PUSH=(091:160,10),RECORDS=4), 
  IFTHEN=(WHEN=GROUP,BEGIN=(139,1,ZD,EQ,4), 
  PUSH=(101:170,10),RECORDS=3), 
  IFTHEN=(WHEN=GROUP,BEGIN=(139,1,ZD,EQ,5), 
  PUSH=(111:180,10),RECORDS=2), 
 
  IFTHEN=(WHEN=(139,1,ZD,EQ,1),OVERLAY=(081:50X)), 
  IFTHEN=(WHEN=(139,1,ZD,EQ,2),OVERLAY=(091:40X)), 
  IFTHEN=(WHEN=(139,1,ZD,EQ,3),OVERLAY=(101:30X)), 
  IFTHEN=(WHEN=(139,1,ZD,EQ,4),OVERLAY=(111:20X)), 
  IFTHEN=(WHEN=(139,1,ZD,EQ,5),OVERLAY=(121:10X)), 
  IFTHEN=(WHEN=(139,1,ZD,EQ,6),OVERLAY=(121:190,10)) 
 
  OUTFIL REMOVECC,NODETAIL,BUILD=(130X), 
  SECTIONS=(131,8,TRAILER3=(1,130)) 
//* 


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:   01/23/2015 12:08 PM
Subject:        Re: Another df/sort objective.
Sent by:        IBM Mainframe Discussion List <[email protected]>



The first pass consists of:
INREC IFTHEN=(WHEN=GROUP,                           <----- Define the
Group..
        BEGIN=(1,10,CH,EQ,C'HEADER-REC '),        <----- Group 
begins......
         PUSH=(81:ID=5))
<-----  Add seq number...

The second pass is a JOINKEYS operation using the sequence number as a 
key.
For each header there will be a minimum of zero and a maximum of 5   80 
byte
detail records.  Each detail record type can be readily identified so that 
I
can pick up the detail data from differing columns.



-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On
Behalf Of Sri h Kolusu
Sent: Friday, January 23, 2015 11:49 AM
To: [email protected]
Subject: Re: Another df/sort objective.

Tony,

You can use ICETOOL's RESIZE operator to merge multiple records into a
single record. Is the number of detail records a variable one or is it a
fixed number of detail records? RESIZE works with fixed number of records. 

 Another alternative is to use IFTHEN processing with WHEN=GROUP or SPLICE
and merge them into a single record.  You also need to consider the LRECL
limits. 32760 for FB records which would allow roughly about 409 records
each with 80 bytes of length.

Show me the 2 step process you used and may be I can suggest an 
alternative
of combining the 2 passes into a single pass.

Thanks,
Kolusu
DFSORT Development
IBM Corporation

IBM Mainframe Discussion List <[email protected]> wrote on
01/23/2015 09:40:49 AM:

> From: "Tony's Basement Computer" <[email protected]>
> To: [email protected]
> Date: 01/23/2015 09:41 AM
> Subject: Another df/sort objective.
> Sent by: IBM Mainframe Discussion List <[email protected]>
> 
> Guys, I have a classic case of   WHEN=GROUP   processing.    I have 
> an input file FB/80:
> 
> Header1......data-I-need-in-column 1
> Detail1.........data-I-need-in-column 10 
> Detail2.........data-I-need-in-column 20 
> Detail3..........data-I-need-in-column 30
> Header2.......  data-I-need-in_column 1    etc
> Detail1......... etc
> Detail2.......... etc
> Detail3...........etc
> Detail4...........etc
> Header3.........etc etc
> 
> My output record, FB/any-length, I wish to consist of 
> Header-data,detail1-data,detail2-data,detailn.......data.etc etc
> 
> 
> I can do this in 2 passes but I'd like to achieve in 1.
> 
> ----------------------------------------------------------------------
> 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

----------------------------------------------------------------------
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

Reply via email to