CL Command Reference - SNDF
CL Command List > SNDF Reference
Description:
The Send File (SNDF) command is used by a CL procedure to send a record to a display device that is being used by an interactive user. The device can be any display station, including the console. The command sends the data from the program¡¯s CL variables to the display¡¯s device file in the specified record format. These variables were automatically declared in the program (one for each field in the record format) when the CL source program was compiled and a Declare File (DCLF) command was processed as part of the source.
Of the record formats specified in the DCLF command, only one can be specified in each SNDF command. If the device file has not been opened, it is opened by this command. The file and record format specified in this command can be overridden by an Override with Display File (OVRDSPF) command if it is entered before the file is opened. However, care should be taken that the fields in the overriding record format correspond to the CL variables declared in the program.
Restrictions:
. This command is valid only within a CL procedure.
. This command is valid only for display files.
. This command cannot be used with database files.
Examples:
Example 1: Using Display File with One Record Format
DCLF FILE(MENU1)
:
SNDF
The record format in the device file MENU1 is sent to the device specified in the file. There is only one record format in the file.
Example 2: Using Display File with Multiple Record Formats
DCLF FILE(SCREEN1) RCDFMT(REC1 REC2)
:
SNDF DEV(DISP3) RCDFMT(REC1)
The device file named SCREEN1 causes the display station named DISP3 to display the data sent by the CL procedure. The data is shown in the format specified by the REC1 record format.
Example 3: Using Open File Identifier
DCLF FILE(SCREEN1) RCDFMT(REC1 REC2) OPNID(OUTDSP1)
DCLF FILE(SCREEN2) RCDFMT(REC3 REC4) OPNID(OUTDSP2)
:
SNDF DEV(*FILE) RCDFMT(REC2) OPNID(OUTDSP1)
The device file named SCREEN1 is used to send data to the display device named in the same device file. The data is presented to the user in the format specified by record format REC2. The SNDF command is associated with device file SCREEN1 because the open file identifier specified on the SNDF command matches the open file identifier specified on the DCLF command for display file SCREEN1.