RPG procedure

20 pts.
Tags:
Database programming
RPG
RPG/400
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.

Answer Wiki

Thanks. We'll let you know when a new response is added.

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
<b>C *LOVAL SETLL MYFILE</b>
C READ PFRPG1
C DOW NOT%EOF
C NAME DSPLY
C ID DSPLY
C ADDRESS DSPLY
<b>C READ PFRPG1 </b>
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

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following