APPX Software Library

Chapter 4-7: Predefined Fields and Processes

GET ENV VAR

This subroutine retrieves the contents of an environment variable. Two arguments are expected to be passed to the subroutine:

  • Desired environment variable (alpha field, maximum length 132)
  • Buffer for returned value (alpha field, maximum length 2048 or 2K)
  • Must be PASS'ed shared.
  • Returns contents of specified environment variable.

The subroutine can be invoked via SUBR or GOSUB.

The following example retrieves the contents of the PATH environment variable and stores it in a work field.

          SET      --- TEMP 132                   =      PATH
          SET      --- TEMP 2K                    =
          *
          PASS     --- TEMP 132                   FIELD            SHARE? N
          PASS     --- TEMP 2K                    FIELD            SHARE? Y
          SUBR     --- GET ENV VAR                      DETACHED     END? N  FAIL 0
          *
          SET      CSY WORK PATH ENV VAR          =  --- TEMP 2K