S procedures consist of a procedure header and a procedure body. Logically associated blocks can be defined in both parts. The first record in an S procedure must be a command.
The procedure header normally begins with the SET-PROCEDURE-OPTIONS command, which is used to define the procedure attributes. If no explicit specifications are made, the default values for this command apply implicitly. Once the procedure attributes have been defined, the DECLARE-PARAMETER command can be used to define symbolic parameters, which are replaced by the values of the like-named S variables during execution.
Processing of the commands, SDF statements and input data is terminated by the CANCEL-PROCEDURE or EXIT-PROCEDURE command or by the last record. If an error occurs, SDF error recovery is triggered (see section "Block-oriented error recovery").
Compiled procedures
Two different procedure formats are possible:
Source procedure
The S procedure is available in the original text form. The full range of SDF-P functions is available only if the chargeable subsystem SDF-P is loaded when the procedure is called. In libraries, element type J should be used for source procedures. (If SDF-P is not loaded, all SDF-P commands in source procedures are subjected to a syntax analysis, with the exception of chargeable control flow commands and the COMPILE-PROCEDURE command. All chargeable commands and functions are not rejected until execution time.)Object procedure
With the aid of the COMPILE-PROCEDURE command, a source procedure can be compiled in an intermediate format. The COMPILE-PROCEDURE command is part of the chargeable SDF-P subsystem. The object procedure can utilize the full functionality of SDF-P (apart from the COMPILE-PROCEDURE command) irrespective of whether the SDF-P subsystem is currently available or not. In libraries, element type SYSJ (the default for COMPILE-PROCEDURE) should be used for source procedures.