Your Browser is not longer supported

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

{{viewport.spaceProperty.prod}}

SDF syntax analysis

&pagelevel(3)&pagelevel

SDF provides a number of capabilities to simply command input such as abbreviations (aliases), implicit variable declaration, use of positional and keyword operands. The utilization of these capabilities, which are primarily intended to ease the entering of input in the dialog, requires more steps when analyzing the syntax and can therefore affect the performance in the procedure mode.

Recommended syntax

Syntax with lower performance

Example 1:

/FOR I=*COUNTER(FROM=1, TO=50)

/ DECLARE-VARIABLE VAR&I

/END-FOR


/FOR I=*COUNT(1,50)
/ DEC-VARI VAR&I
/END-FOR

Example 2:

/SHOW-VAR VARIABLE-NAME=*ALL,

/ INFORMATION=*PARAMETERS(

/ NAME=*FULL-NAME(LIST-INDEX-NUMBER=*YES))


/SHOW-VAR *ALL,LIST-INDEX=Y

Example 3:

/DECL-VAR (TST1, TST2, TST3),TYPE=*STRING

/DECL-VAR TST1,TYPE=*STRING
/DECL-VAR TST2,TYPE=*STRING
/DECL-VAR TST3,TYPE=*STRING


Example 4:
/I = 1


/SET-VARIABLE I = 1

The syntax analysis is made significantly less complicated in the following cases:

  • Names of commands/statements, operands and keywords are fully specified (alternative: use aliases). The use of minimal aliases, which is sometimes recommended to avoid compatibility problems, is insufficient with respect to the performance (see Example 1).

  • Suboperands are not specified outside of their structure (see Example 2).

  • If several objects can be specified at the same time in a command or statement (e.g. by specifying a list or a wildcard string), then the syntax analysis only needs to be performed once. In contrast to this, the syntax analysis must be performed every time when the command or statement for every object is reentered (see the declarations of the string variables TST1, TST2 and TST3 in Example 3).

  • The SDF syntax analysis can also be avoided in the case of the SET-VARIABLE commands when the alias of the command is used (i.e. without the command name, see Example 4).

Taking these points into consideration when developing or writing S procedures may appear to be complicated, but remember that a procedure is only written once, but is called often.