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


Please Help Members By Posting Answers For Below Questions

Can you please let me know the centre name of INS certification in Kolkata.

1708


In COBOL programming, what is PERFORM? What is VARYING?

664


How do you differentiate between cobol and cobol-ii?

646


What is the Purpose of Pointer in the string?

633


how to refer the data field?

1793






What is redefines clause in COBOL?

840


what happens if parmparameter passes zero bytes to the program

1650


How you can read the file from bottom?

652


What are the cobol coding sheets?

655


What is the difference between Structured COBOL Programming and Object Oriented COBOL programming?

666


Are you comfortable in cobol or jcl?

633


Write a cobol program making use of the redefine clause.

720


what is the use of outrecord?

1764


In which area will you utilize 88 level items in cobol?

706


How do get the result of your program directly on your pc?

1871