Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GDG cycles

Status
Not open for further replies.
M

Member 310024

Guest
I am writing a COBOL program on an IBM mainframe.
Under certain conditions I open a GDG in output mode,
and write records to it.
However, under other conditions, I don't open the file.
What I have noticed, is that a new cycle of the GDG gets
created, albeit with zero records in it, even when I don't
open the GDG file.
What I would like, is for a new GDG cycle to be created,
only when I open the file.
I presume that it's what I have in the JCL that is the problem.
I've got DISP=(NEW,CATLG,CATLG) and SPACE=(CYL,(5,1),RLSE)
Is there a JCL problem, or is it simply not possible to avoid the new GDG cycle?
 
Hi Nate,

You're right about the DISP, but there's more to it than that. If you don't want the new gen to appear in the GDG, you have to abend your pgm. Then, when you change your DISP to (,CATLG,DELETE), if the pgm abends the new gen is deleted, if not it's kept (cataloged).

Having said all of that, I hope I can talk you out of deleting the file if you don't use it. It's a good idea to synchronize the gens in the GDG with the runs that created them. It simplifies reruns and generally helps in matching a gen with its run.

Doing that means that you create a version of that dataset even if there's no data to put in it. Just OPEN the file and CLOSE it before you exit the pgm. That "inits" the file so that it can be successfully read by the next pgm(s).

Be sure to keep the (,CATLG,DELETE). You won't want to create a gen if the pgm abends.

Be sure that that fact is emphasized in all documentation so that anyone subesquently using the file can code for the sitation. It should become part of the technical system specs. BTW, it's easier to code for an occasional empty
file than a missing file.

Let us know what you decide.

Regards, Jack.
 
My program works like this.
The user inputs a parameter ( a district code ).
My program has to firstly verify that the district code
is valid and also that other attributes of that district
conform to certain requirements.
If the district is rejected, for any reason, then the
program simply writes an explanation to a report (not the GDG). However, if the district gets the "all clear", then all the records delonging to that district are deleted and an "record print" of each of the deleted records, is written to the GDG.
So, as you can see, I don't really want to create a GDG cycle, if the user accidentally entered a wrong district, or actually just entered a good district, but also a 'N' with the delete-flag, just to get back a count of the number of records that would be deleted, if at some later stage, he wants to go ahead with the delete. I don't really want to waste a GDG cycle with every inquiry, rather than a genuine delete request that is ok. I'm not reaaly happy with the concept of using a GDG for this in the first place, becuase the GDG will eventually re-cycle and the old cycles lost. I would rather have date-time stamped records with open extend to add to the end of the file. However the user requirement is for a GDG.
 
Make the output file a temporary file (DSN=&&TEMPOUT), then if you don't want the output, issue a non-zero return code just before the STOP RUN (or GOBACK). Then next step whould be an IEBGENER to copy the temporary file to the GDG, with a COND=0 on the EXEC line.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top