Logo 
Search:

Cobol Articles

Submit Article
Home » Articles » Cobol » Homework HelpRSS Feeds

PROGRAM FOR THE INVENTORY TRANSACTIONS

Posted By: Charlie Evans     Category: Cobol     Views: 5147

WRITE A PROGRAM FOR THE INVENTORY TRANSACTIONS.

Code for PROGRAM FOR THE INVENTORY TRANSACTIONS in Cobol

       Identification Division.
       Program-Id. Master-Trnasaction.
       Environment Division.
       Input-Output Section.
       File-Control.
           Select M-File ASsign To Disk
           Organization Is Line Sequential.
           Select T-File ASsign To Disk
           Organization Is Line Sequential.
       Data Division.
       File Section.
       FD M-File
           Label Records Are Standard
           Value Of File-Id Is Master-File.
       01 M-Rec.
          02 Item-C  Pic 9(5).
          02 Desc    Pic x(25).
          02 Qty     Pic 9(5).
          02 Price   Pic 9(5)v99.
          02 Reorder Pic 9(4).

       FD T-File
           Label Records Are Standard
           Value Of File-Id Is Trans-File.
       01 T-Rec.
          02 Item-C     Pic 9(5).
          02 Trans-Type Pic a.
          02 Amount     Pic 9(4)v99.


       Working-Storage Section.
       77 EOF1        Pic x Value "N".
       77 EOF2        Pic x Value "N".
       77 Master-File Pic x(12).
       77 Trans-File  Pic x(12).
       77 Temp-Qty    Pic s9(5) Value 0.
       01 Temp-Rec.
          02 Item-C  Pic z(4)9.
          02 Filler  Pic x(8).
          02 Desc    Pic x(25).
          02 Qty     Pic z(4)9.
          02 Filler  Pic x(5).
          02 Price   Pic z(4)9.99.
          02 Reorder Pic zzz9.

       Screen Section.
       01 Reorder-Scr.
          02 Line 5 Column 20 "The Items Requring Reordering are :"
             Highlight.
          02 Line 6 Column 20 Pic x(35) From All "-".
         02 Line 7 Column 5 "Item Code         Description  "
             Highlight.
          02 Line 7 Column 45 "Quantity  Price  Reordering " Highlight.
          

       Procedure Division.
       Main-Para.
           Perform Initialize-Para.
           Perform Open-Para.
           Perform Read-M-Para.
           Perform Read-T-Para.
           Perform Process-Para Until EOF1 = "Y" Or EOF2 = "Y".
           Perform End-Para.
           Stop Run.

       Initialize-Para.
           Move 10 To Lin.
           Move 6 To Col.

       Open-Para.
           Display(10, 20) "Enter the Master File Name :".
           Accept(10, 60) Master-File.
           Display(12, 20) "Enter the Transaction File Name :".
           Accept(12, 60) Trans-File.
           Display(1, 1) Erase.
           Open Input T-file I-O M-file.

       Read-M-Para.
           Read M-File At End Move "Y" To EOF1.
           Move Qty Of M-Rec To Temp-Qty.

       Read-T-Para.
           Read T-File At End Move "Y" To EOF2.

       Process-Para.
           If (Item-C Of M-Rec = Item-C Of T-Rec)
              Perform Equal-Para
           Else
              If(Item-C Of M-Rec > Item-C Of T-Rec)
                Perform Greater-Para
              Else
                Perform Less-Para.

       Equal-Para.
           If (Trans-Type = "T" )
              Subtract Amount From Temp-Qty 
           Else
              Add Amount To Temp-Qty.
           
           Perform Reorder-Para.
           Perform Write-Para.
           Perform Read-M-Para.
           Perform Read-T-Para.

       Less-Para.
           Perform Write-Para.
           Perform Reorder-Para.
           Perform Read-M-Para.

       Greater-Para.
           Perform Reorder-Para.
           Perform Read-T-Para.


       Write-Para.
           If (Temp-Qty < 0)
              Move 0 To Qty Of M-Rec
           Else
              Move Temp-Qty To Qty Of M-Rec.
           ReWrite M-Rec.


       Reorder-Para.
           If (Qty Of M-Rec < Reorder Of M-Rec
               Or Qty Of M-Rec = Reorder Of M-Rec)
              Display Reorder-Scr
              Move Corr M-Rec To Temp-Rec
              Display(Lin, Col) Temp-Rec 
              Add 1 To Lin.


       End-Para.
           Close M-File T-file.
  
Share: 


Didn't find what you were looking for? Find more on PROGRAM FOR THE INVENTORY TRANSACTIONS Or get search suggestion and latest updates.

Charlie Evans
Charlie Evans author of PROGRAM FOR THE INVENTORY TRANSACTIONS is from London, United Kingdom.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!