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
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.
how can we apply for HSBC exam(Mainframe) in India??? i went to their site and was told to submit my CV ,. etc..( totally confusing...)
how do you reference the printer file formats from cobol programs
What are declaratives and what are their uses in cobol?
Write a program that uses move corresponding.
What is the default value(s) for an initialize? What keyword will allow for an override of the default?
What is the Purpose of Pointer in the string?
Why do we code s9 (4) comp. Inspite of knowing comp-3 will occupy less space?
What kind of error is trapped by on size error option?
What is Pic 9v99 Indicates in COBOL?
i want a program using by if, evaluate , string, unstring, perform, occurs?
If you are current on the owner of a set, what is the difference between obtain next and obtain first?
What is the difference between Call and a Link?
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)?
What is the difference between external and global variables in COBOL?