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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

SAR$ WRITE<br />

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

tables, WRITE packet, WRITE procedure, and file information packet.<br />

The SAR$ data structures for the WRITE function are declared by using the definitions<br />

contained in element SAR$DEFN, SAR$WPKTD, and SAR$FILEPKTD.<br />

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

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

The SAR_WRITE_PACKET_CURRENT_VERSION constant is defined in the SAR$WPKTD<br />

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

The WRITE function is initialized by calling the SAR_OPEN_OUTPUT procedure, passing<br />

the WRITE packet address as a parameter. If the CALL_STATUS field of the WRITE<br />

packet is not status S'Normal', the error is processed. The SAR_WRITE procedure is<br />

called to write each SDF image out to the file or element described in the file information<br />

packet.<br />

When all images are written out, the SAR_CLOSE_OUTPUT procedure is called. This<br />

procedure writes an end-of-file record, and if the output is to an element, adds the<br />

element to the program file table of contents.<br />

18.1.4. Status Lists for PLUS WRITE Procedures<br />

The WRITE procedure call status codes listed in Table 18–3 may be returned to the<br />

calling program in the CALL_STATUS field of the WRITE packet. These CALL_STATUS<br />

codes are for SAR_WRITE_PACKET_CURRENT_VERSION = 2 and above. A list of all call<br />

status codes is available as WRITE_CALL_STATUS_LIST, an 18-bit status data entity<br />

defined in the element SAR$WPKTD.<br />

Table 18–3. SAR$: WRITE Procedure CALL_STATUS Codes<br />

Octal Code Status<br />

0 Normal return from SAR$.<br />

01 An outdated WRITE packet version is being used.<br />

02 An invalid WRITE packet version is being used.<br />

03 The value for IMAGE_BUFFER_ADDRESS is NULL; an address must be<br />

given for the output image buffer.<br />

04 The IMAGE_BUFFER_WORD_LENGTH is zero; a length must be given for<br />

the output image buffer.<br />

05 The value for OUTPUT_FILE_INFO_PKT_ADDRESS is NULL; a file<br />

information packet must be given for this output file type.<br />

06 An invalid value is specified for OUTPUT_FILE_TYPE.<br />

07 An invalid value is specified for OUTPUT_LINE_NUMBER_TYPE.<br />

010 An invalid value is specified for UNTRANSLATE_MODE.<br />

7833 1733–004 18–19

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

Saved successfully!

Ooh no, something went wrong!