I have the file which is having the extension no as records.
sample file will look like below.
2310
3410
3256
4350
3781
5408
I need to replace the record which is starting with 3 to 5
(i.e) 3410 to 5410. How can we do it through cobol
and cobol-db2 program? I need the possible logic?
Answer Posted / reena
Define the working storage variable in the following way:
01 ws-var1.
05 ws-var2 pic x(1).
05 ws-var3 pic x(3).
Read the database file.
Move the database field value to the working storage
variable (i.e. ws-var1)
Then preform the following
if ws-var2 = '3'
move '5' to ws-var2
move ws-var1 to the database field
rewrite database record
end -if
read the next record.
Preform the above routine till eof..
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Name some of the examples of COBOl 11?
What is amode(24), amode(31), rmode(24) and rmode(any) (applicable to only mvsesa enterprise server) ?
i made it to stage 3 of an interview process wednessday they will quiz my knowledge again face to face for an analyst role recruiter said it will be based on Business requirements system is cobol and good ideas what they might ask etc
what is amode(24), amode(31), rmode(24) and rmode(any)?
What is a report item?
Is it possible that the redefines clause has different picture clauses compared to the one it redefined?
i need a small 3d program using inline and outline.
how do you reference the ksds vsam file formats from cobol programs
What the difference is between continue and next sentence?
Define cobol?
For rewrite, why is it mandatory that file needs to be opened?
What is the difference between Global and External Variables?
What is the default value(s) for an initialize and what keyword allows for an override of the default?
What is the difference between Call and a Link?
Explain about different table spaces.