Can PRINTER REDIRECTION=TRUE be set from program?

Hi there,

This has been discussed here in 2014:

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,



  • 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.