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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COBOL Link error 2029 with IBM Visualage COBOL

Status
Not open for further replies.

TonyG

Programmer
Nov 6, 2000
79
US
Hello.

I'm trying to compile and link the COBOL sample program provided by
Pervasive SDK 8.5 using IBM Visualage COBOL 3.0.7.

I get a link error "error LNK2029: "_BTRV@28" : unresolved external".

It's a very simple program with five "CALL"s to "_BTRV" and a few moves and
displays as you can see at the end of this message.

"_BTRV@28" is not "CALL"ed anywhere in the source program and cannot be
found in any of the .OBJ files.

So, why is it even looking for "_BTRV@28" ?

Any help would be greatly appreciated.

Thanks,
Tony
***************************************************************************************
IDENTIFICATION DIVISION.
*
PROGRAM-ID. "BTRSAMP".
*
*
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. IBM-PC.
OBJECT-COMPUTER. IBM-PC.
*
*
DATA DIVISION.
*
WORKING-STORAGE SECTION.
*
* BTRIEVE OP CODES
*
01 B-OPEN PIC 9(4) COMP-5 VALUE 0.
01 B-INSERT PIC 9(4) COMP-5 VALUE 2.
01 B-GETFIRST PIC 9(4) COMP-5 VALUE 12.
01 B-UPDATE PIC 9(4) COMP-5 VALUE 3.
01 B-CLOSE PIC 9(4) COMP-5 VALUE 1.
*
01 B-STATUS PIC 9(4) COMP-5 VALUE 0.
01 KEY-NUMBER PIC 9(4) COMP-5 VALUE 0.
01 BUF-LEN PIC 9(4) COMP-5 VALUE 0.
01 FILE-NAME PIC X(13) VALUE SPACES.
01 POSITION-BLOCK PIC X(128) VALUE SPACES.
01 DATA-BUFFER.
02 DECIMAL-FIELD PIC 9(4) COMP-3 VALUE 0.
02 STRING-FIELD PIC X(36) VALUE SPACES.
01 DSP-STATUS PIC 9(5) COMP-5.
*
*
*
PROCEDURE DIVISION.
BEGIN.
*
* Open TEST.BTR
*
*
MOVE 0 TO BUF-LEN.
MOVE 0 TO KEY-NUMBER.
MOVE 'TEST.BTR ' TO FILE-NAME.
CALL "_BTRV" USING B-OPEN, B-STATUS, POSITION-BLOCK,
DATA-BUFFER, BUF-LEN, FILE-NAME, KEY-NUMBER.
IF B-STATUS NOT = 0
DISPLAY 'Error opening file. Status= ' B-STATUS
ELSE
DISPLAY 'File ' FILE-NAME ' successfully opened'
END-IF.
*
* Insert into TEST.BTR
*
*
MOVE 1 TO DECIMAL-FIELD.
MOVE 'Record 1' TO STRING-FIELD.
MOVE 40 TO BUF-LEN.
MOVE 0 TO KEY-NUMBER
CALL "_BTRV" USING B-INSERT, B-STATUS, POSITION-BLOCK,
DATA-BUFFER, BUF-LEN, FILE-NAME, KEY-NUMBER.
IF B-STATUS NOT = 0
DISPLAY 'Error inserting into file. Status= ' B-STATUS
ELSE
DISPLAY 'Inserted: ' DECIMAL-FIELD STRING-FIELD
END-IF.
*
* GetFirst
*
*
MOVE 40 TO BUF-LEN.
MOVE 0 TO KEY-NUMBER
CALL "_BTRV" USING B-GETFIRST, B-STATUS, POSITION-BLOCK,
DATA-BUFFER, BUF-LEN, FILE-NAME, KEY-NUMBER.
IF B-STATUS NOT = 0
DISPLAY 'Error Getting first record. Status= ' B-STATUS
ELSE
DISPLAY 'Retrieved: ' DECIMAL-FIELD STRING-FIELD
END-IF.
*
* Update into TEST.BTR
*
*
MOVE 2 TO DECIMAL-FIELD.
MOVE 'Record 2' TO STRING-FIELD.
MOVE 40 TO BUF-LEN.
MOVE 0 TO KEY-NUMBER
CALL "_BTRV" USING B-UPDATE, B-STATUS, POSITION-BLOCK,
DATA-BUFFER, BUF-LEN, FILE-NAME, KEY-NUMBER.
IF B-STATUS NOT = 0
DISPLAY 'Error updating file. Status= ' B-STATUS
ELSE
DISPLAY 'Updated to: ' DECIMAL-FIELD STRING-FIELD
END-IF.
*
* Close TEST.BTR
*
*
MOVE 0 TO BUF-LEN.
MOVE 0 TO KEY-NUMBER
CALL "_BTRV" USING B-CLOSE, B-STATUS, POSITION-BLOCK,
DATA-BUFFER, BUF-LEN, FILE-NAME, KEY-NUMBER.
IF B-STATUS NOT = 0
DISPLAY 'Error closing file. Status= ' B-STATUS
ELSE
DISPLAY 'Successfully closed TEST.BTR'
END-IF.


STOP RUN.
 
Dunno. But I've got a clue: what I remember from the old days (16-bit OS/2 with Micro Focus cobol). When you call a module which starts with an underscore (_) this implies that you call a 16-bit module.
You did not specify the OS but you could try to call your modules without the underscore-suffix.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top