Page 1 of 1

Can i use Sort?

PostPosted: Thu Aug 12, 2021 7:42 pm
by ussef
I have a job that runs every business day and creates a new generation of a GDG.
Now my requirement is to automate a week job that runs on 1st of every month
The input for this week job are the files that were created in the previous week.Since we can't predict the number files that will get created each week it's not possible to hardcode the generations(ie:0,-1,-2 ...etc).So by specifying the GDG base as the input file(this will take all the 50generations) how can we extract only the required records for the week job.?or the files generated between the last date of processing and the current date ?and add the version (GXXXX) of the file to the output file.

Re: Can i use Sort?

PostPosted: Fri Aug 13, 2021 5:07 pm
by sergeyken
This question is not related neither to SORT, nor to JCL.

You may need to work with catalog to extract the existing latest GDG names. It remains unclear how do you plan to determine those DSN from the last week? It is also not clear how do you plan to use unpredictable number of DSN in a (static?) JCL?

The correct approach would be: always to create daily GDG datasets, even if some of them are empty, and always use last 7 of them when combining the weekly concatenation. Otherwise all other tricks and gimmicks do not look as an acceptable method.

Re: Can i use Sort?

PostPosted: Fri Aug 13, 2021 8:11 pm
by willy jensen
'a week job that runs on 1st of every month The input for this week job are the files that were created in the previous week' ? Are you only interested in datasets from the last week of the month?
Anyway, the way to go is to postprocess a LISTCAT, which will show you the creation date. While you might be able to tweak SORT to do it, I would personally go for a proper program.