The file is a VB file with LRECL=0 and BLKSIZE=4096 Billy Ashton,
Are you sure the LRECL is 0 ? I assuming it is a typo. It is quite is easy to drop the trailer record and format the detail records. I did not understand what you wanted to do with the Header record. Can you explain it a bit more? The following DFSORT JCL will drop the trailer record and remove the first 5 bytes for the detailed records. //STEP0100 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTIN DD DISP=SHR,DSN=Your Input VB file //SORTOUT DD SYSOUT=* //SYSIN DD * OPTION COPY,VLSCMP OMIT COND=(5,7,CH,EQ,C'TRAILER') INREC IFTHEN=(WHEN=(5,5,CH,EQ,C'DATA,'),BUILD=(1,4,10)) //* If you explain the reformat of the header field , I can suggest an alternative in the same step. You can send me the sample input file (no screen shots please) offline and the desired output and I will show you a way to do it. Thanks, Kolusu DFSORT Development IBM Corporation IBM Mainframe Discussion List <IBM-MAIN@listserv.ua.edu> wrote on 05/07/2014 09:28:25 AM: > From: Bill Ashton <bill00ash...@gmail.com> > To: IBM-MAIN@listserv.ua.edu, > Date: 05/07/2014 09:28 AM > Subject: Use SORT to manipulate a CSV? > Sent by: IBM Mainframe Discussion List <IBM-MAIN@listserv.ua.edu> > > Hi friends...you have been helpful to in so many areas so far, and now I > have a question about using SORT. > > I have an application that creates a CSV file (sort of) on the mainframe. > The data rows start with a field "DATA" before the actual data fields, and > there is a Header row that has a lot more than the column names, and a > single trailer row I want to drop. > > I have never used SORT to work with the concept of fields before, and am > not sure if this can be done, but would appreciate if someone might lend a > hand. The file is a VB file with LRECL=0 and BLKSIZE=4096. Here is what the > data records look like: > > DATA,1,"A","S",3000.00,25000.00,23000.00,78000.00 > DATA,17,"A","S",1000.00,10000.00,15000.00,26000.00 > DATA,24,"A","S",1000.00,8500.00,11500.00,26000.00 > DATA,30,"A","S",975.00,9000.00,5500.00,25350.00 > DATA,26,"A","S",950.00,7900.00,11000.00,24700.00 > DATA,31,"A","S",925.00,7500.00,6000.00,24050.00 > > I want to drop the first field and comma, so the output should look like > this: > 1,"A","S",3000.00,25000.00,23000.00,78000.00 > 17,"A","S",1000.00,10000.00,15000.00,26000.00 > 24,"A","S",1000.00,8500.00,11500.00,26000.00 > 30,"A","S",975.00,9000.00,5500.00,25350.00 > 26,"A","S",950.00,7900.00,11000.00,24700.00 > 31,"A","S",925.00,7500.00,6000.00,24050.00 > > Then, the 1st record header looks like this: > ----+----1----+----2----+----3----+----4----+----5----+----6---- > +----7----+----8----+----9----+----0 > HEADER,MYVAR,DETAIL,050714,091407,RECORD,PAYROLL,PAY, > 001,FIELD,NUMBER,N,005,00,N,FIELD,ACTIVITY-CODE... > (this goes on for the 7 column headers. It appears the field contains > "FIELD" just before the column header > (FIELD,NUMBER,...FIELD,ACTIVITY-CODE,...FIELD,ACTIVITY-STATUS,...), and the > first "FIELD" field is the 9th field in the record. > > I would really like this header to look like this (I don't think I need to > add double-quotes, but am not sure how to do that, either!): > NUMBER,ACTIVITY-CODE,ACTIVITY-STATUS,... > > Finally, the trailer looks like this: > TRAILER,0202 > > and I want to just drop this record. > > If someone could help me to reformat these records using SORT, I would > greatly appreciate it! Rexx would be my choice, but the person I am handing > this off to does not know Rexx. > > -- > Thank you and best regards, > *Billy Ashton* > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN > ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN