Using an inline data file
An inline data file is a data file that is included as part of a batch job when the job is read by a reader or a submit jobs command. You use SBMDBJOB or STRDBRDR to queue up a CL batch stream (stream of CL commands to be executed or run). That CL batch stream can include data to be placed into "temporary" files (inline files). When the job ends, the inline files are deleted. An inline data file is delimited in the job by a //DATA command at the start of the file and by an end-of-data delimiter at the end of the file.
The end-of-data delimiter can be a user-defined character string or the default of //. The // must appear in positions 1 and 2. If your data contains a // in positions 1 and 2, you should use a unique set of characters such as: // *** END OF DATA To specify this as a unique end-of-data delimiter, the ENDCHAR parameter on the //DATA command should be coded as:
ENDCHAR('// *** END OF DATA')Inline data files can be accessed only during the first routing step of a batch job. If a batch job contains a Transfer Job (TFRJOB), a Reroute Job (RRTJOB), or a Transfer Batch Job (TFRBCHJOB) command, the inline data files cannot be accessed in the new routing step.
An inline data file can be either named or unnamed. For an unnamed inline data file, either QINLINE is specified as the file name in the //DATA command or no name is specified. For a named inline data file, a file name is specified.
A named inline data file has the following characteristics:
- It has a unique name in a job. No other inline data file can have the same name.
- It can be used more than once in a job.
- Each time it is opened, it is positioned to the first record.
To use a named inline data file, either specify the file name in the program or use an override command to change the file name specified in the program to the name of the inline data file. The file must be opened for input only.
An unnamed inline data file has the following characteristics:
- Its name is QINLINE. (In a batch job, all unnamed inline data files are given the same name.)
- It can only be used once in a job.
- When more than one unnamed inline data file is included in a job, the files must be in the input stream in the same order as when the files are opened.
To use an unnamed inline data file, do one of the following:
- Specify QINLINE in the program.
- Use an override file command to change the file name specified in the program to QINLINE.
If your high-level language requires unique file names within one program, you can use QINLINE as a file name only once. If you need to use more than one unnamed inline data file, you can use an override file command in the program to specify QINLINE for additional unnamed inline data files.
If you run commands conditionally and process more than one unnamed inline data file, the results cannot be predicted if the wrong unnamed inline data file is used.
Parent topic:
Submitting a batch job