Program to demonstrate sort verb, COBOL Programming


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.


    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.


      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
Literals: The actual values can too appear in a program. These values are termed as literals. For illustration, the statement MOVE 0 TO TOTAL indicates that the value zero wil

B (Blank Insertion) : The occurrence of a B anyplace in the picture will insert a space character in the edited data. There can be more than one B in the picture. Examples:

Picture Clause: The picture clause explains the general characteristics of an elementary data item. These characteristics are elaborated below: Class: In COBOL the

BLANK WHEN ZERO: BLANK WHEN ZERO is an editing clause that may be used along with a picture. This will set the whole data item to blanks of its value is equal to zero. Though,

REWRITE STATEMENT: The REWRITE statement has the format for a relative file as shown below, REWRITE record-name  [ FORM identifier ]

PROGRAM FOR IF -ELSE: We have to write a program to check whether the given number is ODD or EVEN. You can use IF..ELSE. Identification division. Program- id. IfElse.

PERFORM WITH TIMES OPTION: The format of a PERFORM TIMES statement is as shown below: Illustration:   A)  Perform the para-2 5 times. In this situation the specifie

Character Set: To study any language, first one should know the alphabets of the language and they are termed as character set in general. There are 50 different characters in

Write a COBOL IF sentence to use the values of numeric variables EXAM and COURSEWORK , both assumed to be with format PIC 999 and in the range 0 to 100 and to move the value:

77 level used for- It is Elementary level item. it Cannot be subdivisions of other items or cannot be qualified, or they can be subdivided themselves.