I have a sequential file of 100 records. How do I load the
records into a two dimensional array ?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / neilsh
It should be
01 xyz
05 pqr occurs 2 times indexed by i
07 abc occurs 50 times indexed by j
09 rec pic x(40).
so it would be like 50 occurance of rec and then 2 occurance
of abc
50 + 50 = two divisions
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / ameet
The answer for this is as below:
01 INPUT-REC.
02 REC-DETAIL OCCURS 100 TIMES INDEXED BY I.
03 REC-DATA PIC X(10 ) - assume
PROCEDURE DIVISION.
READ FILE(INPUT) INTO(WORK-REC) - assume length as 100
SET I TO 1.
PERFORM 1000-WRITE 100 TIMES
STOP RUN.
1000-SECTION.
MOVE WORK-REC TO REC-DATA(I).
SET I UP BY 1.
READ FILE(INPUT) INTO(WORK-REC).
| Is This Answer Correct ? | 2 Yes | 16 No |
I want ALL ERROR codes in VSAM
3 Answers American Express, TCS,
example for sub strings ? and refernce modifications whit output pls
0 Answers College School Exams Tests, IBM,
can we use variable picture clause as xx.99 in cobol.
WHY LRECL NEEDS TO BE 4 EXTRA THEN THE COBOL FILE LENGTH & WHAT IT CONTAIN IN THAT LENGTH
How do you do in-line PERFORM?
How do u find the programs calling the given module, without having doing 3.13 on loadlib/source library?
what is the difference between Plan & package
What is the difference beetween Arrays and Tables in Cobol? please dont give the answer that arrays in cobol terminology is called tables......
What is Pic 9v99 Indicates in COBOL?
0 Answers SwanSoft Technologies,
Extract only those records from a PS file which are having word 'TEXT' in the records using COBOL? The word TEXT is not present in a particular position in all the records.
If my file contains 100,000 records and job abended at 55,000th records processing then how can i restart job from that record onward by ignoring that record. I can not edit the file as file size is big and it is getting browse substituted?
how we can reverse the string in the cobol for example satheesh can be reveresed as hseehtas