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 |
tell me about examine inspect and evaluate ?
Read filea And file b write the same records in both files? Records in a but not in b record in b but not in a
consider the following PROCEDURE DIVISION entry OPEN EXTEND IN-FILE identify the correct statement a.organization of IN-FILE is sequential and records can be added in the beginning b.organization of IN-FILE is sequential and records can be added in the end c.organization of IN-FILE is indexed and records can be added in the beginning d.organization of IN-FILE is indexed and records can be added in the end
I have a field with data type X(10). I want to perform arithmetic operation on this field? I tried doing it by moving the value into a numeric field. but it didn't work out. I am getting a S0C7 abend. Pls let me know if there is any way of getting this done?
What will happen if we generate GDG +2 version instead of +1 version?
Can a Search can be done on a table with or without Index?
i have n records in one file and in this file there is some fields and i want to count that how many sharma in my file so plz give the coding that how we read sharma ?
plz any one tell clearly the justify right clause?
I know my query will return more than one row but I don't want cursor what should I do?
I have put two write operations in a single para for two different conditions.Will that lead to an abend or run successfully and write two records?
How to increase the logical record length of existing PS file?
How can we pass data from cobol to JCl?