jaepaint.blogg.se

Sorting an array in cobol program
Sorting an array in cobol program











Specifies the name of a procedure used to select or modify input records before the sorting operation begins. If file-name-1 contains fixed-length records, the size of the records contained in the input files must not be greater than the largest record of file-name-1. ) must be neither less than the smallest record nor greater than the largest record of the file-name-1.

sorting an array in cobol program

If file-name-1 contains variable-length records, the size of the records contained in the input files (file-name-2, file-name-3. The input files are automatically opened, read and closed.Īll input files must specify sequential or dynamic access mode and be defined in FD entries in the data division. When SORT statement is executed, these files should not be opened.

sorting an array in cobol program

During the SORT operation, all the records from file-name-2, file-name-3. When both the COLLATING SEQUENCE phrase and the PROGRAM COLLATING SEQUENCE clause are omitted, the collating sequence indicated by the COLLSEQ compiler option is used. When the COLLATING SEQUENCE phrase is omitted, the PROGRAM COLLATING SEQUENCE clause in the OBJECT-COMPUTER paragraph used.

sorting an array in cobol program

Must be specified in the ALPHABET clause of the SPECIAL-NAMES paragraph. The COLLATING SEQUENCE phrase has no effect for keys that are not alphabetic or alphanumeric. When the COLLATING SEQUENCE phrase is not specified, the key comparisons are performed according to the rules for comparison of operands. When the COLLATING SEQUENCE phrase is specified, the indicated collating sequence is used for key data items comparisons of alphabetic, alphanumeric, alphanumeric-edited, external floating-point and numeric-edited categories. Specifies the collating sequence to be used in alphanumeric comparisons for the KEY data items in this sort operation. If the DUPLICATES phrase is not specified, the order of these records is undefined. If the DUPLICATES phrase is specified and duplicates existed, the order of associated input files as specified in the SORT statement. DUPLICATES phrase used to specify the order when the duplicate records existed in the file. If all the keys associated with one record are equal to the corresponding keys in one or more other records, then considered that file has duplicate records.

  • When the COLLATING SEQUENCE phrase is specified, the indicated collating sequence is used for key data items of alphabetic, alphanumeric, alphanumeric-edited, external floating-point and numeric-edited categories.
  • When the COLLATING SEQUENCE phrase is not specified, the key comparisons are performed according to the rules for comparison of operands in a relation condition.
  • If the KEY data item is internal floating point, the sequence of key values will be in numeric order.
  • The sequence in which the records are sorted depends on the collating sequence used.
  • If the KEY is a display floating-point item, the compiler treats the data item as character data of the same size as the key.
  • If the KEY data item is alphabetic, alphanumeric, alphanumeric-edited or numeric-edited, the sequence of key values arranged depends on the collating sequence.
  • When DESCENDING is specified, the sequence is from the highest key value to the lowest.
  • When ASCENDING is specified, the sequence is from the lowest key value to the highest key value.
  • The direction of the sorting operation depends on the ASCENDING or DESCENDING keywords as follows. If file-name-3 references an indexed file, the first specification of data-name-1 must be associated with an ASCENDING phrase and the data item referenced by that data-name-1 must occupy the same character positions in this record as the data item associated with the major record key for that file.
  • Internal floating-point or display floating-point.
  • Numeric (except numeric with usage NATIONAL).
  • Alphabetic, alphanumeric, alphanumeric-edited.
  • KEY data items can be any of the following data categories.
  • Group items that contain variable-occurrence data items.
  • sorting an array in cobol program

    KEY data items must not contain an OCCURS clause or be subordinate to an item that contains an OCCURS clause.If file-name-1 contains variable-length records, all of the KEY data-items must be contained within the minimum records size specified for file-name-1.If file-name-1 has more than one record description, the KEY data items need be specifies in only one of the record descriptions.A specific KEY data item must be physically located in the same position and have the same data format in each input file.













    Sorting an array in cobol program