Deploying an Application on UNIX | Maintaining a DB2 Database |
Use SQL Option to include a DB2 application in a Net Express project.You can also maintain a DB2 database using an interactive tool, the SQL Wizard. You can compile, edit and debug your DB2 application in a DB2 environment on your PC. In addition, you can also compile, edit and debug your DB2 application against the mainframe itself, using the XDB Link technology.
You need to have installed SQL Option to do this session. We assume you are familiar with DB2 on a mainframe.
You also need to have read the chapter Start Here for the Tutorials and worked through the first session, Using Net Express, before you do this session.
The full name of this option is SQL Option for DB2. We will generally refer to it as SQL Option. It is a relational database that supports the debugging and testing of DB2 applications.
This session takes you through maintaining and running a DB2 application on your PC. It also shows how you can setup your PC to access the mainframe with the XDB Link technology, and run your DB2 application directly to the mainframe.
The demo application used in this session is a simple DB2 application that you might have downloaded from a mainframe. In this session, you get it working on your PC.
If you have closed Net Express, open it as before. If any project window or other windows are open, close them.
In this session you:
To create the project:
To add your files to the project:
To build the project:
As you saw in the chapter Using Net Express, the correct compiler is automatically called for the source files - in this case, for the COBOL files. The SQL preprocessor is called by the COBOL Compiler for each COBOL file in the ECM environment.
The build finishes with "Rebuild complete".
To start the XDB Server on Windows NT:
To start the XDB Server on Windows 95:
To run the application:
The application runs. The Application Output window appears and displays the screen output from the application. This application simply inserts an employee record into a database, fetches the surname and displays it, and then deletes the record. It displays messages showing its progress.
You can leave the Application Output window visible, as the next section uses it as well.
To debug the application:
You see the same things happening on your screen as when running the application, but in addition a source view window appears, showing the source of test1.cbl. The application has not yet displayed its first screen in the Application Output window, because execution is paused on the first executable statement of the COBOL application. (This is the second statement in the Procedure Division, because the first, EXEC SQL DECLARE...CURSOR, is executed at compile time.
Notice that the source you see is the original source and not the source after preprocessing.
This demonstrates that you single-step a DB2 application in the same way as any other. All the same debugging features are available for a DB2 application as for any other application. We will not debug this application further, but will simply complete the run.
The application completes without debugging, and exits. As before, the Application Output window shows the messages displayed by the application.
When you have finished, you shut down the XDB Server:
To connect to the mainframe directly, without using the XDB server:
Close the source view window and hide the Application Output window.
The Sqldemo project is used in the next session, Maintaining a DB2 Database. If you're planning to go onto that session, you can keep the project open.
If you want to take a break before going on to the next session, you can close Net Express.
Return to the Tutorials Map in the chapter Start Here for the Tutorials and choose which session to go on to next, depending on your interests.
Copyright © 2000 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names
used herein are protected by international law.
Deploying an Application on UNIX | Maintaining a DB2 Database |