SNDF (Send File)
Purpose
The Send File (SNDF) command is used by a control language (CL) program 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 program.
- This command is valid only for display files.
- This command cannot be used with database files.
Optional Parameters
- DEV
- Specifies the name of the display device to which the data in the CL variables for the specified record format is sent.
*FILE: The program's data is sent to the device associated with the device file that was declared in the FILE parameter of the DCLF command. If more than one device name is specified in the device file, *FILE cannot be specified.
device-name: Specify the name of the device or the name of the CL variable that contains the name of the device to which the program's data is sent.
- RCDFMT
- Specifies the name of the record format that is used to send data to the file. The format contains all the fields in the record. This parameter must be coded with a record format name if there is more than one record format name in the device file; *FILE cannot be coded if there is more than one. If the record format contains the INVITE DDS keyword (optioned on), the SNDF functions as if SNDRCVF WAIT(*NO) had been coded.
*FILE: There is only one record format in the device file; that is the format in which the program's data is sent to the file.
record-format-name: Specify the name of the record format in which the program's data is sent to the file. A CL variable cannot be used here to specify the record format name.
Example for SNDF
DCLF FILE(MENU1) * * * SNDFThe 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.
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 program to the user. The data is shown in the format specified by the REC1 record format.
DCLF SCREEN1 (REC1 REC2) * * * SNDF *N REC2The device file named SCREEN1 sends data to the device named in the same device file. *N is the null value for the DEV parameter, coded positionally, that defaults to *FILE. The data is presented to the user in the format specified by REC2.
Error messages for SNDF
*ESCAPE Messages
- CPF0859
- File override caused I/O buffer size to be exceeded.
- CPF0861
- File &1 in library &2 is not a display file.
- CPF0864
- End of file detected for file &1 in &2.
- CPF0883
- *FILE not valid in DEV parameter for file &1.
- CPF0887
- Data available from previous input request.
- CPF4101
- File &2 in library &3 not found or inline data file missing.
- CPF5068
- Program device &4 not found in file &2 in library &3.
- CPF5070
- File &2 in library &3 has no program devices acquired.