TPX Session Management for z/OS

 View Only

Tuesday Tip: Do you know how to get the length of a variable in an ACL program?

  • 1.  Tuesday Tip: Do you know how to get the length of a variable in an ACL program?

    Posted Aug 29, 2014 09:43 AM

    To find out the current length of a variable, you can use the built-in function &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.

     

    To find out the maximal possible length of a variable, you can use the built-in function &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.