STREAM


8.4E

 

The STREAM instruction allows input or output of data using redirection files. The statement format is as follows:

 

 

[label]

STREAM

{mode},{data}

 

Where:

label

Optional. A Program Execution Label.

mode

Required. A keyword, decimal number, equated value, constant, or Numeric Variable identifying the type of operation.

data

Required. A list of previously defined Character String Variables, or Literals processed.

Flags Affected: LESS, OVER, ZERO

Note the following:

  1. This instruction simply transfers data to or from a redirection file.

  2. There is no transformation nor interpretation of the data. This means that all data including CR, LF, or any other binary data can be found in the {data} variables.

  3. When inputting data, the operation continues until the Physical Length of all variables are filled or when no more input data is available.

  4. When outputting data, the logical length of the {data} variables is used.

  5. The {mode} identifies the type of operation performed for a data stream. The following keywords or values are allowed:

  6.  

    Keyword

    Value

    Signifies that the

    *STDIN

    1

    data stream should be retrieved from the stdin file handle with the data being placed into the {data} variable(s). The {data} variables can only be character variables for this operation type. (PLB clients support added in 9.3A)

    *STDOUT

    2

    data found in the {data} variables is output to the stdout file handle. The {data} variables can be character variables or literals for this operation type. (PLB clients support added in 9.3A)

    *USERIN

    3

    data stream is retrieved from the file that has been attached or opened using the SETMODE *KEYIN={filename} operation. The {data} variables can only be character variables for this operation type.

    *USEROUT

    4

    data found in the {data} variables is output to a file that has been attached or opened using the SETMODE *DISPLAY={filename} operation. The {data} variables can be character variables or literals for this operation type.

     

  7. When {mode} is a decimal number, {data} must be a Character Variable.

  8. The LESS flag indicates that the file handle for the operation type being specified is invalid. This means that a STDIN or STDOUT file is not available to the runtime or that a SETMODE *KEYIN or *DISPLAY operation has not been performed. If this flag is set for an output operation, no output action is performed. If this flag is set for an input operation, all variables in the {data} are cleared.

  9. The ZERO flag indicates that data has been transferred for the stream operation.

  10. The OVER flag indicates that an operating systems error occurred while trying to perform the specified stream operation. If this flag is set for an output operation, the output operation simply stops at the point of the error. If this flag is set for an input operation, all variables at and beyond the point of the error are cleared.

  11. PLBSERVE (9.3A) and clients support the STREAM instruction when using the *STDIN and *STDOUT modes. When executing in this configuration, note the following:

 

 

See Also: Disk I/O Instructions

 



PL/B Language Reference SETFILE TRANSACTION