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
how do you reference the esds vsam file formats from cobol programs
What is Pic 9v99 Indicates in COBOL?
How arrays can be defined in COBOL?
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
Differentiate cobol and cobol-ii. (Most of our programs are written in cobolii, so, it is good to know, how, this is different from cobol)?
Difference between cobol and cobol-ii?
What is the difference between binary search and sequential search?
) How do u handle errors in BMS macro?
if we display var1 then what will b displayed in below condition. 77 var1 pic s9(2) value -10. 77 var1 pic s9(2) value -11. " " " -12. " " " -13. -14 ... ... -19.
What is the difference between Call and a Link?
I have to write to a outfile where the number of records in that file should be the header of that file using IMS.. can anyone help me in this issue
What is the LINKAGE SECTION used in COBOL?
What is the difference between a binary search and a sequential search what are the pertinent cobol?
How do you define a variable of comp-1 and comp-2?
What is the use of intialize verb?