Types of sample applications
Db2 provides a number of sample applications that manage sample company information. These applications also demonstrate how to use stored procedures, user-defined functions, and LOBs.
Organization application:
The organization application manages the following company information:
- Department administrative structure
- Individual departments
- Individual employees.
Management of information about department administrative structures involves how departments relate to other departments. You can view or change the organizational structure of an individual department, and the information about individual employees in any department. The organization application runs interactively in the ISPF/TSO, IMS, and CICS® environments and is available in PL/I and COBOL.
Project application:
The project application manages information about a company's project activities, including the following:
- Project structures
- Project activity listings
- Individual project processing
- Individual project activity estimate processing
- Individual project staffing processing.
Each department works on projects that contain sets of related activities. Information available about these activities includes staffing assignments, completion-time estimates for the project as a whole, and individual activities within a project. The project application runs interactively in IMS and CICS and is available in PL/I only.
Phone application:
The phone application lets you view or update individual employee phone numbers. There are different versions of the application for ISPF/TSO, CICS, IMS, and batch:
- ISPF/TSO applications use COBOL and PL/I.
- CICS and IMS applications use PL/I.
- Batch applications use C, C++, COBOL, FORTRAN, and PL/I.
Stored procedure applications:
There are three sets of stored procedure applications:
- IFI applications
- These applications let you pass Db2 commands from a client program to a stored procedure, which runs the commands at a Db2 server using the instrumentation facility interface (IFI). There are two sets of client programs and stored procedures. One set has a PL/I client and stored procedure; the other set has a C client and stored procedure.
- ODBA application
- This application demonstrates how you can use the IMS ODBA interface to access IMS databases from stored procedures. The stored procedure accesses the IMS sample DL/I database. The client program and the stored procedure are written in COBOL.
- Utilities stored procedure application
- This application demonstrates how to call the utilities stored procedure.
- SQL procedure applications
Sample applications are available for both external SQL procedures and native SQL procedures:
- The applications for external SQL procedures demonstrate how to write, prepare, and invoke such procedures. One set of applications demonstrates how to prepare SQL procedures using JCL. The other set of applications shows how to prepare SQL procedures using the SQL procedure processor. The client programs are written in C.
- The sample job for a native SQL procedure shows how to prepare a native SQL procedure, how to manage versions of native SQL procedures, and optionally, how to deploy a native SQL procedure to a remote server. The sample also prepares and executes a sample caller in the C language
- WLM refresh application
- This application is a client program that calls the Db2–supplied stored procedure WLM_REFRESH to refresh a WLM environment. This program is written in C.
- System parameter reporting application
- This application is a client program that calls the Db2–supplied stored procedure ADMIN_INFO_SYSPARM to display the current settings of system parameters. This program is written in C.
All stored procedure applications run in the TSO batch environment.
User-defined function applications:
The user-defined function applications consist of a client program that invokes the sample user-defined functions and a set of user-defined functions that perform the following functions:
- Convert the current date to a user-specified format
- Convert a date from one format to another
- Convert the current time to a user-specified format
- Convert a date from one format to another
- Return the day of the week for a user-specified date
- Return the month for a user-specified date
- Format a floating point number as a currency value
- Return the table name for a table, view, or alias
- Return the qualifier for a table, view or alias
- Return the location for a table, view or alias
- Return a table of weather information
All programs are written in C or C++ and run in the TSO batch environment.
LOB application:
The LOB application demonstrates how to perform the following tasks:
- Define Db2 objects to hold LOB data
- Populate Db2 tables with LOB data using the LOAD utility, or using INSERT and UPDATE statements when the data is too large for use with the LOAD utility
- Manipulate the LOB data using LOB locators
The programs that create and populate the LOB objects use DSNTIAD and run in the TSO batch environment. The program that manipulates the LOB data is written in C and runs under ISPF/TSO.