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
File Description for the Relative and Indexed Files: The FD entry for a relative or an indexed file is similar to that of a sequential file. Some compilers do not permit varia

DISPLAY STATEMENT:   The function of the DISPLAY statement is just opposite to that of the ACCEPT statement. It is used to display the low-volume results on the operator's co

Block Size: The normal practice is to group a number of consecutive records to form that is termed as a block or a physical record. The number of records in a block is frequen

Record Description for the Variable-length Records: When the variable- length records consists of records of various lengths, each record type is to be explained at level 01 f

CR and DB (Credit and Debit Sign): The two characters that is CR or DB symbol may appear only at the rightmost place of the picture. They are similar to the minus sign edit ch

.(Period or Decimal Point) : The period may be used to insert a decimal point and may not come into view more than once. Both the period and V cannot appear in similar picture

RULES OF MOVE VERB:  The Data movement is managed by the rules which are as shown below: (a) The contents of the identifier - 1 or the value of the literal - 1 is moved to

cobol program for generate a eb bill

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

Program for Sequential File Creation & Rewriting  We have to write a program to create a Length file with just two fields: l (Length) and l-c (Length-Code). Add a few records.