You can establish the default device for display and ICF files.
Example:
The following example illustrates how to explicitly establish a default program device for a display file using the _Racquire() function.
CRTDSPF FILE(MYLIB/T1520DDD) SRCFILE(QCPPLE/QADDSSRC) MAXDEV(2)
Figure 141. T1520DDD -- DDS Source for an I/O Display
|
OVRPRTF FILE(STDOUT) TOFILE(QPRINT)
CRTBNDC PGM(MYLIB/T1520DEV) SRCFILE(QCPPLE/QACSRC)
Figure 142. T1520DEV -- ILE C Source to Establish a Default Device
|
The _Racquire() function explicitly acquires the program device DEVICE2. DEVICE2 is the current program device. The _Rformat() function selects the record format EXAMPLE. The _Rwrite() function writes data to the default device. The _Rreadn() function reads the string from the current program device DEVICE2.
CALL PGM(MYLIB/T1520DEV)
The output is as follows:
+--------------------------------------------------------------------------------+ | | | | | | | OUTPUT: Hello | | | | INPUT: __________________ | | | | | | | | | +--------------------------------------------------------------------------------+
The file QPRINT contains:
Response from device : GOOD MORNING
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.