RECSOUT

Figure 1. Syntax

1 RECSOUT(ddname(1))
Notes:
  • 1 When used with a DSC or DSP function, ddname is optional.

Can be used in FASTREXX condition expressions.

Returns the count of records so far written to the specified output data set.

The argument you can specify is:
ddname
Specifies that the count of records so far written to the data set identified by the specified ddname be returned. If ddname is omitted when used with a DSC or DSP function, the default is the ddname of the primary output data set. The primary output data set depends on the File Manager function or panel being used:
Function or panel option Primary output data set is…
Print Utility (option 3.2) Determined by the value of the PRINTOUT field on the Set Print Processing Options panel. For details, see Printing from File Manager.
DSC function Copy Utility (option 3.3) The data set that is the target of the copy function.
DSP function When used in a batch job, the primary output data set is SYSPRINT. When used in a REXX procedure, the primary output data set is determined by the PRINTOUT parameter of the SET function. For details, see SET (Set Processing Options).

Specifying the ddname of the primary output data set is the same as omitting the argument.

If you specify a ddname that is not the ddname of the primary output data set and has not previously been specified as the argument to a WRITE function, the value returned is zero.

The count of records written to an output data set is incremented each time a WRITE function is issued against the specified data set. In the case of the primary output data set, the count is also incremented each time a record is written to the data set by the File Manager function. Unless a record is discarded using the RETURN DROP (or STOP IMMEDIATE) instruction, each record selected for processing is written to the primary output data set. For information about how to discard records, see RETURN return values.

Note: The RECSOUT function treats each member of the primary output data set as separate, that is, the count starts at zero for each output member. However, the count is maintained across members of the input data set so that, if copying from a PDS to a sequential data set, the RECSOUT function reflects the total number of records written, regardless of how many input members are involved.

If you are using the DSC function or Data Copy Utility and you have specified REXX member selection, the RECSOUT function is disabled for the primary output data set. When RECSCOUT targets a ddname other than the primary output data set, it still functions as normal. However, you must keep in mind that after a decision has been made to DROP or PROCESS the member, no further records are passed to your REXX procedure, so subsequent records are not counted.

Example 1

If more than one hundred records have been written to the EXT100 file, then terminate File Manager processing.
rc = WRITE(EXT100)
If RECSOUT(EXT100) > 100 Then Return 'STOP'