Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » COBOL » command prompt closes on me
command prompt closes on me [message #1150526] Tue, 22 October 2013 20:56
Bryan Kruep is currently offline Bryan Kruep
Messages: 2
Registered: April 2013
Junior Member
I am not sure what I am doing wrong but whenever I run this program the command prompt opens and closes right away and was wanting to get some assistance on why this is happening. I apologize ahead of time as I do not know how to make code tags on this site...

IDENTIFICATION DIVISION.
PROGRAM-ID. Horoscope.
AUTHOR. Bryan Kruep.

ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT SOURCE-FILE ASSIGN TO "Horoscope.txt"
ORGANIZATION IS LINE SEQUENTIAL.
SELECT REPORT-FILE ASSIGN TO "Horoscope.txt".

DATA DIVISION.
FILE SECTION.
FD SOURCE-FILE.
01 SOURCE-DETAILS.
88 END-OF-SOURCE-FILE VALUE HIGH-VALUES.
05 FILE-DATA PIC X(300).

FD REPORT-FILE.
01 PRINT-AREA PIC X(80).

WORKING-STORAGE SECTION.
01 HEADING-LINE-1.
05 FILLER PIC X(25) VALUE SPACES.
05 FILLER PIC X(20)
VALUE "Horoscope Report".
05 FILLER PIC X(18) VALUE SPACES.
05 FILLER PIC X(6)
VALUE "Date: ".
05 HL1-MONTH PIC 9(2) VALUE ZEROS.
05 FILLER PIC X VALUE "/".
05 HL1-DAY PIC 9(2) VALUE ZEROS.
05 FILLER PIC X(3) VALUE "/20".
05 HL1-YEAR PIC 9(2) VALUE ZEROS.

01 FOOTER-LINE-1.
05 FILLER PIC X(70) VALUE SPACES.
05 FILLER PIC X(7) VALUE "PAGE #:".
05 FL1-PAGE-NUMBER PIC ZZ9 VALUE ZEROS.

01 DETAIL-HEADING-1.
05 FILLER PIC X(4) VALUE "NAME".
05 FILLER PIC X(3) VALUE SPACES.
05 FILLER PIC X(10) VALUE "DATE RANGE".
05 FILLER PIC X(2) VALUE SPACES.
05 FILLER PIC X VALUE "@".
05 FILLER PIC X(7) VALUE "MESSAGE".
05 FILLER PIC X(18) VALUE SPACES.

01 DETAIL-LINE-1.
05 FILLER PIC X VALUE SPACES.
05 DETAIL-HOROSCOPE-NAME PIC ZZ9 VALUE ZEROS.
05 FILLER PIC X(3) VALUE SPACES.
05 DETAIL-DATE-RANGE PIC X(10) VALUE SPACES.
05 FILLER PIC X(2) VALUE SPACES.
05 DETAIL-MESSAGE PIC X(10) VALUE SPACES.

01 WORK-FIELDS.
05 CURRENT-DATE.
10 CURRENT-YEAR PIC 9(2).
10 CURRENT-MONTH PIC 9(2).
10 CURRENT-DAY PIC 9(2).
05 PAGE-NUMBER PIC 9(3) VALUE ZERO.

01 HOROSCOPE-DATA.
05 HOROSCOPE-NAME PIC X(21).
05 DATE-RANGE.
10 BEGIN-MONTH PIC 9(2).
10 FILLER PIC X.
10 BEGIN-YEAR PIC 9(2).
10 FILLER PIC X.
10 END-MONTH PIC 9(2).
10 FILLER PIC X.
10 END-YEAR PIC 9(2).
05 MESSAGE-RESPONSE PIC X(180).

PROCEDURE DIVISION.
A0000-FILE-READER-PROGRAM.

OPEN INPUT SOURCE-FILE
OUTPUT REPORT-FILE.
PERFORM B1000-INITIALIZE-REPORT.
READ SOURCE-FILE
AT END SET END-OF-SOURCE-FILE TO TRUE
END-READ.
PERFORM C2000-WRITE-DETAILS
UNTIL END-OF-SOURCE-FILE.

PERFORM D3000-WRITE-FOOTER.
CLOSE SOURCE-FILE
REPORT-FILE.
STOP RUN.

B1000-INITIALIZE-REPORT.
ACCEPT CURRENT-DATE FROM DATE.
MOVE CURRENT-YEAR TO HL1-YEAR.
MOVE CURRENT-MONTH TO HL1-MONTH.
MOVE CURRENT-DAY TO HL1-DAY.
MOVE HEADING-LINE-1 TO PRINT-AREA.
WRITE PRINT-AREA AFTER ADVANCING PAGE.
MOVE DETAIL-HEADING-1 TO PRINT-AREA.
WRITE PRINT-AREA AFTER 2 LINES.
WRITE PRINT-AREA AFTER 1 LINES.
MOVE 1 TO PAGE-NUMBER.

C2000-WRITE-DETAILS.
MOVE FILE-DATA TO HOROSCOPE-DATA.
MOVE HOROSCOPE-NAME TO DETAIL-HOROSCOPE-NAME.
MOVE DATE-RANGE TO DETAIL-DATE-RANGE.
MOVE MESSAGE-RESPONSE TO DETAIL-MESSAGE.
MOVE DETAIL-LINE-1 TO PRINT-AREA.
WRITE PRINT-AREA AFTER ADVANCING 1 LINES
READ SOURCE-FILE
AT END SET END-OF-SOURCE-FILE TO TRUE
END-READ.

D3000-WRITE-FOOTER.
MOVE PAGE-NUMBER TO FL1-PAGE-NUMBER.
MOVE FOOTER-LINE-1 TO PRINT-AREA.
WRITE PRINT-AREA AFTER ADVANCING 3 LINES.



Previous Topic:Acucobol-GT convert to another debugger tools.
Next Topic:cobol + oracle
Goto Forum:
  


Current Time: Fri Oct 24 10:39:10 GMT 2014

Powered by FUDForum. Page generated in 0.02858 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software