Question

Asked:
Asked By:
Nov 25 2008   5:32 AM GMT
Shaddy   20 pts.

RPG procedure


RPG, Database programming, RPG/400, fMyFile

Hello Martin,

Below is the codeline which i used for reading a DB file via RPG:

FMYFILE IF E K DISK
C READ PFRPG1
C DOW NOT%EOF
C NAME DSPLY
C ID DSPLY
C ADDRESS DSPLY
C ENDDO
C SETON LR

could you verify the code b'coz i am not getting the output.

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0



Hi,

Your code will only read the first record in the file, then keep displaying the three variables. You need another read in your loop. You should also set the pointer to the first key in your file (you have the file defined as keyed) using setll :-

FMYFILE IF E K DISK
C *LOVAL SETLL MYFILE
C READ PFRPG1
C DOW NOT%EOF
C NAME DSPLY
C ID DSPLY
C ADDRESS DSPLY
C READ PFRPG1
C ENDDO
C SETON LR

This should loop through displaying the values for each record.

Regards,

Martin Gilbert

If yhu are calling this program/not submitting it then you should have seen the first values.
Not getting any output .. make certain there are rercords inthe MyFile.
You can check this with DSPFD MyFile. Record count would be near the bottom.

Phil
  • AddThis Social Bookmark Button

Browse more Questions and Answers on AS/400 and Development.

Looking for relevant AS/400 Whitepapers? Visit the Search400.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register