ALLOCATE
|
Where
variable_name is any valid STL variable name not previously declared.
counter is a counter name, for example, DC1 (for device counter 1) or NC25 (for network counter 25). You can code values in the ranges DC1-DC4095 and NC1-NC4095. (You can also code line-level, terminal-level, and sequence counters. See Note 4.)
save area is a save area name, for example, 1 (for device save area 1) or N140 (for network save area 140). You can code values in the ranges 1-4095 and N1-N4095.
switch is a switch name, for example, SW1 (for device switch 1) or NSW8 (for network switch 8). You can code values in the ranges SW1-SW4095, NSW1-NSW31, and NSW33-NSW4095. STL reserves NSW32 for internal use. (You can also specify terminal-level switches. See Note 4.)
All counter, save area, or switch names must be enclosed in single or double quotation marks.
Function
The ALLOCATE statement allows the STL programmer to specify which resource is to be used to represent a variable. If the ALLOCATE statement is not used, the STL Translator performs this variable-to-resource mapping automatically when a variable is declared.
Examples
allocate mydata '1' /* Use device save area 1 to hold "mydata". */
allocate mycount 'DC1' /* Use device counter 1 to hold "mycount". */
allocate netflag 'NSW1' /* Use network switch 1 to hold "netflag". */
Notes
- The ALLOCATE statement is a declarative statement. You can code it only outside an STL procedure.
- If you use ALLOCATE statements, code them before all other declarative statements and before the first procedure in an STL program. This coding order is necessary to ensure that the resources are allocated properly.
- The ALLOCATE statement should be necessary under only two conditions:
- When you must coordinate separately translated STL programs. You can obtain the variable-to-resource mappings for a translated STL program from the variable dictionary included in the printed listing from the STL Translator.
- When counters and switches unknown to the STL Translator are required.
These include line-level and terminal-level counters, sequence counters,
and terminal switches. For example:
allocate line_count 'LC2' /* Use line counter 2 to hold */ /* "line_count". */ allocate group_flag 'TSW18' /* Use terminal switch 18 to */ /* hold "group_flag". */ allocate net_sequence 'NSEQ' /* Use the network sequence counter */ /* (NSEQ) to hold the variable */ /* "net_sequence". */
- STL does not automatically keep track of line-level and terminal-level counters, terminal-level switches, and sequence counters. Therefore, you can declare multiple STL variables that are mapped to the same resources.
- Be sure that the CNTRS operand is not coded in your network definition. This operand can cause problems when using STL programs.