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
Whats the difference between search & search ALL?
how to refer the data field?
What is the difference between Global and External Variables?
Is it possible that the redefines clause has different picture clauses compared to the one it redefined?
What type of SDLC u followed? Why?
what happens if parmparameter passes zero bytes to the program
Have you used the sort in your project?for this type of questions any working on real time project give the eg. with real time scenario.
There are 5 fields and 1000 records in a file. Unload it into an array. Write the syntax for declaration and how will you unload it.
What is the difference between external and global variables in COBOL?
How do get the result of your program directly on your pc?
Explain what you understand by passing by value.
if we have " ibm mainframe ",in that how to remove first and last leading space eg:"ibm mainframe" like that the answer we need
Write the code to count the sum of n natural numbers.
which is Best IBM Mainframe Training and Placement Institute in Ameerpet Hyderabad
What are the different rules of SORT operation?