Restoring messages from a data set to a queue (SLOAD) on z/OS

The SLOAD function of CSQUTIL is complementary to the COPY or SCOPY function. SLOAD restores messages from the destination data set of an earlier COPY or SCOPY operation. SLOAD processes a single queue.

To use SLOAD the queue manager must be running.

If the data set was created by COPY or SCOPY QUEUE it contains messages from one queue only. If the data set was created by COPY PSID or several successive COPY or SCOPY QUEUE operations, it might contain messages from a number of queues.

By default, SLOAD processes the first queue on the data set. We can specify a particular queue to process using the FROMQUEUE parameter.

By default, messages are restored to a queue with the same name as the one from which it was copied. We can specify that the queue is loaded to a queue with a different name using the QUEUE parameter.

Note: See Syncpoints for information about how to avoid problems with duplicate messages if this function fails.


Queue management (SLOAD)

SLOAD Object SelectionObject SelectionQUEUE(q-name)FROMQUEUE(q-name)DDname SelectionDDname SelectionDDNAME(ddname)Record SelectionRecord SelectionSKIPMSGS(n)MSGCOUNT(m)


Keywords and parameters

    QUEUE(q-name)
    This parameter specifies that the messages from the first or only queue on the destination data set of a prior COPY or SCOPY operation are to be loaded to a named queue. The keyword QUEUE can be abbreviated to Q.

    q-name specifies the name of the queue to which the messages are to be loaded. This name is case sensitive. It must not be a model queue.

    FROMQUEUE(q-name)
    Specifies the name of the queue to process. If this parameter is omitted, the first queue is processed.
    The keyword FROMQUEUE can be abbreviated to FROMQ.

    q-name specifies the name of the queue to be processed. This name is case sensitive.

    DDNAME(ddname)
    Specifies that messages are to be loaded from a named data set. This keyword can be abbreviated to DD.

    ddname specifies the DDNAME that identifies the destination data set of a prior COPY or SCOPY operation, from which the messages are to be loaded. This name is not case sensitive, and can be up to 8 characters long.

    If we omit DDNAME (ddname) the default DDNAME, CSQUINP, is used.

    SKIPMSGS( n )
    Specifies that the first n messages in the sequential data set are to be skipped before commencing the load of the queue.

    If we omit SKIPMSGS( n ) no messages are skipped; the load starts at the first message.

    MSGCOUNT( m )
    Specifies that only m messages are to be read from the data set and loaded to the queue.

    If we omit MSGCOUNT( m ) the number of messages read is unlimited.


Example

Figure 1. Sample JCL for the CSQUTIL SLOAD function
//SLOAD EXEC PGM=CSQUTIL,PARM=('CSQ1'),REGION=0M
//STEPLIB DD DISP=SHR,DSN=thlqual.SCSQANLE
// DD DISP=SHR,DSN=thlqual.SCSQAUTH
//OUTPUTA DD DSN=MY.UTILITY.OUTPUTA,DISP=SHR
//CSQUINP DD DSN=MY.UTILITY.COPYA,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
SLOAD DDNAME(OUTPUTA)
SLOAD QUEUE(TOQ) FROMQUEUE(QUEUEA) SKIPMSGS(55)
/*
Note:

  • REGION - A value of 0M means that the job is allowed to have the amount of storage it needs. However, if a job tries to acquire too much storage, it might impact other jobs in the system. We must ideally look to limit the REGION size and specify an absolute maximum value that the job is allowed to acquire.
  • SLOAD DDNAME(OUTPUTA) - Reloads the first queue from the input data set MY.UTILITY.OUTPUTA. The name of the queue loaded is the same as the queue name from which the data was copied.
  • SLOAD QUEUE(TOQ) FROMQUEUE(QUEUEA) SKIPMSGS(55) - Reloads the messages that were copied from the queue QUEUEA (from the input data set MY.UTILITY.COPYA). The messages are reloaded to the queue called TOQ. In processing the messages in QUEUEA, the first 55 messages are ignored, and loading starts from the 56th message.


Usage notes

  1. To use the SLOAD function, the queues or page sets involved must not be in use when the function is invoked.
  2. If SLOAD fails, or is forced to take a syncpoint, no further CSQUTIL functions are attempted.
  3. CSQUTIL uses MQPMO_SET_ALL_CONTEXT to ensure that the message descriptor fields remain the same as the original copy. It therefore needs an access of CONTROL in the CONTEXT profile of the queue. For full details, see Profiles for context security.

Parent topic: IBM MQ utility program (CSQUTIL) on z/OS