CHECK (Check I/O Completion) Macro

The macro prevents processing until data transfer on an I/O operation is complete.

It can be issued either after a READ or WRITE macro was issued for a work file, or after a READ was issued for a MICR file to ensure that data transfer is complete.

Because of differences in the way that IOCS posts CCB transmission information bits in the DTFs, you should always issue a CHECK macro to ensure that data transfer is complete before testing these bits. If the data transfer is completed without an error or other exceptional condition, CHECK returns control to the next sequential instruction. If an error condition is encountered, control is transferred to the ERROPT address. If ERROPT is not specified, processing continues at the next instruction. If end-of-file is encountered, control transfers to the EOFADDR address.

Issuing a CHECK macro after a READ on a MICR device allows you to query the MICR document buffer (see Table 1) and to specify the control_address operand.

Format

Read syntax diagramSkip visual syntax diagramname CHECK filename(1), control_address,(0)

Requirements for the caller

AMODE:
24
RMODE:
24
ASC Mode:
Primary

Parameters

filename | (1)
The operand specifies the name of the file associated with the record to be checked or, if register notation is used, the register containing a pointer to the field that contains this name. This name is the same as that specified for the DTFxx header entry for the file.
control_address | (0)
Indicates the address to which control passes when a buffer is waiting for data or when the file is closed. If register notation is used, the specified register must point to a field that contains this address.
The CHECK macro determines whether the MICR document buffer:
  • Contains data ready for processing.

    In this case, control passes to the next sequential instruction.

  • Is waiting for data.

    In this case, or if the file is closed, control passes to the address specified for control-address, if present. Else, control passes to the address specified in the ERROPT operand of the DTFMR macro.

  • Contains a special non-data status.

    In this case, control passes to the ERROPT routine. In the routine, you can examine the posted error conditions before determining your action (see byte 0 of the document buffer, bits 2, 3, and 4).

The CHECK macro also determines whether the file (filename) is closed.

Return from the ERROPT routine to the next sequential instruction by a branch either on register 14 or to the address in register 0.

If an error, a closed file, or a waiting condition occurs with neither control-address nor an ERROPT address specified, control is given to your program at the next sequential instruction.

If the waiting condition occurred, byte 0, bit 5 of the buffer is set to 1. If the file was closed, byte 0, bits 5 and 6 of the buffer are set to 1.

Table 1. MICR Document Buffer Format
Byte Bit Comment
0   Buffer Status Indicator
  0 The document is ready for processing (you do not need to test this bit).
  1 Irrecoverable stacker select error, but all document data is present. You can continue to issue GETs and READs.
  2 Irrecoverable I/O error. An operator I/O error message is issued. The file is unusable and must be closed.
  3 Unit Exception. You requested disengage and all follow-up documents are processed. The LITE macro can be issued, and the next GET or READ engages the device for continued reading.
  4 Intervention required or disengage failure. This buffer contains no data. The next GET or READ continues normal processing. This indicator allows your program to give operator information needed to select pockets for documents not properly selected and to determine unread documents.
  5 The program issued a READ, no document is ready for processing; bits 0 through 2 of byte 0 are off, or the file is closed (bit 6 of byte 0 is on). The CHECK macro examines this bit. Test bits 1 through 4 and take appropriate action. No data from a buffer should be processed if bits 2, 3, or 4 are on.
  6 The program issued a GET or READ and the file is closed. Bit 5 also on.
  7 Reserved.
1   Buffer Status Indicator
  0 Applies to old devices.
  1-7 Reserved.
2   Buffer Status Indicator
  0 Applies to old devices.
  1-3 Reserved.
    Bits 4 through 7 reflect MICR sense information
  4 Data check occurred while reading. Examine byte 3 to determine the error fields.
  5 Overrun occurred while reading. Examine byte 3 to determine the error fields. Overruns cause short-length data fields.
  6-7 The meanings of these bits depend on the device type, the model, and the engineering-change level of (old) MICR devices.
3   Buffer Status Indicator – The byte contains MICR sense information (applies to old devices).
4   Buffer Status Indicator – Pocket code

Should be examined by your stacker select routine. If bits 2, 3, or 4 of byte 0 are on, this byte is X'00'. No document was read and your stacker selection routine was not entered.

If auto-selection occurs, this value is ignored. A no-op (X'03') is issued to the device, and the reject pocket code (X'CF') is placed into byte 5. The possible pocket codes (when bit 6 or 7 of byte 2 is on) are:
  Pocket 0: X'0F'          
  Pocket 1: X'1F'          
  Pocket 2: X'2F'          
  Pocket 3: X'3F'          
  Pocket 4: X'4F'
  Pocket 5: X'5F'
  Pocket 6: X'6F'
  Pocket 7: X'7F'
  Pocket 8: X'8F'
  Pocket 9: X'9F'
  Reject Pocket: X'CF'
5   Buffer Status Indicator – Pocket-selected code

Indicates the pocket selected for the document. The contents of the byte are normally the same as that in byte 4.

X'CF' is inserted whenever auto-selection occurs (bit 6 of byte 2, bit 7 of byte 2, bit 0 of byte 2, or bit 2 of byte 3). These conditions might result from late READ commands, errant document spacing, or late stacker selection:
  • Start I/O for stacker selection is unsuccessful (bit 1 of byte 0).
6–end   Additional User Work Area

This area can be used as a work or an output area or both. The size of this area is determined by the DTFMR ADDAREA operand. The only size restriction: this area, plus the status-indicator bytes and the data portion must not exceed 256 bytes. This area can be omitted.

Document Data Area

This area follows immediately your work area. In this area, the data is right-adjusted. The length of this area is determined by the DTFMR RECSIZE operand.