Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Having Problems getting a program to run

Status
Not open for further replies.

jps111s

Programmer
Feb 19, 2001
6
0
0
US
This is a program for my intro cobol course. When i try to run the program i get 'file not found error 13'. My select and assign clause seem to be correct. This is the first cobol program i've written so if u can look at my code and make any suggestions i would appreciate it.

THANK YOU

ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. HP8665C.
OBJECT-COMPUTER. HP8665C.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT BULL-CUSTOMER-FILE ASSIGN TO
"C:\BULL-CUSTOMER-FILE.txt".
SELECT BULL-REPORT ASSIGN TO "OUTPUT.Dat".
*
DATA DIVISION.
FILE SECTION.
FD BULL-CUSTOMER-FILE
LABEL RECORDS ARE OMITTED.
01 BR-BULL-RECORD.
05 BR-CUSTOMER PIC X(20).
05 BR-BREED PIC X(20).
05 BR-SALE-DATE PIC X(9).
05 BR-BIRTH-DATE PIC X(9).
05 BR-BULL-WEIGHT PIC 9(4).
05 BR-SALE-PRICE PIC 9(5)V99.
FD BULL-REPORT.
01 CR-CUSTOMER-RECORD PIC X(132).
WORKING-STORAGE SECTION.
01 WS-DATE PIC 9(6).
01 WS-PROCESSING-INDICATORS.
05 WS-END-OF-FILE-INDICATOR PIC X(3).
88 END-OF-FILE VALUE 'NO '.
01 WS-COUNTER PIC 999 VALUE 0.
01 WS-ACCUMULATORS.
05 TOT-TOTAL-SALES PIC 9(5)V99 VALUE 0.
05 TOT-TOTAL-POUNDS PIC 9(4) VALUE 0.
01 WS-DATA.
05 WS-AVERAGE-SALE-PRICE PIC 9(5)V99.
05 WS-AVERAGE-PRICE-POUND PIC 9(5)V99.
01 DL-DETAIL-LINE.
05 FILLER PIC X(22) VALUE SPACES.
05 DL-CUSTOMER PIC X(20).
05 FILLER PIC X(5) VALUE SPACES.
05 DL-BREED PIC X(20).
05 FILLER PIC X(5) VALUE SPACES.
05 DL-SALE-DATE PIC Z9/99/99.
05 FILLER PIC X(2) VALUE SPACES.
05 DL-BIRTH-DATE PIC Z9/99/99.
05 FILLER PIC X(5) VALUE SPACES.
05 DL-BULL-WEIGHT PIC 9(4).
05 FILLER PIC X(5) VALUE SPACES.
05 DL-SALE-PRICE PIC $ZZZZZ.99.
05 FILLER PIC X(20) VALUE SPACES.
01 HD-REPORT-HEADING-COMPANY-1.
05 FILLER PIC X(58) VALUE SPACES.
05 FILLER PIC X(16)
VALUE 'BULL TRADERS INC'.
05 FILLER PIC X(59) VALUE SPACES.
01 HD-REPORT-HEADING-COMPANY-2.
05 FILLER PIC X(57) VALUE SPACES.
05 FILLER PIC X(20)
VALUE 'LAWRENCE COUNTY, MO.'.
05 FILLER PIC X(57) VALUE SPACES.
01 HD-REPORT-HEADING-DATE.
05 FILLER PIC X(62) VALUE SPACES.
05 HD-HEADING-DATE PIC X(6).
05 FILLER PIC X(62) VALUE SPACES.
01 HD-COLLUMN-HEADING-1.
05 FILLER PIC X(22) VALUE SPACES.
05 FILLER PIC X(20) VALUE 'CUSTOMER'.
05 FILLER PIC X(5) VALUE SPACES.
05 FILLER PIC X(20) VALUE 'BULL'.
05 FILLER PIC X(5) VALUE SPACES.
05 FILLER PIC X(6) VALUE 'SALES'.
05 FILLER PIC X(5) VALUE SPACES.
05 FILLER PIC X(6) VALUE 'BIRTH'.
05 FILLER PIC X(5) VALUE SPACES.
05 FILLER PIC X(4) VALUE 'BULL'.
05 FILLER PIC X(5) VALUE SPACES.
05 FILLER PIC X(7) VALUE 'SALE'.
05 FILLER PIC X(22) VALUE SPACES.
01 HD-COLLUMN-HEADING-2.
05 FILLER PIC X(24) VALUE SPACES.
05 FILLER PIC X(18) VALUE 'NAME'.
05 FILLER PIC X(5) VALUE SPACES.
05 FILLER PIC X(20) VALUE 'BREED'.
05 FILLER PIC X(5) VALUE SPACES.
05 FILLER PIC X(6) VALUE 'DATE'.
05 FILLER PIC X(5) VALUE SPACES.
05 FILLER PIC X(6) VALUE 'DATE'.
05 FILLER PIC X(5) VALUE SPACES.
05 FILLER PIC X(6) VALUE 'WEIGHT'.
05 FILLER PIC X(5) VALUE SPACES.
05 FILLER PIC X(7) VALUE 'PRICE'.
05 FILLER PIC X(22) VALUE SPACES.
01 FT-FOOTING-1.
05 FILLER PIC X(23)
VALUE 'TOTAL TRANSACTIONS ARE '.
05 FT-TRANSACTIONS PIC ZZ9.
01 FT-FOOTING-2.
05 FILLER PIC X(13)
VALUE 'TOTAL POUNDS '.
05 FT-POUNDS PIC ZZZ9.
01 FT-FOOTING-3.
05 FILLER PIC X(26)
VALUE 'TOTAL DOLLARS RECIEVED IS '.
05 FT-DOLLARS-RECIEVED PIC $$,$$$.99.
01 FT-FOOTING-4.
05 FILLER PIC X(27)
VALUE 'AVERAGE PRICE PER POUND IS '.
05 FT-AVERAGE-POUND PIC $$$.99.
01 FT-FOOTING-5.
05 FILLER PIC X(22)
VALUE 'AVERAGE SALE PRICE IS '.
05 FT-AVERAGE-SALE PIC $$,$$$.99.
*
PROCEDURE DIVISION.
A000-BULL-REPORT.
PERFORM B100-INITIAL-ROUTINE.
PERFORM B200-PROCESS-RECORDS
UNTIL END-OF-FILE.
PERFORM B300-ENDING-ROUTINE.
STOP RUN.
B100-INITIAL-ROUTINE.
PERFORM C100-OPEN-FILES.
PERFORM C200-INITIALIZE-VARIABLES.
PERFORM Z100-PRINT-HEADINGS.
PERFORM Z200-READ-BULL-RECORD.
B200-PROCESS-RECORDS.
PERFORM C400-CREATE-DETAIL-RECORD.
PERFORM C500-CALCULATE-VALUES.
PERFORM C600-CREATE-OUTPUT.
PERFORM Z200-READ-BULL-RECORD.
B300-ENDING-ROUTINE.
CLOSE BULL-CUSTOMER-FILE
BULL-REPORT.
C100-OPEN-FILES.
OPEN INPUT BULL-CUSTOMER-FILE
OUTPUT BULL-REPORT.
C200-INITIALIZE-VARIABLES.
INITIALIZE WS-COUNTER.
INITIALIZE WS-ACCUMULATORS.
INITIALIZE WS-DATA.
ACCEPT WS-DATE FROM DATE.
C400-CREATE-DETAIL-RECORD.
MOVE BR-CUSTOMER TO DL-CUSTOMER.
MOVE BR-BREED TO DL-BREED.
MOVE BR-BIRTH-DATE TO DL-BIRTH-DATE.
MOVE BR-SALE-DATE TO DL-SALE-DATE.
MOVE BR-BULL-WEIGHT TO DL-BULL-WEIGHT.
MOVE BR-SALE-PRICE TO DL-SALE-PRICE.
C500-CALCULATE-VALUES.
PERFORM D100-AVERAGE-PRICE-PER-POUND.
PERFORM D200-AVERAGE-SALE-PRICE.
C600-CREATE-OUTPUT.
MOVE WS-COUNTER TO FT-TRANSACTIONS.
MOVE TOT-TOTAL-SALES TO FT-DOLLARS-RECIEVED.
MOVE TOT-TOTAL-POUNDS TO FT-POUNDS.
MOVE WS-AVERAGE-PRICE-POUND TO FT-AVERAGE-POUND.
MOVE WS-AVERAGE-SALE-PRICE TO FT-AVERAGE-SALE.
C700-PROCESS-TOTALS.
MOVE FT-FOOTING-1 TO CR-CUSTOMER-RECORD.
WRITE CR-CUSTOMER-RECORD
AFTER ADVANCING 1 LINE.
MOVE FT-FOOTING-2 TO CR-CUSTOMER-RECORD.
WRITE CR-CUSTOMER-RECORD
AFTER ADVANCING 1 LINE.
MOVE FT-FOOTING-3 TO CR-CUSTOMER-RECORD.
WRITE CR-CUSTOMER-RECORD
AFTER ADVANCING 1 LINE.
MOVE FT-FOOTING-4 TO CR-CUSTOMER-RECORD.
WRITE CR-CUSTOMER-RECORD
AFTER ADVANCING 1 LINE.
MOVE FT-FOOTING-5 TO CR-CUSTOMER-RECORD.
WRITE CR-CUSTOMER-RECORD
AFTER ADVANCING 1 LINE.
D100-AVERAGE-PRICE-PER-POUND.
DIVIDE TOT-TOTAL-SALES BY TOT-TOTAL-POUNDS
GIVING WS-AVERAGE-PRICE-POUND.
D200-AVERAGE-SALE-PRICE.
DIVIDE TOT-TOTAL-SALES BY WS-COUNTER
GIVING WS-AVERAGE-SALE-PRICE.
D300-CREATE-TOTALS.
Z100-PRINT-HEADINGS.
MOVE HD-REPORT-HEADING-COMPANY-1 TO CR-CUSTOMER-RECORD.
WRITE CR-CUSTOMER-RECORD
AFTER ADVANCING 1 LINE.
MOVE HD-REPORT-HEADING-COMPANY-2 TO CR-CUSTOMER-RECORD.
WRITE CR-CUSTOMER-RECORD
AFTER ADVANCING 1 LINE.
ACCEPT WS-DATE FROM DATE.
MOVE WS-DATE TO HD-HEADING-DATE.
MOVE HD-HEADING-DATE TO CR-CUSTOMER-RECORD.
WRITE CR-CUSTOMER-RECORD
AFTER ADVANCING 1 LINE.
MOVE ALL '*' TO CR-CUSTOMER-RECORD.
WRITE CR-CUSTOMER-RECORD
AFTER ADVANCING 1 LINE.
Z200-READ-BULL-RECORD.
READ BULL-CUSTOMER-FILE
AT END MOVE 'NO ' TO WS-END-OF-FILE-INDICATOR.
 
Hi JPS,

Sorry, can't help w/your problem, I'm not a PC guy, but
maybe you have to preallocate your files(both).

I want to congratulate you though, on a very well written program.

The structure is good; the paragraph numbering scheme shows thought and an eye toward organization; and the names are meaningful and understandable.

You may want to separate the paragraphs with a blank line. Personally, I don't use periods except at paragraph end (I use it on a separate line. It doubles as a paragraph separator. It's a religious thing.

Again, congrats.

And now for the sales pitch. I must confess, I'm on a mission. A mission to get pgmrs starting out in this business to process 2 common programming problems correctly. One of them is the "control break" problem, the other is the "file match".

As I've stated before in this forum, easily 90% of batch program design uses either one or both of these techniques, so anyone intending to enter the DP field can save themselves and their users a great deal of grief by understanding the concepts involved.

I know you're under pressure to complete assignments, and generally have other things to, but I urge you to look at (or save it, if you don't have the time now) the thread started by imac900 on 2/18 titled "need help with conbreaks".

Once you understand the concept, it can be used in any control break situation. If you have trouble in going through it or understanding my clumsy attempt at explaining it, send me an e-Mail (it's in my profile) and I'll try to help.

Keep up the good work.

Jack
P.S.
When you want to present Code in this forum, precede the code with
Code:
 and end it with

This somehow preserves the spacing and format of the original. You can even cut & paste.
 
Hi
I dont know what your compiler expects, but mine would require "label records are standard" for a disk file. "label record are omitted" would be used on a device such as a printer. Hope this helps.
 
File not found 013 error usually means exactly that. The program is looking for the file BILL-CUSTOMER-FILE.txt on the C drive in the root directory. It is probably either not there or misspelled. Also some older file systems had an 8 charcter with 3 character extention naming limitation.
 
jps111s,

indeed a very nicely build program, especially for a "first-timer" !
I see you qualifying your input file with a full path, and your output file not; maybe there's your pain. Also, as dlittlesr suggested, check if your input file is really there.
Perhaps you can find out on which of the two files the error occurs, if possible at all; if so, it might prevent you from barking up the wrong tree.

Good luck !
 
Most likely the filenames are mispelled, also for compatability sake you might want to shorten the names so they are fine under standard DOS conventions (otherwise, 8 character names and 3 character file type).

BTW nice program layout for somebody in an intro class, I took my intro COBOL class last semeste and you use pretty much the same setup I do (I call Initial-Routine, Startup and End-Routine, Wrap-Up but those are the only difference), plus all your names are easy to understand (I have seen way too many posted program sections on here which the name are so abbreviated you couldn't understand them, its like decoding customized license plates) Chris Green
Computer Information Systems Student
Cayuga Community College -- Fulton
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top