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

The answer is:

move each record to WS-REC PIC X(04).


then write the below statment to be executed for each rec.

INSPECT WS-REC REPLACING LEADING '3' by '5'.

why am i using LEADING instead of FIRST is that the
requirement says that 'STARTING with 3 by 5'

Is This Answer Correct ?    1 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the configuration section of a cobol program with examples of syntax.

650


write a cobol logic. i have file that has 10 records .1 record go to first output file and second record goes to 2 output and etc

695


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

2536


Write a program to explain size error.

667


Which division and paragraphs are mandatory for a COBOL program?

705






) how do u code after getting data?

1575


How to remove the spaces at the end of each record in the output file of variable length, via cobol program?

667


Explain how you can characterize tables in cobol?

636


What are the various section in data division and briefly explain them.

686


How to read the 2nd last record of a VSAM file? (The file size is huge and we don't know the key)

2718


1.give the details about WHEN OTHER. 2. how many form are available in evaluate.

1605


Write down the divisions of cobol program?

663


What is the difference between Global and External Variables?

655


Write the code implementing the perform … varying.

637


I have a File that has duplicate records. I need only those records that occur more than thrice.?

8607