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
INDEXED TABLES: The OCCURS clause that is used to define tables can optionally have an INDEXED phrase. This phrase involves the names of data items which are to be used as sub

The LENDER Bank offers mortgages on homes valued up to $500,000. The required down payment is calculated as follows: 4% of the first $60,000 borrowed 8% of the next $30,000 borro

Column and Field in COBOL program: In COBOL there are 2 types of entries termed as margin A and margin B entries. The Margin A entries start from the column 8, 9, 10 or 11 and

ACCEPT STATEMENT: The ACCEPT statement is used to read the low-volume data from the operator's console, several other hardware device or from the operating system. The common

calculate simple interest

Illustration of Perform with varying option: A) Perform para-3 varying the k from 1 by 1 until k > 10. Here para-3 will be constantly executed 10 times (For k=1,2,3, .....1

PROCEDURE DIVISION statements for the indexed files: All the statements which are available for a relative file are also available for an indexed file. READ STTATEMENT :

PROGRAM FOR RENAMES CLAUSE: identification division. program- id. environment division. data division. working-storage section. 01 emp.      02 empdet.

DATA RECORD CLAUSE: The DATA RECORD clause, documents the record names defined for the file. For illustration, DATA RECORDS ARE REC-1, REC-2, REC-3 that means there are 3diffe

LABEL RECORD CLAUSE: This clause specifies whether or not the standard header and trailer labels must be present in the magnetic-tape files. VALUE OF CLAUSE: The VAL