From: Chris <cbo...@mi...> - 2002-08-30 14:43:55
|
Here is an excerpt. If this is inadequate I can provide the entire thing, but it's essentially multiple iterations of the same logic for both files. IDENTIFICATION DIVISION. PROGRAM-ID. BuildWAtkTab. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT WAtkTabFile ASSIGN TO WAtkTabFile ORGANIZATION INDEXED ACCESS RANDOM RECORD KEY WAtkTabKey. SELECT WeaponTypeFile ASSIGN TO WeaponTypeFile ORGANIZATION INDEXED ACCESS RANDOM RECORD KEY WSName. DATA DIVISION. FILE SECTION. FD WAtkTabFile. 01 WAtkTab. 05 WAtkTabKey. 10 WCd PIC XX. 10 WAtkTabAT PIC 99 COMP. 05 CritMinRoll OCCURS 5 TIMES PIC 999 COMP. 05 Div PIC 99 COMP. 05 CritTyp PIC XXX. FD WeaponTypeFile. 01 WeaponType. 05 WSName PIC XX. 05 WName PIC X(15). 05 WUse PIC XXX. 05 WtMin PIC 9V9 COMP. 05 WtMax PIC 99V9 COMP. 05 LnMin PIC 9V99 COMP. 05 LnMax PIC 99V9 COMP. 05 Fum PIC 9 COMP. 05 RngInfo OCCURS 5 TIMES. 10 Range PIC 999 COMP. 10 RangeMod PIC S99 COMP. PROCEDURE DIVISION. OPEN OUTPUT WAtkTabFile WeaponTypeFile. INITIALIZE WeaponType. MOVE 'Long Bow' TO WName. MOVE 'MS' TO WUse. MOVE 'lb' TO WSName. MOVE 2.0 TO WtMin. MOVE 3.0 TO WtMax. MOVE 5.00 TO LnMin. MOVE 7.0 TO LnMax. MOVE 5 TO Fum. MOVE 10 TO Range(1). MOVE +20 TO RangeMod(1). MOVE 100 TO Range(2). MOVE 200 TO Range(3). MOVE -30 TO RangeMod(3). MOVE 300 TO Range(4). MOVE -40 TO RangeMod(4). MOVE 400 TO Range(5). MOVE -50 TO RangeMod(5). WRITE WeaponType INVALID KEY DISPLAY 'Failed to Write to WeaponTypeFile' CLOSE WAtkTabFile WeaponTypeFile STOP RUN. MOVE 1 TO WAtkTabAT. MOVE 'lb' TO WCd. MOVE 88 TO CritMinRoll(1). MOVE 93 TO CritMinRoll(2). MOVE 98 TO CritMinRoll(3). MOVE 104 TO CritMinRoll(4). MOVE 124 TO CritMinRoll(5). MOVE 3 TO Div. MOVE 'P ' TO CritTyp. WRITE WAtkTab INVALID KEY DISPLAY 'Failed to Write to WAtkTabFile' CLOSE WAtkTabFile WeaponTypeFile STOP RUN. CLOSE WAtkTabFile WeaponTypeFile. STOP RUN. On Fri, 2002-08-30 at 03:31, bg...@fr... wrote: En r=E9ponse =E0 Chris Borgn=E6s <cbo...@mi...>: =20 > OK, that solved part of the problem. Thanks, I didn't know the prope= r > gcc options to use. I still get this error though: > as -o BuildWAtkTab.o BuildWAtkTab.s > BuildWAtkTab.s: Assembler messages: > BuildWAtkTab.s:35: Error: suffix or operands invalid for `mov' > BuildWAtkTab.s:44: Error: suffix or operands invalid for `mov' >=20 > Paradoxically, when I remove those #sec:0 references to eliminate the > above error, the gcc step still chokes: > gcc -o BuildWAtkTab BuildWAtkTab.o -lhtcobol -lhtcobol2 -lm -ldb -ldl > BuildWAtkTab.o: In function `main': > BuildWAtkTab.o(.text+0x4c): undefined reference to `ww_base0' > BuildWAtkTab.o(.text+0x68): undefined reference to `ww_base0' > collect2: ld returned 1 exit status >=20 =20 >From what I can see and what I remember having coded, those sections 0 should not appear UNLESS there is something the compiler can't handle (some sort of panic!). =20 What is you code looking like? In particular how are the files defined? If you post a minimum sample which shows the problem, I'll look at it. =20 > On Thu, 2002-08-29 at 17:46, Rildo Pragana wrote: >=20 > Hi Chris, > =20 > On 29 Aug 2002, Chris Borgn=E6s wrote: > =20 > > It's been years and years since I really looked at assembler, b= ut > I > > found an oddity. I try to build my program and I get the > following > > error: > > BuildWAtkTab.s: Assembler messages: > > BuildWAtkTab.s:35: Error: suffix or operands invalid for `mov' > > BuildWAtkTab.s:44: Error: suffix or operands invalid for `mov' > > > > I do a htcobol -S and look at the result and this is what I see= : > > > > .Linite_main: > > leal main, %eax > > pushl %eax > > leal .Lend_pgm_main, %eax > > pushl %eax > > pushl $3 > > movl $ww_base0+4 #sec:0, %eax > > pushl %eax > > movl $w_base0+4, %eax > > pushl %eax > > movl $s_base0+4, %eax > > pushl %eax > > call cob_open > > addl $16, %esp > > pushl $3 > > movl $ww_base0+38 #sec:0, %eax > > pushl %eax > > movl $w_base0+20, %eax > > pushl %eax > > movl $s_base0+38, %eax > > pushl %eax > > call cob_open > > > > The as command seems to work fine once I remove the #sec:0 > entries, but > > gcc fails: > > gcc -o BuildWAtkTab BuildWAtkTab.o -lhtcobol -lm > > BuildWAtkTab.o: In function `main': > > BuildWAtkTab.o(.text+0x4c): undefined reference to `ww_base0' > > BuildWAtkTab.o(.text+0x68): undefined reference to `ww_base0' > > /usr/local/lib/libhtcobol.a(fileio.o): In function `cob_open': > > fileio.o(.text+0x563): undefined reference to `__db185_open' > > fileio.o(.text+0x5d6): undefined reference to `__db185_open' > > /usr/local/lib/libhtcobol.a(fileio.o): In function `sort_open': > > fileio.o(.text+0x385f): undefined reference to `__db185_open' > > collect2: ld returned 1 exit status > > > > What's wrong? > > > =20 > Well, from the errors shown by gcc, it seems you missed to includ= e > -ldb to link with libdb. It is needed if your program uses any > kind > of file access, even if no indexes are in use. > =20 > best regards, > Rildo > =20 > ------------------------------------------------------------------ > 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 > =20 > =20 > =20 > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Tin...@li... >=20 > https://lists.sourceforge.net/lists/listinfo/tiny-cobol-users >=20 > =20 >=20 =20 =20 Bernard =20 |