gtpg2m0rGeneral Macros

CENVC-Access Environment Variables

This general macro is the assembler interface to the getenv, setenv, and unsetenv functions, which get and set the values of the environment list variables of a process, or remove variables from the environment list of a process.

Format




label
A symbolic name can be assigned to the macro statement.

FUNCTION
This parameter specifies one of the following functions to perform on the environment list for the process:

GET
Searches the environment list for a variable name and returns a pointer to a string containing its associated value.

SET
Adds or changes the value of an environment variable. Only the private environment list of the process is changed; the global default environment list is not changed.

UNSET
Deletes an environment variable. Only the private environment list of the process is changed; the global default environment list is not changed.

Entry Requirements

Return Conditions

Programming Considerations

Examples

*
* Set an environment variable.
*
         LA    R1,VARNAME      Set the address of the name ...
         ST    R1,PLIST            as the 1st parameter.
         LA    R1,SETVAL       Set the address of the value ...
         ST    R1,PLIST+4          as the 2nd parameter.
         L     R1,CHNGFLG      Set the change flag
         ST    R1,PLIST+8          as the 3nd parameter.
         LA    R1,PLIST        Point R1 to the beginning of the plist.
         CENVC FUNCTION=SET    Call CENVC to set the variable.
         LTR   R15,R15         Was the SET successful?
         BNZ   ERROR1          No, branch to error routine.
*
* Get the value of the environment variable that was just set.
*
         LA    R1,VARNAME      Set the address of the name ...
         ST    R1,PLIST            as the parameter.
         LA    R1,PLIST        Point R1 to the beginning of the plist.
         CENVC FUNCTION=GET    Call CENVC to get the value
         LTR   R15,R15         Was it found?
         BZ    ERROR2          No, branch to error routine.
*
* Delete the environment variable.
*
         LA    R1,VARNAME      Set the address of the name ...
         ST    R1,PLIST            as the parameter.
         LA    R1,PLIST        Point R1 to the beginning of the plist.
         CENVC FUNCTION=UNSET  Call CENVC to delete the variable.
         LTR   R15,R15         Was the UNSET successful?
         BNZ   ERROR1          No, branch to error routine.

·
·
·
PLIST EQU EBW064 VARNAME DC C'GREETING',XL1'00' SETVAL DC C'Hello, world!',XL1'15',XL1'00' CHNGFLG DC F'1'