How to reference the most current Physical Sequential (PS) file in JCL

Viewed 127

I wanted to create a job where I need to consider the latest file available as input file. File format is as below: FILE1.TEST.TYYMMDD is there any way to identify latest file based on date present in file name via JCL. P.S. GDG versions are not created in existing process . Only PS file is created. Thank you

2 Answers

I wanted to create a job where I need to consider the latest file available as input file. File [name] format is as below: FILE1.TEST.TYYMMDD is there any way to identify latest file based on date present in file name via JCL.

No.

You indicate that GDGs are not created in the existing process. GDGs would be the best way to accomplish your goal. Absent GDGs, you must write code.

You could accomplish your goal by writing (C, clist, COBOL, PL/I, Rexx) code using the LMDINIT and LMDLIST ISPF services. Then you would execute your code by running ISPF in batch. Many mainframe shops have a cataloged procedure to execute ISPF in batch.

Agree with @cschneid that there is not a platform way to handle this. However, I want to point out that GDGs are the platform way of managing PS files for access in a relative form.

Your comment

GDG versions are not created in existing process . Only PS file is created.

That statement didn't make sense to me. GDGs are not a file type like physical sequential (PS) or partitioned (PO). It's a convention to allow relative reference to files created over time which sounds like what you want. I've only seen the use of GDGs for PS files.

Putting the date in the file name can have its uses but to z/OS its only part of the filename and not meta information that it operates on (like G0000v00's in GDGs.

Related