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

How to handle a restart logic in cobol pgm & embedded SQ


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shammiullah

New User


Joined: 13 Jun 2005
Posts: 24

PostPosted: Wed Dec 07, 2005 4:57 pm
Reply with quote

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
View user's profile Send private message
Ramya A

Active User


Joined: 26 Jul 2004
Posts: 104

PostPosted: Thu Dec 08, 2005 4:13 am
Reply with quote

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
View user's profile Send private message
shammiullah

New User


Joined: 13 Jun 2005
Posts: 24

PostPosted: Thu Dec 08, 2005 1:40 pm
Reply with quote

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
View user's profile Send private message
shammiullah

New User


Joined: 13 Jun 2005
Posts: 24

PostPosted: Thu Dec 08, 2005 1:53 pm
Reply with quote

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
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Thu Dec 08, 2005 2:50 pm
Reply with quote

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
View user's profile Send private message
Ramya A

Active User


Joined: 26 Jul 2004
Posts: 104

PostPosted: Sat Dec 10, 2005 1:32 am
Reply with quote

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
View user's profile Send private message
vijayprabu

New User


Joined: 15 Dec 2005
Posts: 21

PostPosted: Thu Dec 15, 2005 7:27 pm
Reply with quote

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
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top