When a Format 5 DISPLAY statement is specified, the value stored in envlog-name is moved to environment-name. See ENVIRONMENT-NAME in the SPECIAL-NAMES paragraph. The updated value of environment-name becomes the environment variable or logical to be accessed by subsequent Format 6 DISPLAY and Format 8 ACCEPT statements. Format 5 - DISPLAY envlog-name UPON environment-name [ END-DISPLAY ]
1 – envlog-name
references an alphanumeric data item, or is a nonnumeric literal.
2 – environment-name
is a mnemonic name associated with ARGUMENT-NUMBER in the SPECIAL-NAMES paragraph in the Environment Division, representing the name of an environment variable or system logical.
3 – Example
Example of Formats 5 and 6. IDENTIFICATION DIVISION. PROGRAM-ID. SAMPLE. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. ENVIRONMENT-NAME IS NAME-OF-EVAR ENVIRONMENT-VALUE IS VALUE-OF-EVAR. DATA DIVISION. WORKING-STORAGE SECTION. 01 NAME-1 PIC X(20). 01 VALUE-ACCEPTED PIC X(20). PROCEDURE DIVISION. P1. * The name of the environment variable MOVE "TESTPATH1" TO NAME-1. * Create an environment with the name "TESTPATH1" DISPLAY NAME-1 UPON NAME-OF-EVAR. * Set the value of "TESTPATH1" DISPLAY "/USER/MYNAME" UPON VALUE-OF-EVAR. * Read the value of TESTPATH1 into a variable ACCEPT VALUE-ACCEPTED FROM VALUE-OF-EVAR. * Display the value of TESTPATH1" DISPLAY VALUE-ACCEPTED. STOP RUN.