Highlighted
Absent Member.
Absent Member.
556 views

Can PRINTER REDIRECTION=TRUE be set from program?

Hi there,

This has been discussed here in 2014: https://community.microfocus.com/microfocus/cobol/visual_cobol/f/forum/13102/setting-environment-variables-prior-to-build

Is there a better way now? We have PRINTER REDIRECTION=TRUE in a config text file pointed to by MF's cobcofig_ environment variable which we have to set on all client machines.  Is there a better way, direct from the code?  I'm looking for a global solution without changing our old print programs.  MY ENVIRONMENT: Visual Studio 2015; Latest Visual COBOL V3; Windows clients running our application .exe with COBOL SERVER V3.

I tried ticking, 'use variables when building the project' under, Project properties---Application---[environment...] but no joy.  Maybe that just refers to the build process itself?   

Thank you,

Linden

 

Linden Rowland - IT Consultant
Owner/Developer, www.SchoolReportWriter.com
IT Consultant to Tindle Newspaper Group

0 Likes
1 Reply
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Can PRINTER REDIRECTION=TRUE be set from program?

You can set these tunables in a application.config file which simply needs to be present in the same folder as your starting application at run-time.

Right-click on your project and select Add--New Item and select Application Configuration File. Then double-click on the application.config file in solution explorer and select the run-time configuration tab. Set the option for Redirect ASSIGN TO PRINTER to the Windows print spooler to true. When you rebuild the project a file with the same name as your executable with an extension of .mfgcf will be placed into the output folder. Include this with your executable and you shouldn't have to set an environment variable anymore.
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.