cwbRC_AddParm

Purpose

Add a parameter to the program that is identified by the handle. This function should be called once for each parameter that is to be added to the program. When the program is called the parameters will be in the same order that they are added using this function.

Syntax

unsigned int CWB_ENTRY cwbRC_AddParm(
                             cwbRC_PgmHandle       program,
                             unsigned short        type,
                             unsigned long         length,
                             const unsigned char  *parameter);

Parameters

cwbRC_PgmHandle program - input
Handle that was returned by a previous call to the cwbRC_CreatePgm API. It identifies the program object.
unsigned short type - input
The type of parameter this is. Use one of the defined parameter types: CWBRC_INPUT, CWBRC_OUTPUT, CWBRC_INOUT. If you want to automatically convert between local CCSID and host CCSID, add the appropriate convert flag to this field with a bitwise, or use one of the defined parameter types:
  • CWBRC_TEXT_CONVERT
  • CWBRC_TEXT_CONVERT_INPUT
  • CWBRC_TEXT_CONVERT_OUTPUT
The last two types are intended for use with CWBRC_INOUT when conversion is only needed in one direction.
unsigned long length - input
The length of the parameter. If this is an CWBRC_OUTPUT parameter, the length should be the length of the buffer where the returned parameter will be written.
const unsigned char * parameter - input
Pointer to a buffer that will contain: the value if the type is CWBRC_INPUT or CWBRC_INOUT, or the place where the returned parameter is to be written if the type is CWBRC_OUTPUT or CWBRC_INOUT.

Return Codes

The following list shows common return values:

CWB_OK
Successful completion.
CWBRC_INVALID_PROGRAM
Invalid program handle.
CWBRC_INVALID_TYPE
Invalid type specified.
CWBRC_INVALID_PARM_LENGTH
Invalid parameter length.
CWBRC_INVALID_PARM
Invalid parameter.

Usage

Parameter data is assumed to be binary. No conversion will be performed on the parameter data unless one of the conversion flags is set. For example:

cwbRC_AddParm( hPgm, 
CWBRC_INOUT | CWBRC_TEXT_CONVERT_OUTPUT, 
bufferSize,
buffer ); 

will use the buffer as is to send to the host, and will convert the output (eg to ASCII) before putting the result into the buffer.