Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Redirecting standard I/O files

&pagelevel(4)&pagelevel

At the start of program execution, the standard I/O files are assigned to the following BS2000 system files:

stdin/cin

stdout/cout

stderr/cerr/clog

SYSDTA

SYSOUT

SYSOUT

These default values can be modified in the parameter line. The dummy parameters input and output must be replaced by currently applicable values.

<input

The standard input (stdin, cin) is to be read in from input.

>output

The standard output (stdout, cout) is to be written to output.
If the file already exists, it is overwritten; if not, it is created as a new file.

>>output

The standard output (stdout, cout) is to be appended to output.
If the file does not exist, it is created as a new file.

2>output

The standard error output (stderr, cerr, clog) is to be written to output.If the file already exists, it is overwritten; if not, it is created as a new file.

2>>output

The standard error output (stderr, cerr, clog) is to be appended to output.If the file does not exist, it is created as a new file.

The following current values can be inserted for input or output:

(SYSDTA)
designates the system file SYSDTA. This specification can only be used for input.

(SYSOUT)
(SYSLST)
designate the system files SYSOUT and SYSLST. These entries are only valid for output.

filename
designates the name of a cataloged BS2000 file. This specification is valid for both input and output.

*POSIX(filename)
filename designates the name of a POSIX file. This redirection specification is valid for both input and output and is only possible if the POSIX link option library is linked (see point 3 in section "Use of POSIX library functions").

Files to be used as input files must already exist.

If an output file does not exist, it is created as a new file. If it already exists, it will either be overwritten (> or 2>) or extended by the addition of new output (>> or 2>>).

Note
The redirection of standard I/O files affects all I/O functions that read from standard input or write to standard output by default, as well as all functions that use the file pointers stdin/stdout or the file descriptors 0/1 as arguments. No redirection takes place for I/O operations on files that were explicitly opened with the names “(SYSDTA)”, “(SYSOUT)”, or “(SYSTERM)”.