Document revision date: 19 July 1999
[Compaq] [Go to the documentation home page] [How to order documentation] [Help on this site] [How to contact us]
[OpenVMS documentation]

OpenVMS Calling Standard


Previous Contents Index

4.4 Reserved Data-Type Codes

All codes from 0 through 191 not otherwise defined in this standard are reserved to Digital. Codes 192 through 255 are reserved to Digital's Computer Special Systems Group and for customers for their own use.

Table 4-4 lists the data types and codes that are obsolete or reserved to Digital.

Table 4-4 Reserved Data Types
Symbol Code Purpose
DSC$K_DTYPE_CIT 31 Reserved to COBOL (intermediate temporary)
DSC$K_DTYPE_CIT2 64 Reserved to COBOL (intermediate temporary alternative 2)
DSC$K_DTYPE_TF 40 Reserved to DEBUG (Boolean true/false)
DSC$K_DTYPE_SV 41 Reserved to DEBUG (signed bit-field, aligned)
DSC$K_DTYPE_SVU 42 Reserved to DEBUG (signed bit-field, unaligned)
DSC$K_DTYPE_FIXED 43 Reserved to DEBUG (fixed binary---fixed point in Ada and fixed binary in PL/I)
DSC$K_DTYPE_TASK 44 Reserved to DEBUG (task type in Ada)
DSC$K_DTYPE_AC 45 Reserved to DEBUG (ASCIC text)
DSC$K_DTYPE_AZ 46 Reserved to DEBUG (ASCIZ text)
DSC$K_DTYPE_M68_S 47 Reserved to DEBUG (Motorola 68881 single precision, 32-bit) 1
DSC$K_DTYPE_M68_D 48 Reserved to DEBUG (Motorola 68881 double precision, 64-bit) 1
DSC$K_DTYPE_M68_X 49 Reserved to DEBUG (Motorola 68881 extended precision, 96-bit) 2
DSC$K_DTYPE_1750_S 50 Reserved to DEBUG (1750 single precision, 32-bit)
DSC$K_DTYPE_1750_X 51 Reserved to DEBUG (1750 extended precision, 48-bit)
DSC$K_DTYPE_WC 56 Reserved to DEBUG ( setlocale dependent C string)
No symbol defined 36 Obsolete
DSC$K_DTYPE_T2 38 Obsolete
DSC$K_DTYPE_VT2 39 Obsolete


1Differs from Alpha IEEE floating because of byte ordering.
2Differs from Alpha IEEE floating because of byte ordering and size.

4.4.1 Facility-Specific Data-Type Codes

Data-type codes 160 through 191 are reserved to Digital for facility-specific purposes. These codes must not be passed between facilities because different facilities can use the same code for different purposes. These codes might be used by compiler-generated code to pass parameters to the language-specific run-time support procedures associated with that language or with the OpenVMS Debugger.

As shown in Table 4-4, data-type codes 31 and 64 are reserved for the COBOL facility. Codes 40 through 51 and 56 are reserved for the OpenVMS Debugger facility.

4.5 Varying Character String Data Type (DSC$K_DTYPE_VT)

The varying character string data type (DSC$K_DTYPE_VT) consists of the following two fixed-length areas allocated contiguously with no padding in between (see Figure 4-1):
CURLEN An unsigned word specifying the current length in bytes of the immediately following string.
BODY A fixed-length area containing the string that can vary from 0 to a maximum length defined for each instance of string. The range of this maximum length is 0 to 2 16 - 1.

Figure 4-1 Varying Character String Data Type (DSC$K_DTYPE_VT)---General Format


When passed by reference or by descriptor, the address of the varying character string (VT) data type is always the address of the CURLEN field, not the BODY field.

When a called procedure modifies a varying character string data type passed by reference or by descriptor, it writes the new length, n, into CURLEN and can modify all bytes of BODY, even those beyond the new length.

For example, consider a varying string with a maximum length of seven characters. To represent the string ABC, CURLEN will have a value of 3 and the last four bytes will be undefined, as shown in Figure 4-2.

Figure 4-2 Varying Character String Data Type (DSC$K_DTYPE_VT) Format



Chapter 5
OpenVMS Argument Descriptors

This chapter describes the argument descriptors used in calling a procedure for both VAX and Alpha environments.

A uniform descriptor mechanism is defined for use by all VAX and Alpha procedures that conform to the OpenVMS calling standard. Descriptors are self-describing and the mechanism is extensible. When existing descriptors fail to satisfy the semantics of a language, new descriptors are added to this standard.

Unless stated otherwise, the calling program fills in all fields in descriptors. This is true whether the descriptor is generated by default or by a language extension. The fields are filled in even if a called procedure written in the same language ignores the contents of some of the fields. Therefore, a descriptor conforms to this calling standard if all fields are filled in by the calling program, even if the called program does not need the field.

Note

Unless stated otherwise, all fields in descriptors represented as unsigned quantities are read-only from the point of view of the called procedure, and can be allocated in read-only memory at the option of the calling program.

If a language processor implements a language-specific data type that is not added to this standard (see Chapter 4), the processor is not required to use a standard descriptor to pass an array of such a data type. However, if a language processor passes an array of such a data type using a standard descriptor, the language processor fills in the DSC$B_DTYPE field with the value 0, indicating that the data-type field is unspecified, rather than using a more general data-type code.

For example, an array of PL/I POINTER data types has the DTYPE field filled in with the value 0 (unspecified data type), rather than with the value 4 (longword [unsigned] data type). The remaining fields are filled in as specified by this standard; for example, DSC$W_LENGTH is filled in with the size in bytes. Because the language-specific data type might be added to the standard in the future, generic application procedures that examine the DTYPE field should be prepared for 0 and for additional data types.

Table 5-1 identifies the classes of argument descriptors for use in the standard VAX and Alpha environments. Each class has two synonymous names---one for 32-bit environments (DSC$) and one for 64-bit environments (DSC64$). Descriptions and formats of each of these descriptors follow.

Table 5-1 Argument Descriptor Classes for OpenVMS Alpha and OpenVMS VAX
Descriptor Code Class
DSC$K_CLASS_S
DSC64$K_CLASS_S
1 Fixed-length scalar/string
DSC$K_CLASS_D
DSC64$K_CLASS_D
2 Dynamic string
DSC$K_CLASS_A
DSC64$K_CLASS_A
4 Contiguous array
DSC$K_CLASS_P 1
DSC64$K_CLASS_P 1
5 Procedure argument descriptor
DSC$K_CLASS_SD
DSC64$K_CLASS_SD
9 Decimal (scalar) string
DSC$K_CLASS_NCA
DSC64$K_CLASS_NCA
10 Noncontiguous array
DSC$K_CLASS_VS
DSC64$K_CLASS_VS
11 Varying string
DSC$K_CLASS_VSA
DSC64$K_CLASS_VSA
12 Varying string array
DSC$K_CLASS_UBS
DSC64$K_CLASS_UBS
13 Unaligned bit string
DSC$K_CLASS_UBA
DSC64$K_CLASS_UBA
14 Unaligned bit array
DSC$K_CLASS_SB
DSC64$K_CLASS_SB
15 String with bounds
DSC$K_CLASS_UBSB
DSC64$K_CLASS_UBSB
16 Unaligned bit string with bounds


1The pointer field usage for this descriptor differs from VAX usage (see Section 5.5).

5.1 Descriptor Prototype

Figure 5-1 shows the descriptor prototype format. There are two forms: one for use with 32-bit addresses and one for use with 64-bit addresses. The two forms are compatible in that the forms can be distinguished dynamically at run time and, except for the size and consequential placement of fields, 32-bit and 64-bit descriptors are identical in content and interpretation.

The 32-bit descriptors are used on both OpenVMS VAX and OpenVMS Alpha systems. When used on OpenVMS Alpha systems, 32-bit descriptors provide full compatibility with their use on OpenVMS VAX. The 64-bit descriptors are used only on OpenVMS Alpha systems---they have no counterparts and are not recognized on OpenVMS VAX systems.

Figure 5-1 Descriptor Prototype Format



The 32-bit descriptors on OpenVMS Alpha systems have no required alignment for compatibility with OpenVMS VAX systems; however, longword alignment generally promotes performance. The 64-bit descriptors on OpenVMS Alpha systems must be quadword aligned.

Table 5-2 describes the fields of the descriptor. In this table and the similar tables for descriptors in later sections, note that most fields have two symbols and one description. The symbol that begins with the prefix DSC$ is used with 32-bit descriptors, while the symbol that begins with the prefix DSC64$ is used with 64-bit descriptors.

In this chapter, it is generally the practice to use only the main part of a field name, without either of the prefixes used in actual code. For example, the length field is referred to using LENGTH rather than mentioning both DSC$W_LENGTH and DSC64$Q_LENGTH. The DSC$ and DSC64$ prefixes are used only when referring to a particular form of descriptor.

The CLASS and DTYPE fields occupy the same offsets in both 32-bit and 64-bit descriptors. Thus, the symbols DSC$B_CLASS and DSC64$B_CLASS have the same definition, as do DSC$B_DTYPE and DSC64$B_DTYPE. Furthermore, these fields are permitted to contain the same values with the same meanings in both 32-bit and 64-bit forms.

The DSC$W_LENGTH and DSC$A_POINTER fields in the 32-bit descriptors correspond in placement to the DSC64$W_MBO (must be 1) and DSC64$L_MBMO (must be -1) fields in the 64-bit descriptors. The values of these fields are used to distinguish whether a given descriptor has the 32-bit or 64-bit form as described later in this section.

When the CLASS field is 0, no more information can be assumed than is shown in Table 5-2.

Table 5-2 Contents of the Prototype Descriptor
Symbol Description
DSC$W_LENGTH
DSC64$Q_LENGTH
Defines the data item length specific to the descriptor class.
DSC64$W_MBO In a 64-bit descriptor, this field must contain the value 1. This field overlays the DSC$W_LENGTH field of a 32-bit descriptor and the value 1 is necessary to correctly distinguish between the two forms (see below).
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
A descriptor class code that identifies the format and interpretation of the other fields of the descriptor as specified in the following sections. This interpretation is intended to be independent of the DTYPE field, except for the data types that are made up of units less than a byte (packed-decimal string [P], aligned bit string [V], and unaligned bit string [VU]). The CLASS code can be used at run time by a called procedure to determine which descriptor is being passed.
DSC$A_POINTER
DSC64$PQ_POINTER
The address of the first byte of the data element described.
DSC64$L_MBMO In a 64-bit descriptor, this field must contain the value -1 (all 1 bits). Note that this field overlays the DSC$A_POINTER field of a 32-bit descriptor and the value -1 is necessary to correctly distinguish between the two forms (see below).

As previously mentioned, the MBO field (a word at offset 0) and the MBMO field (a longword at offset 4) are used to distinguish between a 32-bit and 64-bit descriptor. A called routine that is designed to handle both kinds of descriptors must do both of the following:

before concluding that it has a 64-bit form descriptor.

Note

It may seem sufficient to test just the MBMO field. However, that allows a 32-bit descriptor with a length of 0 and an undefined pointer to be inadvertently treated as a 64-bit descriptor.

If the MBMO field contains -1, then 0 and 1 are the only values of the MBO field that have defined interpretations.

5.2 Fixed-Length Descriptor (CLASS_S)

A single descriptor class is used for scalar data and fixed-length strings. Any OpenVMS data type, except data type 34 (unaligned bit string), can be used with this descriptor. Figure 5-2 shows the format of a fixed-length descriptor. Table 5-3 describes the fields of the descriptor.

Figure 5-2 Fixed-Length Descriptor Format



Table 5-3 Contents of the CLASS_S 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 bit string. Length of the data item 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
DSC64$B_CLASS
Defines the descriptor class code that must be equal to 1 for CLASS_S.
DSC$A_POINTER
DSC64$PQ_POINTER
Address of first byte of data storage.
DSC64$L_MBMO Must be -1. See Section 5.1.

If the data type is 14 (character string) and the string must be extended in a string comparison or is being copied to a fixed-length string containing a greater length, the space character (hexadecimal 20 if ASCII) is used as the fill character.

5.3 Dynamic String Descriptor (CLASS_D)

A class D descriptor is used for dynamically allocated strings. When a string is written, either the length field, pointer field, or both can be changed. The OpenVMS Run-Time Library provides procedures for changing fields. As an input parameter, this format is interchangeable with class 1 (CLASS_S). Figure 5-3 shows the format of a dynamic string descriptor. Table 5-4 describes the fields of the descriptor.

Figure 5-3 Dynamic String Descriptor Format



Table 5-4 Contents of the CLASS_D 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 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
DSC64$B_CLASS
Defines the descriptor class code that must be equal to 2 for CLASS_D.
DSC$A_POINTER
DSC64$PQ_POINTER
Address of first byte of data storage.
DSC64$L_MBMO Must be -1. See Section 5.1.

5.4 Array Descriptor (CLASS_A)

The array descriptor shown in Figure 5-4 is used to describe contiguous arrays of atomic data types or contiguous arrays of fixed-length strings. An array descriptor consists of three contiguous blocks. The first block contains the descriptor prototype information and is part of every array descriptor. The second and third blocks are optional. If the third block is present, so is the second. Table 5-5 describes the fields of the descriptor.

Figure 5-4 Array Descriptor Format



Table 5-5 Contents of the CLASS_A 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
DSC64$B_CLASS
Defines the descriptor class code that must be equal to 4 for CLASS_A.
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.
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 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 Section 5.6.)
DSC$V_FL_REDIM
DSC64$V_FL_REDIM
If set, the array can be redimensioned; that is, A0, M i, L i, and U i can be changed. The redimensioned array cannot exceed the size allocated to the array ARSIZE.
DSC$V_FL_COLUMN
DSC64$V_FL_COLUMN
If set, the elements of the array are stored by columns (FORTRAN). That is, the leftmost subscript (first dimension) is varied most rapidly, and the rightmost subscript ( nth dimension) is varied least rapidly. If not set, the elements are stored by rows (most other languages). That is, the rightmost subscript is varied most rapidly and the leftmost subscript is varied least rapidly.
DSC$V_FL_COEFF
DSC64$V_FL_COEFF
If set, the multiplicative coefficients in block 2 are present. Must be set if FL_BOUNDS is set.
DSC$V_FL_BOUNDS
DSC64$V_FL_BOUNDS
If set, the bounds information in block 3 is present and requires that FL_COEFF be set.
DSC$B_DIMCT
DSC64$B_DIMCT
Number of dimensions, n.
DSC$L_ARSIZE
DSC64$Q_ARSIZE
Total size of array (in bytes, unless the TYPE field contains the value 21; see the description for LENGTH). A redimensioned array can use less than the total size allocated.

For data type 1 (aligned bit string), LENGTH is in bits while ARSIZE is in bytes because the unit of length is bits, while the unit of allocation is aligned 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.
DSC$L_M i
DSC64$Q_M i
Addressing coefficients ( M i = U i - L i + 1 ).
DSC$L_L i
DSC64$Q_L i
Lower bound (signed) of ith dimension.
DSC$L_U i
DSC64$Q_U i
Upper bound (signed) of ith dimension.

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

Caution

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

The effective address, E, for element A(I):


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


Previous Next Contents Index

  [Go to the documentation home page] [How to order documentation] [Help on this site] [How to contact us]  
  privacy and legal statement  
5973PRO_010.HTML