Binder Language Example 3
As the application continues to grow, two new procedures are needed
to complete our financial package. The two new procedures, OpenAccount
and CloseAccount, open and close the accounts, respectively. The following
steps need to be performed to update MYLIB/FINANCIAL such that the
program BANKER does not need to be re-created:
- Write the procedures OpenAccount and CloseAccount.
- Update the binder language to specify the new procedures.
The updated binder language supports the new procedures. It also
allows the existing ILE programs or service programs that use the
FINANCIAL service program to remain unchanged. The binder language
looks like this:
FILE: MYLIB/QSRVSRC MEMBER: FINANCIAL
STRPGMEXP PGMLVL(*CURRENT)
EXPORT SYMBOL('Term')
EXPORT SYMBOL('Rate')
EXPORT SYMBOL('Amount')
EXPORT SYMBOL('Payment')
EXPORT SYMBOL('OpenAccount')
EXPORT SYMBOL('CloseAccount')
ENDPGMEXP
STRPGMEXP PGMLVL(*PRV)
EXPORT SYMBOL('Term')
EXPORT SYMBOL('Rate')
EXPORT SYMBOL('Amount')
EXPORT SYMBOL('Payment')
ENDPGMEXP
When an update operation to a service program is needed to do both
of the following:
- Support new procedures or data items
- Allow the existing programs and service programs that use the changed service program to remain unchanged
- Duplicate the STRPGMEXP, ENDPGMEXP block that contains PGMLVL(*CURRENT).
- Change the duplicated PGMLVL(*CURRENT) value to PGMLVL(*PRV).
- In the STRPGMEXP command that contains PGMLVL(*CURRENT), add to the end of the list the new procedures or data items to be exported.
- Save the changes to the source file.
- Create or re-create the new or changed modules.
- Create the service program from the new or changed modules by using the updated binder language.
The second alternative is to take advantage of the signature parameter
on the STRPGMEXP command and to add new symbols at the end of the
export block:
STRPGMEXP PGMVAL(*CURRENT) SIGNATURE('123')
EXPORT SYMBOL('Term')
.
.
.
EXPORT SYMBOL('OpenAccount')
EXPORT SYMBOL('CloseAccount')
ENDPGMEXP
To create the enhanced service program shown in Figure 1,
the updated binder language shown in Binder Language Example 3 is used
on the following CRTSRVPGM command:
CRTSRVPGM SRVPGM(MYLIB/FINANCIAL)
MODULE(MYLIB/MONEY MYLIB/RATES MYLIB/CALCS MYLIB/ACCOUNTS))
EXPORT(*SRCFILE)
SRCFILE(MYLIB/QSRVSRC)
SRCMBR(*SRVPGM)
The BANKER program does not have to change because the previous signature is still supported. (See the previous signature in the service program MYLIB/FINANCIAL and the signature saved in BANKER.) If BANKER were re-created by the CRTPGM command, the signature that is saved with BANKER would be the current signature of service program FINANCIAL. The only reason to re-create the program BANKER is if the program used one of the new procedures provided by the service program FINANCIAL. The binder language allows you to enhance the service program without changing the programs or service programs that use the changed service program.