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
RELATIVE FILES: The Files that are stored on a direct access storage medium like magnetic disk are frequently known as direct access files. The COBOL supports three different

SEARCH VERB: The SEARCH verb is used to position elements in one-dimensional tables. Let us consider the following problem. Assume that each element of a table consists of thr

can we move spaces to numeric field

FILE-CONTROL: The FILE-CONTROL paragraph names each and every file and identifies the first medium through file control entries. The basic format of a file control entry is gi

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:

PROGRAM FOR DIVIDE VERB:   We have to write an easy program to elaborate DIVIDE verb. You can also use edit characters in the program. Identification division. Program-

WRITE STATEMENT: The records are written to be logical place as determined from the value of the record key. The INVALID KEY condition occurs in the cases shown below: (i)

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

There are some restrictions when these procedures are used. (i) The Procedure should not contain any SORT/MERGE statement. (ii) An explicit transfer of the control outside

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