ð1 NAME-OF-LIBRARY PIC X(1ð) VALUE "QUEUELIB".
ð1 SIZE-OF-MSG PIC S9(ð5) VALUE 1ð PACKED-DECIMAL.
ð1 WAIT-TIME PIC S9(ð5) VALUE ð PACKED-DECIMAL.
ð1 MSG PIC X(1ð) VALUE "EXAMPLE".
ð1 MSG-BACK PIC X(1ð).
\
\ Beginning of mainline
\
PROCEDURE DIVISION.
MAIN-LINE.
\
\ Initialize the error code parameter. To signal exceptions to
\ this program by the API, you need to set the bytes provided
\ field of the error code to zero. Because this program has
\ exceptions sent back through the error code parameter, it sets
\ the bytes provided field to the number of bytes it gives the
\ API for the parameter.
\
MOVE 16 TO BYTES-PROVIDED.
\
\ Initialize QCAPCMD options control block for CL processing
\
MOVE ð TO COMMAND-PROCESS-TYPE.
MOVE "ð" TO DBCS-DATA-HANDLING.
MOVE "ð" TO PROMPTER-ACTION.
MOVE "ð" TO COMMAND-STRING-SYNTAX.
MOVE SPACES TO MESSAGE-KEY.
MOVE LOW-VALUES TO RESERVED OF QCA-PCMD-CPOPð1ðð.
\
\ Create library QUEUELIB
\
CALL QCAPCMD USING CRTLIB, COMMAND-LENGTH, QCA-PCMD-CPOPð1ðð,
OPTIONS-SIZE, FORMAT-NAME, RECEIVER,
RECEIVER-LENGTH, RECEIVER-LENGTH, QUS-EC.
\
\ If an exception occurs, the API returns the exception in the
\ error code parameter. The bytes available field is set to
\ zero if no exception occurs and greater than zero if an
\ exception does occur.
\
\
IF BYTES-AVAILABLE > ð PERFORM ERROR-FOUND.
\
\ Create a data queue called EXAMPLEQ in library QUEUELIB. The
\ queue will have a maximum entry length set at 1ð, and will be
\ FIFO (first-in first-out).
\
CALL QCAPCMD USING CRTDQ, COMMAND-LENGTH, QCA-PCMD-CPOPð1ðð,
OPTIONS-SIZE, FORMAT-NAME, RECEIVER,
RECEIVER-LENGTH, RECEIVER-LENGTH, QUS-EC.
\
\ If an exception occurs, the API returns the exception in the
\ error code parameter. The bytes available field is set to
\ zero if no exception occurs and greater than zero if an
\ exception does occur.
\
\
IF BYTES-AVAILABLE > ð PERFORM ERROR-FOUND.
Appendix B. Original Examples in Additional Languages B-167