DSPF & SNDRCVF
30 pts.
0
Q:
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?
ASKED: Apr 2 2008  2:23 PM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
23625 pts.
0
A:
 RATE THIS ANSWER
+1
Click to Vote:
  •   1
  •  0
  • AddThis Social Bookmark Button

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
Last Answered: Apr 2 2008  2:53 PM GMT by Gilly400   23625 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Vatchy   670 pts.  |   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   300 pts.  |   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   23625 pts.  |   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.

 

JohnsonMumbai   380 pts.  |   Sep 10 2009  5:18AM GMT

Thanks to all of you, yes we are on V5R4 and we can use two files provided OPNID is used in DCLF.

 
0