Consultor Eletrônico



Kbase 16566: Passing OS Environment Variables to Progress 4GL
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/10/1998
Passing OS Environment Variables to Progress 4GL

Passing OS Environment Variables to Progress 4GL
-----------------------------------------------

This is a how-to pass operating system environment variables to
Progress 4GL in different versions of Progress. This is important
because of functionality changes in Progress from Version 6 to Version
7 and 8.

VERSION 6
---------

In this version there is no way to get an environment variable
directly. You must shell out to the OS, pass the variable to a file
and then read the contents of this file back in Progress 4GL. This is
necessary because of the rules of parent and child shells. The child
shell inherit the parents variables, but you cannot then pass a
variable back to the parent shell.

This is an example code on how to do this in Version 6 Progress ->

unix silent echo $TERM > file.shell.
def var shell as char.
input from ./file.shell.
set shell.
display shell.

(this will get you the value for the TERM variable which you can now
use in your 4GL)

VERSION 7 and 8
---------------

In these versions we added the functionality of a 4GL command to get a
currently set environment variable interactively.

The 4GL command is OS-GETENV. When used in 4GL it will retrieve the
specified variable directly from the operating system.

This is an example code on how to do this in Version 7 and 8 ->

def var shell as char.
shell = os-getenv("TERM").
display shell.

(this will also get you the value for the TERM variable for use in
your 4GL code with much less coding).

See also KnowledgeBase Entry
6827 "Getting info (tty, pid, environment vars) on UNIX into proc"

REFERENCES TO WRITTEN DOCUMENTATION:
====================================

Version 7 and 8 Progress Language Reference "OS-GETENV"

RVE 1/14/97

Progress Software Technical Support Note # 16566