On 25/04/2009, at 2:44 AM, Dave Boettcher wrote:
Has anyone ever seen a printer file designated as a disk file in a  
RPGLE program?
Yes, and in previous dialects of RPG too. Usually indicates a coding  
defect because your output won't magically end up in a disk file.
The F spec looks like this:
    ferrctrec  o    e             disk
I spent some time searching for the file be fore I discoverred that  
it was a printer file.
And it still amazes me that it is used as a print file and labelled  
disk in the f spec.
Anyone else seen this?
RPG doesn't care what type of file you actually use. Consider that you  
cannot have a printer file, display file, or database file with the  
same name in the same library. Therefore only one instance of a file  
with the specified name will be found by the compiler. The compiler  
uses the DISK, PRINTER, and WORKSTN keywords (in conjunction with I/O/ 
U/C) simply to limit/verify the particular operations your code  
attempts to perform on that file. It doesn't verify that the file it  
found matches the device type you specified. The compiler only cares  
that:
	a) the TYPE specified is appropriate for the DEVICE specified
	b) the operation codes in the program are appropriate for the TYPE
	c) an appropriate DESIGNATION is specified for certain TYPEs
Although the compiler will allow you to code a READ operation on a  
file specified as DISK (as long as I/U is also coded) Common Data  
Management won't allow a PRTF to be opened for READ so you'll get a  
run-time error.
If you want to redirect program printer output into a disk file then  
use an override. I suggest fixing the code to indicate the proper  
device type.
Regards,
Simon Coulter.
--------------------------------------------------------------------
   FlyByNight Software         OS/400, i5/OS Technical Specialists
   
http://www.flybynight.com.au/
   Phone: +61 2 6657 8251   Mobile: +61 0411 091 400        /"\
   Fax:   +61 2 6657 8251                                   \ /
                                                             X
                 ASCII Ribbon campaign against HTML E-Mail  / \
--------------------------------------------------------------------
 
As an Amazon Associate we earn from qualifying purchases.