BASICHELP.HLB  —  RECORD
  The RECORD statement lets you name and define data structures in a BASIC
  program  and  provides the BASIC interface to the Oracle CDD/Repository.
  You can use the defined RECORD name anywhere a BASIC data  type  keyword
  is valid.

  Example

  RECORD Emp_wage_class
         GROUP Emp_name
               STRING First  = 15
               STRING Middle = 1
               STRING Last   = 14
         END GROUP Emp_name
         VARIANT
               CASE
                  GROUP Hourly
                        DECIMAL(4,3) Hourly_wage
                        SINGLE Regular_pay_ytd
                        SINGLE Overtime_pay_ytd
                  END GROUP Hourly
               CASE
                  GROUP Salaried
                        DECIMAL(7,2) Yearly_salary
                        SINGLE Pay_ytd
                  END GROUP Salaried
         END VARIANT
  END RECORD Emp_wage_class

  Once you specify a record structure, you  declare  a  variable  of  that
  record  type  by  using  the  RECORD  name  as a data type keyword.  For
  instance, using the data structure defined above:

      DECLARE Emp_wage_class Emp_variable

  To reference the fields of the record, specify the record variable  name
  and  the  name of the field being accessed separated by two colons.  You
  can also specify any intermediate GROUP names.  However, they  are  only
  necessary  if  more  than  one field of the record has the same name and
  excluding the GROUP names  would  make  the  reference  ambiguous.   For
  example,  the  following assignment statements reference the same record
  field:

      Emp_variable::pay_ytd = 5000
      Emp_variable::Salaried::pay_ytd = 5000

1  –  Syntax

   RECORD rec-name
          rec-component
         .
         .
         .
   END RECORD [ rec-name ]

     rec-component:  { data-type rec-item [,...] }
                     { group-clause                              }
                     { variant-clause                            }

     rec-item:       { unsubs-var [ = int-const ]                }
                     { array ( [int-const1 TO] int-const2,...)
                       [ = int-const]                            }
                     { FILL [ ( int-const ) ] [ = int-const ]    }

     group-clause:   GROUP group-name [ ( int-const,... ) ]
                           rec-component
                               .
                               .
                               .
                     END GROUP [ group-name ]

     variant-clause: VARIANT
                        case-clause
                             .
                             .
                             .
                     END VARIANT

     case-clause:    CASE
                        [ rec-component ]
                              .
                              .
                              .
Close Help