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

What type of SDLC u followed? Why?

1520


I have File 1 occurs 5 times with Employee-ID,Employee-Name,Employee-Dept (EEE and MECH). I have File 2 occurs 10 times with Employee-ID,Employee-Name,Employee-Dept (EEE,CIVIL,CHEMICAL and MECH). In FIle 1 and FIle 2 , for matching Employee-DEPT (Only MECH) , we need to move entire records from file1 to file 2. We should not use 2D array. Your help is needed here.

1117


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

721


What is amode(24), amode(31), rmode(24) and rmode(any) (applicable to only mvsesa enterprise server) ?

676


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

672






What is the difference between a binary search and a sequential search? What are the pertinent cobol commands?

717


how do you reference the rrds file formats from cobol programs

801


what is s000 u4087 error? please give the all error codes in cobol,jcl.

17046


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

681


What is the difference between Global and External Variables?

666


i have 10 names in an array and my name is one of them also array is not in sorted order i need to display my name using index how will i do this

998


What are the different rules for performing sort operation?

763


What are the different rules of SORT operation?

700


how do you reference the esds vsam file formats from cobol programs

634


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

1885