Transient Data

The transient data classes, IccDataQueue and IccDataQueueId, allow you to store data in transient data queues for subsequent processing.

You can:

An IccDataQueue object is used to represent a temporary storage queue. An IccDataQueueId object is used to identify a queue by name. Once the IccDataQueueId object is initialized it can be used to identify the queue as an alternative to using its name, with the advantage of additional error detection by the C++ compiler.

The methods available in IccDataQueue class are similar to those in the IccTempStore class. For more information on these see Temporary storage.

Reading data

The readItem method is used to read items from the queue. It returns a reference to the IccBuf object that contains the information.

Writing data

The writeItem method of IccDataQueue adds a new item of data to the queue, taking the data from the buffer specified.

Deleting queues

The empty method deletes all items on the queue.

Example of managing transient data

This sample program demonstrates how to use the IccDataQueue and IccDataQueueId classes. It can be found in the samples directory (see Sample source code) as file ICC$DAT. Here the code is presented without the terminal IO requests.

#include "icceh.hpp"
#include "iccmain.hpp"

The first two lines include the header files for the foundation classes and the standard main function that sets up the operating environment for the application program.

const char* queueItems[] =
{
  "Hello World - item 1",
  "Hello World - item 2",
  "Hello World - item 3"
};

This defines some buffer for the sample program.

void IccUserControl::run()
{

The run method of IccUserControl class contains the user code for this example.

  short itemNum =1;
  IccBuf              buffer( 50 );
  IccDataQueueId      id( "ICCQ" );
  IccDataQueue        queue( id );
  queue.empty();

This fragment first creates an identification object, of type IccDataQueueId containing "ICCQ". It then creates an IccDataQueue object representing the transient data queue "ICCQ", which it empties of data.

  for (short i=0 ; i<3 ; i++)
  {
    buffer = queueItems[i];
    queue.writeItem( buffer );
  }

This loop writes the three data items to the transient data object. The data is passed by means of an IccBuf object that was created for this purpose.

  buffer = queue.readItem();
  while ( queue.condition() == IccCondition::NORMAL )
  {
    buffer = queue.readItem();
  }

Having written out three records we now read them back in to show they were successfully written.

  return;
}

The end of run, which returns control to CICS®.

See Appendix C. Output from sample programs for the expected output from this sample program.

[[ Contents Previous Page | Next Page Index ]]