View previous topic :: View next topic
|
Author |
Message |
shammiullah
New User
Joined: 13 Jun 2005 Posts: 24
|
|
|
|
hi guyz,
can anyone tell me how to handle a restart logic in cobol pgm(for file) and for embedded sql(cobol db2).
say i'm loading 100 recs from a file to another file.while 50th record it got abend.now instead of starting from 1st rec again i need to start from 51st rec.how to do this using the logic in cobol file program.
now in cobol db2 pgm i'm loading the 100 recs from file to db2 table.it got abend in 51st record.now how to put a commit point after 50 records and how to start from 51st record.
my ques is how do u handle these situations(with logics).
thanx and regards
shammi. |
|
Back to top |
|
|
Ramya A
Active User
Joined: 26 Jul 2004 Posts: 104
|
|
|
|
For file, one way I can think of is: If you can add or use a indicator in the input file, set the indicator for a record as and when it is loaded to the output file. While writing, write only those records for which the indicator is not set.
i.e
Code: |
Read record
If inidcator not set
do
write to output
set indicator
end
Go to Read record
|
However you do this, remember that your output file should have the DISP as (NEW,CATLG,KEEP) and not (NEW,CATLG,DELETE) |
|
Back to top |
|
|
shammiullah
New User
Joined: 13 Jun 2005 Posts: 24
|
|
|
|
thanx for ur prompt reply ramya....
i have 1 more ques...what'll happen if i try to load an empty file to a ksds or esds. |
|
Back to top |
|
|
shammiullah
New User
Joined: 13 Jun 2005 Posts: 24
|
|
|
|
However you do this, remember that your output file should have the DISP as (NEW,CATLG,KEEP) and not (NEW,CATLG,DELETE)????
as u have said why cant be my outfile be (new,catlg,keep)....is there any reason behind it.
thanx and regards
shammi. |
|
Back to top |
|
|
khamarutheen
Active Member
Joined: 23 Aug 2005 Posts: 677 Location: NJ
|
|
|
|
Hi Shammiullah,
Quote: |
what'll happen if i try to load an empty file to a ksds or esds. |
i think 93 or 46 error u may get in file status... not clear..
Quote: |
(new,catlg,keep)....is there any reason behind it. |
i can't follow ur conversation... any how if u say i may help u... |
|
Back to top |
|
|
Ramya A
Active User
Joined: 26 Jul 2004 Posts: 104
|
|
|
|
If you try to load an empty file to a ksds or esds, it will abend since VSAM files can never processed empty. Normally, in our shop we use to load the VSAM file with a dummy record as soon as it is created.
If you give (New,Catlg,Delete), in case your program abends, the dataset will be deleted. So whatever data you've loaded so long (Your basic requirement) will no longer be there. So if you restart your step, you'll have to start from first again.
Hope I'm clear. |
|
Back to top |
|
|
vijayprabu
New User
Joined: 15 Dec 2005 Posts: 21
|
|
|
|
Hi,
1. sort the input file.
2. after reading and writing into the output file write the same record into another file and disp as (new,catlg,keep)
3. whenever the program restarts first read the file which is kept till end of file.
4. you will get the last record written into the output file.
5. then go to the normal process of reading and writing.
I hope this works
if any mistakes execuse......
vijay |
|
Back to top |
|
|
|