Program to demonstrate merge verb, COBOL Programming

PROGRAM TO DEMONSTRATE MERGE VERB:

The two files for which a record having 2 fields viz. Account Number and Name are already available. Now Merge these two files and create a new 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 o2- file assign to disk

    organization is line sequential.

    select s1-file assign to disk

    organization is line sequential.

    select s2-file assign to disk

    organization is line sequential.

    select m- 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 o2- file

  label records are standard

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

01  o2-rec.

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

  02 o2-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).

fd s2-file

  label records are standard

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

01  s2-rec.

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

  02 s2-name pic x(4).

fd m- file

  label records are standard

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

01  m-rec.

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

  02 m-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.

                sort w-file on ascending key w-acc-no using o2-file giving s2- file.

     merge w-file on ascending key w-acc-no  using s1-file  s2-file giving m- file.

stop run.

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







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

Write discussion on Program to demonstrate merge verb
Your posts are moderated
Related Questions
Figurative Constants: The Figurative constants have several fixed names and the compiler recognizes these names and it sets up the equivalent values in the object program.

Example of If- else statement Illustration:   IF   QUANTITY IS NUMERIC AND QUANTITY IS POSITIVE          MOVE ZERO TO ERROR-CODE. COMPUTE SALES VALUE=QUANTITY*RATE

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

Introduction to MOVE Verb: The aim of this section is to introduce the learner how to move data from one place to the other place in the memory. This is completed with the help

Rules for Simple sort verb: The work file is to be defined by a sort elaboration entry (SD entry).The format of SD entry is as shown below. The rules below should be taken

Illustration of if- else statement: IF OK-BALANCE NEXT SENTENCE ELSE MOVE 2 BALANCE-CODE In this illustration, the OK-BALANCE is a condition name. No action is specific if

WRITE statement: The WRITE statement for tape and sequential-disk files has the syntax shown below. WRITE            record-name      [  FROM    identifier   ] As a resu

PROGRAMS FOR REDEFINES CLAUSE: We have to write a simple program to explain the REDEFINES clause at 01 level. identification division. program- id. Redef. environment

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

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