Users can define their own external compile preprocessor source members, which can be used to hold global compile overrides or other compile preprocessor directives. External preprocessor source members are identified with a new preprocessor directive identifier – the X directive.
In a fixed-format source member (such as RPG, COBOL or DSPF) an external source member directive will have the following format:
/* X* [[library-name/]file-name,]member-name /*
In a free-format source member (such as CL), an exit program preprocessor directive will have the following format:
/*X: [[library-name/]file-name,]member-name */
If the library name is not specified, *LIBL is assumed. If a file name is not specified, the current source member file name is assumed.
For instance, a user could create a source member called RPGDFTOVR with the following directives in it:
Z* TGTRLS(V5R1M0) Z* DBGVIEW(*LIST) Z* OPTION(*NODEBUGIO)
and place it in file QRPGLESRC in library QGPL. Then, in all RPGLE source members, the user could simply have the following directive:
/* X* QGPL/QRPGLESRC,RPGDFTOVR /*
and when the program is compiled, the compile preprocessor will retrieve the Z* compilation overrides from the RPGDFTOVR source member and include them in the compilation command.
Any compile overrides specified in an external source member may themselves be overridden by compile overrides specified further down in the source member itself (or in a different external source member which is defined further down in the source member being compiled). So for instance, if the following preprocessor directive directives are coded into an RPGLE source member:
/* X* QGPL/QRPGLESRC,RPGDFTOVR Z* TGTRLS(V5R2M0) /*
then the source member will be compiled using TGTRLS(V5R2M0), since the Z* directive is after the X* directive.
An external source member can itself contain X* directives pointing to 'nested' external source members (there is a limit of 100 nested source members).
External source members can also contain Y* directives, to perform pre-compilation or post-compilation tasks. For instance, if a user has a number of modules MOD1, MOD2 and MOD3, which are bound into a single service program SRVPGM1, they could have single source member called e.g. SRVPGM1 which contains the CRTSRVPGM command to create the service program, e.g.:
Y* CRTSRVPGM SRVPGM(&L/SRVPGM1) +
Y* MODULE( MOD1 MOD2 MOD3) +
Y* TEXT('Service program 1')
In each of the modules MOD1, MOD2 and MOD3, the user can include the following directive anywhere after the first Z* directive:
/* X* QGPL/QRPGLESRC,RPGDFTOVR X* QGPL/QRPGLESRC,SRVPGM1 /*
and whenever any of MOD1, MOD2 or MOD3 are recompiled, the module will be compiled using the defaults in the RPGDFTOVR external member and then the SRVPGM1 service program will also be automatically recreated to include the changed module.
|
Copyright © 2014 CA.
All rights reserved.
|
|