public class TSQ extends RemotableResource
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();
}
com.ibm.cics.server.API
for general restrictions on using the JCICS API.
,
Serialized FormConstructor and Description |
---|
TSQ()
Construct a TSQ bean.
|
TSQ(java.lang.String name)
Construct a TSQ bean with a name.
|
Modifier and Type | Method and Description |
---|---|
void |
delete()
Delete a Temporary Storage Queue (TSQ).
|
java.lang.String |
getName()
Return the name of the TSQ as a string using the LOCALCCSID
value as the encoding.
|
byte[] |
getQueueName()
Return the queueName of the TSQ.
|
TSQType |
getType()
Return the type of the TSQ.
|
int |
readItem(int item,
ItemHolder holder)
Read a specified item from a TSQ.
|
int |
readNextItem(ItemHolder holder)
Read the next item from a TSQ.
|
void |
rewriteItem(int item,
byte[] data)
Rewrite an existing item.
|
void |
rewriteItemConditional(int item,
byte[] data)
Rewrite an existing item.
|
void |
setName(java.lang.String name)
Sets the name of the TSQ.
|
void |
setQueueName(byte[] queueName)
Sets the queueName of the TSQ.
|
void |
setType(TSQType type)
Sets the type of the TSQ.
|
int |
writeItem(byte[] data)
Simplest version of
WRITEQ TS . |
int |
writeItemConditional(byte[] data)
Write an item to a TSQ.
|
int |
writeString(java.lang.String data)
Simple version of
WRITEQ TS . |
getSysId, setSysId
getDescription, setDescription
getCICSServerApiVersion
public TSQ()
public TSQ(java.lang.String name)
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.java.lang.NullPointerException
- name is nullpublic void delete() throws InvalidRequestException, IOErrorException, ISCInvalidRequestException, NotAuthorisedException, InvalidQueueIdException, InvalidSystemIdException
InvalidRequestException
- An INVREQ occurred.IOErrorException
- An IOERR occurred.ISCInvalidRequestException
- An ISCINVREQ occurred.NotAuthorisedException
- A NOTAUTH occurred.InvalidQueueIdException
- A QIDERR occurred.InvalidSystemIdException
- A SYSIDERR occurred.public java.lang.String getName()
public byte[] getQueueName()
public TSQType getType()
public int readItem(int item, ItemHolder holder) throws InvalidRequestException, IOErrorException, ISCInvalidRequestException, ItemErrorException, LengthErrorException, NotAuthorisedException, InvalidQueueIdException, InvalidSystemIdException
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.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.public int readNextItem(ItemHolder holder) throws InvalidRequestException, IOErrorException, ISCInvalidRequestException, ItemErrorException, LengthErrorException, NotAuthorisedException, InvalidQueueIdException, InvalidSystemIdException
holder
- The holder for the data to be returned.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.public void rewriteItem(int item, byte[] data) throws InvalidRequestException, IOErrorException, ISCInvalidRequestException, ItemErrorException, LengthErrorException, NotAuthorisedException, InvalidQueueIdException, InvalidSystemIdException
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.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.public void rewriteItemConditional(int item, byte[] data) throws InvalidRequestException, IOErrorException, ISCInvalidRequestException, ItemErrorException, LengthErrorException, NoSpaceException, NotAuthorisedException, InvalidQueueIdException, InvalidSystemIdException
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.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.public void setName(java.lang.String name) throws java.lang.NullPointerException
setName
in class Resource
name
- the name of the TSQ as a string.
This string is padded with blanks and converted to bytes using the
LOCALCCSID value. Over-length queue names will
be truncated.java.lang.NullPointerException
- queueName is nullpublic void setQueueName(byte[] queueName) throws java.lang.NullPointerException
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.java.lang.NullPointerException
- queueName is nullpublic void setType(TSQType type)
type
- the type of the TSQ.public int writeItem(byte[] data) throws InvalidRequestException, IOErrorException, ISCInvalidRequestException, ItemErrorException, LengthErrorException, NotAuthorisedException, InvalidSystemIdException
WRITEQ TS
.
If there is insufficient space in the TS data-set, the task will
be suspended.data
- A Java byte array containing the data to be written to the
TSQ.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.public int writeString(java.lang.String data) throws InvalidRequestException, IOErrorException, ISCInvalidRequestException, ItemErrorException, LengthErrorException, NotAuthorisedException, InvalidSystemIdException
WRITEQ TS
.
If there is insufficient space in the TS data-set, the task will
be suspended.data
- A String containing the data to be written to the
TSQ. The String is converted into a byte-array with LOCALCCSID.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.public int writeItemConditional(byte[] data) throws InvalidRequestException, IOErrorException, ISCInvalidRequestException, ItemErrorException, LengthErrorException, NoSpaceException, NotAuthorisedException, InvalidSystemIdException
data
- A Java byte array containing the data to rewrite.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.