View previous topic :: View next topic
|
Author |
Message |
che
New User
Joined: 31 Mar 2005 Posts: 6 Location: Chennai
|
|
|
|
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.
|
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
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 |
|
|
che
New User
Joined: 31 Mar 2005 Posts: 6 Location: Chennai
|
|
|
|
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.
|
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
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 |
|
|
che
New User
Joined: 31 Mar 2005 Posts: 6 Location: Chennai
|
|
|
|
Dude
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.
|
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
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 |
|
|
rssomm
New User
Joined: 05 Jun 2005 Posts: 41 Location: Hyderabad
|
|
|
|
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 |
|
|
anuradha
Active User
Joined: 06 Jan 2004 Posts: 247 Location: Hyderabad
|
|
|
|
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 |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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 |
|
|
shobam
New User
Joined: 18 Jul 2005 Posts: 34 Location: CN
|
|
|
|
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 |
|
|
|