Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
I need to copy the data from this file to a new file only if this value is greater than 0.
Here's a DFSORT/ICETOOL job that will copy IN to OUT only if IN has a TRAILER record with a count greater than 0. Otherwise the job will terminate with RC=12 and the file will NOT be copied.
I have around 10 gdg's. I need to concatinate using sort under following condition.
All of my files will have a header and trailer record.I need to skip copying file if trailer records contain total record count as 0000.
It's not clear what you mean by this. If you need more help with it, please show an example of the records in your input files and what you expect for output, and explain the "rules" for getting from input to output.
Also give the RECFM and LRECL of the input files, and the starting position, length and format of all relevant fields (e.g. the 'TRAILER' identifier and the count field).
The record type is as follows
Record format . . . : VB
Record length . . . : 579
The problem is if any of the above generations is having only header and trailer record the job gets abended (i.e., The trailer record contains 000000 as no of records). I have manually browse each of latest generation for above gdg's and if its empty comment it out in job manually.
Now i want to add a step before this using ICETOOL to do this check automatically and create a file which i can use here as input in this step. I am just trying to put a condition in sort which will copy data from current generation to new output file only if trailer record contains value >0. This chekking has to be done to all the above generations and there will be a single output merge file which i can use as input to current step.
I hope i am clear please let me know in case if you have any questions
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
Wouldn't it be as easy to first delete/create your output file with IEFBR14 steps with DISP=(MOD,DELETE,DELETE) and then DISP=(,CALTG). Next, run Frank's step for each of your GDGs using DISP=MOD ?
This would result in concatenating all files where trailer count > 0.
Thank you for the reply, Presently thats what i am planning to do. The only problem i see in this approach is i need to have 9 steps seperately for all the gdg's.
I am checking if there are any other better solutions to this problem or some how i can reduce the amount of code in this solution?
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
Quote:
how i can reduce the amount of code in this solution
I doubt you can reduce the amount of code. Frank has used just 3 lines which can be saved in 2 datasets (or 2 PDS members). All that needs to change from step to step is the DSN and you could maybe use variable substitution in a procedure to reduce the coding of this.