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

Rules for indexed tables, RULES FOR INDEXED TABLES: The rules of index...

RULES FOR INDEXED TABLES: The rules of indexing a table with an INDEXED phrase are as shown below: (1) If indexing is completed for any one level of a table, then indexing

Merge verb with output procedure, MERGE VERB WITH OUTPUT PROCEDURE: Li...

MERGE VERB WITH OUTPUT PROCEDURE: Like the sort verb, the merge verb can also have an output procedure. The syntax of the MERGE verb is as shown below:   The r

Redefine clause, Can we declare a redefine clause as below? A Redefines B, ...

Can we declare a redefine clause as below? A Redefines B, PIC X(4)

File- section and working-storage section, File- Section &Working-Storage S...

File- Section &Working-Storage Section: a) FILE SECTION: The FILE SECTION includes the explanation of all data items that must be read from or written onto some external

Program for output file that can be our vsam file, We have input file, reco...

We have input file, record layout is EMP ID (6 char) , EMP NAME (20 char), Designation (3 char),Salary (5 digit) Base Branch (10char) Grade (3 Alphanumeric). This is the input f

Different data types available in cobol, Data types available in COBOL are ...

Data types available in COBOL are given below Alpha-numeric (X), numeric (9), alphabetic (A)

Handling file that was uploaded from a PC, I uploaded a file from PC to Mai...

I uploaded a file from PC to Mainframe, variable LRCL 256. In my COBOL program I defined it as FD INPUT-FILE LABEL RECORDS ARE OMITTED BLOCK CONTAINS 0 RECORDING MODE

Read statement, READ STATEMENT: The aim of this verb is to make availa...

READ STATEMENT: The aim of this verb is to make available the next logical record from the input file. It is important to note the meaning of the "next" logical record in the

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

Occurs, what does it used

what does it used

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