18.08.2013 Views

(SYSLIB) Programming Reference Manual - Public Support Login ...

(SYSLIB) Programming Reference Manual - Public Support Login ...

(SYSLIB) Programming Reference Manual - Public Support Login ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CASE * :<br />

BEGIN<br />

PROCESS_READ_ERROR;<br />

RETURN;<br />

END;<br />

ENDCASE;<br />

END;<br />

.<br />

.<br />

.<br />

SAR_CLOSE_INPUT(LOC(READ_PKT));<br />

IF READ_PKT.CALL_STATUS NE S ‘Normal’<br />

THEN BEGIN<br />

PROCESS_READ_ERROR;<br />

RETURN;<br />

END;<br />

SAR$ READ<br />

In this example, the COPY statement obtains the SAR$ definitions for the buffers and<br />

tables, READ packet, READ procedures, and file information packet. The SAR$ data<br />

structures are declared by using the definitions contained in elements SAR$DEFN,<br />

SAR$RPKTD, and SAR$FILEPKTD.<br />

The READ packet is initialized by assigning appropriate values to all necessary fields.<br />

All other packet fields take the default values if the READ packet is zero-filled.<br />

The SAR_READ_PACKET_CURRENT_VERSION constant is defined in the SAR$RPKTD<br />

element. The buffer length constants are defined in the SAR$DEFN element.<br />

The READ function is initialized by the calling SAR_OPEN_INPUT procedure, passing the<br />

READ packet address as a parameter. If the CALL STATUS field of the READ packet<br />

(returned by SAR$) is not status ‘Normal', the error is processed.<br />

The SAR_READ procedure reads one SDF image at a time until an end-of-file condition or<br />

an error occurs. When all images are read, the READ function is closed by calling the<br />

SAR_CLOSE_INPUT procedure.<br />

17.1.4. Status Lists for PLUS READ Procedures<br />

The READ procedure call status codes listed in Table 17–3 may be returned to the caller<br />

in the CALL_STATUS field of the READ packet. These CALL_STATUS codes are for<br />

SAR_READ_PACKET_CURRENT_VERSION = 3 and above. A list of all call status codes<br />

is available as READ_CALL_STATUS_LIST, an 18-bit status data entity defined in the<br />

element SAR$RPKTD.<br />

Table 17–3. SAR$: READ Procedure CALL_STATUS Codes<br />

Octal Code Status<br />

0 Normal return from SAR$.<br />

01 End-of-file condition reached by SAR_READ.<br />

7833 1733–004 17–17

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!