COBOL Manual for TNS and TNS/R Programs

Libraries and Utility Routines
HP COBOL Manual for TNS and TNS/R Programs522555-006
13-45
COBOL_GETENV_
Usage Consideration: In a fault-tolerant program, put the CHECKPOINT statement that
specifies cpinfo immediately before the call to COBOL_CONTROL_; otherwise, the
queued information can be lost if a backup process takes over.
COBOL_GETENV_
The COBOL_GETENV_ routine returns the value of a specified environment variable.
This routine is available only to programs compiled for the CRE.
env-var
is the name of the environment variable whose value is to be returned. It cannot
have trailing spaces or a zero-byte terminator.
return-value
is the name of the variable that will hold the returned value of env-var. It must be
large enough to hold the maximum possible value of env-var.
length
is the number of characters that return-value contains. If length is zero,
env-var was not found.
2 file-name is not a COBOL file name.
5 One of:
file-name specifies an open file that is either $RECEIVE or is open for
Fast I-O.
file-name specifies a closed file and there is not enough control space
to allocate the queued information for the next open request.
The program is running in the non-CRE environment and cpinfo has
too few entries.
Value Meaning (page 2 of 2)
*error-return is 0 for a deferred call (that is, one that is held until the file is open). If an error occurs at
that time, a run-time diagnostic is issued.
ENTER
USING env-var
COBOL_GETENV_
" "
lengthGIVING
ns ns
return-value
VST722.vsd