Compiling and Linking Custom Scheduler Rules

To compile and link user code for the Scheduler, Microsoft Visual C++ Version 6.0 Service Pack 3 or later is required. If you did not install Microsoft Visual C++ with the option to set up for use from a command prompt, your PATH, LIB, and INCLUDE environment variables may not be set correctly. To set these variables, you can run VCVARS32.BAT, which is located in the \bin subdirectory of your Visual C++ installation.

See Writing a Custom Scheduler Rule for a summary of the steps required to create custom rules.

To compile and link your custom Scheduler rules:

  1. Create your database directory and copy the files MAKEFILE and USER.DEF from the \Program Files\Infor\Scheduler\USERCODE directory into it. For example:

    $ cd USERCODE

    $ mkdir mydb

    $ cd mydb

    $ copy ..\MAKEFILE

    $ copy ..\USER.DEF

  2. Edit the MAKEFILE and change the "OBJFILES" line, which is near the top of the file, to list your .C custom code files. Instead of a .C file extension, you must use a .OBJ file extension when specifying the files. For example, the files FILE1.C, FILE2.C, and FILE3.C would be specified as:

    OBJFILES = file1.obj file2.obj file3.obj

    Case does not matter. In most cases, you will not need to change anything else in this file. However, there are additional variables you can use for custom compile or link options or for additional libraries to be linked into the program.

  3. If your custom code calls functions uccschd0 or uccsched, you must perform this step. Otherwise, skip to step 4.

    When scheduling custom events, you must add function declaration lines to the .DEF file that is used by the linker. For more details, see the Scheduling Customization Guide, available for download from our Support site. Instead of copying and editing the AIM_SUSR.DEF file as documented there, you must make your edits to the USER.DEF file that you copied in step 1. Go to the end of the USER.DEF file and add a line consisting of the name of your custom event function. The case should match the case of the name as it appears in the .C file. Repeat this step for each custom event function.

  4. You can now perform the compile and link by running the NMAKE command. At an MS-DOS command prompt, change directory to the database directory and run the NMAKE command. This command reads the file MAKEFILE and follows the directives in it to compile and link your user code. Be sure to correct any compile or link errors before proceeding. For example:

    $ cd USERCODE\mydb

    $ nmake

  5. You can now run the Scheduler and it will use your custom code. Any time you change your custom code, you must repeat the appropriate steps in this process.