Highlighted
Absent Member.
Absent Member.
854 views

[archive] Win$printer - Citrix

[Migrated content. Thread originally posted on 30 July 2008]

We have an application using win$printer which works without problems on our local network in our company. If we run this application on our Citrix-Server the application stops suddenly.

First the user can select a printer in our application with
CALL WIN$PRINTER USING WINPRINT-SETUP.
This statement is correctly done.

The next statement is
CALL WIN$PRINTER USING WINPRINT-GET-CURRENT-INFO, WINPRINT-SELECTION GIVING RESULT.
The application-window shuts at this point without any information.

Has anyone an idea what happens and where the difference to our local network is and how our users connected via the Citrix-Server can print?

Many thanks
0 Likes
7 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Win$printer - Citrix

Have u tested if the printer is online?

It'seams like an old problem i had... u need to check if the printer is online before use the winprinter-get-current-info. Atm i don't remember exactly the sintax of the call to know the status of the printer. I need to search it.

donant
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Win$printer - Citrix

Antonio - I have had a few silly problems like this - I would like to know how you were able to check if the printer was ready to print?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Win$printer - Citrix

Hello,

do You mean winprint-get-printer-status?

I tried a lot of calls with win$printer. In my program first I try
call win$printer winprin-supported giving result -
everything is okay.

Then I select the Printer - it works.

But after this when I try to call win$printer with winprint-get-no-printers or winprint-get-printer-status or winprint-get-printer-info my window disappears without information from the screen after some seconds. The call of the win$printer is the last operation which starts and the program disappears at this point.

Thanks a lot for your response. Perhaps you have another idea for us.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Win$printer - Citrix

Have a look at the configuration entry for "WINPRINT_NAMES_ONLY"

This may help you
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Win$printer - Citrix

I referred to this part of the documentation.

I don't find exactly an example in my programs, but need to use this variable:

WINPRINT_NAMES_ONLY

to prevent the crash.



ACUCOBOL-GT Appendices
Version 8.0

Appendix H: Configuration Variables > H.2 Configuration variables >
WINPRINT_NAMES_ONLY

This variable allows you to generate a list of the names of printers installed on a Windows PC. It does this by altering the behavior of some of the operations of the WIN$PRINTER library routine. When WINPRINT_NAMES_ONLY is set to a value of "1" (on, true, yes), the WIN$PRINTER operations that retrieve printer information return only the names of installed printers, rather than the real-time status of all available printer capabilities.

This variable can be set in the configuration file or directly in your program with the following code:

SET ENVIRONMENT "WINPRINT-NAMES-ONLY" TO "1".

Note on WIN$PRINTER library routine:

When this variable is turned on, the following operations of the WIN$PRINTER library routine are affected:

WINPRINT-GET-PRINTER-INFO
WINPRINT-GET-PRINTER-INFO-EX
WINPRINT-GET-CURRENT-INFO
WINPRINT-GET-CURRENT-INFO-EX

Instead of returning detailed information about the capabilities of each printer (duplex, copying, etc.), the routine returns only the name of the printer. This can provide a significant performance improvement, particularly with networked printers.

If you are using the default printer settings, set the WINPRINT_NAMES_ONLY variable to "1", generate a list of printer names using WINPRINTER-GET-PRINTER-INFO-EX (see the WIN$PRINTER documentation in the Appendices of the ACUCOBOL-GT manual set, or refer to the sample program "prndemox.cbl"), and select the desired printer.

If you want to modify the printer settings, such as the number of copies or the paper orientation, you should perform the steps described above, and then set WINPRINT_NAMES_ONLY back to the default of "0" (off, false, no). You may then use WINPRINT-GET-PRINTER-INFO-EX to obtain detailed information about the capabilities of the selected printer.

For more information about Windows printing, refer to WIN$PRINTER in Appendix I.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Win$printer - Citrix

Thanks for your answer,

the problem ist, that this setting just works with version 5.2.1 ( as I have read in the forum in an article ) and we use version 5.2.0. Perhaps we will upgrade in the next time and then we will see whether this was the solution of our problem - unless you have another idea...
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Win$printer - Citrix

There used to be a buffer overflow issue in the earliest versions of the Winprint-get-current-printer, this would trigger when the combination of the printer names length and the number of printers in sum exceeded the allocated buffer.

From your description and that you are using such an old version (I think this was eventually fixed in 7.2), my guess is that you are suffering from this problem.

I would suggest you get a eval copy of a newer version to verify if this is the case.

Citrix environments, particularly farms, are special in that they tend to have a huge amount of printers available, when these are fully qualified with the computer name, the names tend to be extremely long.
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.