@PROGRAM


@PROGRAM[=program_name]
STL_statements
@ENDPROGRAM 

Where

program_name is a 1- to 8-character alphanumeric name that conforms to STL variable naming conventions.

Function

The @PROGRAM control statement specifies the start of an STL program. If you code “=program_name”, the STL trace facility stores trace information for the program under this name. See Obtaining STL trace records for more information about the STL trace facility.

To code multiple programs in one STL input data set, you need the @ENDPROGRAM control statement. You must start each program in the input data set with an @PROGRAM statement and end each program with an @ENDPROGRAM statement. You can only code comments between programs. Defining multiple STL programs lets you reuse variable, constant and label names. (This does not include procedure, user table, or program names.)

For more information on using the @PROGRAM and @ENDPROGRAM statements to code multiple STL programs, see Coding multiple programs in one STL input data set.

Examples

/*******************************************/
/*                                         */
/* This program will be known as AMSGPROG. */
/*                                         */
/*******************************************/
@program = amsgprog
integer i                     /* The variable i is an integer
                                 in this program.               */
amsg:    msgtxt
         do i = 1 to 5
           c = char(i)
           type 'Message Number' c
           transmit
         end
         endtxt
@endprogram                   /* Specifies the end of AMSGPROG. */
/*******************************************/
/*                                         */
/* This new program is unnamed.            */
/* Therefore, STL trace information is not */
/* available for this program.  Also, STL  */
/* statement numbers are not displayed     */
/* when using the Q (Query) operator       */
/* command.                                */
/*                                         */
/*******************************************/
@program
string  i                     /* The variable i is a string in
                                 this program.                  */
bmsg:    msgtxt
         i = 'some text'
         type i
         transmit
         endtxt
@endprogram                   /* Specifies the end of the
                                 previous program.              */
/*******************************************/
/*                                         */
/* This program will be known as CMSGPROG. */
/*                                         */
/*******************************************/
@program = cmsgprog
cmsg:    msgtxt
         opcmnd 'zend'
         quiesce
         endtxt
                              /* The @endprogram statement is
                                 optional for the last program. */

Notes

  • The @PROGRAM statement, if coded, must be the first statement in a program. It must be placed before all the declarations and procedures that make up the program. The @ENDPROGRAM statement, if coded, must be the last statement in a program. No STL statements may follow it unless another @PROGRAM statement is coded. Neither the @PROGRAM statement nor the @ENDPROGRAM statement is valid within a procedure or user table.
  • The @ENDPROGRAM statement is not required if the STL input data set contains only one program. If multiple programs are coded, it is also optional for the last program.
  • You can specify a program name using the PROGRAM execution parameter. This overrides any name that was coded in an @PROGRAM statement for the first program defined in your STL input data set.
  • Program names cannot be the same as names declared for other programs, procedures, or user tables.
  • You cannot code STL statements after the @ENDPROGRAM statement on the same line. However, comments are valid.