32. Output: Specific rules

32a. The stdout dataset

If general order out or outfile is not given a value, strings in the RXS program will be written to stdout. This dataset has the following characteristics:

32b. General order outfile: changing the name of the stdout dataset

If outfile is assigned a value as general order to an action block or text block, this value will be used as the middle qualifier of the name of the stdout datset. Example: if                         outfile='yrsa' output will be written to the dataset <user>.yrsa.data or <user>.yrsa.cobol according to the rules in Section 32a.

outfile will be inherited to any action or text block contained in the block on which it is stated. Otherwise outfile is local, and accordingly a RXS program may use different values for outfile in different blocks.

32c. General order out: state the output dataset or output queue

If out is assigned a value as general order to an action block or text block, and if the value contains at least one period, the value is presumed to be the name of an existing dataset. If the presumption turns out to be wrong, execution of RXS is terminated in error - unless this exception is catched by a )notrigger clause. If the presumption is right, output is written to this dataset. Record format for the dataset may be FB or VB, and LRECL (logical record length) can have any value.

If the value of out does not contain a period, the value is interpreted as the name of an internal queue. Writing on queues is immediate, that is, another action block in the same RXS program may read the records that are written. Several action blocks in a RXS program may write to the same queue, this will not overwrite previously written records.

The value for out will be inherited to any action or text block contained in the block on which it is stated. Otherwise out is local, and accordingly a RXS program may use different values for out in different blocks. Therefore a RXS program may write any number of datasets and members.

To replace an inherited value for out by stdout, assign out = "-" in the action block.

If both out and outfile are assigned values for an action or text block, out will work, outfile will be ignored.

If out contains a file name having last qualifier equal to COBOL then output will be generated with COBOL numbering, unless the written lines from the RXS program all are numeric in columns 1 thru 6, or all are equal to spaces in columns 1 thru 6.

32d. Writing members

out may point to a member of a partitioned dataset.  Example out='myqualif.mydsn(mymbr)'.

ISPF-statistics for the member will be updated. As userid in ISPF statistics is assigned 'RXS'. If the member does not exist, it is created.

32e. Outfunc in a situation with several action blocks or text blocks

outfunc indicates a terminating action when output is created (Section 8).

If outfunc is 'edit', 'browse' or 'view' it will be inherited to any action or text block contained in the block on which it is stated. Otherwise outfunc is local, and accordingly a RXS program may use different values for outfunc in different blocks. But notice: two action blocks writing to the same dataset cannot use two different outfunc. Last stated outfunc will be activated. This is related to the fact that you cannot access the same dataset in , say, edit and browse at the same time.

32f. Setting global values for stdout

Any RXS program may be put inside a text block by writing )text above the program and    )endtext below. This does not change anything. But by stating general orders to such a text block, default values for out, outfunc and outfile may be changed for the whole RXS program.

32g. Commit, rollback: when is writing done?

The physical writing of any output dataset from RXS is postponed to the termination of the RXS program. Any content in the dataset prior to the execution of the RXS program is overwritten. More than one action block in a RXS program may write to the same dataset - this will not overwrite records previously written from other action blocks in RXS. Reading an out dataset from RXS will read what was initially on the dataset - records just written from RXS cannot be read until the RXS program has terminated. If the RXS program does not reach commit, initial content of the dataset is preserved, and nothing is written. The following situations means that a commit is not reached: