Reading a GDG File

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

Post Reply
Posts: 3
Joined: Fri May 11, 2012 9:19 am

Reading a GDG File

Post by siv_san » Fri May 18, 2012 9:10 am


In my JCL I am reading a GDG which is generated on a daily basis. I have a requirement that on Monday I have to read the GDG which was generated on Friday.

For Example,

A.B.C.G1693V001 >> Created on Monday
A.B.C.G1694V001 >> " " Tuesday
A.B.C.G1695V001 >> " " Wednesday
A.B.C.G1696V001 >> " " Thursday
A.B.C.G1697V001 >> " " Friday
A.B.C.G1698V001 >> " " Saturday
A.B.C.G1699V001 >> " " Sunday
A.B.C.G1700V001 >> " " Monday
Now on Monday I have to read the GDG which is created on Friday i.e. A.B.C.G1697V001. Can we do this using only the JCL?

Thanks in advance.

Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Fri May 18, 2012 10:48 am

First of all none of those are valid dataset names as the last portion - the generation number - is 9 byts in length when a generation number can only be 8 bytes in length and no node of a dataset name can exceed 8 bytes.

So, assuming that the '1' at the end of each datatname should not be there - what have you tried and what problems are you having? You HAVE heard of relative generations haven't you and you DO KNOW how to code them - (0) (-1) (-2) etc?

Assuming your job is ALWAYS running after the Monday gds is created then Monday's is (0). Work it out form there.

By the way - you cannot read a file using JCL, your program will read the file and you tell it which file to read by means of the CL.
Last edited by NicC on Fri May 18, 2012 7:08 pm, edited 1 time in total.

Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Fri May 18, 2012 7:02 pm

You need to consider what will happen if there is a day when no new generation is created or if somehow 2 generations are created.
Have a good one

Anuj Dhawan
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Tue May 22, 2012 6:01 pm

If the GDG gets creared everyday, should not a GDG(0) would suffice. Okay, said that - you know, incomplete information -- incomplete answer.

Post Reply


Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Mainframe Interview questions

Other References
Mainframe Tools and others