I'm actually using HP-UX COBOL, But it's just a re-badging of MF COBOL
for Unix.
What I want to do is get a Unix environment variable into my COBOL
program. I stumbled across ENVIRONMENT-NAME & ENVIRONMENT-VALUE in the
manuals, but no examples!
If anyone can help me by providing an example of how to use this, I
would be most appreciative.
Oh, if possible, can you also please 'CC' me at work on ha...@anz.com
Ta muchly,
Regards, -Josh Hall-
Identification Division.
Program-Id. CobEnv.
* This program was written to demonstrate the syntax originally
* developed by X/Open to read and set environment variables
* from a COBOL program.
Data Division.
Working-Storage Section.
01 Env-Values.
05 Env-DoW Pic X(10).
05 Env-Type Pic X(10).
Procedure Division.
Mainline.
* The following two lines read the value contained in the
* environment variable "whatday"
Display "whatday" upon environment-name
Accept Env-DoW from environment-value
Evaluate Function Upper-Case(Env-DoW)
When "MONDAY"
When "TUESDAY"
When "WEDNEDAY"
When "THURSDAY"
When "FRIDAY"
Move "WeekDay" to Env-Type
When "SATURDAY"
When "SUNDAY"
Move "WeekEnd" to Env-Type
When Other
Move "unknown" to Env-Type
End-Evaluate
* The following two lines update the environment variable
* "whattype" indicating what type of day it is.
Display "whattype" upon environment-name
Display Env-Type upon environment-value
* The following line shows the user what environment value
* was set
Display Env-Type upon console
Goback.
--
+ +
+ Bill Klein -
"C" is a nice letter to START the name of your programming language
with
but I wouldn't want to end up there.
Joshua Hall wrote in message <350500B4...@ozonline.com.au>...
All you should need to do is
DISPLAY env-name UPON ENVIRONMENT-NAME
ACCEPT env-val FROM ENVIRONMENT-VALUE
Where env-name is the name of the environment variable you are interested
in, and env-val is a buffer to contain its value.
Hope this helps.
Joshua Hall <j...@ozonline.com.au> wrote in article
Hi Josh.
DISPLAY "var-name" UPON ENVIRONMENT-NAME
ACCEPT env-var-pic-x FROM ENVIRONMENT-VALUE
DISPLAY env-var-pic-x UPON ENVIRONMENT-VALUE
If you have a web browser, go to http://www.dejanews.com/home_ps.shtml
Once there, type "comp.lang.cobol" into the "newgroups" box and
"ENVIRONMENT-NAME" into the "search" box. You should be presented with
25+ articles, some of which contain the examples you were looking for.
Cheers,
Kev.
PS. I think that *everyone* who has a specific question related to a
language construct (or of the "How do I make my "Blah" database
system work with COBOL ?" variety) should first check DejaNews as
well as the FAQ.
In this case, it would have saved you waiting for a response.
Bill - could you add something along these lines to the FAQ ? I think
it's unreasonable for you to add each and every language query like
this to the FAQ (you'll end up with a Language Reference Manual
eventually :)), but they do crop up occaisionally and they are all
archived at DejaNews.
here is a short example
Shell script:
DD_PRTF02=$MRS_ROOT/log/$JOB/$TIMESTAMP/ERROR.dat; export DD_PRTF02
Program:
SELECT PROTOKOLL ASSIGN TO "PRTF02"
I hope this helps
Bye
Bernd
Joshua Hall <j...@ozonline.com.au> schrieb im Beitrag
<350500B4...@ozonline.com.au>...
> Hi there,
>
> I'm actually using HP-UX COBOL, But it's just a re-badging of MF COBOL
> for Unix.
>
> What I want to do is get a Unix environment variable into my COBOL
> program. I stumbled across ENVIRONMENT-NAME & ENVIRONMENT-VALUE in the
> manuals, but no examples!
>
> If anyone can help me by providing an example of how to use this, I
> would be most appreciative.
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
With MF COBOL V 4.0.32
The call to mfextmap is only required if you want to 'set' an environment
variable. Basically the syntax is:
To read:
display "<environment variable name>" upon environment-name.
accept ws-envvar-value from environment-value.
To set:
display "<environment variable name>" upon environment-name.
display ws-envvar-value upon environment-value.
Hope this helps.
Paddy Coleman
Team Leader, Distributed Computing Support (WinTel)
Micro Focus UK.
Ferhat Hajdarpasic wrote in message <6enjro$oaj$1...@ernie.rsvl.unisys.com>...