Data (DATA)

The Data (DATA) command must be used in an input stream to indicate the beginning of an inline data file. This input stream is read by a spooling reader. The Data (DATA) command also specifies what delimiter must be used to indicate the end of the data file. Inline data files exist only during this job, after the job is finished, they are destroyed. Unnamed inline files can be used only once in the job.

Restrictions

  1. The DATA command cannot be run from a work station.
  2. The DATA command must have two slashes (//) in positions 1 and 2 of the data record.
  3. Blanks can separate the slashes from the command name (//DATA).

Parameters

Keyword Description Choices Notes
FILE Input file Name, QINLINE Optional, Positional 1
FILETYPE File type *DATA, *SRC Optional, Positional 2
ENDCHAR Characters for end of data Character value, '//' Optional, Positional 3
IGCDTA User specified DBCS data *NO, *YES Optional

Input file (FILE)

Specifies the name of the inline data file. This name is also specified in the program that processes the file.

QINLINE
The name of the inline data file is QINLINE. The file is processed as an unnamed inline file. An unnamed file can be processed if the program specifies QINLINE as the file name, or if the device file that specifies *YES on the Spool the data (SPOOL) parameter is opened for input. Unnamed inline files can be used only once by the job.
name
Specify the name of the inline data file used by one or more programs in the job. The file is connected to the program when the program opens the file by specifying its file name. Named inline data files can be accessed more than once by the job.

File type (FILETYPE)

Specifies whether the inline data following this command is put in the standard format for source files or in the data file format. The standard source file format is a sequence number (a 6-character source number) followed by the 6-character system date that goes before the data.

*DATA
The inline data is not in the standard format for source files. The data file is passed to the program, which uses it in the data format.
*SRC
The inline data is numbered in sequence; it is a source file that can be used to create another file or a program.

Characters for end of data (ENDCHAR)

Specifies a string of characters used to indicate the end of an inline data file. To be recognized, the character string must begin in position 1 of the record. If you specify a character string other than // (the default value) as the delimiter, all records up to the end-of-file record (the record containing the specified character string starting in column 1) are treated as data. This allows you to embed reader commands in the data stream. The end-of-file record for ENDCHAR values (which are not default values) is not put to the data file, and it is not checked to see if it is a valid reader command. It is used only to determine the end of the data stream and then it is discarded.

'//'
The default value is two slashes. The command works the same way whether two slashes are coded into the parameter or the parameter itself is defaulted. Using the default, the slashes in positions 1 and 2 of a record (in either a data file or a source file) identify the first record beyond the file.
character-value
A character string (up to 25 characters long and enclosed in apostrophes) can be entered to identify the last record in the file. The character string can contain both alphanumeric and special characters. If a character combination other than '//' is specified on the Characters for end of data (ENDCHAR) parameter, reader commands can be safely embedded in the data. The reader ignores all other data while searching for the specified string, including reader commands.

User specified DBCS data (IGCDTA)

Specifies whether the inline data following this command may contain double-byte character set (DBCS) data.

*NO
The inline file does not contain any DBCS data.
*YES
The inline file may contain DBCS data.

Examples

Example 1: Inline Data File in Data File Format

//DATA   FILE(FILE1)

This command assigns the name FILE1 to the data that follows it, until an end of inline data condition is found (two slashes in positions 1 and 2).

Example 2: Specifying an End Character String

//DATA   FILE(FILE2)  ENDCHAR('STOPIT')

This command assigns the name FILE2 to the data following it; the file continues until a record is found that contains the characters STOPIT in positions 1 through 6. This delimiter allows the //BCHJOB, //ENDBCHJOB, and //DATA commands and records with // in positions 1 and 2 to be embedded in an inline file.

Example 3: Specifying a File Containing DBCS Data

//DATA   FILE(FILE3)  IGCDTA(*YES)

This command assigns the name FILE3 to the data that follows it. This file can contain DBCS data.

Error messages

*ESCAPE Messages

CPF1753
Command cannot be run.