COBOL からの環境変数へのアクセス

COBOL ソース コードから環境変数にアクセスするには、次の構文を使用します。

working-storage section.
01 val pic x(100).
Procedure division.
       
display "USERNAME" upon environment-name 
accept val from environment-value
display val
goback.
...
重要: It is unsafe to modify or add environment variables in a threaded application on Linux systems. This is due to limitations of the underlying system libraries. It is however safe to read values from environment variables.