Dave,

Not sure what solution you came up, but here is a job that will manage any
number of records and  put the odd numbered records as a pair and even
numbered records as a pair

We use joinkeys trick of matching the file to itself. we treat a group of 4
records as one group and then merge them as single record.

//****************************************************************
//* CREATE AN INPUT FILE WITH 100 RECORDS WITH A RECORD NUMBER  **
//****************************************************************
//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
DUMMY RECORD
//SORTOUT  DD DSN=&&IN,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//SYSIN    DD *
  OPTION COPY
  OUTFIL REPEAT=100,
  BUILD=(SEQNUM,8,ZD,80:X)
/*
//****************************************************************
//* MERGE THE ODD NUMBERED RECORDS AS A SINGLE RECORD AND EVEN  **
//* NUMBERED RECORDS AS A SINGLE RECORD. EX: 1-3,2-4,5-7,6-8... **
//****************************************************************
//STEP0200 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//INA      DD DSN=&&IN,DISP=(OLD,PASS),VOL=REF=*.STEP0100.SORTOUT
//INB      DD DSN=&&IN,DISP=(OLD,PASS),VOL=REF=*.STEP0100.SORTOUT
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY
  JOINKEYS F1=INA,FIELDS=(81,9,A),SORTED,NOSEQCK
  JOINKEYS F2=INB,FIELDS=(81,9,A),SORTED,NOSEQCK
  REFORMAT FIELDS=(F1:1,80,F2:1,80)
/*
//JNF1CNTL DD *
  INREC IFTHEN=(WHEN=GROUP,RECORDS=4,PUSH=(81:ID=8,SEQ=1))
/*
//JNF2CNTL DD *
  INREC IFTHEN=(WHEN=GROUP,RECORDS=4,PUSH=(81:ID=8,SEQ=1)),
        IFTHEN=(WHEN=(89,1,ZD,LE,2),
        OVERLAY=(89:C'0')),
        IFTHEN=(WHEN=(89,1,ZD,GT,2),
        OVERLAY=(89:89,1,ZD,SUB,+2,EDIT=(T)))
/*


The output from this job is

00000001
00000003
00000002
00000004
00000005
00000007
00000006
00000008
00000009
00000011
00000010
00000012
00000013
00000015


Further if you have any questions please let me know

Thanks,
Kolusu
DFSORT Development
IBM Corporation

IBM Mainframe Discussion List <[email protected]> wrote on
05/15/2018 03:47:14 PM:

> From: "Gibney, Dave" <[email protected]>
> To: [email protected]
> Date: 05/15/2018 03:48 PM
> Subject: Re: Should be easy with SORT :) I thought (:
> Sent by: IBM Mainframe Discussion List <[email protected]>
>
> And of course, the standard make a fool of myself in public and
> immediately find a solution involving adding a sequence number field
> is working for me.
>
> > -----Original Message-----
> > From: IBM Mainframe Discussion List [mailto:[email protected]]
> > On Behalf Of Gibney, Dave
> > Sent: Tuesday, May 15, 2018 2:52 PM
> > To: [email protected]
> > Subject: Should be easy with SORT :) I thought (:
> >
> > I have a file with say 4 records:
> > FDRABR.VZ21RS2.C1000n00 D05809
> > FDRABR.VZ21RSC.C1000n00 D05547
> > FDRABR.VFNTCA2.C1000n00 D06255
> > FDRABR.VFNTCAT.C1000n00 D06244
> >
> > I want a file that is
> > Record1||Record3
> > Record2||Record4
> > That is:
> > FDRABR.VZ21RS2.C1000n00 D05809 FDRABR.VFNTCA2.C1000n00 D06255
> > FDRABR.VZ21RSC.C1000n00 D05547 FDRABR.VFNTCAT.C1000n00 D06244
> >

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to