CDDLHELP.HLB  —  VARIANTS field, Example
  The following example contains three VARIANT  logical  views  of  the
  same record.  In an application program, you can refer to the logical
  view IN_STOCK, BACK_ORDER, or OUT_OF_STOCK depending on how you  want
  to interpret the STOCK field.

  STOCK STRUCTURE.
      VARIANTS.
          VARIANT.
              IN_STOCK STRUCTURE.
                  PRODUCT_NO     DATATYPE IS TEXT
                                 SIZE IS 8 CHARACTERS.
                  DATE_ORDERED   DATATYPE IS DATE.
                  STATUS_CODE    DATATYPE IS BYTE.
                  QUANTITY       DATATYPE IS LONGWORD
                                 ALIGNED ON LONGWORD.
                  LOCATION       ARRAY 1:4
                                 DATATYPE IS TEXT
                                 SIZE IS 30 CHARACTERS.
                  UNIT_PRICE     DATATYPE IS LONGWORD SCALE -2.
              END IN_STOCK STRUCTURE.
          END VARIANT.
          VARIANT.
              BACK_ORDER STRUCTURE.
                  PRODUCT_NO     DATATYPE IS TEXT
                                 SIZE IS 8 CHARACTERS.
                  DATE_ORDERED   DATATYPE IS DATE.
                  STATUS_CODE    DATATYPE IS BYTE.
                  QUANTITY       DATATYPE IS LONGWORD
                                 ALIGNED ON LONGWORD.
                  SUPPLIER       ARRAY 1:4
                                 DATATYPE IS TEXT
                                 SIZE IS 30 CHARACTERS.
                  UNIT_PRICE     DATATYPE IS LONGWORD
                                 SCALE -2.
              END BACK_ORDER STRUCTURE.
          END VARIANT.
          VARIANT.
              OUT_OF_STOCK STRUCTURE.
                  PRODUCT_NO         DATATYPE IS TEXT
                                     SIZE IS 8 CHARACTERS.
                  DATE_LAST_SOLD     DATATYPE IS DATE.
              END OUT_OF_STOCK STRUCTURE.
          END VARIANT.
      END VARIANTS.
  END STOCK STRUCTURE.
Close Help