Declare variables in RPGLE program

Tags:
AS/400
RPGLE
How will we declare variables in an RPGLE program which have the same field names of a file that is declared in the PF?
1

Answer Wiki

Thanks. We'll let you know when a new response is added.
If you declare a PF within a RPGLE program, the PF’s fields will become implicit variables within your RPGLE source. This makes it unnecessary to declare those variables explicitly.

Discuss This Question: 5  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.
  • philpl1jb
    If the file is used in an input or update f-spec with E(xternal) format the fields are automatically declared as part of the compile.
    54,090 pointsBadges:
    report
  • philpl1jb

    If it's not used in the F-spec then a D-Spec

    D MyFileDS  E    DS     ExtName(Myfile)

    54,090 pointsBadges:
    report
  • ToddN2000
    I have had luck when using 2 versions of the same file by using the "PREFIX" method in the F spec.
    Fmyfile    if   e             disk    prefix('IN')
    134,720 pointsBadges:
    report
  • hunshabbir7
    Fields of a physical file (externally described) are automatically created. You should use prefix (as ToddN2000 suggested) with physical. That will be easier for you also when you'll be modifying the code.  
    2,900 pointsBadges:
    report
  • deepu9321
    Hi Vasanthisrini,

    If you have a field that is already declared in PF, Ideally, You dont need to declare the field again.

    But, if you are declaring it (File is being defined in F - Spec), Field name in RPGLE should have equal attributes as physical file field.

    Pradeep.
    4,980 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.

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

Following

Share this item with your network: