Printing

I am having trouble using the printer_redirection code.  My printer will act like it wants to start printing, but nothing comes out. I am testing with the testprintraw cobol project.  My printer acts like it wants to start printing, but nothing happens.  What I am looking to do is build a report, save it to a file with headers and data and then print those results to my windows printer.  I am using the Micro Focus Cobol for Visual Studio 2012 version.

Tags:

Parents
  • Verified Answer

    Take a look at PC_PRINT_FILE routine in the docs under Library routines.

    The first parameter that you pass in is a variable containing the filename to print.

    This could be the same variable that you use to hold the file-name in the SELECT.

    If you are assigning your file to an environment variable which is set outside of the program then you would have to read the contents of that environment variable in order to set the name.

    something like the following:

    select test-file assign to external MYENV

    ...

    01 pn-name.

     03 pn-name-len   pic x(2) comp-5

     03 pn-name         pic x(256).

    open output test-file

    display "MYENV" upon environment-name

    accept pn-name from environment-value

    *>find the length of the file name

    perform varying pn-name-len from length of pn-name by -1 until pn-name-len < 1

      if pn-name(pn-name-len:1) not = " "

         exit perform

      end-if

    end-perform

    call "PC_PRINT_FILE using pn-name...

Reply
  • Verified Answer

    Take a look at PC_PRINT_FILE routine in the docs under Library routines.

    The first parameter that you pass in is a variable containing the filename to print.

    This could be the same variable that you use to hold the file-name in the SELECT.

    If you are assigning your file to an environment variable which is set outside of the program then you would have to read the contents of that environment variable in order to set the name.

    something like the following:

    select test-file assign to external MYENV

    ...

    01 pn-name.

     03 pn-name-len   pic x(2) comp-5

     03 pn-name         pic x(256).

    open output test-file

    display "MYENV" upon environment-name

    accept pn-name from environment-value

    *>find the length of the file name

    perform varying pn-name-len from length of pn-name by -1 until pn-name-len < 1

      if pn-name(pn-name-len:1) not = " "

         exit perform

      end-if

    end-perform

    call "PC_PRINT_FILE using pn-name...

Children
No Data