cwbRC_SetParm

Purpose

Set the parameter value identified by the index. The index will range from 0 to the total number of parameters - 1. This number can be obtained by calling the cwbRC_GetParmCount API. Note that this function is to be used to change a parameter. Use cwbRC_AddParm to create the parameter.

Syntax

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

Parameters

cwbRC_PgmHandle handle - input
Handle that was returned by a previous call to the cwbRC_CreatePgm API. It identifies the program object.
unsigned short index - input
The number of the specific parameter in this program that should be changed. This index is zero-based.
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 latter two 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_OUT 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 return 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_SetParm( 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 (for example, to ASCII) before putting the result into the buffer.