HELPLIB.HLB  —  SORT  Specification File Qualifiers, /DATA
    Specifies the fields of a record to be directed to the output
    file.

    Formats

      /DATA=  field-name

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

              "new-contents")

1  –  Qualifier Values

 field-name

    Specifies the name of a field in a record. The field-name must be
    defined previously in a /FIELD qualifier.

 condition-name

    Specifies a condition-name that has been defined previously in a
    /CONDITION qualifier.

 new-contents

    Specifies how the record is to be altered. The new-contents can
    be a constant or a field-name that has been defined in a /FIELD
    qualifier.

2  –  Full Description

    A /DATA qualifier must identify every field in the records you
    are directing to the output file. Specify the data fields in the
    order you want them to appear in the output record. By default,
    the record format for an output file is the same as that for
    the input file. If you want to eliminate or reorder fields from
    the output record, you can use the /DATA qualifier, causing only
    those fields identified by the /DATA qualifier to be directed to
    the output file.

    You can conditionally change the contents of a field in the
    output records by first specifying a condition name and then
    setting up a test for what meets the condition in a /CONDITION
    qualifier. You then 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:1,SIZE:5)
      /FIELD=(NAME=ZIP,POSITION:6,SIZE:3)
      /FIELD=(NAME=STYLE,POSITION:10,SIZE:5)
      /FIELD=(NAME=CONDITION,POSITION:16,SIZE:9)
      /FIELD=(NAME=PRICE,POSITION:26,SIZE:5)
      /FIELD=(NAME=TAXES,POSITION:32,SIZE:5)
      /DATA=PRICE
      /DATA="  "
      /DATA=TAXES
      /DATA="  "
      /DATA=STYLE
      /DATA="  "
      /DATA=ZIP
      /DATA="  "
      /DATA=AGENT

      The /FIELD qualifiers define the fields in the records from an
      input file that has the following format:

        AGENT ZIP STYLE CONDITION PRICE TAXES

      The /DATA qualifiers, which use the field-names defined in
      the /FIELD qualifiers, reformat the records to create output
      records of the following format:

        PRICE TAXES STYLE ZIP AGENT

    2./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.
Close Help