Skip to content

ati§

ATI tnz interface

ATI (Automated Task Interpreter) was an IBM-internal language/runtime built for automating 3270 terminal interaction. It had a syntax very similar to Rexx. This module is intended to help with porting ATI code to python. It is also the base of the zti tool.

Some of these functions have enhancements on top of the ATI function. Enhancments include using a negative index/position or length to indicate a position relative to the END of the string. See individual functions for details.

USAGE The way to make a python script that is most like ATI source code is to use 'import *'. Be warned that this will override the 'set' symbol (otherwise a python builtin function).

    from tnz.ati import *
    set('SESSION', 'SES1')
    wait(lambda: scrhas('RUNNING'))
    drop('SESSION')

The next step up in being more pythonic is to import the module
as a symbol, but still make the assumption that python is running
a single ATI program.

    from tnz import ati
    ati.set('SESSION', 'SES1')
    ati.wait(lambda: ati.scrhas('RUNNING'))
    ati.drop('SESSION')

In a more complex program that may manage multiple ATI programs,
the Ati class can be imported.

    from tnz.ati import Ati
    ati = Ati()
    ati.set('SESSION', 'SES1')
    ati.wait(lambda: ati.scrhas('RUNNING'))
    ati.drop('SESSION')

And a more pythonic way of using ATI-like variables can be used.
Note that this bypasses much of the ATI tracing/logging.

    from tnz.ati import Ati
    ati = Ati()
    ati.session = 'SES1'
    ati.wait(lambda: ati.scrhas('RUNNING'))
    ati.drop('SESSION')

Special ATI-like variables that did not exist in ATI:

LOGCOUNT
    Default is 9. Can be set to other positive integers. Used
    only when LOGMAX is non-zero. Used to determine the number of
    backup logs kept when a log reaches the maximum size. When
    the number of bytes in the log is about to exceed this value,
    the log file is closed and a new file is opened for output.
    The old file will be renamed to end in '.n', where 'n' is the
    current total number of backups. The first backup will end in
    '.1', the second in '.2', etc.

LOGMAX
    Default is 0. Can be set to a positive integer. When
    non-zero, value is the number of bytes at which log
    rollover/rotation occurs. When the number of bytes in the log
    is about to exceed this value, the log file is closed and a
    new file is opened for output.

LOGTRUNC
    Default is 1. Can be set to 0 or 1. Affects processing done
    when LOGDEST is set. When 1 and LOGDEST identifies an
    existing file, the file will be truncated to 0 bytes before
    logging begins. When 0 and LOGDEST identifies an existing
    file, log entries will be appended to the existing file.
    After LOGDEST is set to a file, LOGTRUNC is set to 0.
Environment variables used

COLORTERM (see _termlib.py) DATEFORM ESCDELAY (see zti.py) SESSION_PS_SIZE TERM_PROGRAM (see _termlib.py) TNZ_COLORS (see tnz.py) TNZ_LOGGING (see tnz.py) ZTI_AUTOSIZE (see zti.py) ZTI_SECLEVEL (see tnz.py) ZTI_TITLE (see zti.py) _BPX_TERMPATH (see _termlib.py)

Copyright 2021, 2024 IBM Inc. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Attributes§

ati module-attribute §

ati = Ati()

Classes§

Ati §

Automate a set of 3270 terminal sessions.

Methods with ATI function equivalents
  • drop
  • extract
  • logwrt
  • num
  • say
  • scrhas
  • send
  • set
  • share
  • value
  • wait
  • when

Methods from tnz.rexx with ATI function equivalents: copies index left length right strip substr word words

Methods from Python with ATI function equivalents
  • stripl
  • stript
  • upper
ATI functions with no equivalent method implemented
  • chr
  • cms
  • include
  • keywait
  • ord
  • pull
  • push
Properties with internal ATI variable equivalents
  • age
  • curcol
  • currow
  • date
  • datetime
  • display
  • hitcol
  • hitrow
  • hitstr
  • keylock
  • keyunlock
  • logdest
  • maxcol
  • maxrow
  • maxlostwarn
  • maxwait
  • milliage
  • onerror
  • rc
  • sendstr
  • seslost
  • session
  • sessionid
  • sessions
  • session24
  • showline
  • showtype
  • time
  • trace
  • waitsleep

Attributes§

age property writable §
age

Program Age in Seconds

If unchanged by the program, contains the number of seconds that have elapsed since the program execution started.

Usage Notes:

- At the start of program execution, AGE is set to 0.

- AGE is incremented once a second
audit property writable §
audit

Set to 1 to enable audit tracing. Like TRACE='HOST', but screens are only traced when an AID is sent.

connected instance-attribute §
connected = True
curcol property §
curcol

Cursor column value for current session.

currow property §
currow

Cursor row value for current session.

date property §
date

Current Date

Contains the current date in the form mm/dd/yy. To get the date in mm/dd/yyyy form, set the DATEFORM environment variable to LONG (in any case).

datetime property §
datetime

Current Date/Time

Contains the current date and time in the form yy/mm/dd hh:mm:ss. To get the date in yyyy/mm/dd hh:mm:ss form, set the DATEFORM environment variable to LONG (in any case).

display property writable §
display

Display Controls

Determines how much host or Ati activity is displayed during program execution. Valid values:

NONE No host or Ati activity is displayed. This is the default setting.

ALL Displays both host screens and Ati functions in an alternating manner.

CODE Displays a trace of the current Ati program.

HOST Displays the entire host screen whenever it is referenced.

HOSTCODE Displays the current ATI statement on the bottom line of the display with the upper part of the screen showing the current session.

RESULTS Displays the results of function calls along with the Ati function calls as they are being executed.

SINGLE Causes single-step tracing to begin, with both host screens and Ati functions being displayed.

Usage Notes:

- At the start of program execution, DISPLAY is set to NONE

- DISPLAY is a read/write variable and can be changed at
  any time during execution.
hitcol property §
hitcol

The column position of the first character of the string found by SCRHAS or the start column position of an EXTRACT.

hitrow property §
hitrow

The row position of the first character of the string found by SCRHAS or the start row position of an EXTRACT.

hitstr property §
hitstr

String found

The string that was found by the scrhas function.

keylock property §
keylock

Keyboard status

Contains the keyboard status of the active session. Set to '1' if the active session is not accepting any input (keyboard lock); otherwise the value is set to '0'.

keyunlock property writable §
keyunlock

Keyboard Unlock Wait Time

The number of seconds that a send will wait for the keyboard to unlock before it actually sends the data.

Usage Notes:

KEYUNLOCK defaults to 60 (1 minute). If the KEYUNLOCK
wait period expires due to a locked keyboard, the session
is dropped (disconnected). In the rare case that an
application stays in keyboard lock and the user would
like to wait for it to unlock longer than the 1-minute
default, KEYUNLOCK can be used to lengthen the time that
a SEND waits.
logcount property writable §
logcount

Number of logs being managed.

Default is 9. Can be set to other positive integers. Used only when LOGMAX is non-zero. Used to determine the number of backup logs kept when a log reaches the maximum size. When the number of bytes in the log is about to exceed this value, the log file is closed and a new file is opened for output. The old file will be renamed to end in '.n', where 'n' is the current total number of backups. The first backup will end in '.1', the second in '.2', etc.

logdest property writable §
logdest

Log Destination/File

The name of the file where the history is recorded.

Usage Notes:

- If the file specified by expression already exists, the
  the log may be appended or truncated. See LOGTRUNC.

Return Codes (internal variable RC):

 0  A handler is registered for the specified file

 -  other RC values if a failure occurred?
logmax property writable §
logmax

Maximum size of log file

Default is 0. Can be set to a positive integer. When non-zero, value is the number of bytes at which log rollover/rotation occurs. When the number of bytes in the log is about to exceed this value, the log file is closed and a new file is opened for output.

logtrunc property writable §
logtrunc

Determine if existing log data is truncated (deleted)

Default is 1. Can be set to 0 or 1. Affects processing done when LOGDEST is set. When 1 and LOGDEST identifies an existing file, the file will be truncated to 0 bytes before logging begins. When 0 and LOGDEST identifies an existing file, log entries will be appended to the existing file. After LOGDEST is set to a file, LOGTRUNC is set to 0.

maxcol property §
maxcol

Maximum column value for current session.

maxlostwarn property writable §
maxlostwarn

Maximum Lost Session Warnings

Specifies the default maximum number of Lost Session warnings that will be output before the progem is aborted.

Usage notes:

- If MAXLOSTWARN is set to 0, the automatic aborting
  feature is disabled and an unlimited number of Warning
  12s can appear without the program aborting.

- Upon program initialization MAXLOSTWARN is set to 5.

- The setting of MAXLOSTWARN can be changed at any time
  during program execution.
maxrow property §
maxrow

Maximum row value for current session.

maxwait class-attribute instance-attribute §
maxwait = property(None, __maxwait, None, __doc__)
milliage property §
milliage

Program age in milliseconds

Contains the number of milliseconds that have elapsed since the object instance global context was created.

onerror property writable §
onerror

Control error handler

Turns the error handler on or off.

pgmname instance-attribute §
pgmname = None
rc property writable §
rc

Return Code

The return code from the last function that caused a return code to be generated.

scrdelay property writable §
scrdelay

Screen Save Delay

Not implemented.

scrlibs property writable §
scrlibs

Screen Library Search List

Not implemented

scrupdate property writable §
scrupdate

Screen Comparison/Save Control

Not implemented.

sendstr property §
sendstr

Sent string

Contains the last string that was passed to the host session.

ses_exc instance-attribute §
ses_exc = None
seslost property §
seslost

Lost session identifier

Contains the name of the session that was abnormally lost.

Usage Notes
  • This variable can be used to check if a session has 'gone away'; i.e., PVM drop, Mysterious Logical Device Support Drop, Excessive Keyboard Lock Drop, and so on. This variable is set upon a session assignment, wait, or send functions.

  • It is initialized to null (''), and it is set to null after a successful session assignment.

session property writable §
session

Current/Active Session

Establish/determine the session for host interaction.

Usage Notes:

- The purpose of SESSION is to enable you to control
  multiple sessions within a single program. By
  establishing different sessions with unique names, you
  can change the current/active session at any time.

- A program can check the return code after a SESSION a
  assignment. If the session had existed and a RC=12 is
  set, then the session has 'gone away' since the last
  interaction because of a PVM drop, Mysterious Logical
  Device Support Drop, Excessive Keyboard Lock Drop, and
  so on. See SESLOST -- Lost Session Identifier.

- This setting can be changed at any time during program
  execution.

Return Codes (internal variable RC):

 0  New session was established

 1  Session specified was established previously

 8  Unable to establish session

12  Session specified was lost or undefined
session24 property writable §
session24

Limit Session Terminal Type

Limits new sessions to 24x80 with no extended attributes.

Usage Notes:

- SESSION24 is not session specific; i.e. if it is set to
  TRUE, it is active on all newly created sessions until
  it is set to FALSE.

- The default SESSION24 value comes from the SESSION24
  environment variable.
sessionid property writable §
sessionid

Control Session Name Display

Not implemented

sessions property §
sessions

Available sessions

A space-separated list of names of active sessions.

showline class-attribute instance-attribute §
showline = property(None, __showline, None, __doc__)
showtype property writable §
showtype

Controls Send To Screen

Setting to 1 (TRUE) causes the send data to be displayed on the screen of the current session when DISPLAY is set to HOST or HOSTCODE.

Usage Notes:

- SHOWTYPE can be left FALSE; however, when dealing with
  panel applications, CMS, or CP, this feature can
  greatly aid debugging.

- The value of SHOWTYPE can be set to TRUE or FALSE
  throughout the program. SHOWTYPE is not session
  specific; i.e., if it is set TRUE, it affects all
  sessions in the program until it is set FALSE.

- The default SHOWTYPE value comes from the SHOWTYPE
  environment variable.

- The send data is automatically suppressed if the
  application being executed on the particular session
  addresses the screen in a no non-fullscreen mode
  Therefore, the echo does not operate with all
  applications.
time property §
time

Current Time

Contains the current time in the form hh:mm:ss.

trace property writable §
trace

Control Tracking/Logging

Specifies the type of information that is written to the log file. Valid values:

NONE No extra information is recorded. This is the default setting.

ALL Sends all information from each of the other options to the log file.

CAPTURE Logs the current session's screen and returns the TRACE variable to its previous value.

CODE Logs a trace of the function calls that involve an Ati instance method.

ERROR Causes logging to be done when either of the following errors occur:

- A wait function containing an expression times out
  (returns a 0 code)

- A FIRST or LAST character string in an extract or scrhas
  function call was not found on the host screen. The
  FIRST or LAST character string is recorded.

HOST Logs each host screen as it is scanned. The screen dimensions, cursor position keyboard lock flag, and time are also logged above the screen data.

RESULTS Logs a trace of the results of function calls that involve an Ati instance method.

waitsleep property writable §
waitsleep

Check interval for wait/when

Sets the time interval (in seconds) that the wait function conditions and active when functions are checked. Can be an integer from 1 to 99.

Usage Notes:

  • Initialized to 1. That is, the condition of a wait function is checked every second or every screen update until the wait condition is satisfied or the wait times out. This value is used to improve system performance by increasing the time between wait rechecks to longer intervals.

  • Does not affect the length of a wait. For example, if waitsleep=10 and a 2-second wait is requested, the maximum wait time is still only 2 seconds, which is checked in one interval.

Functions§

drop §
drop(*args)

Delete user-defined variable(s).

Drops one or more user-defined variable(s) or host sessions from memory. DROP will cause the value of a variable to be reset to its name in capital letters. DROP can be used safely on non-GLOBAL variables. Note that statement labels and WHEN labels cannot be dropped. Please see 'DROPPING A GLOBAL VARIABLE' for the consequences of dropping a GLOBAL variable.

(ATI) DROP varname1 [ … ] | SESSION

(python) drop(varname1[,varname2…])

where
  • varname1, etc. are previously defined user variables.

  • SESSION will cause the current host session to be released. If the session was a CMS userid, it will be disconnected, and if it is not reconnected within 15 minutes, it will be logged off by CP.

EXAMPLE

DROP counter password

where
  • 'counter' and 'password' are variables. After the DROP, their values will be 'COUNTER' and 'PASSWORD', respectively.
  • Dropping SESSION when it has a value of 'NONE' will cause a run time warning to occur.

RETURN CODES Not affected

escape staticmethod §
escape(text)

Escape special characters in text.

Return a text string that is an escaped version of the input text string. The input text is treated as if it has no mneumonics and the returned text can be used as input to send without having any of it interpreted as a mneumonic.

extract §
extract(*args, wc=None)

Return a text string from the host screen.

Usage/Syntax:

extract({length | EOL}[, location][, wc='*'])

location:
    (r, c) | {FIRST|LAST}, string[, (xr, xc)][, wc='*']

length A numeric value specifying the length of the string to be extracted from the host screen.

EOL Causes the extraction to reach as far as the end of the host screen line where it began.

(r, c) An absolute begin-extraction location on the host screen. It can be used instead of the FIRST or LAST sequence if the user knows the coordinates of the screen where extraction is to begin. The row value range is between 1 and the height of the host screen (MAXROW). The column value range is between 1 and the width of the host screen (MAXCOL). Negative values for r and c can be used and are interpreted as relative to the height and width of the screen, respectively. For example specifying -1 for r is interpretaed as the last (bottom) row of the screen. Default is (1, 1).

FIRST Indicates that the begin-extraction location on the host screen is after the location of the first occurrence of string on the current host screen.

LAST Indicates that the begin-extraction location on the host screen is after the location of the last occurrence of string on the current host screen.

string The string to be searched for on the host screen.

(xr, xc) A relative row-column offset from the located string. The xr and xc fields are integers that represent the offset to the location of the extraction. In calculating this address, if the vertical edge of the host screen is encountered, a wrap-around to the next row wil occur and the offset counting then continues at this new location.

The value for xr can range from -MAXROW to MAXROW. The
value for xc can range from -MAXCOL to MAXCOL. For
example, (1, -10) would set the extraction location to
one row below and ten columns to the left of the first
character in string.

If (xr, xc) is not provided, the begin-extraction
location defaults to one character to the right of
string. The relative location could be defined as (0,
n) if string has a length of n.

wc='' Indicates that '' is the wildcard character in string. If more than one character is specified in the wildcard string, only the first character is used. If a null is specified, no wildcard is set. The '*' is a place holder that is not compared to the corresponding character in the string being tested on the host screen.

Usage Notes:

- The string is searched for on the host screen by
  increasing columns and rows (from top to bottom of
  screen, with each row being searched left to right).

- Absolute (r, c) is mutually exclusive with the
  FIRST/LAST and string option sequence.

- If the extraction occurs, HITROW and HITCOL is set
  to the location where the extraction began.

Return Codes (internal variable RC):

 0  The extraction was completed successfully.

 3  The extraction length was less than one; null
    string returned.

 6  The FIRST and LAST character string was not
    found; null string returned.

 7  Error in the FIRST or LAST sequence relative
    address specification null string returned.

 8  The begin-address specification exceeds screen
    bounds; null string returned.

 9  The extraction extended beyond screen bounds;
    result truncated.

12  Session lost or undefined; null string returned.
get_asyncio_event_loop §
get_asyncio_event_loop()

Return the asyncio event and loop as a tuple.

get_tnz §
get_tnz(name=None)

Return session Tnz instance.

Or None if there is none.

keys §
keys()

Like dict.keys

logwrt §
logwrt(value)

Writes the input string to the current log destination.

new_program §
new_program(share=None, share_sessions=None)

Create a new instance for a ATI-like program.

The new instance will share GLOBAL (including internal) variables.

num staticmethod §
num(value)

Use ATI rules to convert the input string to an integer.

numvalue §
numvalue(name, trace=None)

Shorthand for num(value(varname))

rename §
rename(name)

Rename the current session.

Changes the name of the current session to the session name specified. The specified session name cannot match the name of a currently established session.

This function performs the function of the RENAME option on the GOTO EXEC and overtyping the session name in the ATI session manager.

say §
say(value)

Print the input string.

Write input string to standard output (likely the terminal). If tracing is active (the internal variable TRACE is set to either CODE or ALL), say will also direct output to the log destination.

scrcomp §
scrcomp(value)
scrhas §
scrhas(*args, wc=None)

Check current screen for a string.

Return True if the specified character string exists on the current host screen. Otherwise return False.

Usage/Syntax:

scrhas(string)               (string is always required)

scrhas(string,wc='*')        (wc is optional to all)
scrhas(CASI,string)          (CASI is optional to all)

scrhas(string,(r,c))

scrhas(string,FIRST,string2)
scrhas(string,LAST,string2)

scrhas(string,(r,c),length)
scrhas(string,(r,c),(r2,c2))

CASI Signifies that the screen search is to be done case independently. Thus, 'Logon' is equivalent to 'LOGON' or 'logon'.

string The string that is searched for on the host screen.

FIRST Indicates that the begin-search location on the host screen is after the location of the last character of the first occurrence of string2 on the current host screen.

LAST Indicates that the begin-search location on the host screen is after the location of the last character of the last occurrence of string2 on the current host screen.

string2 A string that, along with the FIRST or LAST keyword, specifies the location on the host screen where the search for the string will begin.

(r, c) An absolute begin-search location on the host screen. Row ® must be an integer between 1 and the host screen height (MAXROW). Column © is an integer between 1 and the host screen width (MAXCOL).

length An optional parameter specifying the length of the area to be searched for the indicated string. If omitted, the area searched will range from the specified start position to the end of the screen.

(r2, c2) Specifies an absolute end-search location diagonally opposite to (r, c). Row (r2) and column (c2) must be integers from 1 to MAXROW and from 1 to MAXCOL, respectively. The (r, c) and (r2, c2) define a rectangular window on the screen where the specified string is searched for.

wc='' Indicates that '' is the wildcard character in string. The '*' is a place holder that is not compared to the corresponding character in the string being tested on the host screen. The wildcard can be any character that the user chooses. Whenever a character is to be interpreted as a wildcard, wc must be specified.

Usage Notes:

 - The internal variables HITROW, HITCOL, and HITSTR
   are set by this function if the search is
   successful.

 - If a begin location is not specified, the search
   will begin at the upper left corner (1:1) of the
   host screen and will cover the entire screen.

 - If string2 is not found on the current host screen,
   this function returns False.

 - Search direction is by increasing columns and rows.
   (Top to bottom, each row being searched left to
   right.)

Return Codes (internal variable RC):

  0  The string was found on the host screen.
     Function returns True.

  1  The string was not found on the host screen.
     Function returns False.

  6  The FIRST or LAST character string was not found.
     Function returns False.

  8  The begin-search or end-search location exceeds
     screen bounds.
     Function returns False.

 12  Session lost or undefined.
     Function returns False.
send §
send(*args)

Send string to the active session.

Send a string of characters and/or special keys to the active session. The session recognizes them as if the user typed the data interactively at the keyboard and, depending on the data sent, it performs the necessary action.

Usage/Syntax:

send([(row, col),] string)

string The data to be sent to the host screen.

(row,col) The location of the cursor that should be set before the data is sent to the host screen. The default is the current cursor location.

Usage Notes:

1 - After completion of the send function, the internal
    variable SENDSTR will contain the value of string. A
    difference from ATI is that SENDSTR will NOT contain
    characters that were ignored.

2 - The send function transmits data to the active
    session starting at the current cursor position. The
    programmer can access the internal variables CURROW
    and CURCOL to check the current cursor location. A
    difference from ATI is that the position at which
    data is transmitted can be specified by (row,col).

3 - <TODO need more on mneumonics>

Special Keys

    [backtab]
    [curdown]
    [curleft]
    [curright]
    [curup]
    [delete]
    [eraseeof]
    [home]
    [insert]
    [newline]
    [tab]

The RESET key ([reset])

    The RESET key has three different meanings--depending on
    its location in the input string:

    Terminate INSERT mode
        Occurs when the key appears in the middle of the
        input string; i.e., there is data before and
        after the RESET key.

    Ignore Keyboard Lock Condition
        Occurs when the key is the first data item in the
        string being sent. Normally if the keyboard is
        locked, ATI waits up to 1 minute for the keyboard
        to unlock before sending data. (Note that this
        value can be changed using the KEYUNLOCK internal
        variable. However, there are rare cases when it
        is necessary to transmit data while the keyboard
        is locked. For example, the user may want to send
        '####' to PVM (Pass-Through Virtual Machine) to
        drop a link, ignoring the condition of the
        screen. For example:

            send(reset+'####'+enter)

        Note: If the keyboard were not to unlock in the
        time allowed, the session would be dropped.

    Suppress Warning Messages
        Is not a very common use of the RESET key. By
        appending a RESET key just before the control
        key, warnings are not logged by the compiler if
        the send function was unsuccessful. For example,
        it is usually desirable not to see warning
        messages when a LOGOFF or DISCONNECT is sent to a
        session. For example:

            send('LOGOFF'+reset)

Control keys

    [clear]
    [enter]
    [pa1]-[pa3]
    [pf1]-[pf24] (also [pf01]-[pf24])

    Note that there is no equivalent to the ATI HOLDSEND.
    None is needed since ENTER is not implied.

Return Codes (return value and internal variable RC):

     0  The string was successfully sent to the host screen.

     4  Data placed in protected field ignored.

    12  Session lost or undefined.

    14  Session dropped due to excessive keyboard lock;
        null string returned.
set §
set(name, value, xtern=True, trace=None, verifycert=None)

Set an ATI-like variable.

share §
share(*args)

Perform the ATI GLOBAL statement function

value §
value(name, trace=None)

returns the contents of the ATI variable for the input name

wait §
wait(*args)

Wait for either a specific time limit or for a specified wait condition to be satisfied.

Usage/Syntax:

wait([{ss | '[[hh:]mm:]ss'}])
wait([{ss | '[[hh:]mm:]ss'},] {bool | callable})

hh Represents the number of hours to wait.

mm Represents the number of minutes to wait.

ss Represents the number of seconds to wait.

: A delimiter that separates the hour, minute, and second.

bool An expression that evaluates to True or False.

callable An expression in the form of a callable (e.g. lambda) that returns a bool.

Usage Notes:

- The wait function will return upon a True expression
  (or when the wait time is exceeded).

- The wait function will continuously request updates of
  the current host session screen. A wait time of 0 will
  cause a host screen update to occur and ATI processing
  to continue immediately.

- If no time is specified, the wait time will be the
  value of the program variable MAXWAIT.

- The condition is checked once every second unless the
  value of the internal variable, WAITSLEEP, is changed.

Return Codes (return value and internal variable RC):

 0  The wait time expired before the expression was
    satisfied.

 1  The expression was satisfied before the wait time
    expired.

12  Sesesion lost or undefined.
when §
when(*args)

ATI WHEN statement function.

Usage/Syntax:

@when({bool | callable | lambda: expression})
def whenlabel():
    statement(s)

when(whenlabel, [priority, ] ON)
when(whenlabel, OFF)

whenlabel The assigned name of the WHEN block.

priority A priority level that a WHEN block is given at runtime. This determines the order of execution relative to other active WHEN blocks. The priority level is an integer between 1 and 5. The default priority is 1 (highest) at the start of program execution. The priority will remain the last value assigned to it on a WHEN ON statement.

ON Used to begin the monitoring of whenlabel. All WHEN blocks are initialized to OFF. For any monitoring of WHEN blocks to occur, each WHEN must be explicitly turned ON.

OFF Used to suspend the monitoring of whenlabel. It is highly recommended to turn off any unnecessary WHEN conditions. Excessive WHEN condition monitoring slows processing.

An indicator that a WHEN, when active, will execute in all included or called programs as well as the program in which it is declared.

expression A WHEN condition in the form of an expression.

statement(s) A list of statements to be executed whenever expression is true.

Usage Notes

-  The expression used in a WHEN block may involve a host
   screen check and/or an ATI variable check. The WHEN
   conditions may be classified to determine the
   frequency of monitoring.

-  While a WHEN block is currently being executed, no
   other WHEN expressions are checked.

-  A WHEN condition can be suspended or executed inside
   of a WHEN execution block.