public class Container extends API
This is the Java implementation of CICS Containers.
Applications should use methods on the Channel
class to obtain Containers.
For example:
Task t=Task.getTask();
Channel custData = t.createChannel("Customer_Data");
Container custRec = custData.createContainer("Customer_Record");
The string supplied to the createContainer() method is the name by which the Container object is known to CICS. The name is padded with spaces to 16 characters, if necessary, to conform to CICS naming conventions. If a container of the same name already exists in the channel, a ContainerErrorException is thrown.
A JCICS program that is passed a channel can access all the Container objects by using a Channel object without receiving the channel explicitly.
When a Channel object is instantiated, its getContainerNames() method returns a list of names of all the containers currently existing on this channel. When you have a container name, the container object can be obtained with the getContainer(java.lang.String,boolean) method. Use 'false' for the boolean parameter where no further checking for existence is required.
For example:
Task t = Task.getTask();
Channel chl = t.getCurrentChannel();
if (chl != null)
{
List<String> names = chl.getContainerNames();
for (String name : names)
{
Container custData = chl.getContainer(name, false);
// Process the container...
}
}
com.ibm.cics.server.API
for general restrictions on using the JCICS API.
Modifier and Type | Field and Description |
---|---|
static int |
DATATYPE_BIT
Constant for BIT type containers
|
static int |
DATATYPE_CHAR
Constant for CHAR type containers
|
static int |
MAX_CONTAINER_NAME_LENGTH
The maximum allowable length for a container name.
|
static int |
NOTSET
Constant for state that has yet been set
|
Modifier and Type | Method and Description |
---|---|
void |
append(byte[] byteArrayData)
Appends a byte[] to the end of the data in the Container.
|
void |
append(byte[] byteArrayData,
java.lang.String sourceCodePage)
Appends a byte[] to the end of the data in the Container.
|
void |
appendString(java.lang.String stringData)
Appends a String to the end of the data in the Container.
|
void |
delete()
Delete the Container in CICS, and remove it from the
owning Channel.
|
boolean |
exists()
Does the container exist in CICS yet ?
|
byte[] |
get()
Get the data from the Container.
|
int |
get(byte[] destination,
int sourceOffset,
int length)
Get a specified length of data at the given source offset from the Container into a pre-existing byte array.
|
int |
get(byte[] destination,
int destinationOffset,
int theSourceOffset,
int length)
Get a specified length of data at the given source offset from the Container
into the given destination offset in a pre-existing byte array.
|
byte[] |
get(int sourceOffset,
int length)
Get a specified length of data at the given source offset from the Container
|
byte[] |
get(java.lang.String targetCodePage)
Get the data from the Container.
|
byte[] |
get(java.lang.String targetCodePage,
int sourceOffset,
int length)
Get a specified length of data at the given source offset from the Container, converting the data
from the source code page into the given destination code page.
|
int |
getCCSID()
Get the CCSID value of the data returned by getNoConvert().
|
int |
getDatatype()
Get the datatype of this container.
|
int |
getLength()
Get the length of the data in the Container.
|
int |
getLength(java.lang.String targetCodePage)
Get the length of the data in the Container.
|
int |
getLengthNoConvert()
Get the length of the data in the Container without conversion.
|
java.lang.String |
getName()
Get the name of the Container as known to CICS.
|
byte[] |
getNoConvert()
Get the data from the Container without conversion.
|
int |
getNoConvert(byte[] destination,
int sourceOffset,
int length)
Get a specified length of data at the given source offset from the Container into a pre-existing byte array.
|
int |
getNoConvert(byte[] destination,
int destinationOffset,
int theSourceOffset,
int length)
Get a specified length of data at the given source offset from the Container
into the given destination offset in a pre-existing byte array.
|
byte[] |
getNoConvert(int offset,
int length)
Get a specified length of data at the given source offset from the Container, without code page
conversion.
|
java.lang.String |
getString()
Get the data from a CICS Container and return it as a String.
|
void |
prepend(byte[] byteArrayData)
Prepends a byte[] to the start of the data in the Container.
|
void |
prepend(byte[] byteArrayData,
java.lang.String sourceCodePage)
Prepends a byte[] to the start of the data in the Container.
|
void |
prependString(java.lang.String stringData)
Prepends a String to the start of the data in the Container.
|
void |
put(byte[] byteArrayData)
Puts byte[] array data into the Container.
|
void |
put(byte[] byteArrayData,
java.lang.String sourceCodePage)
Puts byte[] array data into the Container.
|
void |
putString(java.lang.String stringData)
Puts String data into the Container.
|
java.lang.String |
toString() |
getCICSServerApiVersion
public static final int NOTSET
public static final int DATATYPE_BIT
public static final int DATATYPE_CHAR
public static final int MAX_CONTAINER_NAME_LENGTH
public java.lang.String getName()
public java.lang.String getString() throws ContainerErrorException, ChannelErrorException, CCSIDErrorException, CodePageErrorException, LengthErrorException
ContainerErrorException
- CONTAINERERRChannelErrorException
- CHANNELERRCCSIDErrorException
- CCSIDERRCodePageErrorException
- CODEPAGEERRLengthErrorException
- LENGERRpublic byte[] get() throws ContainerErrorException, ChannelErrorException, CCSIDErrorException, CodePageErrorException, LengthErrorException
ContainerErrorException
- CONTAINERERRChannelErrorException
- CHANNELERRCCSIDErrorException
- CCSIDERRCodePageErrorException
- CODEPAGEERRLengthErrorException
- LENGERRpublic byte[] get(java.lang.String targetCodePage) throws ContainerErrorException, ChannelErrorException, CCSIDErrorException, CodePageErrorException, LengthErrorException
targetCodePage
- is the code page in which the container data will be returnedContainerErrorException
- CONTAINERERRChannelErrorException
- CHANNELERRCCSIDErrorException
- CCSIDERRCodePageErrorException
- CODEPAGEERRLengthErrorException
- LENGERRpublic byte[] get(java.lang.String targetCodePage, int sourceOffset, int length) throws ContainerErrorException, ChannelErrorException, CCSIDErrorException, CodePageErrorException, LengthErrorException
targetCodePage
- the code page in which the container data will be returnedsourceOffset
- the offset at which to begin reading data from the Container. If negative, 0 is assumedlength
- length of data to retrieve starting at offsetContainerErrorException
- CONTAINERERRChannelErrorException
- CHANNELERRCCSIDErrorException
- CCSIDERRCodePageErrorException
- CODEPAGEERRLengthErrorException
- LENGERRpublic byte[] getNoConvert() throws ContainerErrorException, ChannelErrorException, CCSIDErrorException, CodePageErrorException, LengthErrorException
ContainerErrorException
- CONTAINERERRChannelErrorException
- CHANNELERRCCSIDErrorException
- CCSIDERRCodePageErrorException
- CODEPAGEERRLengthErrorException
- LENGERRpublic byte[] getNoConvert(int offset, int length) throws ContainerErrorException, ChannelErrorException, CCSIDErrorException, CodePageErrorException, LengthErrorException
offset
- start of the data (offset in bytes, 0 indexed). If negative, 0 is assumedlength
- length of data to retrieve starting at offsetContainerErrorException
- CONTAINERERRChannelErrorException
- CHANNELERRCCSIDErrorException
- CCSIDERRCodePageErrorException
- CODEPAGEERRLengthErrorException
- LENGERRpublic int get(byte[] destination, int sourceOffset, int length) throws ContainerErrorException, ChannelErrorException, CCSIDErrorException, CodePageErrorException, LengthErrorException
destination
- the byte array to populatesourceOffset
- the offset at which to begin reading data from the Container. If negative, 0 is assumedlength
- the length of data to retrieve from the ContainerContainerErrorException
- CONTAINERERRChannelErrorException
- CHANNELERRCCSIDErrorException
- CCSIDERRCodePageErrorException
- CODEPAGEERRLengthErrorException
- LENGTHERRpublic int get(byte[] destination, int destinationOffset, int theSourceOffset, int length) throws ContainerErrorException, ChannelErrorException, CCSIDErrorException, CodePageErrorException, LengthErrorException
destination
- the byte array to populatedestinationOffset
- the offset within the destination byte array at which to write outputtheSourceOffset
- the offset at which to begin reading data from the Container. If negative, 0 is assumedlength
- the length of data to retrieve from the ContainerContainerErrorException
- CONTAINERERRChannelErrorException
- CHANNELERRCCSIDErrorException
- CCSIDERRCodePageErrorException
- CODEPAGEERRLengthErrorException
- LENGTHERRpublic int getNoConvert(byte[] destination, int destinationOffset, int theSourceOffset, int length) throws ContainerErrorException, ChannelErrorException, CCSIDErrorException, CodePageErrorException, LengthErrorException
destination
- the byte array to populatedestinationOffset
- the offset within the destination byte array at which to write outputtheSourceOffset
- the offset at which to begin reading data from the Container. If negative, 0 is assumedlength
- the length of data to retrieve from the ContainerContainerErrorException
- CONTAINERERRChannelErrorException
- CHANNELERRCCSIDErrorException
- CCSIDERRCodePageErrorException
- CODEPAGEERRLengthErrorException
- LENGERRpublic int getNoConvert(byte[] destination, int sourceOffset, int length) throws ContainerErrorException, ChannelErrorException, CCSIDErrorException, CodePageErrorException, LengthErrorException
destination
- the byte array to populatesourceOffset
- the offset at which to begin reading data from the Container. If negative, 0 is assumedlength
- the length of data to retrieve from the ContainerContainerErrorException
- CONTAINERERRChannelErrorException
- CHANNELERRCCSIDErrorException
- CCSIDERRCodePageErrorException
- CODEPAGEERRLengthErrorException
- LENGERRpublic byte[] get(int sourceOffset, int length) throws ContainerErrorException, ChannelErrorException, CCSIDErrorException, CodePageErrorException, LengthErrorException
sourceOffset
- start of the data (offset in bytes, 1 indexed). If negative, 0 is assumedlength
- length of data to retrieve starting at offsetContainerErrorException
- CONTAINERERRChannelErrorException
- CHANNELERRCCSIDErrorException
- CCSIDERRCodePageErrorException
- CODEPAGEERRLengthErrorException
- LENGERRpublic boolean exists()
public int getLength() throws ContainerErrorException, ChannelErrorException, CCSIDErrorException, CodePageErrorException
ContainerErrorException
- CONTAINERERRChannelErrorException
- CHANNELERRCCSIDErrorException
- CCSIDERRCodePageErrorException
- CODEPAGEERRpublic int getLength(java.lang.String targetCodePage) throws ContainerErrorException, ChannelErrorException, CCSIDErrorException, CodePageErrorException
targetCodePage
- is the code page into which the container data will be converted when retrieved from the container.ContainerErrorException
- CONTAINERERRChannelErrorException
- CHANNELERRCCSIDErrorException
- CCSIDERRCodePageErrorException
- CODEPAGEERRpublic int getLengthNoConvert() throws ContainerErrorException, ChannelErrorException, CCSIDErrorException, CodePageErrorException
ContainerErrorException
- CONTAINERERRChannelErrorException
- CHANNELERRCCSIDErrorException
- CCSIDERRCodePageErrorException
- CODEPAGEERRpublic int getCCSID()
public int getDatatype() throws ContainerErrorException, ChannelErrorException
ContainerErrorException
- CONTAINERERRChannelErrorException
- CHANNELERRpublic void append(byte[] byteArrayData) throws ContainerErrorException, ChannelErrorException, InvalidRequestException, CCSIDErrorException, CodePageErrorException
byteArrayData
- data to be appended to the existing data in the Container.ContainerErrorException
- CONTAINERERRChannelErrorException
- CHANNELERRInvalidRequestException
- INVREQCCSIDErrorException
- CCSIDERRCodePageErrorException
- CODEPAGEERRpublic void prepend(byte[] byteArrayData) throws ContainerErrorException, ChannelErrorException, InvalidRequestException, CCSIDErrorException, CodePageErrorException
byteArrayData
- data to be prepended to the existing data in the Container.ContainerErrorException
- CONTAINERERRChannelErrorException
- CHANNELERRInvalidRequestException
- INVREQCCSIDErrorException
- CCSIDERRCodePageErrorException
- CODEPAGEERRpublic void put(byte[] byteArrayData) throws ContainerErrorException, ChannelErrorException, InvalidRequestException, CCSIDErrorException, CodePageErrorException
byteArrayData
- data to be put into the Container.ContainerErrorException
- CONTAINERERRChannelErrorException
- CHANNELERRInvalidRequestException
- INVREQCCSIDErrorException
- CCSIDERRCodePageErrorException
- CODEPAGEERRpublic void append(byte[] byteArrayData, java.lang.String sourceCodePage) throws ContainerErrorException, ChannelErrorException, InvalidRequestException, CCSIDErrorException, CodePageErrorException
byteArrayData
- data to be appended to the existing data in the Container.sourceCodePage
- is the code page in which the byteArrayData is encoded.ContainerErrorException
- CONTAINERERRChannelErrorException
- CHANNELERRInvalidRequestException
- INVREQCCSIDErrorException
- CCSIDERRCodePageErrorException
- CODEPAGEERRpublic void prepend(byte[] byteArrayData, java.lang.String sourceCodePage) throws ContainerErrorException, ChannelErrorException, InvalidRequestException, CCSIDErrorException, CodePageErrorException
byteArrayData
- data to be appended to the existing data in the Container.sourceCodePage
- is the code page in which the byteArrayData is encoded.ContainerErrorException
- CONTAINERERRChannelErrorException
- CHANNELERRInvalidRequestException
- INVREQCCSIDErrorException
- CCSIDERRCodePageErrorException
- CODEPAGEERRpublic void put(byte[] byteArrayData, java.lang.String sourceCodePage) throws ContainerErrorException, ChannelErrorException, InvalidRequestException, CCSIDErrorException, CodePageErrorException
byteArrayData
- data to be put into the Container.sourceCodePage
- is the code page in which the byteArrayData is encoded.ContainerErrorException
- CONTAINERERRChannelErrorException
- CHANNELERRInvalidRequestException
- INVREQCCSIDErrorException
- CCSIDERRCodePageErrorException
- CODEPAGEERRpublic void appendString(java.lang.String stringData) throws ContainerErrorException, ChannelErrorException, InvalidRequestException, CCSIDErrorException, CodePageErrorException
stringData
- data to be put into the Container.ContainerErrorException
- CONTAINERERRChannelErrorException
- CHANNELERRInvalidRequestException
- INVREQCCSIDErrorException
- CCSIDERRCodePageErrorException
- CODEPAGEERRpublic void prependString(java.lang.String stringData) throws ContainerErrorException, ChannelErrorException, InvalidRequestException, CCSIDErrorException, CodePageErrorException
stringData
- data to be put into the Container.ContainerErrorException
- CONTAINERERRChannelErrorException
- CHANNELERRInvalidRequestException
- INVREQCCSIDErrorException
- CCSIDERRCodePageErrorException
- CODEPAGEERRpublic void putString(java.lang.String stringData) throws ContainerErrorException, ChannelErrorException, InvalidRequestException, CCSIDErrorException, CodePageErrorException
stringData
- data to be put into the Container.ContainerErrorException
- CONTAINERERRChannelErrorException
- CHANNELERRInvalidRequestException
- INVREQCCSIDErrorException
- CCSIDERRCodePageErrorException
- CODEPAGEERRpublic void delete() throws ContainerErrorException, ChannelErrorException, InvalidRequestException
ContainerErrorException
- CONTAINERERRChannelErrorException
- CHANNELERRInvalidRequestException
- INVREQpublic java.lang.String toString()
toString
in class java.lang.Object