Same files in different AS/400 RPG library

515 pts.
Tags:
AS/400 Library
F Spec
RPG III
I would like to declare same files which are in two libraries in my RPG III. one file in in read only mode and another in update mode.

Software/Hardware used:
AS400

Answer Wiki

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

The two files need to have two different names in the F specs of your program.
Then you can do a OVRDBF before the call to the program.
You can also specify the library of the 2nd file within your RPG program.

Discuss This Question: 1  Reply

 
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
  • TomLiotta
    Here's some code that declares file QCUSTCDT from library QIWS as well as file QCUSTCDT from a library named in a variable:
         FQCUSTCDT1 if   e             disk    extfile( 'QIWS/QCUSTCDT' )
    
         FQCUSTCDT2 if   e             disk    usropn
         f                                     extfile( CUSTCDT2  )
         f                                     extmbr( CDMBR )
         f                                     rename( CUSREC : CUSREC2 )
         f                                     prefix( QC : 2 )
    
         D CUSTCDT2        s             21
         D CDMBR           c                   'MYMBR'
    
                             CUSTCDT2  = %trimr( PgmLib ) + '/'
                                       + 'QCUSTCDT' ;
    There are more options there than you need. The two F-specs use slightly different techniques. Use only pieces that you really need. The requirement is that the compiler needs file descriptions named "QCUSTCDT1" and "QCUSTCDT2" at compile-time because those are the F-spec names. You can either create duplicate file descriptions in a library in your library list when you compile or execute OVRDBF before the compile command executes. There is no need to run OVRDBF when the program runs if you do it this way. When you duplicate a file description for this, you don't need the data. Nor do you even need any members. The file description objects are small enough not to make any real difference to your system. If necessary, they can be deleted after the compile finishes; but I prefer keeping them in a development library for later reference. Tom
    125,585 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