Joined: 27 Nov 2008 Posts: 31 Topics: 9 Location: India
Posted: Thu Nov 07, 2013 4:11 pm Post subject: Bypass certain records from QSAM file
Hi All,
Could you please help me out with the below production issue?
I am currently working on the production issue in which the program is abending with invalid record. The master QSAM file (driver file) of the program contains header , detail(s) and trailer record. The program is abending since particular field in detail records is invalid. As a work around we are looking to bypass the invalid records.
One option I could think of is to modify the program, bypass the those records, update the trailer count. But I dont want to modify the program.
The other option I could think of, is to use some sort step. Is it possible using sort to bypass the records and update the trailer count in a single sort step.
Could you please help me on this, if its not possible using sort or any other means than i would need to modify the program?
Joined: 26 Nov 2002 Posts: 12368 Topics: 75 Location: San Jose
Posted: Thu Nov 07, 2013 4:47 pm Post subject:
lenovo,
Quite easy. Here is an example of eliminating records with invalid numeric data for detail records and updating the trailer count to reflect the count. The trailer count starts at position 25 for a length of 8 bytes with leading zeroes suppressed.
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
HDR LENOVO
----+----1----+----2----+----3----+----4----+----5----
RECORD 20
RECORD 30
RECORD AB
RECORD 40
RECORD 60
RECORD CC
TRL DETAIL RECORD COUNT: 6
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INCLUDE COND=(1,3,SS,EQ,C'HDR,TRL',OR,
10,2,FS,EQ,NUM)
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum