/sys$common/syshlp/helplib.hlb
MERGE, Specification File Qualifiers, Specification File Example

 *Conan The Librarian (sorry for the slow response - running on an old VAX)

  /FIELD=(NAME=RECORD_TYPE,POS:1,SIZ:1)   ! Records type, one-byte field
  /FIELD=(NAME=PRICE,POS:2,SIZ:8)         ! Price field, both files
  /FIELD=(NAME=TAXES,POS:10,SIZ:5)        ! Taxes field, both files
  /FIELD=(NAME=STYLE_A,POS:15,SIZ:10)     ! Style field, format A file
  /FIELD=(NAME=STYLE_B,POS:20,SIZ:10)     ! Style field, format B file
  /FIELD=(NAME=ZIP_A,POS:25,SIZ:5)        ! Zip code field, format A file
  /FIELD=(NAME=ZIP_B,POS:15,SIZ:5)        ! Zip code field, format B file

  /CONDITION=(NAME=FORMAT_A,              ! Condition test, format A file
              TEST=(RECORD_TYPE EQ "A"))
  /CONDITION=(NAME=FORMAT_B,              ! Condition test, format B file
              TEST=(RECORD_TYPE EQ "B"))

            KEY=ZIP_A,
            DATA=PRICE,
            DATA=TAXES,
            DATA=STYLE_A,
            DATA=ZIP_A)

  /INCLUDE=(CONDITION=FORMAT_B,           ! Output format, type B records
            KEY=ZIP_B,
            DATA=PRICE,
            DATA=TAXES,
            DATA=STYLE_B,
            DATA=ZIP_B)

      In this example, two input files from two different branches of
      a real estate agency are sorted according to the instructions
      specified in a specification file. The records in the first
      file that begin with an A in the first position have this
      format:

        |A|PRICE|TAXES|STYLE|ZIP|
         1 2     10    15    25

      The records in the second file that begin with a B in the first
      position and have the style and zip code fields reversed, as
      follows:

        |B|PRICE|TAXES|ZIP|STYLE|
         1 2     10    15  20

      To sort these two files on the zip code field in the format
      of record A, first define the fields in both records with the
      /FIELD qualifiers. Then, specify a test to distinguish between
      the two types of records with the /CONDITION qualifiers.
      Finally, the /INCLUDE qualifiers change the record format of
      type B to record format of type A on output.

      Note that, if you specify either key or data fields in an
      /INCLUDE qualifier, you must explicitly specify all the key and
      data fields for the sort operation in the /INCLUDE qualifier.

      Also note that records that are not type A or type B are
      omitted from the sort.
  Close     HLB-list     TLB-list     Help  

[legal] [privacy] [GNU] [policy] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.