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

Reply via email to