Question

  Asked: Apr 2 2008   2:23 PM GMT
  Asked by: SOUTHEAST


DSPF & SNDRCVF


AS/400, RCVF, CL, DSPF, 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?

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
+1
Click to Vote:
  •   1
  •  0




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
  • AddThis Social Bookmark Button

Browse more Questions and Answers on AS/400.

Looking for relevant AS/400 Whitepapers? Visit the Search400.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register

Vatchy  |   Apr 3 2008  3:40PM GMT

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.

 

GAC  |   Apr 4 2008  2:56PM GMT

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.

 

Gilly400  |   Apr 8 2008  3:06PM GMT

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.