Are you wondering how send the arguments for CICS Transactions. There will be many cases when user wants to call specific logic in the application code based on particular condition. Writing separate programs for each condition and defining separate transaction for each such program will be difficult for an application programmer. Using the power CICS APIs, CICS application programmer can send arguments for a transaction.
TXSeries for Multi-platforms provides wide verity of CICS APIs. Using EXEC CICS RECEIVE API, user can read the data from terminal. As most of the terminals uses 24x80 screens, each line can have a maximum of 80 characters. Using EXEC CICS RECEIVE API, user can read the 80 characters as described in pseudo code. After reading, user needs to parse the character string based on requirement. The first four characters contains the transaction name. User can use the remaining 75 characters to pass the character arguments for the transaction.
void main (void)
{
cics_char_t TextBuffer [80];
cics_sshort_t TextLength = 80;
memset(TextBuffer, ' ', 79);
TextBuffer [79] = '\0';
EXEC CICS RECEIVE
INTO(Text_Buffer)
LENGTH(TextLength);
/* Read the Trasaction character arguments */
/* 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 */
/* SAMP 1*/ /* SAMP is the transaction and '1' is the argument */
/* SAMP 2*/ /* SAMP is the transaction and '2' is the argument */
/* SAMP 3*/ /* SAMP is the transaction and '3' is the argument */
/* SAMP 111 2 33*/
if (Text_Buffer [4] != ' ')
print(Error Message/Usage)
switch(Text_Buffer [5])
{
case '1' : Business Logic 1;
break;
case '2' : Business Logic 2;
break;
case '3' : Business Logic 3;
break;
.
.
.
.
Default : Business Logic ;
break;
}
// Business Logic //
}
User can also pass multiple arguments to the transaction using some delimiter. But in application program it needs to be parsed based on the delimiter or by using some tokenizing techniques.