Each symbol record assigns a number, called a symbol index, that is used by later records to refer to the symbol (for example, the name of a user variable or constant) described by this record. The name of the identifier is indicated by a literal index. Each symbol record contains the file index and source line number for the file and line in which the symbol was declared.
If the identifier is part of a structure or union, the symbol record contains a symbol index for each of the following:
Consider the following structure:
dcl
1 a
, 3 b fixed bin
, 3 c fixed bin
, 3 d
, 5 e fixed bin
, 5 f fixed bin
;The symbol indices assigned to the elements of the preceding structure would be as follows:
symbol index sibling parent child ----- ----- ------- ------ ----- a 1 0 0 2 b 2 3 1 0 c 3 4 1 0 d 4 0 1 5 e 5 6 4 0 f 6 0 4 0
Each symbol record also contains a series of bit(1) fields that indicate if various attributes apply to this variable.
Each symbol record also contains the following elements:
The number of dimensions declared for the variable not counting any inherited dimensions.
The number of dimensions for the variable including all inherited dimensions.
A union within the record is dedicated to describing information that is dependent on the variable's storage class:
The variable's data type is specified by the ordinal shown in Figure 115.
define
ordinal
xin_Data_Kind
( xin_Data_Kind_Unset
,xin_Data_Kind_Character
,xin_Data_Kind_Bit
,xin_Data_Kind_Graphic
,xin_Data_Kind_Fixed
,xin_Data_Kind_Float
,xin_Data_Kind_Picture
,xin_Data_Kind_Pointer
,xin_Data_Kind_Offset
,xin_Data_Kind_Entry
,xin_Data_Kind_File
,xin_Data_Kind_Label
,xin_Data_Kind_Format
,xin_Data_Kind_Area
,xin_Data_Kind_Task
,xin_Data_Kind_Event
,xin_Data_Kind_Condition
,xin_Data_Kind_Structure
,xin_Data_Kind_Union
,xin_Data_Kind_Descriptor
,xin_Data_Kind_Ordinal
,xin_Data_Kind_Handle
,xin_Data_Kind_Type
) prec(8) unsigned;A union within the record is dedicated to describing information that is dependent on the variable's data type. Most of this information is self-explanatory (for example, the precision for an arithmetic type) except perhaps for the following:
declare
( xin_Extent_Constant value(01)
,xin_Extent_Star value(02)
,xin_Extent_Nonconstant value(04)
,xin_Extent_Refer value(08)
,xin_Extent_In_Error value(16)
)
fixed bin;
If the element has any dimensions, the type and values for its lower and upper bounds are specified at the very end of the record. These fields are not present if the element has no dimensions. Figure 116 shows the declare for a symbol record.
declare /* */
1 xin_Sym based( null() ), /* */
/* */
2 Xin_Sym_Hdr /* standard header */
like Xin_Hdr, /* */
/* */
2 Xin_Sym_File_Id /* file id */
fixed bin(32) unsigned, /* */
/* */
2 Xin_Sym_Line_No /* line no within file */
fixed bin(32) unsigned, /* */
/* */
2 xin_Id /* identifying number */
fixed bin(31), /* */
/* */
2 xin_Sibling /* xin_id of next sibling */
fixed bin(31), /* */
/* */
2 xin_Parent /* xin_id of parent */
fixed bin(31), /* */
/* */
2 xin_Child /* xin_id of first child */
fixed bin(31), /* */
/* */
2 xin_Blk_Id /* blk_id of owning block */
fixed bin(31), /* */
/* */
2 xin_Sym_Tok /* token id of declaring token */
fixed bin(31), /* */
/* */
2 xin_Logical_Level /* logical level in structure */
unsigned fixed bin(08), /* */
/* */
2 xin_Physical_Level /* given level in structure */
unsigned fixed bin(08), /* */
/* */
2 xin_Total_Dims /* Total number of dims */
unsigned fixed bin(08), /* */
/* */
2 xin_Own_Dims /* count of self-made dims */
unsigned fixed bin(08), /* */
/* */
2 xin_Attr_Flags union, /* */
/* */
3 * bit(64), /* */
/* */
3 *, /* */
/* */
4 xin_Attr_Automatic /* */
bit(1), /* */
4 xin_Attr_Based /* */
bit(1), /* */
4 xin_Attr_Controlled /* */
bit(1), /* */
4 xin_Attr_Defined /* */
bit(1), /* */
4 xin_Attr_Parameter /* */
bit(1), /* */
4 xin_Attr_Position /* */
bit(1), /* */
4 xin_Attr_Reserved /* */
bit(1), /* */
4 xin_Attr_Static /* */
bit(1), /* */
4 xin_Attr_Condition /* */
bit(1), /* */
4 xin_Attr_Constant /* */
bit(1), /* */
4 xin_Attr_Variable /* */
bit(1), /* */
4 xin_Attr_Internal /* */
bit(1), /* */
4 xin_Attr_External /* */
bit(1), /* */
4 xin_Attr_Abnormal /* */
bit(1), /* */
4 xin_Attr_Normal /* */
bit(1), /* */
4 xin_Attr_Assignable /* */
bit(1), /* */
4 xin_Attr_Nonassignable /* */
bit(1), /* */
4 xin_Attr_Aligned /* */
bit(1), /* */
4 xin_Attr_Unaligned /* */
bit(1), /* */
4 xin_Attr_Descriptor /* */
bit(1), /* */
4 xin_Attr_Value /* */
bit(1), /* */
4 xin_Attr_Byvalue /* */
bit(1), /* */
4 xin_Attr_Byaddr /* */
bit(1), /* */
4 xin_Attr_Connected /* */
bit(1), /* */
4 xin_Attr_Nonconnected /* */
bit(1), /* */
4 xin_Attr_Optional /* */
bit(1), /* */
4 xin_Attr_Native /* */
bit(1), /* */
4 xin_Attr_Nonnative /* */
bit(1), /* */
4 xin_Attr_Initial /* */
bit(1), /* */
4 xin_Attr_Typedef /* */
bit(1), /* */
4 xin_Attr_Builtin /* */
bit(1), /* */
4 xin_Attr_Generic /* */
bit(1), /* */
4 xin_Attr_Date /* */
bit(1), /* */
4 xin_Attr_Noinit /* */
bit(1), /* */
/* */
2 xin_Data_Is /* */
ordinal xin_Data_Kind, /* */
/* */
2 xin_Misc_Flags union, /* */
/* */
3 * bit(8), /* */
/* */
3 *, /* */
/* */
4 xin_Implicit_Dcl /* dcl is implicit */
bit(1), /* */
/* */
4 xin_Contextual_Dcl /* dcl is contextual */
bit(1), /* */
/* */
4 xin_Has_Been_Mapped /* aggregate has been mapped */
bit(1), /* */
/* */
2 xin_Align /* alignment */
unsigned fixed bin(08), /* */
/* */
2 xin_Begin_Offset /* bitlocation(sym) */
unsigned fixed bin(08), /* */
/* */
2 xin_Offset /* location(sym) */
fixed bin(31), /* */
/* */
2 xin_Size /* length in bytes, with all */
fixed bin(31), /* children and array */
/* elements factored in */
/* */
2 xin_Base_Size /* element length - in bytes */
fixed bin(31), /* unless bit aligned */
/* */
2 xin_Name /* name - id of lit record */
fixed bin(31), /* */
/* */
2 * union, /* */
/* */
3 xin_Static_Data, /* */
/* */
4 xin_Static_Ext /* id of literal specifing its */
fixed bin(31), /* external name */
/* */
3 xin_Based_Data, /* */
/* */
4 xin_Based_On_Id /* xin_Id of basing reference */
fixed bin(31), /* 0 if not simple */
/* */
3 xin_Defined_Data, /* */
/* */
4 xin_Defined_On_Id /* xin_Id of basing reference */
fixed bin(31), /* 0 if not simple */
/* */
4 xin_Defined_Pos /* -1 if not constant */
fixed bin(31), /* */
/* */
3 xin_Parm_Data, /* */
/* */
4 xin_Parm_Index /* index of parm */
fixed bin(31), /* 1 for first, etc */
/* */
2 * union, /* */
/* */
3 xin_Str_Data, /* used for char, bit, graphic */
/* and area, but not used for */
/* picture character or numeric*/
/* */
4 xin_Str_Len_Node /* length as parse tree */
fixed bin(31), /* */
/* */
4 xin_Str_Len /* length: if type is constant */
fixed bin(31), /* */
/* */
4 xin_Str_Len_Type /* type */
unsigned fixed bin(08), /* */
/* */
4 *, /* */
5 xin_Str_Varying /* */
bit(1), /* */
5 xin_Str_Nonvarying /* */
bit(1), /* */
5 xin_Str_Varyingz /* */
bit(1), /* */
/* */
4 xin_Str_Date /* index of date literal */
fixed bin(31), /* */
/* */
3 xin_Arith_Data, /* used for fixed and float */
/* */
4 xin_Arith_Precision /* precision */
unsigned fixed bin(08), /* */
/* */
4 xin_Arith_Scale_Factor /* scale factor */
signed fixed bin(07), /* */
/* */
4 *, /* */
5 xin_Arith_Binary /* */
bit(1), /* */
5 xin_Arith_Decimal /* */
bit(1), /* */
5 xin_Arith_Fixed /* */
bit(1), /* */
5 xin_Arith_Float /* */
bit(1), /* */
5 xin_Arith_Real /* */
bit(1), /* */
5 xin_Arith_Complex /* */
bit(1), /* */
5 xin_Arith_Signed /* */
bit(1), /* */
5 xin_Arith_Unsigned /* */
bit(1), /* */
5 xin_Arith_Ieee /* */
bit(1), /* */
5 xin_Arith_Hexadec /* */
bit(1), /* */
/* */
4 * /* unused */
fixed bin(31), /* */
/* */
4 * /* unused */
fixed bin(31), /* */
/* */
4 xin_Arith_Date /* index of date literal */
fixed bin(31), /* */
/* */
3 xin_Ordinal_Data, /* used for ordinal */
/* */
4 xin_Ordinal_Type_Id /* type id */
fixed bin(31), /* */
/* */
3 xin_Type_Data, /* used for typed */
/* */
4 xin_Type_Is /* type id */
fixed bin(31), /* */
/* */
3 xin_Pic_Data, /* used for all pictures */
/* */
4 xin_Pic_Ext /* external specification */
fixed bin(31), /* */
/* */
4 *, /* */
5 xin_Pic_Fixed /* */
bit(1), /* */
5 xin_Pic_Float /* */
bit(1), /* */
5 xin_Pic_Character /* */
bit(1), /* */
5 xin_Pic_Real /* */
bit(1), /* */
5 xin_Pic_Complex /* */
bit(1), /* */
5 * /* */
bit(3), /* */
5 * /* */
bit(8), /* */
5 xin_Pic_Prec /* */
unsigned /* */
fixed bin(08), /* */
5 xin_Pic_Scale /* */
signed /* */
fixed bin(07), /* */
/* */
4 * /* unused */
fixed bin(31), /* */
/* */
4 xin_Pic_Date /* index of date literal */
fixed bin(31), /* */
/* */
3 xin_Entry_Data, /* */
/* */
4 xin_Entry_Min /* min number of args */
fixed bin(15), /* allowed when invoked */
/* */
4 xin_Entry_Max /* max number of args */
fixed bin(15), /* allowed when invoked */
/* */
4 xin_Entry_Returns_Id /* xin_Id of returns descriptor*/
fixed bin(31), /* */
/* */
4 xin_Entry_Parms_Id /* xin_Id of first parms */
fixed bin(31), /* */
/* */
4 *, /* */
5 xin_Entry_Returns /* */
bit(1), /* */
5 xin_Entry_Limited /* */
bit(1), /* */
5 xin_Entry_Fetchable /* */
bit(1), /* */
5 xin_Entry_Is_Proc /* */
bit(1), /* */
5 xin_Entry_Is_Secondary /* */
bit(1), /* */
/* */
3 xin_Ptr_Data, /* */
/* */
4 *, /* */
5 xin_Ptr_Segmented /* */
bit(1), /* */
/* */
3 xin_Offset_Data, /* */
/* */
4 xin_Offset_Area /* */
fixed bin(31), /* */
/* */
3 xin_Sym_Bif_Id /* */
ordinal xin_Bif_Kind, /* */
/* */
/* */
3 xin_File_Data, /* */
/* */
4 *, /* */
5 xin_File_Buffered /* */
bit(1), /* */
5 xin_File_Direct /* */
bit(1), /* */
5 xin_File_Exclusive /* */
bit(1), /* */
5 xin_File_Input /* */
bit(1), /* */
5 xin_File_Keyed /* */
bit(1), /* */
5 xin_File_Output /* */
bit(1), /* */
5 xin_File_Print /* */
bit(1), /* */
5 xin_File_Record /* */
bit(1), /* */
5 xin_File_Stream /* */
bit(1), /* */
5 xin_File_Transient /* */
bit(1), /* */
5 xin_File_Unbuffered /* */
bit(1), /* */
5 xin_File_Update /* */
bit(1), /* */
/* */
2 * union, /* */
/* */
3 xin_Value_Id /* id of value lit - if the */
fixed bin(31), /* xin_Attr_Value flag is set */
/* */
3 xin_First_Stmt_Id /* id of first stmt record - */
fixed bin(31), /* if xin_Attr_Entry and */
/* xin_Entry_Is_Proc flags */
/* are both set */
/* */
2 xin_Bounds dim(15), /* */
/* */
3 xin_Lbound_Type /* lbound type */
unsigned fixed bin(08), /* */
/* */
3 xin_Hbound_Type /* hbound type */
unsigned fixed bin(08), /* */
/* */
3 * /* */
char(2), /* */
/* */
3 xin_Lbound_Node /* expression parse tree */
fixed bin(31), /* */
/* */
3 xin_Hbound_Node /* expression parse tree */
fixed bin(31), /* */
/* */
3 xin_Lbound /* value: if type is constant */
fixed bin(31), /* xin_Id: if type is refer */
/* */
3 xin_Hbound /* value: if type is constant */
fixed bin(31), /* xin_Id: if type is refer */
/* */
2 * char(0);
The definition of the ordinal xin_Bif_Kind can be found in Figure 117
define
ordinal
xin_Bif_Kind
( xin_Bif_Unknown
,xin_bif_abs
,xin_bif_acos
,xin_bif_add
,xin_bif_addr
,xin_bif_all
,xin_bif_allocation
,xin_bif_allocn
,xin_bif_any
,xin_bif_asin
,xin_bif_atan
,xin_bif_atand
,xin_bif_atanh
,xin_bif_bin
,xin_bif_binvalue
,xin_bif_binary
,xin_bif_binaryvalue
,xin_bif_bit
,xin_bif_bool
,xin_bif_ceil
,xin_bif_char
,xin_bif_completion
,xin_bif_complex
,xin_bif_conjg
,xin_bif_copy
,xin_bif_cos
,xin_bif_cosd
,xin_bif_cosh
,xin_bif_count
,xin_bif_cpln
,xin_bif_cplx
,xin_bif_cstg
,xin_bif_currentstorage
,xin_bif_datafield
,xin_bif_date
,xin_bif_datetime
,xin_bif_dec
,xin_bif_decimal
,xin_bif_dim
,xin_bif_divide
,xin_bif_empty
,xin_bif_entryaddr
,xin_bif_erf
,xin_bif_erfc
,xin_bif_exp
,xin_bif_fixed
,xin_bif_float
,xin_bif_floor
,xin_bif_graphic
,xin_bif_hbound
,xin_bif_high
,xin_bif_imag
,xin_bif_index
,xin_bif_lbound
,xin_bif_length
,xin_bif_lineno
,xin_bif_log
,xin_bif_log10
,xin_bif_log2
,xin_bif_low
,xin_bif_max
,xin_bif_min
,xin_bif_mod
,xin_bif_mpstr
,xin_bif_multiply
,xin_bif_null
,xin_bif_offset
,xin_bif_onchar
,xin_bif_oncode
,xin_bif_oncount
,xin_bif_onfile
,xin_bif_onkey
,xin_bif_onloc
,xin_bif_onsource
,xin_bif_pageno
,xin_bif_plicanc
,xin_bif_plickpt
,xin_bif_plidump
,xin_bif_plirest
,xin_bif_pliretc
,xin_bif_pliretv
,xin_bif_plisrta
,xin_bif_plisrtb
,xin_bif_plisrtc
,xin_bif_plisrtd
,xin_bif_plitest
,xin_bif_pointer
,xin_bif_pointeradd
,xin_bif_pointervalue
,xin_bif_poly
,xin_bif_prec
,xin_bif_precision
,xin_bif_priority
,xin_bif_prod
,xin_bif_ptr
,xin_bif_ptradd
,xin_bif_ptrvalue
,xin_bif_real
,xin_bif_repeat
,xin_bif_round
,xin_bif_samekey
,xin_bif_sign
,xin_bif_sin
,xin_bif_sind
,xin_bif_sinh
,xin_bif_sqrt
,xin_bif_status
,xin_bif_stg
,xin_bif_storage
,xin_bif_string
,xin_bif_substr
,xin_bif_sum
,xin_bif_sysnull
,xin_bif_tan
,xin_bif_tand
,xin_bif_tanh
,xin_bif_time
,xin_bif_translate
,xin_bif_trunc
,xin_bif_unspec
,xin_bif_verify
,xin_bif_days
,xin_bif_daystodate
,xin_bif_acosf
,xin_bif_addrdata
,xin_bif_alloc
,xin_bif_allocate
,xin_bif_allocsize
,xin_bif_asinf
,xin_bif_atanf
,xin_bif_auto
,xin_bif_automatic
,xin_bif_availablearea
,xin_bif_bitloc
,xin_bif_bitlocation
,xin_bif_byte
,xin_bif_cds
,xin_bif_center
,xin_bif_centerleft
,xin_bif_centerright
,xin_bif_centre
,xin_bif_centreleft
,xin_bif_centreright
,xin_bif_character
,xin_bif_charg
,xin_bif_chargraphic
,xin_bif_charval
,xin_bif_checkstg
,xin_bif_collate
,xin_bif_compare
,xin_bif_cosf
,xin_bif_cs
,xin_bif_currentsize
,xin_bif_daystosecs
,xin_bif_dimension
,xin_bif_edit
,xin_bif_endfile
,xin_bif_epsilon
,xin_bif_expf
,xin_bif_exponent
,xin_bif_fileddint
,xin_bif_fileddtest
,xin_bif_fileddword
,xin_bif_fileid
,xin_bif_fileread
,xin_bif_fileseek
,xin_bif_filetell
,xin_bif_filewrite
,xin_bif_gamma
,xin_bif_getenv
,xin_bif_handle
,xin_bif_hex
,xin_bif_heximage
,xin_bif_huge
,xin_bif_iand
,xin_bif_ieor
,xin_bif_inot
,xin_bif_ior
,xin_bif_isigned
,xin_bif_isll
,xin_bif_ismain
,xin_bif_isrl
,xin_bif_iunsigned
,xin_bif_left
,xin_bif_loc
,xin_bif_location
,xin_bif_log10f
,xin_bif_logf
,xin_bif_loggamma
,xin_bif_lower2
,xin_bif_lowercase
,xin_bif_maxexp
,xin_bif_maxlength
,xin_bif_memindex
,xin_bif_memsearch
,xin_bif_memsearchr
,xin_bif_memverify
,xin_bif_memverifyr
,xin_bif_minexp
,xin_bif_offsetadd
,xin_bif_offsetdiff
,xin_bif_offsetsubtract
,xin_bif_offsetvalue
,xin_bif_omitted
,xin_bif_oncondcond
,xin_bif_oncondid
,xin_bif_ongsource
,xin_bif_onsubcode
,xin_bif_onwchar
,xin_bif_onwsource
,xin_bif_ordinalname
,xin_bif_ordinalpred
,xin_bif_ordinalsucc
,xin_bif_packagename
,xin_bif_picspec
,xin_bif_places
,xin_bif_pliascii
,xin_bif_pliebcdic
,xin_bif_plifill
,xin_bif_plifree
,xin_bif_plimove
,xin_bif_pliover
,xin_bif_plisaxa
,xin_bif_plisaxb
,xin_bif_pointerdiff
,xin_bif_pointersubtract
,xin_bif_pred
,xin_bif_present
,xin_bif_procedurename
,xin_bif_procname
,xin_bif_ptrdiff
,xin_bif_ptrsubtract
,xin_bif_putenv
,xin_bif_radix
,xin_bif_raise2
,xin_bif_random
,xin_bif_rank
,xin_bif_rem
,xin_bif_repattern
,xin_bif_replaceby2
,xin_bif_reverse
,xin_bif_right
,xin_bif_scale
,xin_bif_search
,xin_bif_searchr
,xin_bif_secs
,xin_bif_secstodate
,xin_bif_secstodays
,xin_bif_signed
,xin_bif_sinf
,xin_bif_size
,xin_bif_sourcefile
,xin_bif_sourceline
,xin_bif_sqrtf
,xin_bif_subtract
,xin_bif_succ
,xin_bif_system
,xin_bif_tally
,xin_bif_tanf
,xin_bif_threadid
,xin_bif_tiny
,xin_bif_trim
,xin_bif_type
,xin_bif_unallocated
,xin_bif_unsigned
,xin_bif_uppercase
,xin_bif_valid
,xin_bif_validdate
,xin_bif_varglist
,xin_bif_vargsize
,xin_bif_verifyr
,xin_bif_wchar
,xin_bif_wcharval
,xin_bif_weekday
,xin_bif_whigh
,xin_bif_widechar
,xin_bif_wlow
,xin_bif_xmlchar
,xin_bif_y4date
,xin_bif_y4julian
,xin_bif_y4year
) prec(16) unsigned;
It should also be noted that the attributes flags reflect the attributes after the compiler has applied all defaults. So, for example, every numeric variable (including numeric PICTURE variables) will have either the REAL or COMPLEX attribute flag set.