View previous topic :: View next topic
|
Author |
Message |
TS70363
New User
Joined: 07 Apr 2010 Posts: 94 Location: Bangalore, India
|
|
|
|
Hi all,
In a recent interview, I was asked--
1) A COBOL module is reading a flat file containing some 1000 records and writing those 1000 records in some differently arranged form in a new file.
Say, suppose my program abends somewhere in the middle while reading the 499th record.
Tell me the logic to start the program from where it abended.....
2) Can we retain the value of working storage variable once the program is over?????
Answer : 1) As it is flat file, we need to read the records from the beginning..We cannot skip the records or any I/O read operation.
2) NO we cannot retain the value of the working storage variable in COBOL. But if it is a CICS then it is possible.. |
|
Back to top |
|
|
TS70363
New User
Joined: 07 Apr 2010 Posts: 94 Location: Bangalore, India
|
|
|
|
Please let me know if I am correct.... |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
1. though a qsam file by definition must be read sequentially, if you kept track of the number of records you process, and save this count in another file, you could skip those records already processed during your restart.
2. you can write your working-storage values to either db2 or a file during your processing.
so, I would say that you are not correct.
I would also suggest googling - RESTART Checkpoint processing and
do a little reading. |
|
Back to top |
|
|
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
Quote: |
though a qsam file by definition must be read sequentially, if you kept track of the number of records you process, and save this count in another file, you could skip those records already processed during your restart. |
How to Skip the records in Sequential File -Read? Even i am having the count value how to read & skip those records of sequential files? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
the word SKIP is to apply to
process
and not read. |
|
Back to top |
|
|
TS70363
New User
Joined: 07 Apr 2010 Posts: 94 Location: Bangalore, India
|
|
|
|
Quote: |
1. though a qsam file by definition must be read sequentially, if you kept track of the number of records you process, and save this count in another file, you could skip those records already processed during your restart. |
Can you just brief out on this topic...
Let us assume my job abended when reading the 498th record and next time I start my job, my program should start reading the input file from 498th record.
How do we accomplish this programmatically.
I am not sure how to skip read statement for a sequential file.
Please post the code if possible or atleast some syntax |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
count-of-process-records is a field contained in the checkpoint restart record for the program.
Before starting your normal processing logic:
if count-of-process-records = 0, that means there is no restart processing to perform.
if count-of-process-records > 0, that means the program blew up on record number ?
Code: |
IF count-of-process-records > 0
THEN
PERFORM count-of-process-records TIMES
READ ...
END-PERFORM
END-IF |
PERFORM NORMAL PROCESSING LOGIC
Keep in mind, if you have an output file, you need to have a disposition of MOD. |
|
Back to top |
|
|
TS70363
New User
Joined: 07 Apr 2010 Posts: 94 Location: Bangalore, India
|
|
|
|
This means that we still need to perform read operation for count-of-process-records number of times.
So any how we cannot skip the records..
We are reading them but doing nothing with the number of processed records. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
I apologize for my bad verbiage.
those of use with english as a first language understand the meaning of skipping in this context,
but when the computer meaning of skip is applied, the definition/meaning is different.
again, the term skip only referred to the process. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Additionally,
I have never worked at a shop that did not have some type of standard restart procedure.
This is especially true if you work for an outsourcing firm.
I would suggest that you obtain and read all documentation concerning standards at your organization or the organization that you are supporting. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
FWIW- restart is not usually done for a process that only reads a sequential file and writes another. . . Actually, i've never seen this.
As DBZ mentions, organizations that use restart/recovery have a process in place and any new processes that need to be restarted should use the existing standard method.
With the newer/faster dasd and cpus, many places no longer implement restart processes. In the rare case where there is a re-startable abend, total down-time is less by simply rerunning from the beginning. . . |
|
Back to top |
|
|
|