The SPOOLREAD command obtains the next record from the system spooler.

SPOOLREAD
>>-SPOOLREAD--TOKEN(data-area)--INTO(data-area)----------------->
>--+------------------------+--+----------------------+--------->
'-MAXFLENGTH(data-value)-' '-TOFLENGTH(data-area)-'
.--------------------.
V |
>----+-NOHANDLE-------+-+--------------------------------------><
'-RESP-+-------+-'
'-RESP2-'
Conditions:
ALLOCERR, ENDFILE, ILLOGIC, INVREQ, LENGERR, NOSPOOL, NOSTG,
NOTFND, NOTOPEN, SPOLBUSY, SPOLERR, STRELERR
Options
- INTO(data-area)
- specifies the data area for the variable-length data. It is a receiver
field.
- MAXFLENGTH(data-value)
- specifies, as a fullword binary variable, the maximum length of data
transferred. This is set by the user on input. The limit of length is 32 760 bytes. This is the maximum size of the CICS®
buffer used to read a record.
- TOFLENGTH(data-area)
- specifies, as a fullword binary variable, the length of the data that
is transferred. This is set by CICS on input. It is optional and, if it is
omitted, you are not notified of the actual length of the data received.
- TOKEN(data-area)
- specifies the 8-character CICS-allocated token used to identify a report.
Conditions
Note: There are no default actions.
- ALLOCERR
- occurs in any of the following situations:
- Dynamic allocation has rejected a request to allocate an input data set.
RESP2 gives the dynamic allocation response code that denotes this error.
The first two characters are the information reason code (S99INFO), and the
second two are the error reason code (S99ERROR), as defined in the z/OS®: MVS™ Programming: Authorized Assembler Services Guide, SA22-7608.
- ENDFILE
- occurs in any of the following situations:
- All data for the current spool file being read has been retrieved. You
should proceed to issue a SPOOLCLOSE command as soon as possible, to release
the lock on the JES single thread, and to terminate current SYSOUT data set
processing.
- ILLOGIC
- RESP2 values:
- 3
- Invalid CLASS value specified.
- INVREQ
- RESP2 values:
- 4
- Unsupported language.
- 8
- Unsupported function.
- 12
- Read attempt after end of file.
- 24
- INTO missing.
- 40
- Subsystem interface already enabled.
Note: Errors 1024 and
over are internal, and should not occur. If one of these error codes is returned,
contact your IBM® support center.
- LENGERR
- occurs in any of the following situations:
- You provided insufficient buffer space to read your record, or you requested
more than the maximum allowable buffer size of 32 760 bytes (the
size of a CICS buffer used to read a record). If the buffer space is too small,
it receives as much data as possible. The amount of data truncated is then
placed in the RESP2 field. If the TOFLENGTH operand is specified, the actual
length of the record is placed here.
Note: In the event of a length
error due to insufficient buffer space, the next record is not read until
the error has been corrected and the current record reread.
RESP2 indicates the amount of data truncated, or shows zero if the MAXFLENGTH
field is greater than the maximum allowable buffer size 32 760 bytes.
- NOSPOOL
- RESP2 values:
- 4
- No subsystem present.
- 8
- Interface being disabled; CICS is quiescing.
- 12
- Interface has been stopped.
- NOSTG
- occurs in any of the following situations:
- NOTFND
- RESP2 values:
- 4
- No data sets could be located for retrieval for the specified external
writer name.
- NOTOPEN
- RESP2 values:
- 8
- Data set has not been opened.
- 12
- Attempt to read an output file.
- 1024
- Subtask OPEN macro failure.
- SPOLBUSY
- RESP2 values:
- 4
- Interface already in use by another task.
- 8
- Interface already in use by current task.
Also occurs (RESP2 not set) in any of the following situations:
- The JES/input single thread within the JES interface was not available.
- SPOLERR
- occurs in any of the following situations:
- STRELERR
- occurs in any of the following situations: