7. Embedded QUEL for Pascal : Pascal Variables and Data Types : Variable and Type Declarations : The Character Data Types
 
Share this page                  
The Character Data Types
Three Pascal data types are compatible with Ingres string objects: char, packed array of char, and varying of char. Note that literal string constants are of type packed array of char. EQUEL allows only regular Pascal string literals: sequences of printing characters enclosed in single quotes. The VMS Pascal extensions of parenthesized string constructors and of nonprinting characters represented by their ASCII values in parentheses are not allowed.
The char data type does have some restrictions. Because of the mechanism used to pass string-valued arguments to the EQUEL runtime library, you cannot use a member of a packed array of char or varying of char to interact with Ingres. Also plain array of char (for example, not packed or varying) is not compatible with Ingres string objects; an element of such an array, however, is a char and as such is compatible.
For example, given the following legal declarations:
##  type
##      Alpha = 'a'..'z'; {1 character}
##      Packed_6 = packed array[1..6] of Char; 
##            {6-char string}
##      Vary_6 = varying[6] of Alpha; {6-char string}
##      Array_6 = array[1..6] of Char; 
##            {1-dimensional array}
##  var
##      letter: Alpha; {1 character}
##      p_str_arr: array[1..5] of Packed_6; 
##            {Array of strings}
##      chr_arr: array[1..6] of Char; 
##            {1-dimensional array}
##      two_arr: array[1..5] of Array_6;
              {2-dimensional array of char}

##  v_string : Vary_6; {String}
these usages are legal:
##  message letter              {a char is a string}
##  message chr_arr[3]          {a char is a string}
##  message two_arr[2][5        {a char is a string}
##  message v_string            {a varying array is a string}
##  message p_str_arr[2]        {a packed array is a string}
but these usages are illegal:
##  message chr_arr         {an array of chars is not a string}
##  message v_string[2]     {cannot index a varying array}
##  message p_str_arr[2][3] {Cannot index a packed array}