WINPRINT-GET-JOB-STATUS

This operation code allows you to check the current status of a print job. This is useful for determining if a printer is paused or out of paper.

Usage

CALL "WIN$PRINTER"
    USING WINPRINT-GET-JOB-STATUS, WINPRINT-JOB-STATUS
    GIVING RESULT

Parameters

WINPRINT-JOB-STATUS Group item defined in winprint.def as follows:
01  WINPRINT-JOB-STATUS.
   03  WINPRINT-JOB-PRINTER            PIC X(80).
   03  WINPRINT-JOB-ID                 SIGNED-INT.
   03  WINPRINT-JOB-STATUS-NO          PIC 9(9) COMP-5.
      88 WPRT-JOB-PAUSE                VALUE 1.
      88 WPRT-JOB-RESUME               VALUE 2.
      88 WPRT-JOB-CANCEL               VALUE 3.
      88 WPRT-JOB-RESTART              VALUE 4.
   03  WINPRINT-JOB-POSITION           SIGNED-INT.
   03  WINPRINT-JOB-PAGE-TOTAL         SIGNED-INT.
   03  WINPRINT-JOB-PAGE-PRINTED       SIGNED-INT.
   03  WINPRINT-JOB-STATUS-TEXT        PIC X(80).

Return Values

This operation returns the printer status as defined in the Windows API.

A great variety of conditions can affect a single print job and printer status may be the result of a combination of values. This makes it impossible to catalog all possible status settings in winprint.def. Refer to the Windows API documentation for a description of any status not covered in that file.

Description

This operation may be called at any time a print job has started, or has started and closed. There is no need to reset this function. WINPRINT-JOB-STATUS should be initialized prior to use.

Note: If this function is executed on a networked printer with a missing or malfunctioning network, your application may appear to hang. Once the timeout has completed, your application will resume. This is a feature of the Windows API, not an effect of the runtime.
WINPRINT-GET-JOB-STATUS has the following values:
WINPRINT-JOB-PRINTER Should be set to the value of WINPRINT-NAME as obtained through a call to WINPRINT-GET-PRINTER-INFO(-EX) or WINPRINT-GET-CURRENT-INFO(-EX).
WINPRINT-JOB-ID Returns the Windows Job ID of the last print job. The printer must be open. The Job ID may be used for subsequent calls to the same printer, even if multiple jobs are printing.
WINPRINT-JOB-STATUS-NO Specifies the current condition of the printer, which may be one or more of the JOB-CONDITIONS defined in winprint.def.
WINPRINT-JOB-POSITION Specifies a print job's current position in the queue of a particular printer. For example, if your job is third in the queue, this value is 3. This does not necessarily mean that the print job will wait until the two prior jobs in the queue have printed.
WINPRINT-JOB-PAGE-TOTAL Specifies the total number of pages to print.
WINPRINT-JOB-PAGE-PRINTED Specifies the total number of pages printed at the time of inquiry.
WINPRINT-JOB-STATUS-TEXT Specifies the status of the printer as a text string. Depending on the error condition, this string may be empty. This is a feature of the Windows API. Use both this parameter and WINPRINT-JOB-STATUS-NO when checking job status to be sure that you have determined the correct error condition.