@GENERATE
|
Where
WSim_statements are message generation statements enclosed in single or double quotation marks. You may use STL variables and named string constants to form the statements (string operators and functions are not permitted).
Function
The @GENERATE control statement enables you to include message generation statements directly. When the STL Translator encounters an @GENERATE statement, it enters "generate mode," and will remain in this mode until it processes the @ENDGENERATE statement. While in generate mode, the translator processes only string constants, variables, and comments. Resources—counters, save areas, and switches—will be substituted for the variable names, and the resulting string constant expression will be output.
Examples
The following code includes message
generation statements in an STL program.
@generate
' WTO (HELLO)'
' SET 'a'=12345' /* "a" is an integer variable. */
@endgenerate
The preceding example generates the following
message generation statements: WTO (HELLO)
SET DC1=12345
Notes
- The @GENERATE statement is valid only inside an STL procedure.
- The @GENERATE and @ENDGENERATE statements can function as a DO-END statement group when coded as part of an IF, ONIN, ONOUT, or ON SIGNALED statement.
- You can abbreviate @GENERATE as @GEN and @ENDGENERATE as @ENDGEN.
- For more information about using the @GENERATE control statement, see Including message generation statements in STL programs.
- While in generate mode, be careful when coding string constants
containing single quotation marks (') especially when the single quotation
mark is used as the string constant delimiter. WSim interprets
pairs of quotation marks as one quotation mark. Therefore, to code
a quotation mark in a string, you must double each instance of a quotation
mark, as shown in the following example. Note that this rule only applies in generate mode. For STL coding, you would simply double a quotation mark that you did not intend to use as a string delimiter character.
@gen ' TEXT (It is 2 o'clock)' /* WRONG! STL error. */ ' TEXT (It is 2 o''clock)' /* WRONG! OK for STL, but */ /* flagged by preprocessor. */ ' TEXT (It is 2 o''''clock)' /* RIGHT! */ " TEXT (It is 2 o''clock)" /* RIGHT! */ " TEXT (It is 2 o'clock)" /* WRONG! OK for STL, but */ /* flagged by preprocessor. */ @endgen
- The statements must conform to the rules for coding WSim statements. See WSim language statements for more information about requirements for message generation statements.
- If you include a network definition in your STL input data set, you can also include entire message generation decks within it. See @NETWORK for more information.
- No syntax checking is done and offsets are not added for save areas when the save area number is included as a variable name.
- In order to preserve the integrity of the STL trace correlation
file, the statement must be started before column 16. Statements started
after column 15 are assumed to be a continuation of the prior statement.
The label statement should not be coded. The statement
numbers in the STL trace output may not match your STL program if
the rules for the @GENERATE statement are not followed. For example, the following @GENERATE statements would maintain the integrity of the trace correlation file and the statement sequence numbers.
@generate ' WTO (A text message) ' -> Starts in col 15 ' ' -> Blank line ' TEXT (A message that ), ' -> Starts in col 15 ' (wraps) ' -> Continued in 16 '* A comment line ' -> Comment line @endgenerate
The following @GENERATE statements would cause confusion and possibly incorrect trace output messages during execution of an STL program containing the statements.@generate ' WTO (A text message) ' -> Starts in col 16 ' TEXT (A message that ), ' -> Valid start but ' (wraps) ' -> continued before col 16 'MYLABEL LABEL ' -> Should not code @endgenerate