Program to demonstrate merge verb, COBOL Programming

Assignment Help:

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.


Related Discussions:- Program to demonstrate merge verb

Cobol words, COBOL Words: The COBOL word can be formed by using the ch...

COBOL Words: The COBOL word can be formed by using the characters as shown below: 0-9 A-Z (a-z) - (hyphen) The rules below should be hold in forming the COBOL words.

Illustration of search verb, Illustration of Search verb: To illustrat...

Illustration of Search verb: To illustrate the other use of SEARCH verb, assume we wish to search the similar tab to find the number of persons whose deposited amount is more

Occurs clause, Occurs Clause: Let us establish tables with the help of...

Occurs Clause: Let us establish tables with the help of an illustration. Assume that there are ten different types of income-tax rates that are read from some input medium and

Input-output section - cobol programming, INPUT-OUTPUT SECTION: This s...

INPUT-OUTPUT SECTION: This section holds information regarding the files to be used in the program. There are 2 paragraphs in this section- FILE-CONTROL & I-O-CONTROL. The

Floating insertion - , Floating Insertion   The currency symbol ($) c...

Floating Insertion   The currency symbol ($) can emerge in multiples on the left-hand side of the picture. In this situation the character will be treated in similar way as t

Accept statement, ACCEPT STATEMENT: The ACCEPT statement is used to re...

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

Input and output procedure in statement, INPUT AND OUTPUT PROCEDURE IN SORT...

INPUT AND OUTPUT PROCEDURE IN SORT STATEMENT: The common format of the SORT statement can write as shown below: The format of the RELEASE statement is as shown be

Sequential files with the variable-length records, SEQUENTIAL FILES WITH TH...

SEQUENTIAL FILES WITH THE VARIABLE-LENGTH RECORDS: The Magnetic - tape or disk files can hold variable-length records. In this situation the file can have records with various

Size - picture clause, Size: The number of characters or digits needed...

Size: The number of characters or digits needed to store the data item in the memory in termed as the Size of the data item. All the 4 general characteristics explained can

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd