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
can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there
How to fetch 1000 error records from VSAM file(Eg: 1000000 records present) while getting SOC7 abend ?
Difference between array and sub-script ?
What is the difference between structured cobol programming and object alternativelyiented cobol?
Why do we code s9 (4) comp. Inspite of knowing comp-3 will occupy less space?
What rules are to be followed while using the corresponding options?
What are 77 levels used for?
Discuss about changing dataset name in proc.
What is report-item in COBOL?
What is the use of intialize verb?
how do you reference the printer file formats from cobol programs
what is difference bt COND, REGION & TIME parameters at JOB & EXEC. give an exp.
What is the default value(s) for an initialize? What keyword will allow for an override of the default?
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.
State the various causes of s0c1, s0c5 and s0c7.