Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

ALLOCATE DESCRIPTOR - Request SQL descriptor area

You use ALLOCATE DESCRIPTOR to create an SQL descriptor area. The descriptor area is used in dynamic statements and cursor descriptions as the interface between the application program and the SQL database.

The structure of an item descriptor and how they are used is described in section "Descriptor area". ALLOCATE DESCRIPTOR creates the descriptor area but does not define its contents.



ALLOCATE DESCRIPTOR GLOBAL descriptor [WITH MAX number ]

descriptor ::= { alphanumeric_literal | : host_variable }

number ::= { integer | : host_variable }



GLOBAL

The descriptor area you create can be used in any compilation unit of the current SQL session.


descriptor

String containing the name of the SQL descriptor area. For descriptor you can specify an alphanumeric literal (not in hexadecimal format) or an alphanumeric host variable of the SQL data type CHAR(n), where 1 <= n <= 18.

The descriptor area name can start and end with one or more blanks. Once leading or trailing blanks have been removed, the remaining string must be an unqualified name (see section "Unqualified names").

Two descriptor are names are considered identical if, once the blanks have been removed, the remaining unqualified names are identical (see section "Identical unqualified names").


number

Maximum number of item descriptors in the SQL descriptor area.

For number you can specify an integer or a host variable of the SQL data type SMALLINT, where 1 <= number <= 1000.

number determines the size of the reserved SQL descriptor area.
If you store longer alphanumeric values in the descriptor area, the space in the descriptor area may be insufficient and an appropriate SQLSTATE is returned. In this case, you must increase the value of number (see example).

In UTM applications, the “UTM conversation memory” is used to store SQL descriptor areas. If this memory is insufficient, an error message is issued.

WITH MAX number omitted:
20 is the default value for number.

Examples

Create an SQL descriptor area for up to 100 item descriptors:

ALLOCATE DESCRIPTOR GLOBAL :demo_desc WITH MAX 100

Create an SQL descriptor area for 100 item descriptors. The descriptor area should be large enough for the item descriptors to be able to store values of the type CHAR(80).

ALLOCATE DESCRIPTOR GLOBAL :demo_desc WITH MAX 200

See also

DEALLOCATE DESCRIPTOR, DESCRIBE, GET DESCRIPTOR, SET DESCRIPTOR