VMS Help  —  MERGE  Specification File Qualifiers, /CONDITION
    Defines conditions for key and data handling and for record
    selection.

    Formats

      /CONDITION=  (NAME=condition-name,

      TEST=(field-name operator test-condition

      [logical-operator ...]))

1  –  Qualifier Values

 NAME=condition-name

    Specifies the name of the condition you are testing. This
    condition-name can be used in /KEY, /DATA, /OMIT, and /INCLUDE
    qualifiers after it has been defined using the /CONDITION
    qualifier.

 TEST=(field-name operator test-condition)

    Specifies the conditional test.

 field-name

    Specifies the name of the field you are testing. The field-name
    must be defined previously by a /FIELD qualifier.

 operator

    Specifies the logical or relational operator used in the
    conditional test. The logical operators that you can use are
    AND and OR. The relational operators that you can specify are as
    follows:

    EQ       Equal to
    NE       Not equal to
    GT       Greater than
    GE       Greater than or equal to
    LT       Less than
    LE       Less than or equal to

 test-condition

    Specifies the constant or field-name against which you are
    testing. A constant is specified with the following format:

       Decimal_digits (default)
       %Ddecimal_digits
       %Ooctal_digits
       %Xhexadecimal_digits
       "character"

                                   NOTE

       Normally, you do not need to specify the radix operator
       (%D); however, test-condition will assume the same data type
       as the field-name.

    The field-name must be defined by a /FIELD qualifier.

2  –  Full Description

    A specification file can be used to change the relative order of
    a record or to alter the contents of certain fields of a record.
    You must first use a /CONDITION qualifier to define a conditional
    test. Once you define a test using a /CONDITIONAL qualifier, you
    can use that same test with a /KEY or /DATA qualifier to change
    the order of record. You can also use the test with an /OMIT or
    /INCLUDE qualifier to change the contents of a record.

    If you want to change the order of records in the output file,
    first specify a condition name with a /CONDITION qualifier and
    set up a test for what meets that condition. Then, specify the
    relative order with a /KEY qualifier of the form:

    /KEY=(IF condition-name THEN value ELSE value)

    You can use any values to specify the relative order of the
    records.

    The /CONDITION qualifier also permits you to change the contents
    of a field in the output records. First specify a condition name,
    and then set up a test for what meets the condition. Specify the
    contents you want in the field in a /DATA qualifier of the form:

    /DATA=(IF condition-name THEN "new-contents" ELSE "new-contents")

3  –  Examples

    1./FIELD=(NAME=AGENT,POSITION:20,SIZE:15)
      /CONDITION=(NAME=AGENCY,
                  TEST=(AGENT EQ "Real-T Trust"
                  OR
                  AGENT EQ "Realty Trust"))
         /DATA=(IF AGENCY THEN "Realty Trust" ELSE AGENT)

      In this example, two real estate files are being sorted. One
      file refers to an agency as Real-T Trust; the other refers
      to the same agency as Realty Trust. The /CONDITION and /DATA
      qualifiers instruct Sort to list the AGENT field in the sorted
      output file as Realty Trust.

    2./FIELD=(NAME=ZIP,POSITION:60,SIZE:6)
      /CONDITION=(NAME=LOCATION,
                  TEST=(ZIP EQ "01863"))
      /KEY=(IF LOCATION THEN 1
            ELSE 2)

      In this example, all the records with a zip code of 01863
      will appear at the beginning of the sorted output file. The
      conditional test is on the ZIP field, defined with the /FIELD
      qualifier; the condition is named LOCATION. The values 1 and
      2 in this /KEY qualifier signify a relative order for those
      records that satisfy the condition and those that do not.

    3./FIELD=(NAME=ZIP,POSITION:60,SIZE:6)
      /CONDITION=(NAME=LOCATION,
                  TEST=(ZIP EQ "01863"))
      /DATA=(IF LOCATION THEN "NORTH CHELMSFORD"
             ELSE "Outside district")

      In this example, the /CONDITION qualifier tests for the 01863
      zip code. The /DATA qualifier specifies that the name of town
      field will be added to the output record, depending on the test
      results.

    4./FIELD=(NAME=FFLOAT,POS:1,SIZ:0,F_FLOATING)
      /CONDITION=(NAME=CFFLOAT,TEST=(FFLOAT GE 100))
      /OMIT=(CONDITION=CFFLOAT)

      In this example, the number 100 is considered to be an
      F_FLOATING data type because field FFLOAT is defined as
      F_FLOATING in the /FIELD qualifier.
Close Help