Program for inventory , COBOL Programming

Assignment Help:

PROGRAM FOR INVENTORY 

We have to write a program to update the inventory file. Consider 2 files,viz, invfile an tranfile. Invfile has 3 fields pno,name,qty. Tranfile has 3 fileds tpno,trcode,tqty. By readin tranfile records if trcode=1 then update the qty with qty+tqty in invfile. If trcode=2 the update the qty with qty-tqty in invfile.

 identification division.

  program- id.

  environment division.

  input-output section.

  file-control.

    select invfile assign to disk

    organization is indexed

    access mode is dynamic

    record key is pno

    file status is fs.

    select tranfile assign to disk

    organization is line sequential.

  data division.

  file section.

  fd  invfile

    label records are standard

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

  01  invrec.

    02 pno  pic 9(5).

    02 name pic x(5).

    02 qty  pic 9(5).

  fd tranfile

  label records are standard

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

01 tranrec.

  02 tpno  pic 9(5).

  02 trcode pic 9.

  02 tqty    pic 9(5).

working-storage section.

01  ans pic x value space.

01  fs  pic x(2) value spaces.

01  key- in pic x value space.

  procedure division.

  p-1.

    open i-o invfile.

    if fs = "30"

      open output invfile

      close invfile

      open i-o invfile.

    perform g-w-inv until ans = 'n' or 'N'.

    move space to ans.

    open output tranfile.

    perform g-w-tran until ans = 'n' or 'N'.

    close tranfile.

    open input tranfile.

  read-para.

    read tranfile at end go to close-para.

    move tpno to pno.

    read invfile key is pno invalid key 

        display(5 5) "No Record Found for" ; pno

       accept key- in

       go to read-para.

    if trcode = 1 

      add tqty to qty

      rewrite invrec.

    if trcode = 2 

      subtract tqty from qty 

      rewrite invrec.

     go to read-para.

  close-para.

    close invfile tranfile.

  op-para.

  open input invfile.

r-para.

  read invfile next record at end go to cl-para.

  display(1 1) erase.

  display(3 5) "Part No: " pno.

  display(5 5) "Name : " name.

  display(7 5) "Qty : " qty.

  accept key- in.

  go to r-para.

cl-para.

  close invfile.

  stop run.

g-w-tran.

  display(1 1) erase.

  display(2 5) "Tran Details ....".

  display(3 5) "Part No: ".

  accept tpno.

  display(5 5) "Trancode : ".

  accept trcode.

  display(7 5) "Quantity : ".

  accept tqty.

  write tranrec.

  display(12 5) "Add more [y/n] :".

  accept ans.

g-w- inv.

  display(1 1) erase.

  display(2 5) "Inven Details....".

  display(3 5) "Part No: ".

  accept pno.

  display(5 5) "Name : ".

  accept name.

  display(7 5) "Quantity : ".

  accept qty.

  write invrec invalid key display(10 5) "Rec Exists!".

  display(12 5) "Add more [y/n] :".

  accept ans.


Related Discussions:- Program for inventory

Illustration of subtract verb, Illustration of Subtract verb: (a) SUBT...

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

Example of condition names, Example of condition names: The illustrati...

Example of condition names: The illustration below is of the use of the condition names  77  MARITAL-STATUS     PIC    9   88  SINGLE    VALUE    IS     ZERO   88  MA

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

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

File description- fixed-length records, FILE DESCRIPTION- FIXED-LENGTH RECO...

FILE DESCRIPTION- FIXED-LENGTH RECORDS: The normal characteristics of a file are explained in the file description (FD) entry of the DATA DIVISION.

Rules for search verb, RULES FOR SEARCH VERB: The rules apply for the ...

RULES FOR SEARCH VERB: The rules apply for the SEARCH verb is as shown below: (1) The SEARCH verb can be applied only to a table that has the OCCURS clause and INDEXED phra

What are name the divisions in a cobol program, Name the divisions in a COB...

Name the divisions in a COBOL program are given below DENTIFICATION DIVISION DATA DIVISION ENVIRONMENT DIVISION PROCEDURE DIVISION.

Example of nested if statement, Example of Nested if statement: Illus...

Example of Nested if statement: Illustration: Consider the following sentence The nested IF sentence holds two IFs and one ELSE. The IF-ELSE couple has been marke

Introduction to cobol, Introduction to COBOL: In the year 1959, a new ...

Introduction to COBOL: In the year 1959, a new language named the COBOL ( CO mmon B usiness O riented L anguage) was introduced remembering the business purpose application

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)

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