I have a sequential file of 100 records. How do I load the
records into a two dimensional array ?
Answer Posted / gopal
01 INPUT-REC.
02 REC-ROWS OCCURS 10 TIMES INDEXED BY I.
03 REC-COLS OCCURS 10 TIMES INDEXED BY J.
04 REC-DATA PIC X(20 ) - assume
PROCEDURE DIVISION.
READ FILE(INPUT) INTO(WORK-REC) - assume length as 100
SET I TO 1. SET J TO 1.
PERFORM 1000-WRITE 10 TIMES
STOP RUN.
1000-SECTION.
MOVE WORK-REC TO REC-DATA(I J).
SET J UP BY 1.
READ FILE(INPUT) INTO(WORK-REC).
This will move the 10 occurences of J that is (I 1) to (I
10)
Then the outer loop should be incremented 10 times that is
I from 1 to 10.
| Is This Answer Correct ? | 12 Yes | 0 No |
Post New Answer View All Answers
How you can read the file from bottom?
I have one ps file in which there are 3 fileds emp_no,emp_name and leave_app.this ps file information give the detail of employee which is going to apply for leave.suppose emp_no=113430,emp_name=ajay,leave_app=1 that means he is going to apply for 1 day leave.and accordingling the table in db2 will be updated means if he has that no of leave in his account then he will get dat leave and updated acc. in table(leave_balance=previous leave present in table-leave_app).Now i want to check whther the updated result is correct or not by comparing the two ps file using IEBCOMPARE or icetool so what is going to be the two ps file and how its is going to be compare.
How to remove the spaces at the end of each record in the output file of variable length, via cobol program?
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)?
Is it possible that the redefines clause has different picture clauses compared to the one it redefined?
What is amode(24)?
How many sections are there in data division in COBOL?
explain sorting techniques in cobol program?
how do you reference the variable unblock file formats from cobol programs
What is the difference between PIC 9.99 and 9v99 in COBOL?
What is inspect in cobol ?
When is inspect verb is used in cobol?
how to refer the data field?
Define cobol?
How are the next sentence and continue different from each other?