Peter, I don't know how long is your record, assuming it's 80 and that the LL field in H record is between 1 and .... 99, this could be a solution:
//SYSIN DD * INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'H'), PUSH=(81:3,2)) SORT FIELDS=COPY OUTREC IFTHEN=(WHEN=(1,1,CH,EQ,C'H'), BUILD=(1,80)), IFTHEN=(WHEN=(81,2,CH,EQ,C'01'), OVERLAY=(04:76X)), IFTHEN=(WHEN=(81,2,CH,EQ,C'02'), OVERLAY=(05:75X)), IFTHEN=(WHEN=(81,2,CH,EQ,C'03'), OVERLAY=(06:74X)), IFTHEN=(WHEN=(81,2,CH,EQ,C'04'), OVERLAY=(07:73X)), IFTHEN=(WHEN=(81,2,CH,EQ,C'05'), OVERLAY=(08:72X)), IFTHEN=(WHEN=(81,2,CH,EQ,C'06'), OVERLAY=(09:71X)), IFTHEN=(WHEN=(81,2,CH,EQ,C'07'), OVERLAY=(10:70X)), IFTHEN=(WHEN=(81,2,CH,EQ,C'08'), OVERLAY=(11:69X)), IFTHEN=(WHEN=(81,2,CH,EQ,C'09'), OVERLAY=(12:68X)), IFTHEN=(WHEN=(81,2,CH,EQ,C'10'), OVERLAY=(13:67X)) /* I stopped writing the IFTHEN at length 10, you can code the other statements. It's possible to "pre-analyze" the "H" records and dynamically generate only the needed IFTHEN statements. This is the output: H 05 COMMENT: "05" IS SIGNIFICANT DATA COLUMNS D 12345 D 45678 H 10 D 1234567890 D 9876543210 Hope this helps. Best regards. Max Il giorno mer 8 gen 2020 alle ore 01:34 Farley, Peter x23353 < [email protected]> ha scritto: > I have a fixed-record-length data file which has "subsections" starting > with a "data characteristics" record (call it a "subsection header"). One > of the fields in the "subsection header" is a 2-byte zoned decimal "data > length" value which identifies the number of SIGNIFICANT columns in the > "data" portion of the records following the "subsection header". > > What I would like to do is to blank out the NON-significant data columns > in the data records that follow each "subsection header". The data records > have suffered from some "data pollution" where non-significant data has > been accidentally stored beyond the significant data columns. > > Each "subsection header" may have a different "significant data" length > value for the following data records. > > Example INPUT data (column 1 = record type [H = header, D = data], data > starts in column 3 in each record): > > H 05 COMMENT: "05" IS SIGNIFICANT DATA COLUMNS > D 12345 XYZ ABC DEF > D 45678 GHI JKL MNO > H 10 > D 1234567890 ABCDEFGHIJKL > D 9876543210 MNOPQWRSTUVWXYZ > > Example OUTPUT data (column 1 = record type [H = header, D = data], data > starts in column 3): > > H 05 COMMENT: "05" IS SIGNIFICANT DATA COLUMNS > D 12345 > D 45678 > H 10 > D 1234567890 > D 9876543210 > > Obviously I can write a pretty simple script or program to accomplish this > "data cleaning" operation, but I wondered if it would be possible using > just SORT. > > The data volume is in the range of about 100K-200K records per file if > that matters. > > TIA for any ideas you can offer. > > Peter > -- > > > > ---------------------------------------------------------------------- > 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
