Document revision date: 30 March 2001

## OpenVMS Calling Standard

Previous | Contents | Index

       E = A0 + I*LENGTH
         = POINTER + [I - L1]*LENGTH

The effective address, E, for element A(I1,I2) with FL_COLUMN clear:

       E = A0 + [I1*M2 + I2]*LENGTH
         = POINTER + [[I1 - L1]*M2 + I2 - L2]*LENGTH

The effective address, E, for element A(I1,I2) with FL_COLUMN set:

       E = A0 + [I2*M1 + I1]*LENGTH
         = POINTER + [[I2 - L2]*M1 + I1 - L1]*LENGTH

The effective address, E, for element A(I1, . . . ,In) with FL_COLUMN clear:

       E = A0 + [[[[...[I1]*M2 + ...]*Mn-2 + In-2]*Mn-1
          + In-1]*Mn + In]*LENGTH
         = POINTER + [[[[...[I1 - L1]*M2
          + ...]*Mn-2 + In-2 - Ln-2]*Mn-1
          + In-1 - Ln-1]*Mn + In - Ln]*LENGTH

The effective address, E, for element A(I1, . . . ,In) with FL_COLUMN set:

       E = A0 + [[[[...[In]*Mn-1 + ...]*M3 + I3]*M2 + I2]*M1 + I1]*LENGTH
         = POINTER + [[[[...[In - Ln]*Mn-1 + ...]*M3 + I3
           - L3]*M2 + I2 - L2]*M1 + I1 - L1]*LENGTH

## 5.5 Procedure Argument Descriptor (CLASS_P)

A descriptor for a procedure argument identifies a procedure and its result data type, if any.

On VAX processors, the descriptor for a procedure argument specifies its entry address and function value data type. On Alpha processors, the procedure argument descriptor is a pointer to the procedure descriptor, which is described in Section 3.4. Figure 5-5 shows the format of a procedure argument descriptor. Table 5-6 describes the fields of the descriptor.

Figure 5-5 Procedure Argument Descriptor Format

Table 5-6 Contents of the CLASS_P Descriptor
Symbol | Description
--- | ---
DSC$W_LENGTH DSC64$Q_LENGTH | Length associated with the function value, or 0 if no function value is returned.
DSC64$W_MBO | Must be 1. See Section 5.1.
DSC$B_DTYPE DSC64$B_DTYPE | Function value data-type code. Data-type codes are listed in Sections 4.1 and 4.2.
DSC$B_CLASS DSC64$B_CLASS | Defines the descriptor class code that must be equal to 5 for CLASS_P.
DSC$A_POINTER DSC64$PQ_POINTER | Address of entry mask to the procedure for VAX environments. Address of the procedure descriptor of the procedure for Alpha environments.
DSC64$L_MBMO | Must be -1. See Section 5.1.

Procedures return a function value as described in Section 2.5 for VAX or Section 3.8.7 for Alpha.

## 5.6 Decimal String Descriptor (CLASS_SD)

Figure 5-6 shows the format of a decimal string descriptor. Decimal size and scaling information for both scalar data and simple strings is given in this descriptor form. Table 5-7 describes the fields of the descriptor.

Figure 5-6 Decimal String Descriptor Format

Table 5-7 Contents of the CLASS_SD Descriptor
Symbol | Description
--- | ---
DSC$W_LENGTH DSC64$Q_LENGTH | Length of the data item in bytes, unless the DTYPE field contains the value 1 (aligned bit string) or 21 (packed-decimal string). Length of the data item is in bits for the bit string. Length of the data item is the number of 4-bit digits (not including the sign) for packed-decimal string.
DSC64$W_MBO | Must be 1. See Section 5.1.
DSC$B_DTYPE DSC64$B_DTYPE | A data-type code. Data-type codes are listed in Sections 4.1 and 4.2.
DSC$B_CLASS DSC64$B_CLASS | Defines the descriptor class code that must be equal to 9 for CLASS_SD.
DSC$A_POINTER DSC64$PQ_POINTER | Address of the first byte of data storage.
DSC64$L_MBMO | Must be -1. See Section 5.1.
DSC$B_SCALE DSC64$B_SCALE | Signed power-of-two or power-of-ten multiplier, as specified by FL_BINSCALE, to convert the internal form to external form. (See examples in Table 5-8.)
DSC$B_DIGITS DSC64$B_DIGITS | If nonzero, the unsigned number of decimal digits in the internal representation. If 0, the number of digits can be computed based on LENGTH. This field should be 0 unless the TYPE field specifies a string data type that could contain numeric values.
DSC$B_SFLAGS DSC64$B_SFLAGS | Scalar flag bits <23:16>:
Bits <18:16> | Reserved and must be 0.
DSC$V_FL_BINSCALE DSC64$V_FL_BINSCALE | If set, the scale factor specified by SCALE is a signed power-of-two multiplier to convert the internal form to external form. If not set, SCALE specifies a signed power-of-ten multiplier. (See examples in Table 5-8.)
Bit <23:20> | Reserved and must be 0.

Examples of SCALE and FL_BINSCALE interpretation are presented in Table 5-8.

Table 5-8 Internal-to-External BINSCALE Conversion Examples
Internal Value | SCALE | FL_BINSCALE | External Value
--- | --- | --- | ---
123 | +1 | 0 | 1230
123 | +1 | 1 | 246
200 | --2 | 0 | 2
200 | --2 | 1 | 50

## 5.7 Noncontiguous Array Descriptor (CLASS_NCA)

The noncontiguous array descriptor describes an array in which the storage of the array elements can be allocated with a fixed, nonzero number of bytes separating logically adjacent elements. Two elements are said to be logically adjacent if their subscripts differ by 1 in the most rapidly varying dimension only. The difference between the addresses of two adjacent elements is termed the stride. You can align elements by row or column, because the accessing algorithm in the called procedure handles both alignments.

This array descriptor is to be used where the calling program, at its option, can pass a slice of an array that contains noncontiguous allocations. This standard indicates no preference between the noncontiguous array descriptor (NCA) and the contiguous array descriptor (A), as described in Section 5.4, for language processors that always allocate contiguous arrays. Figure 5-7 shows the format of a noncontiguous array descriptor, which consists of three contiguous blocks. Table 5-9 describes the fields of the descriptor.

Figure 5-7 Noncontiguous Array Descriptor Format

Table 5-9 Contents of the CLASS_NCA Descriptor
Symbol | Description
--- | ---
DSC$W_LENGTH DSC64$Q_LENGTH | Length of an array element in bytes, unless the DTYPE field contains the value 1 (aligned bit string) or 21 (packed-decimal string). Length of an array element is in bits for the bit string. Length of an array element is the number of 4-bit digits (not including the sign) for a packed-decimal string.
DSC64$W_MBO | Must be 1. See Section 5.1.
DSC$B_DTYPE DSC64$B_DTYPE | A data-type code. Data-type codes are listed in Sections 4.1 and 4.2.
DSC$B_CLASS | Defines the descriptor class code that must be equal to 10 for CLASS_NCA.
DSC$A_POINTER DSC64$PQ_POINTER | Address of first actual byte of data storage.
DSC64$L_MBMO | Must be -1. See Section 5.1.
DSC$B_SCALE DSC64$B_SCALE | Signed power-of-two or power-of-ten multiplier, as specified by FL_BINSCALE, to convert the internal form to external form. (See Section 5.6.)
DSC$B_DIGITS DSC64$B_DIGITS | If nonzero, the unsigned number of decimal digits in the internal representation. If 0, the number of digits can be computed based on LENGTH. This field should be 0 unless the TYPE field specifies a string data type that could contain numeric values.
DSC$B_AFLAGS DSC64$B_AFLAGS | Array flag bits <23:16>:
Bits <18:16> | Reserved to Compaq. Must be 0.
DSC$V_FL_BINSCALE DSC64$V_FL_BINSCALE | If set, the scale factor specified by SCALE is a signed power-of-two multiplier to convert the internal form to external form. If not set, SCALE specifies a signed power-of-ten multiplier. (See Section 5.6.)
DSC$V_FL_REDIM DSC64$V_FL_REDIM | Must be 0.
DSC$V_FL_UNALLOC DSC64$V_FL_UNALLOC | If set, the storage for the array described by this descriptor has not been allocated; the POINTER field must contain 0. If not set, storage for the array described by this descriptor has been allocated; the POINTER field may or may not be 0, depending on the bounds of the array. (If the POINTER field contains a nonzero value, then this flag must not be set.)
DSC$V_FL_NODEALLOC | If set, the storage for the array described by this descriptor must not be deallocated. (The POINTER and other fields of this descriptor may be cleared or otherwise set to eliminate access to the described storage, but the storage itself belongs to some other descriptor which must be used to deallocate that storage.)
Bit <23:23> | Reserved to Compaq. Must be 0.
DSC$B_DIMCT DSC64$B_DIMCT | Number of dimensions, n.
DSC$L_ARSIZE DSC64$Q_ARSIZE | If the elements are contiguous, ARSIZE is the total size of the array (in bytes, unless the DTYPE field contains the value 21; see the description of LENGTH). If the elements are not allocated contiguously or if the program unit allocating the descriptor is uncertain whether the array is actually contiguous, the value placed in ARSIZE might be meaningless. For data type 1 (aligned bit string), LENGTH is in bits while ARSIZE is in bytes because the unit of length is in bits while the unit of allocation is in bytes.
DSC$A_A0 DSC64$PQ_A0 | Address of element A(0,0,...,0). This need not be within the actual array. It is the same as POINTER for zero-origin arrays. A0 = POINTER - ( S 1*L 1 + S 2*L 2 + ...+ S n *L n )
DSC$L_Si DSC64$Q_Si | Stride of the ith dimension. The difference between the addresses of successive elements of the ith dimension.
DSC$L_L i DSC64$Q_L i | Lower bound (signed) of the ith dimension.
DSC$L_U i DSC64$Q_U i | Upper bound (signed) of the ith dimension.

The following formulas specify the effective address, E, of an array element.

Caution Modification of the following formulas is required if DTYPE equals 1 or 21 because LENGTH is given in bits or 4-bit digits rather than bytes.

The effective address, E, of A(I):

       E = A0 + S1*I
         = POINTER + S1*[I - L1]

The effective address, E, of A(I1,I2):

       E = A0 + S1*I1 + S2*I2
         = POINTER + S1*[I1 - L1] + S2*[I2 - L2]

The effective address, E, of A(I1, . . . ,In):

       E = A0 + S1*I1 + . . . + Sn*In
         = POINTER + S1*[I1 - L1] + . . . + Sn*[In - Ln]

## 5.8 Varying String Descriptor (CLASS_VS)

A class VS descriptor is used for varying string data types (see Section 4.5).

As an input parameter, this format is not interchangeable with class 1 (CLASS_S) or with class 2 (CLASS_D). When a called procedure modifies a varying string passed by reference or by descriptor, it writes the new length, n, into CURLEN and can modify all bytes of BODY. Figure 5-8 shows the format of a varying string descriptor. Table 5-10 describes the fields of the descriptor.

Figure 5-8 Varying String Descriptor Format

Table 5-10 Contents of the CLASS_VS Descriptor
Symbol | Description
--- | ---
DSC$W_MAXSTRLEN DSC64$Q_MAXSTRLEN | Maximum length of the BODY field of the varying string in bytes in the range 0 to 2 16 - 1.
DSC64$W_MBO | Must be 1. See Section 5.1.
DSC$B_DTYPE DSC64$B_DTYPE | A data type code that has the value 37, which specifies the varying character string data type (see Sections 4.2 and 4.5). The use of other data types is reserved to Compaq.
DSC$B_CLASS DSC64$B_CLASS | Defines the descriptor class code that must be equal to 11 for CLASS_VS.
DSC$A_POINTER DSC64$PQ_POINTER | Address of the first field (CURLEN) of the varying string.
DSC64$L_MBMO | Must be -1. See Section 5.1.

Figure 5-9 illustrates the use of a 32-bit varying string descriptor to present a variable that is capable of holding a string value of up to five characters in length and that is currently holding the string value ABCD. As shown in the figure, MAXSTRLEN contains five, CURLEN contains four, string is currently ABCD, and the remaining byte is currently undefined.

Figure 5-9 Varying String Descriptor with Character String Data Type

## 5.9 Varying String Array Descriptor (CLASS_VSA)

A variant of the noncontiguous array descriptor is used to specify an array of varying strings where each varying string has the same maximum length. Each array element is of the varying string data type (see Section 4.5).

When a called procedure modifies a varying string in an array of varying strings passed to it by reference or by descriptor, it writes the new length, n, into CURLEN and can modify all bytes of BODY. The format of this descriptor is the same as the noncontiguous array descriptor except for the first two longwords. Figure 5-10 shows the format of a varying string array descriptor. Table 5-11 describes the fields of the descriptor.

Figure 5-10 Varying String Array Descriptor Format

Table 5-11 Contents of the CLASS_VSA Descriptor
Symbol | Description
--- | ---
DSC$W_MAXSTRLEN DSC64$Q_MAXSTRLEN | Maximum length of the BODY field of an array element in bytes in the range 0 to 2 16 - 1.
DSC64$W_MBO | Must be 1. See Section 5.1.
DSC$B_DTYPE DSC64$B_DTYPE | A data-type code that has the value 37, which specifies the varying character string data type (see Sections 4.2 and 4.5). The use of other data types is reserved to Compaq.
DSC$B_CLASS DSC64$B_CLASS | Defines the descriptor class code that must be equal to 12 for CLASS_VSA.
DSC$A_POINTER DSC64$PQ_POINTER | Address of the first actual byte of data storage.
DSC64$L_MBMO | Must be -1. See Section 5.1.

The remaining fields in the descriptor are identical to those in the noncontiguous array descriptor (NCA). The effective address computation of an array element produces the address of CURLEN of the desired element.

## 5.10 Unaligned Bit String Descriptor (CLASS_UBS)

A descriptor is used to pass an unaligned bit string (DSC$K_DTYPE_VU) that starts and ends on an arbitrary bit boundary. The descriptor provides two components: a base address and a signed relative bit position. Figure 5-11 shows the format of an unaligned bit string descriptor. Table 5-12 describes the fields of the descriptor.

Figure 5-11 Unaligned Bit String Descriptor Format

Table 5-12 Contents of the CLASS_UBS Descriptor
Symbol | Description
--- | ---
DSC$W_LENGTH DSC64$Q_LENGTH | Length of data item in bits.
DSC64$W_MBO | Must be 1. See Section 5.1.
DSC$B_DTYPE DSC64$B_DTYPE | A data-type code that has the value 34, which specifies the unaligned bit string data type (see Sections 4.1 and 4.2). The use of other data types is reserved to Compaq.
DSC$B_CLASS DSC64$B_CLASS | Defines the descriptor class code that must be equal to 13 for CLASS_UBS.
DSC$A_BASE DSC64$PQ_BASE | Base of the address relative to which the signed relative bit position, POS, is used to locate the bit string. The base address need not be the first actual byte of data storage.
DSC64$L_MBMO | Must be -1. See Section 5.1.
DSC$L_POS DSC64$Q_POS | Relative bit position with respect to BASE of the first bit of unaligned bit string.

Previous | Next | Contents | Index

| privacy and legal statement |
5973PRO_011.HTML