The Dismal Swamp of CTOS Generic Print System Programming.

"Printer Location, for example, Printer Room or Dismal Swamp, as displayed in the Print Manager"

And I felt empathy with that documentation writer, as an print subsystem function I was calling was failing, and taking the program I was working on, when it did.

Dismal swamp indeed.

The cause?

The printer name had trailing spaces, which when passed to the GetGPSDeviceConfig function call, crashed it.  For the code-archaeologists out there, I coded around it by doing this:

* The PRINTER-NAME (from sys.printers) is the Device Name of the
*  printer, as defined the Install Printer Driver screen of
*  Print Manager (InstDD).
     MOVE DEVICE-NAME OF PRINTER-TABLE (SUB) TO PBDEVICENAME
     PERFORM WITH TEST AFTER
         VARYING CBDEVICENAME FROM 12 BY –1
         UNTIL GPAM-TEST-CHAR NOT = SPACE
         MOVE PBDEVICENAME (CBDEVICENAME:1) TO GPAM-TEST-CHAR
     END-PERFORM
     PERFORM G9400-GETGPSDEVICECONFIG

Bookmark and Share