Your Browser is not longer supported

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

{{viewport.spaceProperty.prod}}

Procedure lines

&pagelevel(4)&pagelevel

The procedure lines contain the commands, statements and data for a procedure.

The most important points to be taken into account are:

  • procedure line length

  • first character of procedure lines

  • command length

  • separation of commands

  • continuation handling

  • comment syntax

  • tags

Procedure line length

The length in which procedure lines are evaluated is influenced by means of the INPUT-FORMAT operand of the SET-PROCEDURE-OPTIONS command (the SET-PROCEDURE-OPTIONS command is a component of the procedure head and is therefore described in detail in section “Creating the procedure head”).

The default setting for the length of procedure lines is INPUT-FORMAT = *FREE-RECORD-LENGTH. This means that in S procedures (in contrast to non-S procedures), the procedure lines are evaluated in their full length or up to the continuation character (see section “Continuation handling”).

For reasons of compatibility with non-S procedures, the operand INPUT-FORMAT = *BY-SDF-OPTION was introduced in the SET-PROCEDURE-OPTIONS command. The effect of this operand is that procedure lines containing commands are evaluated only up to column 72. The column that must then contain the continuation character depends on what has been set for the CONTINUATION operand in the SDF command MODIFY-SDF-OPTIONS.

Note

ISAM files are accepted as S procedures only if they have KEY-POS = 5 and KEY-LEN = 8.

First character of procedure lines

The following distinctions must be made:

  • The first procedure line must begin with a single slash (/).

  • All other procedure lines that begin with only one slash contain commands. SDF expects commands from the logical system file SYSCMD (see “Commands”[3]).

  • Procedure lines that begin with two slashes contain statements in the SDF format (to a program with SDF interface). SDF expects statements from the logical system file SYSSTMT, for which the same assignment applies as for the system file SYSDTA (see “Commands” [3]).

  • Procedure lines which do not start with a slash are data lines. These contain program input data.

  • The first relevant character of any command continuation lines must also be a slash. The first relevant characters in each statement continuation line must be two slashes. The way that the continuation of data lines is handled will depend on the program doing the processing.

  • Commands, statements and data must not be chained together in one procedure line.

Command length

If the command length is checked, you must consider whether an expression replacement is contained in the command call. Commands must not be longer than 16364 characters following an expression replacement.

Separation of commands

Each procedure line can contain several commands. These commands must be separated from one another by semicolons.

The first command is located at the beginning of a procedure line and must begin with a slash (/). If a procedure line contains several commands, these must be separated by semicolons and the individual commands must not be introduced by slashes.

Commands which are written after AID commands, and are separated from the latter by semicolons, will be processed as part of the AID command sequence; i.e. they are not treated as part of the procedure input, but instead are processed directly by AID.

Continuation handling

Commands, command sequences or statements can be distributed over several lines. “Continuation handling” determines how associated lines are recognized and evaluated.

In S procedures, up to 16364 characters (4090 characters for ISP commands) can be linked by means of continuation lines to form a command sequence.

The continuation character is a hyphen (–). The position in the procedure line at which the continuation character can be located is implicitly set by means of the INPUT-FORMAT operand in the SET-PROCEDURE-OPTIONS command.

Unless otherwise specified, the continuation character can be located in any column of the procedure line (INPUT-FORMAT = *FREE-RECORD-LENGTH). However, the continuation character must not be followed by any other characters; it must be the last character (apart from trailing blanks) in the procedure line.

If INPUT-FORMAT = *BY-SDF-OPTION applies, the setting of the CONTINUATION operand in the MODIFY-SDF-OPTION command must be taken into account:

  • With CONTINUATION = *OLD-MODE, the continuation character for commands must be in column 72.

  • With CONTINUATION = *NEW-MODE, the continuation character can be located in any column from 2 to 72.

Comments enclosed in quotation marks

Comments enclosed in quotation marks are used for the internal documentation of procedures. Comments can be used anywhere within a command or statement where blanks are permitted (except after a continuation character).

A comment can be any text that is enclosed in quotation marks (“ ”).

Even if a comment is written on a separate line, it must be enclosed in quotation marks, and follow the introductory (/). SDF-P then interprets such a procedure line as a command which consists solely of a comment. This will not be executed or logged. If such a “comment-command” is given a tag, only this tag will be logged. In addition, expression replacement is not performed for any such comments which are written on a separate line.

End-of-line comments

End-of-line comments are particularly important in the development of S procedures. Endof-line comments are marked by the character pair “&*”. Text after this character pair will be ignored when the procedure is evaluated. Consequently, any continuation characters, character separators (such as semicolons) and & characters must be written before the end-of-line character pair.

Examples

The character pair “&*” can be used to append a note after a command:

/PRINT-DOC &FILE &* My file is printed out here.

or it might be used to modify the input:

(1)

PRINT-DOC &FILE ,PRINT-JOB-NAME='&(SUBSTRING(FILE,1,8))'

(2)

PRINT-DOC &FILE &*,PRINT-JOB-NAME='&(SUBSTRING(FILE,1,8))'

In the case of (1) the PRINT-DOCUMENT command will be modified, whereas in the case of (2) the simple insertion of “&*” means that the default setting will be used instead. This allows the first form (1) to be very easily restored; all that has to be done is delete the “&*” again.

Notes

  • Until now the character string “&*” was not permitted in S procedures - even when enclosed in quotation marks. The only place where it was previously not forbidden was in comment lines containing no operation names, e.g. “ cmt1 &* cmt2 ”.
    This should be taken into account if any incompatibilities arise with procedures which were created earlier.

  • The character pair “&*” must not be split by blanks or any other characters.

  • It is possible to incorporate the character pair “&*” as part of the input; this requires the & character to be duplicated: &&*.
    However, care must be taken to avoid repeating the & character too often. For example, “&&&*” will defeat the intention of canceling the special function of the character pair “&*”. In this case, the character string would again indicate an end of line comment.

Tags

Procedure lines can be provided with tags. These tags can then be used as branch destinations, for command block nesting or for branches made by branch commands. They are also known as S tags.

The following rules apply to S tags:

  • SDF data type: <structured-name>

  • Maximum length: 255 characters

  • Character set: A...Z, 0...9, $, #, @,

  • First character: letter

  • Last character: colon

  • The colon must follow the tag directly, without spaces

  • Tags must not be generated by expression replacement

  • Tags must be located before the operation name and be separated from this name by at least one space. (The “operation name” is the name used to call a command.)

For information on non-S tag handling (.tag), also see the conversion instructions in chapter“Converting non-S procedures”.