An
in-stream data set is a data set contained
within a set of JCL statements. In-stream data sets (also called inline
data sets) begin with a
DD * or
DD DATA statement.
These
DD statements can have any valid ddname, including
SYSIN.
If you omit a
DD statement before the input data, the system provides
a
DD * statement with the ddname of
SYSIN. This example
shows you how to indicate an in-stream data set:
//MYDD DD *
record 1
record 2
record 3
/*
The // at the beginning of the data set starts in column
1.
The statement
fopen("DD:MYDD","rb"); opens a data set with
lrecl=80,
blksize=80, and
recfm=FB. In this example, the delimiter
indicating the end of the data set is
/*. In some cases,
your data may contain this string. For example, if you are using C
source code that contains comments,
z/OS® XL C/C++ treats the beginning of
the first comment as the end of the in-stream data set. To avoid this
occurrence, you can change the delimiter by specifying
DLM=nn,
where
nn is a two-character delimiter, on the
DD statement
that identifies the file. For example:
//MYDD DD *,DLM=¢¢
#include <stdio.h>
/* Hello, world program */
int main() {printf("Hello, world\n"); }
@@
For more information about in-stream data sets, see z/OS MVS JCL User's Guide.
To open an in-stream data set, call the fopen() or freopen() library
function and specify the ddname of the data set. You can open an in-stream
data set only for reading. Specifying any of the update, write, or
append modes fails. Once you have opened an in-stream data set, you
cannot acquire or change the file position except by rewinding. This
means that calls to the fseek(), ftell(), fgetpos(), and fsetpos() for
in-stream data sets fail. Calling rewind() causes z/OS XL C/C++ to reopen
the file, leaving the file position at the beginning.
You can concatenate regular sequential data sets and in-stream
data sets. If you do
so, note the following:
- If the first data set is in-stream, you cannot acquire or change
the file position for the entire concatenation.
- If the first data set is not in-stream and supports repositioning,
you must specify the noseek parameter on the fopen() or freopen() call
that opens the concatenation. If you do not, fopen() or freopen() opens
the file successfully; however, an error occurs when the read position
gets to the in-stream.
- The in-stream data set is treated as FB 80 and the
concatenation rules for sequential concatenation apply.