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

Why we cannot call a service program? If I add a PEP can i call the service program?

1 Answers   DELL,


during execution, an rpg/400 program automatically follows a sequence of operations for each record that is processed. The built-in program cycle includes the following logical steps.

0 Answers   IBM,


What is SFLNXTCHG keyword why it has used and where? Briefly explain with Example.

2 Answers   IBM,


we hav job which is running as batch. it takes atleast 06hours to complete tht job. bu i wana do tht job with in 3hours.........? so plz post ur answers

8 Answers   Cap Gemini, IBM,


What hapens when we use CPYF command to copy a LF? On which PF will it be dependent???

7 Answers   HSBC, Systime,


How to set on/off a group of indicators in a single statement?

3 Answers  


If there are 1000 member(PGM type) in a SRC file. How can we compile in a CL program? ( It need to be done in a loop)?

1 Answers  


Please help me, I have created window subfile,I have created Footer with same lengh and postion of window SFL. When I call the pgm, first is shows only Footer and then it shows subfile records.This time Footer is not showsing ..plz hel me how can i do it...? Sameple DDS and RPG: A R WIN1 SFL A*%%TS SD 20090130 165346 MUNSHIJ REL-V4R2M0 5769- PW1 A FLD001 1Y 0B 4 3EDTCDE (Z) A ATFILE R O 4 7REFFLD (QWHFDBAS/ATFILE LIB/LIBF- A ILE) A R WINCTL SFLCTL (WIN1) A*%%TS SD 20090202 123459 MUNSHIJ REL-V4R2M0 5769- PW1 A ALTNAME ('y') A SFLSIZ (0004) A SFLPAG (0004) A WINDOW (FOOTER) A ROLLUP (27) A ROLLDOWN (28) A CF12 (12 'Cancel') A 50 SFLDSP A N51 SFLDSPCTL A 51 SFLCLR A 1 2'Select Option,Press enter' A 2 3'1= Select' A R FOOTER A* A WINDOW(8 31 9 43) A 8 4'F12 = Cancel' A R DUMMY ASSUME A 24 10' ' in RPG: Dow *IN12 = *Off Write Footer Fxfmt WInCTL

2 Answers  


How to declare the more than one file in cl/400.

13 Answers   IBM,


please help me answer to this question what is the difference between the binding and srvpgm in ilerpg?

4 Answers   HCL,


1.What is the Maximum field length we can declare in RLU?? 2. What is the difference if your designing RLU using DDS and using the option 19 for the RLU??

2 Answers  


what is kids-rpg?

0 Answers   IBM,


Categories