DSPF & SNDRCVF

30 pts.
Tags:
AS/400
CL
DSPF
RCVF
SNDRCVF
In a CL, I need to define two files. One file is a display file and the other is a physical file. Then I need to do a RCVF to pass the retrieve data in the display file then use the physical file. When I try to compile the pgm using the RCVF, it does not recognize the variables in the display file or the record format in the files. How can I declare multiple files in a CL program?

Answer Wiki

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

Hi,

You need to specify an OPNID on your DCLF statements and also on your RCVF or SNDRCVF statements. The following example should work (assuming you have the same fields on your display file that you have in your physical file) :-

PGM

/* Declare display file */
DCLF FILE(MYDISP) OPNID(DISPLAY)

/* Declare physical file */
DCLF FILE(MYFILE) OPNID(DATA)

/* Read physical data file */
RCVF DEV(*FILE) OPNID(DATA)

/* Show data from physical file on display file */
SNDRCVF DEV(*FILE) OPNID(DISPLAY)

ENDPGM

Discuss This Question: 6  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
  • Vatchy
    You cannot declare or use more than one file in a CL program. In order to access two files you must use a second program. If you are driving the display from a data file then declare the data file in the first program and call the second program to display the data passed from the first program.
    1,410 pointsBadges:
    report
  • GAC
    What Vatchy writes is true as long as you are in an OS version previous to V5R3. Then check your OS version and decide. Good luck.
    300 pointsBadges:
    report
  • Gilly400
    You can access more than one file in a CL program these days, but you have to use the OPNID parameter to distinguish between the files.
    23,730 pointsBadges:
    report
  • JohnsonMumbai
    Thanks to all of you, yes we are on V5R4 and we can use two files provided OPNID is used in DCLF.
    1,160 pointsBadges:
    report
  • Vinaykumar
    how to retrieve data from display file to cl programing
    10 pointsBadges:
    report
  • Ii2none
    Once you declare the file, the compiler prefixes all your DSPF variables with a ampersand ("&"). So if you have a field in your DSPF labelled "$State", you refer to it in your CL code as "&$State".
    25 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