7.14 GET_ENV_VALUE

Returns the file name of the source or target file in either internal or external format.

For a successful completion, the type of value is indicated in the result code by one following:

Result Code Meaning
EXIT_ENV_SOURCE_FILE

Return value is the source file name in internal format.

EXIT_ENV_SOURCE_FILE_EXT

Return value is the source file name in external format.

EXIT_ENV_TARGET_FILE

Return value is the target file name in internal format.

EXIT_ENV_TARGET_FILE_EXT

Return value is the target file name in external format.

Syntax

For C:

#include "usrdecs"
short    result;
short    source_or_target;
char     buf[100];
long     actuallen; 
long     maxlen;
short    truncated;
result = GET_ENV_VALUE (source_or_target, &buf, &maxlen, &actuallen,
                         &truncated);

For TAL:

?source usrdect
int     result;
int     source_or_target;
string  .ext buf;
int(32) maxlen;
int(32) .ext actuallen;
int     .ext truncated;
result :=  GET_ENV_VALUE(source_or_target, buf, maxlen, actuallen, 
                         truncated);

For COBOL:

?CONSULT =EXTRACT (or =REPLICAT)
01 result           PIC S9(4) COMP.
01 source-or-target PIC S9(4) COMP.
01 buf              PIC X(100).
01 maxlen           PIC S9(8) COMP.
01 actuallen        PIC S9(8) COMP.
01 truncated        PIC S9(4) COMP.
ENTER C "GET_ENV_VALUE" using source-or-target, buf, maxlen, actuallen,
                         truncated giving result.
actuallen

The actual length of the returned buffer

buf

The character buffer that will receive data. The space is allocated when the function is used. PIC X(100) and char buf[100] are only examples of a possible value.

maxlen

The maximum size that was allocated to the buffer.

source_or_target
source-or-target

Represented by either EXIT‐FN‐SOURCE‐VAL or EXIT-FN-TARGET-VAL to indicate whether the record is a source or target record.

truncated

Indicates whether the returned data has been truncated.

result

A code indicating whether the call was successful or not.