Package com.ibm.cics.server
Class TSQ
java.lang.Object
com.ibm.cics.server.API
com.ibm.cics.server.Resource
com.ibm.cics.server.RemotableResource
com.ibm.cics.server.TSQ
- All Implemented Interfaces:
Serializable
This Class provides the Java interface to CICS Temporary Storage Queues (TSQs).
A temporary storage (TS) queue is a set of data items that can be read and re-read in any sequence, and TSQ resources can be dynamically created at runtime. The following CICS temporary storage commands are supported: DELETEQ TS, READQ TS, and WRITEQ TS.
Example writing to a TSQ:
// Create an in memory temporary storage queue
TSQ tsq = new TSQ();
tsq.setType(TSQType.MAIN);
// Set the TSQ name
tsq.setName("TSQWRITE");
// Write to the temporary storage queue
String message = "Hello from JCICS";
try
{
tsq.writeString(message);
}
catch (CicsConditionException cce)
{
cce.printStackTrace();
}
Example reading from a TSQ:
// Create an ItemHolder to be used to read bytes from the TSQ
ItemHolder holder = new ItemHolder();
try
{
// Read item from the TSQ into the ItemHolder
tsq.readNextItem(holder);
// Extract the string data
String strData = holder.getStringValue()
}
catch (CicsConditionException cce)
{
cce.printStackTrace();
}
Example reading a specific item from a TSQ:
// Create an ItemHolder to be used to read bytes from the TSQ
ItemHolder holder = new ItemHolder();
try
{
// Read item number 2 from the TSQ into the ItemHolder
// Note: TSQ item numbers start from 1, not zero
int itemNumber = 2;
tsq.readItem(itemNumber, holder);
// Extract the string data
String strData = holder.getStringValue()
}
catch (CicsConditionException cce)
{
cce.printStackTrace();
}
- See Also:
- Since CICS TS version:
- 1.3
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddelete()Delete a Temporary Storage Queue (TSQ).getName()Return the name of the TSQ as a string using the LOCALCCSID value as the encoding.byte[]Return the queueName of the TSQ.getType()Return the type of the TSQ.intreadItem(int item, ItemHolder holder) Read a specified item from a TSQ.intreadNextItem(ItemHolder holder) Read the next item from a TSQ.voidrewriteItem(int item, byte[] data) Rewrite an existing item.voidrewriteItemConditional(int item, byte[] data) Rewrite an existing item.voidSets the name of the TSQ.voidsetQueueName(byte[] queueName) Sets the queueName of the TSQ.voidSets the type of the TSQ.intwriteItem(byte[] data) Simplest version ofWRITEQ TS.intwriteItemConditional(byte[] data) Write an item to a TSQ.intwriteString(String data) Simple version ofWRITEQ TS.Methods inherited from class com.ibm.cics.server.RemotableResource
getSysId, setSysIdMethods inherited from class com.ibm.cics.server.Resource
getDescription, setDescriptionMethods inherited from class com.ibm.cics.server.API
getCICSServerApiVersion
-
Constructor Details
-
TSQ
public TSQ()Construct a TSQ bean.- Since CICS TS version:
- 1.3
-
TSQ
Construct a TSQ bean with a name.- Parameters:
name- The name of the TSQ. This is padded with blanks and converted to bytes using the LOCALCCSID value. Over-length queue names will be truncated.- Throws:
NullPointerException- name is null- Since CICS TS version:
- 6.1
-
TSQ
Construct a TSQ bean with name , description and sysId.- Parameters:
name- The name of the TSQ. This is padded with blanks and converted to bytes using the LOCALCCSID value. Over-length queue names will be truncated.description- The description of the TSQ.sysId- sysId the name of the CICS system. If less than 4 characters, it is padded to 4 characters. If more than 4 characters it is cropped to be 4 characters.- Throws:
InvalidSystemIdException- This exception is thrown if an empty SYSID is supplied.- Since CICS TS version:
- 6.3
-
-
Method Details
-
delete
public void delete() throws InvalidRequestException, IOErrorException, ISCInvalidRequestException, NotAuthorisedException, InvalidQueueIdException, InvalidSystemIdExceptionDelete a Temporary Storage Queue (TSQ).- Throws:
InvalidRequestException- An INVREQ occurred.IOErrorException- An IOERR occurred.ISCInvalidRequestException- An ISCINVREQ occurred.NotAuthorisedException- A NOTAUTH occurred.InvalidQueueIdException- A QIDERR occurred.InvalidSystemIdException- A SYSIDERR occurred.- Since CICS TS version:
- 1.3
-
getName
Return the name of the TSQ as a string using the LOCALCCSID value as the encoding. -
getQueueName
public byte[] getQueueName()Return the queueName of the TSQ.- Returns:
- byte[] the TSQ queueName
- Since CICS TS version:
- 1.3
-
getType
Return the type of the TSQ.- Returns:
- TSQType the type of the TSQ
- Since CICS TS version:
- 1.3
-
readItem
public int readItem(int item, ItemHolder holder) throws InvalidRequestException, IOErrorException, ISCInvalidRequestException, ItemErrorException, LengthErrorException, NotAuthorisedException, InvalidQueueIdException, InvalidSystemIdException Read a specified item from a TSQ.- Parameters:
item- The number of the item to read. Note: TSQ item numbers start from 1, not zero.holder- The holder for the data to be returned.- Returns:
- The number of items in the queue.
- Throws:
InvalidRequestException- An INVREQ occurred.IOErrorException- An IOERR occurred.ISCInvalidRequestException- An ISCINVREQ occurred.ItemErrorException- An ITEMERROR occurred.LengthErrorException- A LENGERR occurred.NotAuthorisedException- A NOTAUTH occurred.InvalidQueueIdException- A QIDERR occurred.InvalidSystemIdException- A SYSIDERR occurred.- Since CICS TS version:
- 1.3
-
readNextItem
public int readNextItem(ItemHolder holder) throws InvalidRequestException, IOErrorException, ISCInvalidRequestException, ItemErrorException, LengthErrorException, NotAuthorisedException, InvalidQueueIdException, InvalidSystemIdException Read the next item from a TSQ.- Parameters:
holder- The holder for the data to be returned.- Returns:
- The number of items in the queue.
- Throws:
InvalidRequestException- An INVREQ occurred.IOErrorException- An IOERR occurred.ISCInvalidRequestException- An ISCINVREQ occurred.ItemErrorException- An ITEMERROR occurred.LengthErrorException- A LENGERR occurred.NotAuthorisedException- A NOTAUTH occurred.InvalidQueueIdException- A QIDERR occurred.InvalidSystemIdException- A SYSIDERR occurred.- Since CICS TS version:
- 1.3
-
rewriteItem
public void rewriteItem(int item, byte[] data) throws InvalidRequestException, IOErrorException, ISCInvalidRequestException, ItemErrorException, LengthErrorException, NotAuthorisedException, InvalidQueueIdException, InvalidSystemIdException Rewrite an existing item. If there is insufficient space in the TS dataset, the task will be suspended.- Parameters:
item- The number of the item to be rewritten. Note: TSQ item numbers start from 1, not zerodata- A Java byte array containing the data to rewrite.- Throws:
InvalidRequestException- An INVREQ occurred.IOErrorException- An IOERR occurred.ISCInvalidRequestException- An ISCINVREQ occurred.ItemErrorException- An ITEMERROR occurred.LengthErrorException- A LENGERR occurred.NotAuthorisedException- A NOTAUTH occurred.InvalidQueueIdException- A QIDERR occurred.InvalidSystemIdException- A SYSIDERR occurred.- Since CICS TS version:
- 1.3
-
rewriteItemConditional
public void rewriteItemConditional(int item, byte[] data) throws InvalidRequestException, IOErrorException, ISCInvalidRequestException, ItemErrorException, LengthErrorException, NoSpaceException, NotAuthorisedException, InvalidQueueIdException, InvalidSystemIdException Rewrite an existing item. If there is insufficient space in the TS dataset, a NoSpaceException will be thrown.- Parameters:
item- The number of the item to be rewritten. Note: TSQ item numbers start from 1, not zerodata- A Java byte array containing the data to rewrite.- Throws:
InvalidRequestException- An INVREQ occurred.IOErrorException- An IOERR occurred.ISCInvalidRequestException- An ISCINVREQ occurred.ItemErrorException- An ITEMERROR occurred.LengthErrorException- A LENGERR occurred.NoSpaceException- A NOSPACE occurred.NotAuthorisedException- A NOTAUTH occurred.InvalidQueueIdException- A QIDERR occurred.InvalidSystemIdException- A SYSIDERR occurred.- Since CICS TS version:
- 1.3
-
setName
Sets the name of the TSQ. -
setQueueName
public void setQueueName(byte[] queueName) Sets the queueName of the TSQ.- Parameters:
queueName- the queueName of the TSQ. If the queueName passed in is shorter than 16 bytes it is padded to the correct length with spaces. Over-length queueNames will be truncated.- Throws:
NullPointerException- queueName is null- Since CICS TS version:
- 1.3
-
setType
Sets the type of the TSQ.- Parameters:
type- the type of the TSQ.- Since CICS TS version:
- 1.3
-
writeItem
public int writeItem(byte[] data) throws InvalidRequestException, IOErrorException, ISCInvalidRequestException, ItemErrorException, LengthErrorException, NotAuthorisedException, InvalidSystemIdException Simplest version ofWRITEQ TS. If there is insufficient space in the TS data-set, the task will be suspended.- Parameters:
data- A Java byte array containing the data to be written to the TSQ.- Returns:
- The item number assigned to the new item. Note: TSQ item numbers start from 1, not zero
- Throws:
InvalidRequestException- An INVREQ occurred.IOErrorException- An IOERR occurred.ISCInvalidRequestException- An ISCINVREQ occurred.ItemErrorException- An ITEMERROR occurred.LengthErrorException- A LENGERR occurred.NotAuthorisedException- A NOTAUTH occurred.InvalidSystemIdException- A SYSIDERR occurred.- Since CICS TS version:
- 1.3
-
writeString
public int writeString(String data) throws InvalidRequestException, IOErrorException, ISCInvalidRequestException, ItemErrorException, LengthErrorException, NotAuthorisedException, InvalidSystemIdException Simple version ofWRITEQ TS. If there is insufficient space in the TS data-set, the task will be suspended.- Parameters:
data- A String containing the data to be written to the TSQ. The String is converted into a byte-array with LOCALCCSID.- Returns:
- The item number assigned to the new item.
- Throws:
InvalidRequestException- An INVREQ occurred.IOErrorException- An IOERR occurred.ISCInvalidRequestException- An ISCINVREQ occurred.ItemErrorException- An ITEMERROR occurred.LengthErrorException- A LENGERR occurred.NotAuthorisedException- A NOTAUTH occurred.InvalidSystemIdException- A SYSIDERR occurred.- Since CICS TS version:
- 5.1
-
writeItemConditional
public int writeItemConditional(byte[] data) throws InvalidRequestException, IOErrorException, ISCInvalidRequestException, ItemErrorException, LengthErrorException, NoSpaceException, NotAuthorisedException, InvalidSystemIdException Write an item to a TSQ. If there is insufficient space in the TS data set, a NoSpaceException will be thrown.- Parameters:
data- A Java byte array containing the data to rewrite.- Returns:
- The item number assigned to the new item.
- Throws:
InvalidRequestException- An INVREQ occurred.IOErrorException- An IOERR occurred.ISCInvalidRequestException- An ISCINVREQ occurred.ItemErrorException- An ITEMERROR occurred.LengthErrorException- A LENGERR occurred.NoSpaceException- A NOSPACE occurred.NotAuthorisedException- A NOTAUTH occurred.InvalidSystemIdException- A SYSIDERR occurred.- Since CICS TS version:
- 1.3
-