Q and A

Asked and Answered

I've been told I must use DB2 Connect from a Java application to extract data from DB2 tables. One of the columns contains group data that is a DCLGEN and looks like this:

G_AGCY_LOB_STAT_TB
(AGENCY LINE OF BUSINESS STATUS TABLE)
05 G-AGCY-LOB-STATUS-TBL OCCURS 7 TIMES.
10 C-AGCY-LOB-STATUS PIC X.
10 D-AGCY-LOB-CLOSE PIC 9(7) COMP-3.
10 D-AGCY-LOB-FINAL-CLOSE PIC 9(7) COMP-3.


I need to access the data in the 6th occurrence of this table. Do I need to worry about the Comp-3 data and how it will be interpreted by an ASCII machine?

Robert Catterall responds:

First of all, you don't necessarily need DB2 Connect to access DB2 data from a Java program. What you need is a Java database connectivity (JDBC) driver. A JDBC driver ships with DB2 for OS/390, and this driver is appropriate for use when the Java program in question is running on the same S/390 server as is the DB2 subsystem.

If the Java program is running on an ASCII-based system (for example, a Unix server), you have network issues to deal with. In this case, IBM's DB2 Connect will provide you with both a JDBC driver and the means to connect to a DB2 database located on a remote mainframe system.

An alternative to DB2 Connect is the JDBC driver product available from HiT Software, Inc. I don't think you need to worry about accessing the DB2 data which the COBOL program defines as COMP-3. That COBOL definition maps to the DB2 DECIMAL (or NUMERIC ) data type.

Here's a link to an online version of the DB2 for OS/390 and z/OS Version 7 manuals: http://www-3.ibm.com/software/data/db2/os390/v7books.html . Look in the Application Programming Guide and Reference for Java. In particular, see Table 1 in Chapter 2.4. Here, you will see the Java and JDBC data types that map to the DB2 DECIMAL data type. EBCDIC-to-ASCII translation (and vice versa) is handled automatically when you access DB2 data using the Distributed Relational Database Architecture (DRDA) protocol (and you will be using DRDA if you use DB2 Connect or the HiT Software Type 4 JDBC driver). The mainframe DB2 subsystem will have associated with it an EBCDIC code page, and the ASCII-based requester system will have associated with it an ASCII code page. Standard translate tables that map the one to the other will take care of the data translation for you.


See a complete archive of reader/author Q&As .

CAREER CENTER
Ready to take that job and shove it?
SEARCH JOBS
RECENT JOB POSTINGS
CAREER NEWS
10 Search Engines You Don't Know About
Go beyond Google and get vertical. These specialized search sites will help you find the business information you need -- fast.

Subscribe to the new digital version of IBM Database Magazine
New Digital Version

Sponsored links:



Subscribe to the IBM Database Magazine Newsletter

Email Address *
First Name
Last Name
HTML Preference
HTML Text
 

Fields with * are required.

 




Visit these other IBM and TechWeb Partner Sites: :
Maximizing ROI Through Business Process Management (BPM) and Service-Oriented Architecture (SOA)
Internet Evolution – The Macrosite for News, Analysis, & Opinion About the Future of the Internet
Business Innovation – Technology Strategies and Solutions for Driving Business Success


:: IBM Database Magazine ::