If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > COBOl DB2 connectivity on windows

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-22-07, 10:06
ms_2007 ms_2007 is offline
Registered User
 
Join Date: Jul 2007
Posts: 4
COBOl DB2 connectivity on windows

hi everone,

I want to connect cobol with Db2 on windows .some helpful details are:

COBOL compiler:Fujitsu 3.0(student version)
DB2:Windows Version
OS:Windows XP professional with SP2

Please provide me steps and some simple example to do this.

-MS
Reply With Quote
  #2 (permalink)  
Old 07-23-07, 01:45
grofaty grofaty is offline
Registered User
 
Join Date: Jan 2003
Posts: 1,570
Hi,
can you provide more info about DB2 database?
1. database version, execute command in DB2 Command Window: db2level
2. what is the type of database: db2licm -l

Regards,
Grofaty
Reply With Quote
  #3 (permalink)  
Old 07-24-07, 14:37
ms_2007 ms_2007 is offline
Registered User
 
Join Date: Jul 2007
Posts: 4
Hi,

here is the info u asked

Version of DB2B2 v9.1.0.356
Licencse Type:Trial

-MS
Reply With Quote
  #4 (permalink)  
Old 07-25-07, 04:01
guyprzytula guyprzytula is offline
Registered User
 
Join Date: Jun 2006
Posts: 471
most samples/syntax is explained in
application development guide client
samples are shipped in samples directory below sqllib - also for cobol
__________________
Best Regards, Guy Przytula
DB2 UDB LUW certified V6/7/8
Reply With Quote
  #5 (permalink)  
Old 07-26-07, 13:36
ms_2007 ms_2007 is offline
Registered User
 
Join Date: Jul 2007
Posts: 4
hi all,

I am trying a sample program with Fujitsu compiler ,it fails at compilation
I attached a doc named error containing the print screen of error.

code which is used for compilation is follows:
please help

Code:
000010 IDENTIFICATION DIVISION.
000020 PROGRAM-ID.    SAMPLE10.
000030 ENVIRONMENT    DIVISION.
000040 DATA           DIVISION.
000050 WORKING-STORAGE SECTION.
000060     EXEC SQL BEGIN DECLARE SECTION END-EXEC. 
000070 01 PNO          PIC S9(4) COMP-5.
000080 01 PNAME        PIC X(20).
000090 01 STOCKS       PIC S9(9) COMP-5.
000100 01 STOCKER      PIC S9(4) COMP-5.
000110 01 SQLSTATE     PIC X(5).
000120 01 SQLMSG       PIC X(128).
000130     EXEC SQL END DECLARE SECTION END-EXEC.
000140 PROCEDURE DIVISION.
000150* EMBEDDED EXCEPTION DECLARATION
000160     EXEC SQL
000170       WHENEVER NOT FOUND GO TO :P-END
000180     END-EXEC.
000190* DECLARE CURSOR
000200     EXEC SQL
000210       DECLARE CUR1 CURSOR FOR SELECT * FROM STOCK
000220     END-EXEC.
000230 P-START.
000240* CONNECT TO THE DATABASE ON THE DEFAULT SERVER.
000250     EXEC SQL
000260       CONNECT TO DEFAULT
000270     END-EXEC.  
000280*-----------------------------------------------------------------
000290*******************
000300****   NOTES   ****
000310*******************
000320*    This program does not support Microsoft(R) SQL Server(TM) to
000330*    connect to a database.
000340*    If you use Microsoft(R) SQL Server(TM) to connect to a database,
000350*    correct the following lines
000360*
000370*      004500* DETERMINE CONNECTION
000380*      004600     IF SQLSTATE = "00000" THEN
000390*                                ~~~~~
000400*     to read as follows
000410*      004500* DETERMINE CONNECTION
000420*      004600     IF SQLSTATE = "01000" THEN
000430*                                ~~~~~
000440*-----------------------------------------------------------------
000450* DETERMINE CONNECTION
000460     IF SQLSTATE = "00000" THEN
000470       DISPLAY "SUCCESSFUL CONNECTION WITH DATABASE."
000480       DISPLAY " "
000490     ELSE
000500       DISPLAY "UNSUCCESSFUL CONNECTION WITH DATABASE."
000510       DISPLAY "       SQLSTATE : " SQLSTATE
000520       DISPLAY "       SQLMSG   : " SQLMSG
000530       GO TO END-PROC
000540     END-IF.
000550       
000560* OPEN THE CURSOR. 
000570     EXEC SQL
000580       OPEN CUR1 
000590     END-EXEC.  
000600 P-LOOP.
000610* FETCH THE DATA.
000620     EXEC SQL
000630       FETCH CUR1
000640       INTO :PNO,:PNAME,:STOCKS,:STOCKER
000650     END-EXEC.  
000660     DISPLAY " PRODUCT-NO     =  "  PNO.
000670     DISPLAY " PRODUCT-NAME   =  "  PNAME.
000680     DISPLAY " STOCK-COUNT    =  "  STOCKS.
000690     DISPLAY " STOCKER-NO     =  "  STOCKER.
000700     DISPLAY " ".
000710
000720     GO TO P-LOOP.
000730
000740 P-END.
000750* CLOSE THE CURSOR.
000760     EXEC SQL
000770       CLOSE CUR1
000780     END-EXEC.  
000790* END THE TRANSACTION.
000800     EXEC SQL
000810       ROLLBACK WORK
000820     END-EXEC.
000830* DISCONNECT FROM THE DATABASE.
000840     EXEC SQL
000850       DISCONNECT DEFAULT
000860     END-EXEC.
000870
000880 END-PROC.
000890     DISPLAY "END OF SESSION".
000900     STOP RUN.
000910
000920*-----------------------------------------------------------------
000930* Microsoft is a registered trademark of Microsoft Corporation in
000940* the USA and other countries.
000950* SQL Server is a registered trademark of Microsoft Corporation in
000960* the USA.
000970*-----------------------------------------------------------------
Attached Files
File Type: doc error.doc (72.0 KB, 72 views)
Reply With Quote
  #6 (permalink)  
Old 07-27-07, 02:32
guyprzytula guyprzytula is offline
Registered User
 
Join Date: Jun 2006
Posts: 471
have you looked at this thread :
Fujitsu 3.0 & Exec SQL
__________________
Best Regards, Guy Przytula
DB2 UDB LUW certified V6/7/8
Reply With Quote
  #7 (permalink)  
Old 02-14-12, 08:42
VanHoutte VanHoutte is offline
Registered User
 
Join Date: Feb 2012
Posts: 1
Quote:
Originally Posted by guyprzytula View Post
have you looked at this thread :
Fujitsu 3.0 & Exec SQL
thanks this helped!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On