From: Bill G. <bi...@cs...> - 2002-09-05 17:48:28
|
I am testing Tiny Cobol in anticipation of its being used this semester by our students. In doing this, I have uncovered a bug. I am using FreeBSD and the bug first appeared in the version in The Ports collection, which is 0.57. I then manula built and installed 0.58. The same bug is there also. Here is the error message I receive: server2# htcobol -F -L/usr/local/lib w1.cob w1.s: Assembler messages: w1.s:226: Error: suffix or operands invalid for `mov' Here is the assembler generated (the error being rather obvious): .LB_MAIN_PROGRAM_0: pushl $3 movl $ww_base0+0 #sec:0, %eax pushl %eax Notice the extraneous "#sec:0" in the movl..... And here's the COBOL that causes it. The testing I have done points to it being something in the "OPEN OUTPOUT" statement. IDENTIFICATION DIVISION. PROGRAM-ID. Grade-Point-Averages. AUTHOR. R. McCloskey and A. Programmer. * Assisted by: no one INSTALLATION. U of S. DATE-WRITTEN. September 1, 1992. *********************************************************** * Program Abstract: * < Here should be a general description of * the purpose/functionality of the program > *********************************************************** ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT Student-File ASSIGN TO "GPA.DAT". SELECT Out-File ASSIGN TO SYS$OUTPUT. DATA DIVISION. FILE SECTION. FD Student-File DATA RECORD IS Student-Record. 01 Student-Record. 02 SSN PIC X(9). 02 Name PIC X(20). 02 Attempted-Hours PIC 99. 02 Quality-Points PIC 99V99. FD Out-File DATA RECORD IS Print-Line. 01 Print-Line PIC X(80). WORKING-STORAGE SECTION. 01 Eof PIC X VALUE 'F'. 01 Gpa PIC 9V99. 01 Deans-List-Threshold PIC 9V9 VALUE 3.5. 01 Col-Head-Line-1. 02 FILLER PIC X(37) VALUE SPACES. 02 FILLER PIC X(5) VALUE 'Hours'. 01 Col-Head-Line-2. 02 FILLER PIC X(6) VALUE SPACES. 02 FILLER PIC A(3) VALUE 'SSN'. 02 FILLER PIC X(12) VALUE SPACES. 02 FILLER PIC X(4) VALUE 'Name'. 02 FILLER PIC X(10) VALUE SPACES. 02 FILLER PIC X(15) VALUE 'Attempted'. 02 FILLER PIC X(2) VALUE SPACES. 02 FILLER PIC X(3) VALUE 'GPA'. 02 FILLER PIC X(5) VALUE SPACES. 02 FILLER PIC X(7) VALUE 'Remarks'. 01 Out-Line. 02 FILLER PIC X(3) VALUE SPACES. 02 Out-SSN PIC X(9). 02 FILLER PIC X(5) VALUE SPACES. 02 Out-Name PIC X(20). 02 FILLER PIC X(2) VALUE SPACES. 02 Out-Attempted-Hours PIC Z9. 02 FILLER PIC X(10) VALUE SPACES. 02 Out-GPA PIC 9.99. 02 FILLER PIC X(5) VALUE SPACES. 02 Out-Remarks PIC X(20). PROCEDURE DIVISION. Main-Program. OPEN OUTPUT Out-File OPEN INPUT Student-File PERFORM Print-Col-Headings PERFORM Read-a-Record PERFORM UNTIL Eof = 'T' PERFORM Process-a-Record PERFORM Read-a-Record END-PERFORM CLOSE Student-File CLOSE Out-File STOP RUN . Read-a-Record. READ Student-File AT END MOVE 'T' TO Eof END-READ . Process-a-Record. DIVIDE Attempted-Hours INTO Quality-Points GIVING Gpa IF Gpa IS GREATER THAN Deans-List-Threshold MOVE "Dean's List" TO Out-Remarks ELSE MOVE SPACES TO Out-Remarks END-IF MOVE SSN TO Out-SSN MOVE Name TO Out-Name MOVE Attempted-Hours TO Out-Attempted-Hours MOVE Gpa TO Out-GPA PERFORM Write-Record . Write-Record. WRITE Print-Line FROM Out-Line . Print-Col-Headings. WRITE Print-Line FROM Col-Head-Line-1 BEFORE ADVANCING 1 LINE WRITE Print-Line FROM Col-Head-Line-2 BEFORE ADVANCING 1 LINE . END-PROGRAM. Any help greatly appreciated and I will be glad to test any patch you may come up with. All the best and good luck. bill -- Bill Gunshannon | de-moc-ra-cy (di mok' ra see) n. Three wolves bi...@cs... | and a sheep voting on what's for dinner. University of Scranton | Scranton, Pennsylvania | #include <std.disclaimer.h> |
From: <hud...@so...> - 2002-09-05 18:39:09
|
Hi Bill, > Here is the error message I receive: > server2# htcobol -F -L/usr/local/lib w1.cob > w1.s: Assembler messages: > w1.s:226: Error: suffix or operands invalid for `mov' > > Here is the assembler generated (the error being rather obvious): > > .LB_MAIN_PROGRAM_0: > pushl $3 > movl $ww_base0+0 #sec:0, %eax > pushl %eax > > Notice the extraneous "#sec:0" in the movl..... > > And here's the COBOL that causes it. The testing I have done points to > it being something in the "OPEN OUTPOUT" statement. > > INPUT-OUTPUT SECTION. > FILE-CONTROL. > SELECT Student-File ASSIGN TO "GPA.DAT". > SELECT Out-File ASSIGN TO SYS$OUTPUT. I think that the problem is the output name to Out-File (SYS$OUTPUT). Modify this name and it will work. > INPUT-OUTPUT SECTION. > FILE-CONTROL. > SELECT Student-File ASSIGN TO "GPA.DAT". > SELECT Out-File ASSIGN TO SYSOUTPUT. or > INPUT-OUTPUT SECTION. > FILE-CONTROL. > SELECT Student-File ASSIGN TO "GPA.DAT". > SELECT Out-File ASSIGN TO "SYSOUTPUT". or > INPUT-OUTPUT SECTION. > FILE-CONTROL. > SELECT Student-File ASSIGN TO "GPA.DAT". > SELECT Out-File ASSIGN TO external "SYSOUTPUT". Hope this helps. Hudson. |
From: Rildo P. <ri...@pr...> - 2002-09-05 20:02:35
|
Hi, On Thu, 5 Sep 2002 hud...@so... wrote: > > SELECT Student-File ASSIGN TO "GPA.DAT". > > SELECT Out-File ASSIGN TO SYS$OUTPUT. > > I think that the problem is the output name to Out-File (SYS$OUTPUT). > Modify this name and it will work. Not really that. The problem is because the file name is not within double quotes. The first SELECT is right. The second must be something like SELECT Out-File ASSIGN TO "SYS$OUTPUT". Anyway, I suspect this is not what the programmer wants. We don't have the standard output as a file name. Instead, we have STD-OUTPUT (and STD-ERROR as well) that may be used for DISPLAY statements. The other form of assignment is with a named variable. Say we declare SELECT OutFile ASSIGN to W-FILENAME. then in the data division we must define this variable: 77 W-FILENAME PIC X(80). or whatever we like. We must of course, move the actual file name to that variable, before executing any OPEN statement, or use a VALUE clause at its declaration. best regards, Rildo ------------------------------------------------------------------ Rildo Pragana FPGA/uControllers * Linux * tcl/tk R.Joaquim Nabuco,92/302 Derby http://www.pragana.net Recife, PE - Brazil 52011-000 +55-81-3223-5694 |