Skip to main content

[Migrated content. Thread originally posted on 01 June 2012]

Is there a way to specify, maybe through an environment variable or something, the entire path to a file so that a SELECT statement can be defined in mainframe style?
Like
SELECT VIT-IN-FILE ASSIGN TO VITFLIN.
instead of
SELECT VIT-IN-FILE ASSIGN TO
"C:\\Development Projects\\TestFiles\\VITFLIN.dat".

[Migrated content. Thread originally posted on 01 June 2012]

Is there a way to specify, maybe through an environment variable or something, the entire path to a file so that a SELECT statement can be defined in mainframe style?
Like
SELECT VIT-IN-FILE ASSIGN TO VITFLIN.
instead of
SELECT VIT-IN-FILE ASSIGN TO
"C:\\Development Projects\\TestFiles\\VITFLIN.dat".
Have a look at the filename mapping chapter here

[Migrated content. Thread originally posted on 01 June 2012]

Is there a way to specify, maybe through an environment variable or something, the entire path to a file so that a SELECT statement can be defined in mainframe style?
Like
SELECT VIT-IN-FILE ASSIGN TO VITFLIN.
instead of
SELECT VIT-IN-FILE ASSIGN TO
"C:\\Development Projects\\TestFiles\\VITFLIN.dat".
Yes, I did read this before I posted. Unfortunately I wasn't able to make a lot of sense out of the doc.
I tried several different ways without success.
The latest is:
I'm on the Environment tab in Run -> Debug Configuarations -> COBOL Application -> New_configuration.
I added variable DD_VITFLIN, gave it a value C:\\Development Projects\\TestFiles\\VIT.SETL.FILE01

[Migrated content. Thread originally posted on 01 June 2012]

Is there a way to specify, maybe through an environment variable or something, the entire path to a file so that a SELECT statement can be defined in mainframe style?
Like
SELECT VIT-IN-FILE ASSIGN TO VITFLIN.
instead of
SELECT VIT-IN-FILE ASSIGN TO
"C:\\Development Projects\\TestFiles\\VITFLIN.dat".
In order for this external assignment to work you will either have to add the EXTERNAL phrase to the SELECT or compile using the ASSIGN"EXTERNAL" directive.

Example:
SELECT VIT-IN-FILE ASSIGN TO EXTERNAL VITFLIN

[Migrated content. Thread originally posted on 01 June 2012]

Is there a way to specify, maybe through an environment variable or something, the entire path to a file so that a SELECT statement can be defined in mainframe style?
Like
SELECT VIT-IN-FILE ASSIGN TO VITFLIN.
instead of
SELECT VIT-IN-FILE ASSIGN TO
"C:\\Development Projects\\TestFiles\\VITFLIN.dat".
Thanks, adding the EXTERNAL phrase does work.
I can set the environment variable, DD_Whatever, to the file name I want.
Although this lets me run in Visual COBOL on Windows it's not quite what I was looking for.
Our production is on Linux and all of the SELECT statements are coded without the EXTERNAL phrase.
I wanted to be able to replicate the code exactly on my Windows machine, making some kind of behind the scenes mapping to the file name, so I don't have to remember to change the code before I move it back to Linux.
If I'm going to have to change the code anyway it's just as easy to code the file name directly in the program as it is to assign and set an environment variable to that name.

[Migrated content. Thread originally posted on 01 June 2012]

Is there a way to specify, maybe through an environment variable or something, the entire path to a file so that a SELECT statement can be defined in mainframe style?
Like
SELECT VIT-IN-FILE ASSIGN TO VITFLIN.
instead of
SELECT VIT-IN-FILE ASSIGN TO
"C:\\Development Projects\\TestFiles\\VITFLIN.dat".
Thanks, adding the EXTERNAL phrase does work.
I can set the environment variable, DD_Whatever, to the file name I want.
Although this lets me run in Visual COBOL on Windows it's not quite what I was looking for.
Our production is on Linux and all of the SELECT statements are coded without the EXTERNAL phrase.
I wanted to be able to replicate the code exactly on my Windows machine, making some kind of behind the scenes mapping to the file name, so I don't have to remember to change the code before I move it back to Linux.
If I'm going to have to change the code anyway it's just as easy to code the file name directly in the program as it is to assign and set an environment variable to that name.

[Migrated content. Thread originally posted on 01 June 2012]

Is there a way to specify, maybe through an environment variable or something, the entire path to a file so that a SELECT statement can be defined in mainframe style?
Like
SELECT VIT-IN-FILE ASSIGN TO VITFLIN.
instead of
SELECT VIT-IN-FILE ASSIGN TO
"C:\\Development Projects\\TestFiles\\VITFLIN.dat".
Then you can use the other option that I specified which is to compile using the ASSIGN"EXTERNAL" directive.
Then you do not have to change your select statements as EXTERNAL will become the default.

Add this under Project-->Properties-->Micro Focus COBOL-->Project Settings-->COBOL-->Additional Directives.



[Migrated content. Thread originally posted on 01 June 2012]

Is there a way to specify, maybe through an environment variable or something, the entire path to a file so that a SELECT statement can be defined in mainframe style?
Like
SELECT VIT-IN-FILE ASSIGN TO VITFLIN.
instead of
SELECT VIT-IN-FILE ASSIGN TO
"C:\\Development Projects\\TestFiles\\VITFLIN.dat".

Where do we set our environment Variables in for managed codes.

On selecting App.config file , an xml file comes up . How do we define variables there.

For eg: File Path declaration.


[Migrated content. Thread originally posted on 01 June 2012]

Is there a way to specify, maybe through an environment variable or something, the entire path to a file so that a SELECT statement can be defined in mainframe style?
Like
SELECT VIT-IN-FILE ASSIGN TO VITFLIN.
instead of
SELECT VIT-IN-FILE ASSIGN TO
"C:\\Development Projects\\TestFiles\\VITFLIN.dat".

Where do we set our environment Variables in for managed codes.

On selecting App.config file , an xml file comes up . How do we define variables there.

For eg: File Path declaration.


[Migrated content. Thread originally posted on 01 June 2012]

Is there a way to specify, maybe through an environment variable or something, the entire path to a file so that a SELECT statement can be defined in mainframe style?
Like
SELECT VIT-IN-FILE ASSIGN TO VITFLIN.
instead of
SELECT VIT-IN-FILE ASSIGN TO
"C:\\Development Projects\\TestFiles\\VITFLIN.dat".

I have got answer for this in other posts ... Thank You