How I can reread the physical file in CL program once the
end of file reached in same CL program.

Answers were Sorted based on User's Feedback



How I can reread the physical file in CL program once the end of file reached in same CL program...

Answer / naga srinivas.kattula

Why u need POSDBF? whether u are checking the record in
first file is in second file?

Is This Answer Correct ?    1 Yes 1 No

How I can reread the physical file in CL program once the end of file reached in same CL program...

Answer / ravikumar

Hi,

we can read this file from end of file now.

but once the cursor reached at the end of file then we can not read it again.



DCLF FILE(FILE NAME) OPNID(E)

POSDBF OPNID(File Name) POSITION(*END)

READ: RCVF OPNID(E)

MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END))

OPERATIONS

GOTO CMDLBL(READ)

END: ENDPGM

Is This Answer Correct ?    0 Yes 0 No

How I can reread the physical file in CL program once the end of file reached in same CL program...

Answer / tthomas

Once the file reaches EOF the file is close.POSDBF wont
work in this case. To be clear no file operations can be
done on the file.

Upto 5 files can be declared in V5R3 with different OPEN
ID's.So u can declare the same file 5 times if u want and
perform different operations until the file reaches EOF.

Hope this info will be sufficient.

Is This Answer Correct ?    4 Yes 5 No

How I can reread the physical file in CL program once the end of file reached in same CL program...

Answer / sekhar

In V5R4M0 , we can declare 5 files in CL-ILE pgm

DCLF (FILE1) OPENID(OP1_)
DCLF (FILE2) OPENID(OP2_)
DCLF (FILE3) OPENID(OP3_)
DCLF (FILE4) OPENID(OP4_)
DCLF (FILE5) OPENID(OP5_)

DCL &LGL *LGL VALUE('1')

DOWHILE (&LGL = '1')

RCVF (RCDFMT_FILE1)

MONMSG MSGID(CPF0864) EXEC(LEAVE)

OPERATIONS

ENDDO

SIMILAR TO ALL 4 FILES....

Is This Answer Correct ?    4 Yes 5 No

How I can reread the physical file in CL program once the end of file reached in same CL program...

Answer / jp

Answer no. #11 is correct. Thanks Abhishek. NOthing else
works.

Is This Answer Correct ?    0 Yes 1 No

How I can reread the physical file in CL program once the end of file reached in same CL program...

Answer / abhishek bajpai

Hi All,

Please read the question first. It asks the method to re-
position/re-read the file again after it reached EOF in a
CL. Please dont post answers to prevent it from reaching
EOF :).
Also, u can use a single keyword CLOSE for the same as
described above by me.
Thanks

Is This Answer Correct ?    0 Yes 1 No

How I can reread the physical file in CL program once the end of file reached in same CL program...

Answer / mathi

The PF must be opended using OPNDBF or OPNQRYF in CL. Then
using POSDBF OPNID(Filename) POSITION(*START) command we
can make the cursor to point to begining of the file.

Is This Answer Correct ?    3 Yes 10 No

How I can reread the physical file in CL program once the end of file reached in same CL program...

Answer / siddhartha

Use POSDBF OPNID(File Name) POSITION(*START) to position
the cursor to the beginning of the file.

Is This Answer Correct ?    11 Yes 20 No

How I can reread the physical file in CL program once the end of file reached in same CL program...

Answer / sekhar

PGM
DCLF FILE(FILENAME)
READ: RCVF RCDFMT(RECORDFORMAT)

MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END))
OPERATIONS
GOTO CMDLBL(READ)
END: ENDPGM

Is This Answer Correct ?    10 Yes 20 No

How I can reread the physical file in CL program once the end of file reached in same CL program...

Answer / skma

I think it can be done by using OVRDBF
Like
OVRDBF FILE(FILE1) POSITION(*START)

Thanks

Is This Answer Correct ?    1 Yes 12 No

Post New Answer

More RPG400 Interview Questions

what is the difference between do while and do until?

0 Answers   IBM,


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  


Q:Hi all,i want accurate answer with code using in built functions.please sent me code as soon as posible. I have program nmed PGM1 which '' RETRIEVE Current production date''should correctly default the production date for the user who is issuing raw materials to the manufacturing.The production date can be different from the celendra date. However, the program does not make the correct adjustment for all manufacturing plants. there is a parameter which determines the production start time e.g. 07:00 if the system time precedes this,the program subtracts one from the celendra day.This work fine when the celendar day starts after production day as it does in England,the system should be adding one to the celendar day during the overlap. unfortunately the program was desined to assumed the celendar day always starts before the production day. Change required in the program: Change the PROGRAM PGM1 to use the new parrameter to decide whether to add or subtract 1 from the celendar day when determining the production date.

0 Answers   TCS,


can we perform CHAIN operation on Subfile record format....?

4 Answers  


Can you copy the records created by the OPNQRYF to other files and how?

2 Answers  


1. Which Built-In-Function will you use to achieve the following functionality? CLONO1NO2NO3 Factorl÷÷+OpcdeFactor2++÷ResultLenDHHiLoEq C QTY IFLT *ZERO C QTY MULT -1 QTY C ENDIF a) %ABS b) %TRIM c) %TRIMS d) %UNS

3 Answers   IBM,


Can anybody tell me that why we use option(*nodebugio)in H- Spec?

3 Answers  


wat is curser?? and its types???

4 Answers   HSBC,


We have job which is running as batch. It takes atleast 06 hours to complete tht job. But I wanna do tht job with in 3 hours?

0 Answers  


Hi all friend, Could Any body send me the code (with coding) of this senario because I have tried but I am stucking somewhere so Please reply ASAp with coding. senario:Q: I have to write the flat file(FLAT1) into the three different PFS (PF1,PF2 and PF3) with the respect of H line data, D line data and Z line data of flat file. where I have different data in flat file(FLAT1) which is mentioned below with data. H0929200909282009092820095529420003000073 D2222220006765555webservi001633.9909222009092820090924200951 8564380134049ROSNER TOYOTA OF FREDE FREDERICKSBURVA 224080000USA840840001633.99001633.99851856492689800208001915 511001633.990408490000000.0000000003446048 1,3 110793145 09070700351 372367 Rosner Motors D3333320006774444webservi000271.2409222009092820090924200951 8564380134049ROSNER TOYOTA OF FREDE FREDERICKSBURVA 224080000USA840840000271.24000271.24851856492689800208001835 511000271.240930680000000.0000000003450293 1 110793254 09072100079 373933 Rosner Motors Z0929200900000020001905.25 FLAT1 has the three pf data H line-represents the header pf data,D-Represent Details pf data,Z-Represents the trailer pf data Now I have to write H line data of flat file into Header pf (PF1),D line data of flat into datails pf(PF2) and Z line data of flat file into pf(PF3) with the spefic position(H,D and Z data of flat file into PF1, PF2 and PF3) of flat file.

4 Answers   IBM,


Can we trigger an rpg program which has user interaction with display file when updating a file using the command ADDPFTRG?

2 Answers  


what procedure should we use to find whether the following operations are successful or not setll setgt chain read reade readp pls tell with example i'm not lazy to read the manual or not lazy to do anything.but sometimes i cannot understand the things given in manual in high level english its little bit complicated for me,i can't understand their way of writing thats why i ask these questions here and find the solution in simple words that i can understand thats the real reason sir.sorry if i had hurt you or disturbed you.please understand my situation.

5 Answers   iGate,


Categories