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 / pa

read the record to the WS varible defined below
01 ws-var1.
05 ws-var2 pic x(1).
05 ws-var3 pic x(2).

if ws-var2 = '3'
inspect ws-var replacing first '3' by '5'
end -if

read the next record.

Hope it works

Is This Answer Correct ?    5 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how can i see junk values in dclgen or in hostvariable of comp ?

2545


Name the sections present in data division.

701


What rules are to be followed while using the corresponding options?

641


which is Best IBM Mainframe Training and Placement Institute in Ameerpet Hyderabad

1024


Explain how you can characterize tables in cobol?

638






How do you differentiate between cobol and cobol-ii?

658


Write a program to enter and display the names of students in a class using the occurs clause.

654


What is the Purpose of POINTER Phrase in STRING command in COBOL?

721


State the various causes of s0c1, s0c5 and s0c7.

665


When is inspect verb is used in cobol?

677


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

722


Why is it necessary that file needs to be opened in I-O mode for REWRITE?

748


Difference between cobol and cobol-ii?

708


) How do u handle errors in BMS macro

1512


i was faced one question- i have value -00001234.56 Suppress the zeroes and the output should be -1234.56 But Not - 1234.56 spaces should not be available after suppressing the zeroes. logic in jcl and cobol?

897