Bill Ashton, If you have data on multiple records and you need to combine them to a single record, you need to use WHEN=GROUP to push the contents on to other records and then write out a single record.
So if you can send the original input file on the mainframe, I can show you a way to do it. Thanks, Kolusu DFSORT Development IBM Corporation IBM Mainframe Discussion List <[email protected]> wrote on 12/29/2017 09:07:38 AM: > From: Bill Ashton <[email protected]> > To: [email protected] > Date: 12/29/2017 09:08 AM > Subject: Problem creating file of combined records with SORT > Sent by: IBM Mainframe Discussion List <[email protected]> > > Hello! I am trying to use DFSORT to extract some records from a transaction > work file to be displayed in Microsoft Excel (and also on the mainframe). > > The data contains a lot of hierarchical information (Customer, Region, > Location, and contact people), and I would like to create a single record > for each contact containing the whole hierarchy. I coded what I thought was > the correct SORT statements, but I still get a confusing error on my INREC > statement. > > I even cut the input down to a single IfTHEN statement, and that still > flunked. I would appreciate Kolusu or someone else taking a look at this to > see what I have missed. > > Here is my SYSIN (the INCLUDE works fine): > OPTION COPY,VLSCMP IT IS NOT REQUIRED, BUT USEFUL > * > INCLUDE COND=(1,04,CH,EQ,C'CM03',OR, > 1,04,CH,EQ,C'CR02',OR, > 1,04,CH,EQ,C'CL01',OR, > 1,04,CH,EQ,C'CC02',OR, > 1,14,CH,EQ,C'>CUST MASTER$,',OR, > 1,10,CH,EQ,C'>CUST REG,',OR, > 1,11,CH,EQ,C'>CUST LOC1,',OR, > 1,12,CH,EQ,C'>CUST CONT$,') > > INREC IFOUTLEN=245, > IFTHEN=(WHEN=(1,14,CH,EQ,C'>CUST MASTER$,'), > PARSE=(%01=(ABSPOS=15,ENDBEFR=C'(',FIXLEN=50))), > IFTHEN=(WHEN=(1,04,CH,EQ,C'CM03'), > PARSE=(%02=(ABSPOS=06,ENDBEFR=C' ',FIXLEN=5))), > IFTHEN=(WHEN=(1,10,CH,EQ,C'>CUST REG,'), > PARSE=(%03=(ABSPOS=11,ENDBEFR=C'(',FIXLEN=50))), > IFTHEN=(WHEN=(1,04,CH,EQ,C'CR02'), > PARSE=(%04=(ABSPOS=06,ENDBEFR=C' ',FIXLEN=3))), > IFTHEN=(WHEN=(1,11,CH,EQ,C'>CUST LOC1,'), > PARSE=(%05=(ABSPOS=12,ENDBEFR=C' ',FIXLEN=50))), > IFTHEN=(WHEN=(1,04,CH,EQ,C'CL01'), > PARSE=(%06=(ABSPOS=06,ENDBEFR=C' ',FIXLEN=3), > %07=(ABSPOS=10,ENDBEFR=C' ',FIXLEN=15))), > IFTHEN=(WHEN=(1,12,CH,EQ,C'>CUST CONT$,'), > PARSE=(%08=(ABSPOS=13,ENDBEFR=C' ',FIXLEN=50))), > IFTHEN=(WHEN=(1,04,CH,EQ,C'CC02'), > PARSE=(%09=(ABSPOS=06,FIXLEN=3), > %10=(ABSPOS=10,FIXLEN=2), > %11=(ABSPOS=13,FIXLEN=1), > %12=(ABSPOS=15,FIXLEN=1), > %13=(ABSPOS=17,FIXLEN=5))), > > BUILD=(%01,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'",')) > %02,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'",'), > %03,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'",'), > %04,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'",'), > %05,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'",'), > %06,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'",'), > %07,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'",'), > %08,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'",'), > %09,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'",'), > %10,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'",'), > %11,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'",'), > %12,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"')) > > > I am trying to create two output sets, but since I did not get the first to > work, I did not even try the second. Hopefully someone can put me on the > right track. > > I have attached a file with the data layout (it won't display right in HTML > with multiple embedded spaces). > > Thanks for lending a hand here, and happy new year! > Billy > > -- > Thank you and best regards, > *Billy Ashton* > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > [attachment "SORT Trans Data.txt" deleted by Sri h Kolusu/Silicon Valley/IBM] ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
