Hi,Please give me complete code with this logic.
The question is how to read the records from a file with
load an array of size with error condition?
(The logic is
Z-Add 0 IDX
*LOVAL SETLL FILE
READ FILE 99
*IN9 DOWEQ *OFF
IDX ANDLT 99
ADD 1 IDX
MOVE FIELD ARR,IDX
READ FILE 99
ENDDO)please give me complete code with
explanation?



Hi,Please give me complete code with this logic. The question is how to read the records from a fil..

Answer / indraneel

Z-Add 0 IDX --- Initialize a array index field to 0
*LOVAL SETLL FILE -- repostion pointer to a file.
READ FILE 99 -- read file (EoF indicator is *in99)
*IN9 DOWEQ *OFF -- read FILE till EoF not reached
IDX ANDLT 99 -- and array index is less than 99
ADD 1 IDX -- add one to index
MOVE FIELD ARR,IDX -- moved data from FILE (field)
to array ARR(1)..
READ FILE 99

This code is reading records from a file and moving the
FIELD data to a array..

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More RPG400 Interview Questions

WHERE DO WE USE COMIT KEYWORD IN AN RPG PROGRAM? YOU MADE SOME CHANGES TO DATABASE BUT YOU DON'T WANT TO SAVE THOSE CHANGES NOW? HOW DO YOU HANDLE THIS ONE?

2 Answers  


How do I read records from Subfile? what is the purpose of READC explain with example?

4 Answers   IBM,


How to handle duplicate error handling in RPG?

0 Answers  


1..Write an sql query to find the employee name who is having 2 phone numebr? 2.Write an sql query to the the second highest salary of the employee?

4 Answers  


Is it possible to call a subfile using CL. IF yes.. kindly help me out with explanation...?

3 Answers  






in a cl pgm records are copied to a file in qtemp a pgm is called to delete records from the file in qtemp no of records in file in library qtemp is checked wat shud be the count of records let say it was 10 initially endpgm

2 Answers  


1.I have a Batch job, Running for 4 hours, i want to reduce the executing time to 2 hours what should you do?

5 Answers   Cap Gemini,


Delete FileName at first statement in RPG.

1 Answers  


what is estimation? and what is the level identifier parameter in PF?

3 Answers   TCS,


This is my Physical file 'EMPS' existing in library "TAMIL1" and its record format is 'EMPRCD" a)its source is R EMPRCD ENO 4 0 ENAME 10 EADD 10 b)The records present in EMPS are as follows ENO ENAME EADD 0001 tamil coimbatore 0002 kumar bangalore 0003 sunder bangalore 0004 arunkumar chennai 0005 pandi hyderabad 0006 santhosh hyderabad 0007 sasi salem 0008 kalai chennai 0009 suresh hyderabad 0010 vijay bangalore 0011 Arul chennai 0012 velu chennai 0013 khan bangalore 0014 praba chennai 0015 praba.p coimbatore 0016 anand ooty 0017 raja erode 0018 sankar erode 0019 vadivel namakkal 0020 anbu chennai 0021 Ajith mumabi c)now i want to select the 'ENAME' field records starting with 'S' for that i have created a RPG program its source code is PGM DCLF FILE(TAMIL1/EMPS) DCL VAR(&MYENO) TYPE(*CHAR) LEN(4) OVRDBF FILE(EMPS) SHARE(*YES) OPNQRYF FILE((TAMIL1/EMPS)) QRYSLT('ENAME *EQ %WLDCRD("S *")') READ: RCVF RCDFMT(EMPRCD) MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END)) CHGVAR VAR(&MYENO) VALUE(&ENO) SNDUSRMSG MSG(&MYENO) SNDUSRMSG MSG(&ENAME) SNDUSRMSG MSG(&EADD) GOTO READ END: CLOF OPNID(EMPS) DLTOVR FILE(EMPS) ENDPGM Is this coding correct sir,the program gets compiled,and if i call it it says query running but records are not displayed.please help me out

4 Answers   Virtusa,


How do you do indexing in a physical file?

2 Answers  


I have a RPG program of 100 Lines and first line is to SETON indicator LR. Will the program execute rest of the 99 Lines?

6 Answers  


Categories