IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Rewrite on GDG generation.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
che

New User


Joined: 31 Mar 2005
Posts: 6
Location: Chennai

PostPosted: Fri Jul 22, 2005 3:12 pm
Reply with quote

Problem goes like this.

Is it possible to rewrite or update on a current generation of a GDG base.

If so could anyone say how i access my current generation to write a set of records and update records which are already there.

My run JCL would creates a GDG generation for every new write from a program.


Thanks in advance to fellow forum mates.


36_2_35.gif
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Fri Jul 22, 2005 3:27 pm
Reply with quote

HI che,

Quote:
Is it possible to rewrite or update on a current generation of a GDG base.

Generations of a GDG are more or less same as a flat dataset.....When you say update a current generation ....I assume you want to edit latest generation of the GDG.....& It is indeed possible to edit records in generations of the GDG...
Quote:
If so could anyone say how i access my current generation to write a set of records and update records which are already there.

there are two scenarios....
1. If generation is being generated in the job you want to edit the generation....Thru the end of the job That generation will be referred as (+1)...
2. If generation has already been created...& you want to refer the latest generation in a separate job....It will be referred as (+0)...

Using DISP=MOD.....you can do the update for records....

Get me back...If I m not clear....

Regards,

Priyesh.
Back to top
View user's profile Send private message
che

New User


Joined: 31 Mar 2005
Posts: 6
Location: Chennai

PostPosted: Fri Jul 22, 2005 3:37 pm
Reply with quote

how to access the current generation (write fail generation of prev time) from the program.

what mode do i open the file (i,O,IO,extend) and do i use write or rewrite .....????


Thanks for a quick reply priyesh.

Thanks for all other forum mates for having a look.


36_2_35.gif
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Fri Jul 22, 2005 4:41 pm
Reply with quote

Hi che,

Quote:
how to access the current generation (write fail generation of prev time) from the program.

I said earlier too...Generations of a GDG are more or less same as a flat dataset... You have to go the way you refer Flat Dataset in your program... Just need to give Generation name in the DSN of the job....

Quote:
(write fail generation of prev time)

I didnt get this one...

Quote:
what mode do i open the file (i,O,IO,extend) and do i use write or rewrite .....????

use I/O....

Regards,

Priyesh.
Back to top
View user's profile Send private message
che

New User


Joined: 31 Mar 2005
Posts: 6
Location: Chennai

PostPosted: Fri Jul 22, 2005 5:54 pm
Reply with quote

Dude icon_smile.gif


I do know every generation is like a flat file and you could use it as like a flat file.Guess u didn't get what i said.

lemme say it once again and u try helpin me..

say i have some data(say 3 records) in my GDGFILAV008...while writing 4th record write fails.

i restart my program which selects records from (say 4th record) onwards.
i need to write the selected records to an existing GDGFILAV008 generation. this is an update on an existing file.

if i run my RUNJCL data which is fetched on by select ?ery wud be written on to a newer generation say GDGFILAV009.

i don't want this.also if there are any half written records(say record 4)..it should be updated.i also need the existing records.


Let me know if one of you could help me in this.

36_2_35.gif
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Fri Jul 22, 2005 6:35 pm
Reply with quote

Hi che....

You have 3 records in latest generation of the GDG and in the program you want to append the records from 4th onwards to the latest generation.

So you have to open your GDG Gen in prog as Extended mode....

Quote:
if i run my RUNJCL data which is fetched on by select ?ery wud be written on to a newer generation say GDGFILAV009.

i don't want this.also if there are any half written records(say record 4)..it should be updated.i also need the existing records.


What i understand you are giving GDG GEN(+1) there....thats why it is writing to a new DS...

For more clearance can you post ur JCL Code here....

Regards,

Priyesh.
Back to top
View user's profile Send private message
rssomm

New User


Joined: 05 Jun 2005
Posts: 41
Location: Hyderabad

PostPosted: Fri Jul 22, 2005 6:41 pm
Reply with quote

Hi Che....

For a GDG, you can have upto 255 generations and 100(0 to 99) versions.

For example if u have generation TEST.GDG(0) [TEST.GDG.G001V00], which you wanted to update due to some reason you can use following technique.

Use Input file as TEST.GDG.G001V00 and output file as TEST.GDG.G001V01.

When u refer this Generatin later as TEST.GDG(0), It always refers latest version, say in this case TEST.GDG.G001V01.

If u want to refer previous version for any reason you can always refer as TEST.GDG.G001V00.

As far as my knowledge, this is the only way u can solve your prob .

Thank U.
Madhu
Back to top
View user's profile Send private message
anuradha

Active User


Joined: 06 Jan 2004
Posts: 247
Location: Hyderabad

PostPosted: Fri Jul 22, 2005 9:11 pm
Reply with quote

Hi Che!

Quote:
say i have some data(say 3 records) in my GDGFILAV008...while writing 4th record write fails.

i restart my program which selects records from (say 4th record) onwards.
i need to write the selected records to an existing GDGFILAV008 generation. this is an update on an existing file.

if i run my RUNJCL data which is fetched on by select ?ery wud be written on to a newer generation say GDGFILAV009.

i don't want this.also if there are any half written records(say record 4)..it should be updated.i also need the existing records.


If I interpreted your problem correctly then this issue can be solved thru proper restart instructions in the JCL.

Say TEST.GDG.G0001V00 is created and 3 records were written into it and got abended. Now restart the job by refering the GDG as TEST.GDG(0) and change the DISP parameter as MOD.

Hope this solves your issue.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Jul 23, 2005 9:50 pm
Reply with quote

Hey Dude,

1) You can only update DISK flat files.
2) Both TAPE and DISK flat files can be extended.
3) You open the file as I-O to update and/or extend.
4) To extend only you can use extend open option.
5) Use DISP=OLD in the JCL, the open will give you MOD if you need it.
6) In JCL you can ref the file relatively (DSN=....(0)) or absolutely
(DSN=.....GnnnV00)
Back to top
View user's profile Send private message
shobam

New User


Joined: 18 Jul 2005
Posts: 34
Location: CN

PostPosted: Mon Jul 25, 2005 10:32 am
Reply with quote

If there is a failure in the program while it is writing the 4th record , while restarting the job try overriding the DSN parameter from GDG(+1) to GDG(0) and also change the DISP parameter from OLD to MOD.

Since you are going to ADD and also UPDATE a record in the GDG , open the file in I-O mode.

Please correct me if I am wrong.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts DFHPI1008 JSON generation failed COBOL Programming 0
No new posts rewrite same SAY line CLIST & REXX 8
No new posts Started task using a generation dataset JCL & VSAM 7
No new posts Report generation JCL & VSAM 18
No new posts How can I get Generation Nbr of GDG f... IBM Tools 1
Search our Forums:

Back to Top