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
Can you please let me know the centre name of INS certification in Kolkata.
In COBOL programming, what is PERFORM? What is VARYING?
How do you differentiate between cobol and cobol-ii?
What is the Purpose of Pointer in the string?
how to refer the data field?
What is redefines clause in COBOL?
what happens if parmparameter passes zero bytes to the program
How you can read the file from bottom?
What are the cobol coding sheets?
What is the difference between Structured COBOL Programming and Object Oriented COBOL programming?
Are you comfortable in cobol or jcl?
Write a cobol program making use of the redefine clause.
what is the use of outrecord?
In which area will you utilize 88 level items in cobol?
How do get the result of your program directly on your pc?