Highlighted
Super Contributor.
Super Contributor.
630 views

GLOBAL clause in FD when using Managed COBOL

Jump to solution
A LONG time ago we used the GLOBAL clause in the FD's of native .exes so that the .exe controlled the OPEN and CLOSE of files and called .dlls just read and wrote them. UNFORTUNATELY, that code was lost to the mists of time. Today we want to resurrect that functionality, but in Managed COBOL. I've put together an .exe that has FD LOG-FILE IS GLOBAL and does OPEN, WRITE, invokes a .dll, WRITEs again, and CLOSEs. The .dll (class) has FD LOG-FILE and does a write, no OPEN or CLOSE. Everything works in VS Debug mode until the WRITE in the .dll, which gets a 4/8 File Status and "148 Wrong open mode or access mode for write". Does anybody know what I forgot?
0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: GLOBAL clause in FD when using Managed COBOL

Jump to solution
It should be the EXTERNAL clause instead of GLOBAL.

View solution in original post

0 Likes
2 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: GLOBAL clause in FD when using Managed COBOL

Jump to solution
It should be the EXTERNAL clause instead of GLOBAL.

View solution in original post

0 Likes
Highlighted
Super Contributor.
Super Contributor.

RE: GLOBAL clause in FD when using Managed COBOL

Jump to solution
The EXTERNAL did the trick! Thanks for the clarification. As I said, the original code was gone but I remembered the functionality. While reading the documentation I didn't catch on that GLOBAL **ONLY** applies to all programs in a compilation, and our situation involves separate compilations.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.