[Info-vax] VMS Cobol filename issue

Arne Vajhøj arne at vajhoej.dk
Thu Dec 21 09:54:04 EST 2023


Even considering that in general I do not understand
Cobol, then this one has me puzzled.

How does one open a file with the filename being variable?

Docs says:

<quote>
On OpenVMS, if file-spec is not a literal, the compiler:
• Translates hyphens in the COBOL word to underline characters
• Treats the word as if it were enclosed in quotation marks
...
If you specify ASSIGN TO unquoted string, you need not specify this name 
in the WORKING-STORAGE section. For example:

ASSIGN TO TEST1

This assignment would use "TEST1.DAT" on OpenVMS Alpha and I64.

On UNIX systems, you would specify:

ASSIGN TO "TEST1.DAT"

or:

ASSIGN TO TEST1
...
WORKING-STORAGE SECTION.
01 TEST1 PIC X(9) VALUE IS "TEST1.DAT".
</quote>

So easy to do in OSF/1 aka DUNIX aka Tru64, but how
does one do it on VMS??

Arne






More information about the Info-vax mailing list