Program to demonstrate sort verb, COBOL Programming

PROGRAM TO DEMONSTRATE SORT VERB:

The file for which a record having 2 fields, viz., Account Number and Name is already available. Sort the file based on the ascending order of the Account Number.

 identification division.

  program- id.

  environment division.

  input-output section.

  file-control.

    select o1- file assign to disk

    organization is line sequential.

  select s1-file assign to disk

    organization is line sequential.

    select w- file assign to disk.

  data division.

  file section.

  fd o1- file

    label records are standard

    value of file- id is "o1.dat".

  01  o1-rec.

    02 o1-acc-no pic 9(2).

    02 o1-name pic x(4).

 

  fd s1-file

    label records are standard

    value of file- id is "s1.dat".

01  s1-rec.

  02 s1-acc-no pic 9(2).

  02 s1-name pic x(4).

sd w-file.

01  w-rec.

  02 w-acc-no pic 9(2).

  02 w-name pic x(4).

procedure division.

p-1.

      sort w-file on ascending key w-acc-no using o1-file

        giving s1- file.

  stop run.

 

Posted Date: 10/18/2012 1:25:25 AM | Location : United States







Related Discussions:- Program to demonstrate sort verb, Assignment Help, Ask Question on Program to demonstrate sort verb, Get Answer, Expert's Help, Program to demonstrate sort verb Discussions

Write discussion on Program to demonstrate sort verb
Your posts are moderated
Related Questions
Example of Sign condition: The illustration below describes the use of the sign condition. Illustration:     77  BALANCE  PIC  S9 (6) V99.       .       .     I

Floating Insertion   The currency symbol ($) can emerge in multiples on the left-hand side of the picture. In this situation the character will be treated in similar way as t

Introduction to COBOL: In the year 1959, a new language named the COBOL ( CO mmon B usiness O riented L anguage) was introduced remembering the business purpose application

REWRITE STATEMENT: As in the situation of a relative file, the REWRITE statement needs that the file should be opened in the I-O mode, and if the SEQENTIAL access mode is spec

What is the difference b/w index and subscript? Subscript indicates to the array occurrence whereas index is the displacement (in no of bytes) from the beginning of the array.

GIVING    file-name-5. The input files to be merged through the MERGE statements which are specified in the USING phrase. These files should be sequential files and should be

COBOL Words: The COBOL word can be formed by using the characters as shown below: 0-9 A-Z (a-z) - (hyphen) The rules below should be hold in forming the COBOL words.


REDEFINES CLAUSE: At times it may be found that two or more storage regions defined in the DATA DIVISION are not in use concurrently. In such situations only one storage regio

Illustration of Subtract verb: (a) SUBTRACT A FROM B. This illustration means that the value of A will be subtracted from the value of B and the subtracted result will be s