Editing an IMS Database | Maintaining a DB2 Database |
Use SQL Option to include a DB2 application in a Mainframe 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.
SQL Option and Host Compatibility Option are alternative facilities for handling a DB2 application. See the chapter DB2 Applications (Host Compatibility Option) for a session using Host Compatibility Option.
You need to have read the chapter Start Here for the Tutorials and worked through the first session, Using Mainframe Express, before you do this session.
You need to have installed SQL Option to do this session.
We assume you are familiar with DB2 on a mainframe.
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.
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 Mainframe Express, open it as before. If any project window or other windows are open, close them.
In this session you:
To create the project:
You now get a page asking which of the installed options this project uses.
Because you have said this project uses SQL, and you installed SQL Option (rather than Host Compatibility Option), you now get a page asking for details of the SQL server the project uses.
Mainframe Express checks that an XDB Server is running on your computer. When it finds that none is, it displays a dialog box asking if you want to start one, and if it should check in future.
You need the server running so you can use the SQL Wizard and run the application. You could start it later from the Tools menu, but it's convenient to start it here.
The XDB Server starts, with its window minimized. You can click it on the Windows taskbar if you want to see it, but as you don't need to watch it you can leave it minimized.
To add your files to the project:
The files are added to the project.
To build the project:
As you saw in the chapter Using Mainframe Express, the correct compiler is automatically called for each source file - in this case, for the COBOL and CLIST files. For the COBOL file, the SQL preprocessor is called first, followed by the COBOL compiler.
The build finishes with "Build finished with no errors".
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 sqltest.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:
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 Mainframe 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 © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names
used herein are protected by international law.
Editing an IMS Database | Maintaining a DB2 Database |