-2

This is the assignment. I have no clue where to start. I have written some of the code but I am not sure if it is even correct.

Assignment Details

Here is what code I have written so far

   IDENTIFICATION DIVISION.
   PROGRAM-ID. PROGRAM1.
   AUTHOR. KJONES.
  ****************************************************************
  * Program1 produces a TRUCK INVENTORY REPORT listing the current
  * inventory for all three trucks. Listing the truck ID, employee
  * ID, item ID, quantity in stock, purchase price, and selling
  * price.
  * ******
  * INPUT:
  *     The PIZZA FILE contains the following data in
  *     each record:
  *           1. TRUCK ID
  *           2. EMPLOYEE ID
  *           3. DRIVERS FIRST NAME & LAST NAME
  *           4. NUMBER IN STOCK
  *           5. PURCHASE PRICE
  *           6. SELL PRICE
  * ******
  * OUTPUT:
  ****************************************************************
   ENVIROMENT DIVISION.
   CONFIGURATION SECTION.
   SOURCE-COMPUTER. IBM-PC.
   OBJECT-COMPUTER. IBM-PC.

   INPUT-OUTPUT SECTION.
   FILE-CONTROL.
       SELECT PIZZA-FILE
           ASSIGN TO 'PIZZA.TXT'
           ORGANIZATION IS LINE SEQUENTIAL.
       SELECT PIZZA-INVENTORY-FILE
           ASSIGN TO PRINTER 'TRUCKINVENTORY'.

   DATA DIVISION.
   FILE SECTION.

   FD PIZZA-FILE
      RECORD CONTAINS 80 CHARACTERS.

   01 PIZZA-RECORD.
       05  PR-TRUCK-ID             PIC X(5).
       05  PR-EMP-ID               PIC X(4).
       05  PR-EMP-NAME             PIC X(20).
       05  PR-ITEM-ID              PIC AA.
       05  PR-NUM-IN-STOCK         PIC S999.
       05  PR-PURCH-PRICE          PIC S999.
       05  PR-SELL-PRICE           PIC S999.
       05  FILLER                  PIC X(40).

   FD PIZZA-INVENTORY-FILE
      RECORD CONTAINS 80 CHARACTERS.

   01 REPORT-RECORD                PIC X(80).

   WORKING-STORAGE SECTION.

   01  FLAGS-N-SWITCHES.
       05  EOF-FLAG                PIC X         VALUE ' '.

   01  REPORT-FIELDS.
       05  PROPER-SPACING          PIC S9        VALUE +1.

  **************        OUTPUT AREA        ********************

   01 TITLE-ONE.
      05                           PIC X(2)      VALUE SPACES.
      05 H1-DATE                   PIC X(33) 9999/99/99.
      05                           PIC X(32)     VALUE
                                     'ROLLING PIZZA'.
      05                           PIC X(12)     VALUE 'KJJ'.

   01 TITLE-TWO.
      05                           PIC X(33)      VALUE SPACES.
      05                           PIC X(46)      VALUE
                                     'INVENTORY REPORT'.

   01 TITLE-THREE.
      05                           PIC X(5)      VALUE SPACES.
      05                           PIC X(10)     VALUE 'TRUCK'.
      05                           PIC X(13)     VALUE 'EMPLOYEE'.
      05                           PIC X(9)      VALUE 'ITEM'.
      05                           PIC X(11)     VALUE 'NUM IN'.
      05                           PIC X(13)     VALUE 'PURCHASE'.
      05                           PIC X(18)     VALUE 'SELLING'.

   01 TITLE-FOUR.
      05                           PIC X(6)      VALUE SPACES.
      05                           PIC X(12)     VALUE 'ID'. 
cschneid
  • 10,237
  • 1
  • 28
  • 39

1 Answers1

1

This should at least get you started.

You must fix H1-DATE as it is syntactically incorrect.

You must complete the layout of TITLE-3 to make it match the printer spacing chart.

You must code what are often called "detail lines" holding the data to be printed to match the printer spacing chart.

You will need to code a numeric variable to count the number of lines you have printed.

You must code a Procedure Division to...

Open your files.

Read your input file (this is sometimes called a "priming read") and set your EOF-FLAG at end of file.

Probably use a Perform statement with the Until option to...

  • Write out new TITLE records If this is first time through or a new page is needed; you know a new page is needed by counting how many lines you have printed. Remember to reinitialize your line counter variable after each new page is printed.

  • Move data from your input record to your output detail areas.

  • Write the output detail record.

  • Read your input file and set your EOF-FLAG at end of file.

...the Until option must check if your EOF-FLAG has been set.

Close your files.

Goback or Stop Run.

So you will probably want to check out the documentation for Open, Close, Read, Write, Perform, Move, Goback, and how to increment your line counter variable. Compilers generally come with this documentation.

cschneid
  • 10,237
  • 1
  • 28
  • 39