how to access any particular menber of any pf

310 pts.
Tags:
DB2/400
PF
RPGLE
Hi, if i have a pf having 5 members..how can i access 3rd member of it through in rpgile.. regards Ambrish

Answer Wiki

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

You can issue an ovrdbf command in a CL prior to calling the Rpg program.
Phil

==========================================================

Assuming RPG IV in a reasonably recent release:
<pre>
F someFile IF E K Disk infds( someFileDS )
F extfile( MYFILE )
F extmbr( MYMBR )

D MYFILE c const( ‘MYFILE’ )
D MYMBR c const( ‘MYMBR3′ )
</pre>
The EXTFILE() and EXTMBR() keywords can refer to literals or variables. If you use a variable, you can close the file, change the variable value and open the file against a different member.

Tom

Discuss This Question: 7  Replies

 
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
  • Ambrish 82
    could u please suggest an example.............
    310 pointsBadges:
    report
  • TomLiotta
    suggest an example…………. An example of what? I supplied code that shows an example. What else is possible? If you can provide a basic program that reads a file with multiple members that you have, I can reply with changes that would cause it to read a different member. Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    Tom's answer looks good Then in the C-specs you can have a read loop from somefile and you wll be reading the data in MyFile MyMbr3. You show us some code and we'll help. Phil
    51,355 pointsBadges:
    report
  • rajeshece
    Using OVRDBF command, we can achieve this
    1,215 pointsBadges:
    report
  • ten2008
    Hi Tom/Philip, it is said with out using OVRDBF one can read a specified member in a file. Please mention the process if any thing of this kind is available. I think the answer is in using a flat file. thanks
    1,150 pointsBadges:
    report
  • philpl1jb
    Tom's answer doesn't reqyure an override. Phil
    51,355 pointsBadges:
    report
  • CharlieBrowne
    The comment by Ten2008 suggesting using a flat file is not relevant. Whether a file is a flat file or and externally defined file, it can still have multiple members.
    41,380 pointsBadges:
    report

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