DOC1 Programmer's Guide
DOC1 Programmer's Guide
DOC1 Programmer's Guide
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
User Exits<br />
For Lookup Table exits: use with any entry in the<br />
section.<br />
The name used (‘SendToArchive’ in the example<br />
above) must match the external name specified in the<br />
appropriate DuxRegister… function within the user<br />
program itself.<br />
You will also need to code a section<br />
which identifies the object modules containing the<br />
user programs to be referenced.<br />
If required, you can pass parameters to the user<br />
program either by accessing symbols defined in the<br />
OPS file or by extending the parameters in the<br />
USEREXIT keyword. The DuxGetOpsSymbolValue<br />
and DuxGetInvokeParameter API functions allow you<br />
to retrieve these values within the user program.<br />
The format of these commands is demonstrated in<br />
the OPS example below.<br />
<br />
REFER TO THE <strong>DOC1</strong> USERS GUIDE FOR GENERAL<br />
INFORMATION ABOUT CREATING AND USING AN OPS FILE.<br />
Sample OPS settings for user exits<br />
;replace input data with a user exit<br />
<br />
DataInput=USEREXIT(BWDI)<br />
;The user exit will provide keyed images<br />
<br />
Map1=USEREXIT(AKM)<br />
;replace a lookup table with a user exit<br />
;the user program expects 2 parameters<br />
<br />
Table1=USEREXIT(BWLT,15,2004)<br />
;this declares the user program modules<br />
<br />
1=<strong>DOC1</strong>IN.DLL<br />
2=<strong>DOC1</strong>KMAP.DLL<br />
3=<strong>DOC1</strong>LTAB.DLL<br />
Creating the user program<br />
The user program interfaces with <strong>DOC1</strong> Generate<br />
using the DUX API (<strong>DOC1</strong> User Exit) which is an<br />
external function library supplied with the <strong>DOC1</strong><br />
Generate distribution material. This object module<br />
must be included in the link dependencies when the<br />
user program is built. A header file declaring the<br />
available functions is also supplied and this must be<br />
included in the source code for the user program.<br />
The API is written in standard C and this is also the<br />
language expected in the user program. C++<br />
programs can also access the interface but note that<br />
no C++ classes are provided.<br />
Note the following:<br />
• If the program calls modules in other languages<br />
it is the users responsibility to ensure that all<br />
inter-language linking issues are properly<br />
resolved.<br />
• Under OS/390 or z/OS you may only initiate<br />
one user exit function for each load module.<br />
• Under Windows all user exit functions called by<br />
a single <strong>DOC1</strong> program should be contained<br />
within a single DLL to prevent memory<br />
fragmentation.<br />
Program structure<br />
All user exit programs must consist of at least:<br />
A <strong>DOC1</strong>REG function (the name is fixed) which<br />
registers the user program with <strong>DOC1</strong> Generate.<br />
Within <strong>DOC1</strong>REG you will need to include a call to<br />
the relevant DuxRegister… API function which<br />
defines the type of user exit to <strong>DOC1</strong>, supplies a<br />
name by which the exit is identified externally and<br />
names a further function that will carry out the<br />
actual user exit activity.<br />
192