VMS Help
SORT, Specification File Qualifiers, /CONDITION, Examples

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

    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     HLB-list     TLB-list     Help  

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