How to get information about TPX variables like type, length etc. from within an ACL program?

Document ID : KB000009395
Last Modified Date : 14/02/2018
Show Technical Document Details
Introduction:

Sometimes you need information about a variable beside the content of that variable. You want to know the length of the data inside the variable or the Data Type. There are some functions in ACL/E which were created for that purpose.

Instructions:

To get information about variables you can use three predefined function variables:

&MSIZE_OF(...)

Example:

    VDEFINE    VAR,8
    SET        VAR,'HELLO'
    SET        M,&MSIZE_OF(&VAR)

Variable &M will contain 8, the maximum possible length of variable &VAR, as defined in the VDEFINE statement.

&SIZE_OF(...)

Example:

    VDEFINE    VAR,10
    SET        VAR,'HELLO'
    SET        S,&SIZE_OF(&VAR)

Variable &S will contain 5, the length of the value currently kept in variable &VAR

&TYPE_OF(...)

Note: The variable name must be entered without '&'.

Possible values are:

ARRAY             Indicates that this is an array variable
BIN               Indicates that this is a binary variable.
CHAR              Indicates that this is a character variable.
UPCHAR            Indicates that this is an uppercase character variable.
HEX               Indicates that this is a hexadecimal variable.
NOTRUNC           Indicates that the variable will not be stripped of trailing blanks when substitution takes place.
NUM               Indicates that this is a numeric variable.
UNDEFINED         Indicates that this variable is not defined.
This value can be attached to the ones above:
ACL               Indicates that the variable was defined in ACL/E

Example:

    VDEFINE    VAR,8,TYPE=CHAR
    SET        VAR,'HELLO'
    SET        T,&SIZE_OF(VAR)  <--- without '&' 

Variable &T will contain string 'CHAR ACL'.