Compare Records with Trailer Record



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Compare Records with Trailer Record

Postby rayngerfan » Thu Aug 28, 2014 4:33 pm

To Whom It Concern:

My input data set is FB,LRECL=200 and contains a header, data & trailer records. There are times when the vender will transmit a file that contains an extra blank line after the trailer record causing the job to fail on a trailer count mismatch. I want to compare the records in the data set against the trailer record count. The below job works if the extra blank line is before the trailer. There are a total of 9 records in the below example including the blank line after the trailer record. Any thoughts on how I could change the below code to include the blank that is after the trailer record?

//S1 EXEC PGM=SORT,PARM='NULLOUT=RC4'
//SORTIN DD *
HEADER20110825233448
111111111111111111111111111111111111111111
222222222222222222222222222222222222222222
333333333333333333333333333333333333333333
444444444444444444444444444444444444444444
555555555555555555555555555555555555555555
666666666666666666666666666666666666666666
TRAILER20110825233449000000008

//SORTOUT DD DSN=&&TEMP,DISP=(NEW,PASS),SPACE=(CYL,(1,1),RLSE)
//SYSOUT DD SYSOUT=*
//SORTLIST DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,6,ZD))
OUTFIL INCLUDE=(1,7,CH,EQ,C'TRAILER',AND,25,6,ZD,EQ,81,6,ZD)
/*
rayngerfan
 
Posts: 51
Joined: Fri Apr 17, 2009 4:57 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Compare Records with Trailer Record

 

Re: Compare Records with Trailer Record

Postby BillyBoyo » Thu Aug 28, 2014 5:17 pm

You need to be clear about what you want to do. At the moment, you write the TRAILER to SORTOUT if it is equal to the running count at the time.

Note that it is likely in the original program that the failure is not really a count mismatch, but a "record after trailer" problem.

You should test the original program with a file containing two trailer records (with correct counts per running total at the time).
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Compare Records with Trailer Record

Postby rayngerfan » Thu Aug 28, 2014 6:56 pm

Hi BillyBoyo

Thanks for your response.

This is the message from the program.

THE RECORD COUNT IN THE TRAILER RECORD DOES NOT
MATCH THE RECORD COUNT OF THE PROGRAM!!!
rayngerfan
 
Posts: 51
Joined: Fri Apr 17, 2009 4:57 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Compare Records with Trailer Record

Postby BillyBoyo » Thu Aug 28, 2014 8:13 pm

I don't doubt you :-)

When the trailer is encountered, that is when the total should be verified. If something appears after the trailer (an obvious erroneous file) then a different error should be produced.

As I said, try with two trailer records. I suspect the program will "work".

Now, you going to tell us what you want?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Compare Records with Trailer Record

Postby rayngerfan » Thu Aug 28, 2014 9:47 pm

Hi BillyBoyo

I ran a test and the program did work with 2 trailer records.

FILE06I-RECS-READ = 2
FILE06O-RECS-WRITTEN = 2

I would like to count all records in the data set and compare that to the trailer record count. If they are equal get a RC=0 or a RC=4 if they aren't equal. I wasn't sure how to capture the extra record (blank line) after the trailer record.
rayngerfan
 
Posts: 51
Joined: Fri Apr 17, 2009 4:57 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Compare Records with Trailer Record

Postby BillyBoyo » Thu Aug 28, 2014 10:35 pm

OK, first raise a fault for the program which processes two trailer records as though everything in the world is OK :-)

The problem will be, when the trailer is read, a value is stored. When end of file is reached, the counts are compared.

What should happen is when the trailer is read, the counts are checked. Another READ. If not EOF (and irrelevant of content) there is a problem. This can be a in a loop to report any "post-trailer records".

You're going to need IFTHEN=(WHEN=GROUP with BEGIN= for the trailer value, and PUSH a SEQ.
when a file has data
On your existing OUTFIL you change your condition for NE and you add an OR which looks at the PUSHed SEQ (which only needs to be one byte) for NE space (C' '). Then, since you have SyncSORT, you hope you are sufficiently up-to-date such that when you look in the manual, you find the option, similar to NULLOUT, which gives a non-zero RC when a file has data.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post