IBM AS/400 Frozen Dessert Maker User Manual


 
Service Program Overview
Chapter 8. Creating a Service Program
This chapter provides:
An overview of the service program concept
Strategies for creating service programs
A brief description of the CRTSRVPGM command
An example of a service program
Service Program Overview
A service program is a bound program (type *SRVPGM) consisting of a set of pro-
cedures that can be called by procedures in other bound programs.
Service programs are typically used for common functions that are frequently called
within an application and across applications. For example, the ILE compilers use
service programs to provide run-time services such as math functions and
input/output routines. Service programs enable reuse, simplify maintenance, and
reduce storage requirements.
A service program differs from a program in two ways:
It does not contain a program entry procedure. This means that you cannot call
a service program using the CALL operation.
A service program is bound into a program or other service programs using
binding by reference.
When you bind a service program to a program, the contents of the service
program are not copied into the bound program. Instead, linkage information of the
service program is bound into the program. This is called 'binding by reference' in
contrast to the static binding process used to bind modules into programs.
Because a service program is bound by reference to a program, you can call the
service program's exported procedures using bound procedure calls. The initial call
has a certain amount of overhead because the binding is not completed until the
service program is called. However, subsequent calls to any of its procedures are
faster than program calls.
The set of exports contained in a service program are the interface to the services
provided by it. You can use the Display Service Program (DSPSRVPGM) command
or the service program listing to see what variable and procedure names are avail-
able for use by the calling procedures. To see the exports associated with service
program PAYROLL, you would enter:
DSPSRVPGM PAYROLL DETAIL(*PROCEXP *DATAEXP)
Copyright IBM Corp. 1994, 1999 91