[Migrated content. Thread originally posted on 02 March 2011]
helol am using the eclipse visual cobol.
i try to build this program :
==============================================================
$set db2(db=sample)
****************************************************************
* Copyright (C) 1998-2002 Micro Focus International Ltd.
* All Rights Reserved
*---------------------------------------------------------------
working-storage section.
* Include the SQL Communications Area. This includes the
* definitions of SQLCODE, etc
EXEC SQL INCLUDE SQLCA END-EXEC
*> DB2 UDB limits database alias names to 8 characters
*> other DB2 servers such DB2/MVS can have database names up to
*> 18 characters which you can still access via DB2 CONNECT
*> by creating an ALIAS name for the database with a max of 8
*> characters
01 ws-db pic x(08).
*> DB2 UDB has a limit of 8 characters for a logon id.
*> Passwords may be up 18 characters but if you may run into case
*> and length problems going to other DB2 servers if you use more
*> than 8 characters or if you use lower case characters in a
*> password
01 ws-usr pic x(08).
01 ws-pass pic x(18).
01 ws-var-pass.
49 ws-var-pass-len pic s9(04) comp-5.
49 ws-var-pass-dat pic x(18).
procedure division.
*> Connect to an IBM DB2 Sample database
display "Connect statement tests"
display " "
display "Enter database alias to connect to (Eg Sample) "
with no advancing
accept ws-db
display "Enter username "
with no advancing
accept ws-usr
display "Enter password "
with no advancing
accept ws-pass
*> test 1 - basic type 1 CONNECT without id or password
display "Test 1:"
EXEC SQL
CONNECT TO :ws-db
END-EXEC
if sqlcode not = 0
display "Error: cannot connect "
display sqlcode
display sqlerrmc
stop run
else
display "Test 1: OK"
EXEC SQL
DISCONNECT CURRENT
END-EXEC
if sqlcode not = 0
display "Error: cannot disconnect "
display sqlcode
display sqlerrmc
stop run
end-if
end-if
*>test2
*>type 1 connect with id / password passed as char fields
display "Test 2:"
EXEC SQL
CONNECT TO :ws-db USER :ws-usr USING :ws-pass
END-EXEC
if sqlcode not = 0
display "Error: cannot connect Test 2 "
display sqlcode
display sqlerrmc
stop run
end-if
display "Test 2: OK"
EXEC SQL
DISCONNECT CURRENT
END-EXEC
if sqlcode not = 0
display "Error: cannot disconnect "
display sqlcode
display sqlerrmc
stop run
end-if
*>test3
*>type 1 connect with id / password passed as varchar field
display "Test 3:"
move 0 to ws-var-pass-len
move ws-pass to ws-var-pass-dat
inspect ws-pass tallying ws-var-pass-len for characters
before initial " "
EXEC SQL
CONNECT TO :ws-db USER :ws-usr USING :ws-var-pass
END-EXEC
if sqlcode not = 0
display "Error: cannot connect Test 3 "
display sqlcode
display sqlerrmc
stop run
end-if
display "Test 3: OK"
EXEC SQL
CONNECT RESET
END-EXEC
if sqlcode not = 0
display "Error: cannot disconnect "
display sqlcode
display sqlerrmc
stop run
end-if
stop run.
===============================================================
and get this error :
os.init:
os.init.windows:
os.init.unix:
init:
init.New_Configuration:
build:
os.init:
os.init.windows:
os.init.unix:
init:
pre.build.cfg.New_Configuration:
os.init:
os.init.windows:
os.init.unix:
init:
cfg.New_Configuration:
[cobol]
[cobol] Compiling CONNECT.CBL...
[cobol] Compilation complete with no errors.
[cobollink] Linking sqlproj1.exe...
[cobollink] C:\\PROGRA~2\\MICROF~1\\VISUAL~1\\bin\\cbllink.exe -FM -Osqlproj1.exe CONNECT.obj
[cobollink] Micro Focus COBOL - CBLLINK utility
[cobollink] Version 1.2.0.156 Copyright (C) 1984-2010 Micro Focus (IP) Limited.
[cobollink]
[cobollink] Microsoft (R) Incremental Linker Version 10.00.30319.01
[cobollink] Copyright (C) Microsoft Corporation. All rights reserved.
[cobollink]
[cobollink] CONNECT.obj
[cobollink] cbllds00001AB8.obj
[cobollink] mfsqlsmf.lib
[cobollink] Creating library sqlproj1.lib and object sqlproj1.exp
[cobollink] CONNECT.obj : error LNK2001: unresolved external symbol _SQLGSTRT@12
[cobollink] CONNECT.obj : error LNK2001: unresolved external symbol _SQLGALOC@16
[cobollink] CONNECT.obj : error LNK2001: unresolved external symbol _SQLGSTLV@28
[cobollink] CONNECT.obj : error LNK2001: unresolved external symbol _SQLGCALL@20
[cobollink] CONNECT.obj : error LNK2001: unresolved external symbol _SQLGSTOP@4
[cobollink] sqlproj1.exe : fatal error LNK1120: 5 unresolved externals
[cobollink] Link complete with errors
[cobollink]
BUILD FAILED
Build finished with 1 errors, 0 warnings, 0 notices and a maximum exit code of 1,120
D:\\SHLOMOCOBOL\\workspace\\sqlproj1\\.cobolBuild:141: Build errors have occurred
Total time: 4 seconds
=============================================
it appears in any program with sql.
can anybody help ?
thanks
shlomo