Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
Could there be some logic in the OUTFIL step where the trailer is written only if the total record count in the output file is more than 2 ?
There are no built-in functions for conditionally writing a trailer record. The trailer1 record is always written. You'll need to separately check for an empty or non-empty data set.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
essence21 wrote:
Could there be some logic in the OUTFIL step where the trailer is written only if the total record count in the output file is more than 2 ?
There is an alternative way to get the results but it is based on an assumption that your input has only 1 '99' record which is the last record, here is DFSORT JCL which will take care of empty files as well but generate the desired results.
There is an alternative way to get the results but it is based on an assumption that your input has only 1 '99' record which is the last record, here is DFSORT JCL which will take care of empty files as well but generate the desired results
That should help me out. But let me explain what my code aims to achieve...
i have 2 files A and B. I need to create a file C which is basically A-B.
I used ICETOOL to achieve for splicing. That left only the trailer record to be generated which i did as follows.
record length is 201.
As given in my code above,
Using Build in inrec records with 01 were appended 100 from 202 to 204 posn. Similarly 02 records with 010 and 03 with 001..
Initially the requirement said that files A, B even if empty would contain header and trailer records. My logic works fine here.
Now req says that if A,B are absolutely empty C should also be empty.
here my logic failed as it generated the trailer..
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
essence21,
Show me your SPLICE Job with DCB Properties of both files involved, key information , sample input from both files and desired output and I will show you a way to do it in splice job itself