MQCHARV - Variable Length String
Use the MQCHARV structure to describe a variable length string.
Availability
AIX®
IBM® i
Linux®
Windows
Character set and encoding
Data in the MQCHARV must be in the encoding of the local queue manager that is given by MQENC_NATIVE and the character set of the VSCCSID field within the structure. If the application is running as an MQ client, the structure must be in the encoding of the client. Some character sets have a representation that depends on the encoding. If VSCCSID is one of these character sets, the encoding used is the same encoding as that of the other fields in the MQCHARV. The character set identified by VSCCSID can be a double-byte character set (DBCS).
Usage
The MQCHARV structure addresses data that might be discontiguous with the structure containing it. To address this data, fields declared with the pointer data type can be used. Be aware that COBOL does not support the pointer data type in all environments. Because of this, the data can also be addressed using fields that contain the offset of the data from the start of the structure containing the MQCHARV.
Fields
| Field name and description | Name of constant | Initial value (if any) of constant |
|---|---|---|
| VSPtr (pointer to the variable length string) | None | Null pointer or null bytes. |
| VSOffset (offset in bytes of the variable length string from the start of the structure that contains this MQCHARV structure) | None | 0 |
| VSBufSize (size in bytes of the buffer addressed by the VSPtr or VSOffset field) | MQVS_USE_VSLENGTH | 0 |
| VSLength (length in bytes of the variable length string addressed by the VSPtr or VSOffset field) | None | 0 |
| VSCCSID (character set identifier of the variable length string addressed by the VSPtr or VSOffset field) | MQCCSI_APPL | -3 |
|
Note: In the C programming language, the macro variable MQCHARV_DEFAULT contains the values that are
listed in the table. It can be used in the following way to provide initial values for the fields in
the structure:
|
||
Language declarations
C declaration for MQCHARV
typedef struct tagMQCHARV MQCHARV;
struct tagMQCHARV {
MQPTR VSPtr; /* Address of variable length string */
MQLONG VSOffset; /* Offset of variable length string */
MQLONG VSBufSize; /* Size of buffer */
MQLONG VSLength; /* Length of variable length string */
MQLONG VSCCSID; /* CCSID of variable length string */
};
COBOL declaration for MQCHARV
** MQCHARV structure
10 MQCHARV.
** Address of variable length string
15 MQCHARV-VSPTR POINTER.
** Offset of variable length string
15 MQCHARV-VSOFFSET PIC S9(9) BINARY.
** Size of buffer
15 MQCHARV-VSBUFSIZE PIC S9(9) BINARY.
** Length of variable length string
15 MQCHARV-VSLENGTH PIC S9(9) BINARY.
** CCSID of variable length string
15 MQCHARV-VSCCSID PIC S9(9) BINARY.
COPY CMQCHRVV REPLACING POINTER BY ==BINARY PIC S9(9)==.
where CMQCHRVV can be exchanged for the copy book to be used.PL/I declaration for MQCHARV
dcl
1 MQCHARV based,
3 VSPtr pointer, /* Address of variable length string */
3 VSOffset fixed bin(31), /* Offset of variable length string */
3 VSBufSize fixed bin(31), /* Size of buffer */
3 VSLength fixed bin(31), /* Length of variable length string */
3 VSCCSID fixed bin(31); /* CCSID of variable length string */
High Level Assembler declaration for MQCHARV
MQCHARV DSECT
MQCHARV_VSPTR DS F Address of variable length string
MQCHARV_VSOFFSET DS F Offset of variable length string
MQCHARV_VSBUFSIZE DS F Size of buffer
MQCHARV_VSLENGTH DS F Length of variable length string
MQCHARV_VSCCSID DS F CCSID of variable length string
*
MQCHARV_LENGTH EQU *-MQCHARV
ORG MQCHARV
MQCHARV_AREA DS CL(MQCHARV_LENGTH)