SAS Accelerator Publishing Agent for DB2

Prerequisites

SAS Foundation and the SAS/ACCESS Interface to DB2 must be installed before you install and configure the SAS Accelerator Publishing Agent for DB2.

Overview of the SAS Accelerator Publishing Agent for DB2

This section describes how to install and configure the SAS Accelerator Publishing Agent for DB2. The SAS 9.2 Formats Library for DB2 is included with the SAS Accelerator Publishing Agent for DB2. This section also describes how to install the SAS 9.2 Formats Library.
The SAS Accelerator Publishing Agent for DB2 enables you to use a scoring publishing macro (%INDB2_PUBLISH_MODEL) to create scoring model functions inside the database.
The SAS Accelerator Publishing Agent for DB2 contains three publishing macros:
  • %INDB2_PUBLISH_MODEL, which enables you to create scoring model functions.
  • %INDB2_PUBLISH_COMPILEUDF and %INDB2_PUBLISH_DELETEUDF, which register utility functions in the database. The utility functions are called by the scoring publishing macro, %INDB2_PUBLISH_MODEL. You must run these two macros before you run the scoring publishing macro.

Function Publishing Process in DB2

To publish the SAS scoring model functions on a DB2 server, the publishing macros need to create and transfer the files to the DB2 environment, compile those source files into object files using the appropriate compiler for that system, and then link with the SAS 9.2 Formats Library. After that, the publishing macros register the scoring model functions in DB2 with those object files. If an existing scoring model function is replaced, the publishing macros remove the obsolete object file upon successful compilation and publication of the new scoring model function.
The publishing macros use a SAS FILENAME SFTP statement to transfer the scoring source files to the DB2 server. An SFTP statement offers a secure method of user validation and data transfer. The SAS FILENAME SFTP statement dynamically launches an SFTP or PSFTP executable, which creates an SSH client process that creates a secure connection to an OpenSSH Server. All conversation across this connection is encrypted, from user authentication to the data transfers.
Currently only the OpenSSH client and server on UNIX that supports protocol level SSH-2 and the PUTTY client on WINDOWS are supported. For more information about setting up the SSH software to enable the SAS SFTP to work, please see Setting Up SSH Client Software in UNIX and Windows Environments for Use with the SFTP Access Method in SAS 9.2, located at http://support.sas.com/techsup/technote/ts800.pdf.

DB2 Installation and Configuration Steps

  1. Apply Hot Fix B85002 for SAS Table Server Base Components 9.2_M2. This hot fix can be found at http://ftp.sas.com/techsup/dowload/hotfix/HF2/B85.html#B85002.
  2. Verify that you can use PSFTP from Windows to UNIX without being prompted for a password or cache.
    To do this, enter the following commands from the PSFTP prompt, where userid is the user ID that you want to log on as and machinename is the machine to which you want to log on.
    psftp> userid@machinename
    psftp> ls
  3. Install the SAS 9.2 Formats Library and binary files for the SAS_COMPILEUDF and SAS_DELETEUDF functions.
  4. Run the %INDB2_PUBLISH_COMPILEUDF macro to create the SAS_COMPILEUDF function.
  5. Run the %INDB2_PUBLISH_DELETEUDF macro to create the SAS_DELETEUDF function.
    For more information, see Running the %INDB2_PUBLISH_DELETEUDF Macro.

Installing the SAS 9.2 Formats Library and Binary Files

Move the Files to DB2

The SAS 9.2 Formats Library and the binary files for the SAS_COMPILEUDF and SAS_DELETEUDF functions are contained in a self-extracting TAR file. The location of the TAR file, the README file, and possibly other files, is in the ordersummary.html file that accompanies the software. Your order e-mail contains the path to the ordersummary.html file. You can use PSFTP, SFTP, or FTP to transfer the TAR file to the DB2 server to be unpacked and compiled.
The file does not have to be downloaded to a specific location, but you need to note where it is downloaded so that it can be executed as the DB2 instance owner at a later time. Choose the TAR file based on the UNIX platform that your DB2 server runs on. For example:
AIX: acceldb2fmt_AIX.sh
Linux(x86_64): acceldb2fmt_Linux_x86_64.sh
List the directory in UNIX to verify that the file has been moved.

Unpack the Files

After the TAR file has been transferred to the DB2 machine, follow these steps to unpack the files:
  1. Log in as the user who owns the DB2 instance from a secured shell, such as SSH.
  2. Use the following commands to unpack the appropriate TAR file.
    $ cd path_to_tar_file
    $ sh tar_file
    path_to_tar_file is the location to which you copied the TAR file.
    tar_file is either acceldb2fmt_Linux_x86_64.sh or acceldb2fmt_AIX.sh depending on your operating system.
    After this script is run and the files are unpacked, the content of the target directories should be similar to the following, depending on your operating system. Part of the directory path is shaded to emphasize the different target directories that are used.
    /path_to_tar_file/SAS/SASFormatsLibraryForDB2/9.2-1.8/bin/
       InstallAccelDB2Fmt_AIX.sh
    
    /path_to_tar_file/SAS/SASFormatsLibraryForDB2/9.2-1.8/bin/CopySASFiles.sh
    
    /path_to_tar_file/SAS/SASFormatsLibraryForDB2/9.2-1.8/lib/SAS_CompileUDF
    
    /path_to_tar_file/SAS/SASFormatsLibraryForDB2/9.2-1.8/lib/SAS_DeleteUDF
    
    /path_to_tar_file/SAS/SASFormatsLibraryForDB2/9.2-1.8/lib/libjazxfbrs.so
    
    /path_to_tar_file/SAS/SASFormatsLibraryForDB2/9.2 -> ~SAS/
       SASFormatsLibraryForDB2/9.2-1.8
  3. Use the following command to place the files in the DB2 instance:
    $ path_to_tar_file/SAS/SASFormatsLibraryForDB2/9.2/bin/
       CopySASFiles.sh path_to_sqllib_for_db2
    
    Note: If the SAS_CompileUDF, SAS_DeleteUDF, and libjazxfbrs.so files currently exist, you must rename the existing files before you run the CopySASFiles.sh command. Otherwise, the CopySASFiles.sh command does not work, and you get a "Text file is busy" message for each of the three files.
    path_to_sqllib_for_db2 is the path to the DB2 instance that you want to use (typically db2path/sqllib).
    After this script is run and the files are copied, the target directory should look similar to this.
    db2path/sqllib/function/SAS/SAS_CompileUDF
    db2path/sqllib/function/SAS/SAS_DeleteUDF
    db2path/sqllib/function/SAS/libjazxfbrs.so
    
  4. Use the DB2SET command to tell DB2 where to find the 64-bit formats library.
    The DB2 instance owner must run this command for it to be successful. Note that this is similar to setting a UNIX system environment variable using the UNIX EXPORT or SETENV commands. DB2SET registers the environment variable within DB2 only for the specified database server.
    Before running the DB2SET command, ensure that the DB2 environment is set up correctly. To source the DB2 environment, run the following command.
    $ path_to_sqllib_for_db2 . . /db2profile
    Now, run the DB2SET command.
    $ db2set DB2LIBPATH=path_to_sqllib_for_db2/function/SAS
    path_to_sqllib_for_db2 is the path to the DB2 instance that you want to use (typically db2path/sqllib).
  5. To verify that DB2LIBPATH was set appropriately, run the DB2SET command without any parameters as follows.
    $ path_to_sqllib_for_db2/adm/db2set
    The correct path should be listed if it was set correctly.

Running the %INDB2_PUBLISH_COMPILEUDF Macro

Overview of the %INDB2_PUBLISH_COMPILEUDF Macro

The %INDB2_PUBLISH_COMPILEUDF macro publishes the following components to the SASLIB schema in a DB2 database:
  • SAS_COMPILEUDF function
    The SAS_COMPILEUDF function facilitates the %INDB2_PUBLISH_MODEL scoring publishing macro. The SAS_COMPILEUDF function performs the following tasks:
    • compiles the scoring model source files into object files. This compilation occurs through the SQL interface using an appropriate compiler for the system.
    • copies the object files to the db2path/sqllib/function/SAS directory. You specify the value of db2path in the %INDB2_PUBLISH_COMPILEUDF macro syntax.
    • registers those object files in DB2.
    • creates a link to the SAS 9.2 Formats Library for DB2 that is needed for scoring model publishing.
  • SASUDF_DB2PATH and SASUDF_COMPILER_PATH global variables
    The SASUDF_DB2PATH and the SASUDF_COMPILER_PATH global variables are used when you publish the scoring model functions.
You have to run the %INDB2_PUBLISH_COMPILEUDF macro only one time.
The SAS_COMPILEUDF function must be published before you run the %INDB2_PUBLISH_DELETEUDF macro and the %INDB2_PUBLISH_MODEL macro. Otherwise, these macros fail.
Note: To publish the SAS_COMPILEUDF function, you must have the appropriate DB2 user permissions to create and execute this function in the SASLIB schema and in the specified database. For more information, see DB2 Permissions for the SAS Accelerator Publishing Agent.

%INDB2_PUBLISH_COMPILEUDF Macro Run Process

To run the %INDB2_PUBLISH_COMPILEUDF macro, follow these steps:
  1. Create a SASLIB schema in the database where the SAS_COMPILEUDF function is published.
    You must use “SASLIB” as the schema name for DB2 in-database processing to work correctly.
    You specify that database in the DATABASE argument of the %INDB2_PUBLISH_COMPILEUDF macro. For more information, see %INDB2_PUBLISH_COMPILEUDF Macro Syntax.
    The SASLIB schema will contain the SAS_COMPILEUDF and SAS_DELETEUDF functions and the SASUDF_DB2PATH and SASUDF_COMPILER_PATH global variables.
  2. Start SAS 9.2 and submit the following commands in the Enhanced Editor or Program Editor:
    %indb2pc;
    %let indconn = server=yourserver user=youruserid password=yourpwd
       database=yourdb;
    %indb2_publish_compileudf(
       database=database,
       action=create,
       db2path=yourdb2path/sqllib,
       compiler_path=yourcompilerpath,
       objname=yourobjectfilename,
       outdir=youroutputdirectory);
    
You can verify that the SAS_COMPILEUDF function and global variables have been published successfully. For more information, see Validating the Publishing of SAS_COMPILEUDF and SAS_DELETEUDF Functions and Global Variables.
After the SAS_COMPILEUDF function is published, run the %INDB2_PUBLISH_DELETEUDF publishing macro to create the SAS_DELETEUDF function. For more information, see Running the %INDB2_PUBLISH_DELETEUDF Macro.

%INDB2PC Macro

The %INDB2PC macro is an autocall library that initializes the %INDB2_PUBLISH_COMPILEUDF macro.

INDCONN Macro Variable

The INDCONN macro variable provides the credentials to make a connection to DB2. You must specify the server, user, password, and database information to access the machine on which you have installed the DB2 database. You must assign the INDCONN macro variable before the %INDB2_PUBLISH_COMPILEUDF macro is invoked.
The value of the INDCONN macro variable for the %INDB2_PUBLISH_COMPILEUDF macro has this format.
SERVER=<'>server<'> USER=<'>userid<'> PASSWORD=<'>password<'>
DATABASE=<'>database<'>
SERVER=<'>server<'>
specifies the DB2 server name or the IP address of the server host. If the server name contains spaces or nonalphanumeric characters, you must enclose it in quotation marks.
Requirement: The name must be consistent with the way that the host name was cached when PSFTP server was run from the command window. If the full server name was cached, you must use the full server name in the SERVER argument. If the short server name was cached, you must use the short server name. For example, if the long name, disk3295.unx.comp.com, is used when PSFTP was run, then server=disk3295.unx.comp.com must be specified. If the short name, disk3295, was used, then server=disk3295 must be specified. For more information, see DB2 Installation and Configuration Steps.
USER=<'>userid<'>
specifies the DB2 user name (also called the user ID) that is used to connect to the database. If the user name contains spaces or nonalphanumeric characters, you must enclose it in quotation marks.
PASSWORD=<'>password<'>
specifies the password that is associated with your DB2 user ID. If the password contains spaces or nonalphabetic characters, you must enclose it in quotation marks.
Tip:You can use only PASSWORD= or PW= for the password argument. Other aliases such as PASS= or PWD= are not supported and cause an error.
DATABASE=<'>database<'>
specifies the DB2 database that contains the tables and views that you want to access. If the database name contains spaces or nonalphanumeric characters, you must enclose it in quotation marks.
Note: The SAS_COMPILEUDF function and the two global variables (SASUDF_DB2PATH and SASUDF_COMPILER_PATH) are published to the SASLIB schema in the specified database. The SASLIB schema must be created before publishing the SAS_COMPILEUDF and SAS_DELETEUDF functions.

%INDB2_PUBLISH_COMPILEUDF Macro Syntax

%INDB2_PUBLISH_COMPILEUDF(
DB2PATH=db2path/sqllib
, COMPILER_PATH=compiler-path-directory
<, DATABASE=database-name>
<, ACTION=CREATE | REPLACE | DROP>
<, OBJNAME=object-file-name>
<, OUTDIR=diagnostic-output-directory>
);
Arguments
DB2PATH=db2path/sqllib
specifies the parent directory that contains the function/SAS subdirectory, where all the object files are stored and defines the SASUDF_DB2PATH global variable that is used when publishing the scoring model functions.
Interaction:db2path should be the same path as the path that was specified during the installation of the SAS_COMPILEUDF binary file. For more information, see Step 3 in Unpack the Files.
Tip:The SASUDF_DB2PATH global variable is defined in the SASLIB schema under the specified database name.
COMPILER_PATH=compiler-path-directory
specifies the path to the location of the compiler that compiles the source files and defines the SASUDF_COMPILER_PATH global variable that is used when publishing the scoring model functions.
Tip: The SASUDF_COMPILER_PATH global variable is defined in the SASLIB schema under the specified database name. The xlc compiler should be used for AIX, and the gcc compiler should be used for Linux.
DATABASE=database-name
specifies the name of a DB2 database to which the SAS_COMPILEUDF function is published.
Interaction: The database that you specify in the DATABASE= argument takes precedence over the database that you specify in the INDCONN macro variable. For more information, see %INDB2_PUBLISH_COMPILEUDF Macro Run Process.
Tip:This argument lets you publish the SAS_COMPILEUDF function to a shared database where other users can access it.
ACTION=CREATE | REPLACE | DROP
specifies that the macro performs one of the following actions:
CREATE
creates a new SAS_COMPILEUDF function.
REPLACE
overwrites the current SAS_COMPILEUDF function, if a SAS_COMPILEUDF function by the same name is already registered, or creates a new SAS_COMPILEUDF function if one is not registered.
DROP
causes the SAS_COMPILEUDF function to be dropped from the DB2 database.
Default:CREATE
Tip:If the SAS_COMPILEUDF function was published previously and you now specify ACTION=CREATE, you receive warning messages from DB2. If the SAS_COMPILEUDF function was published previously and you specify ACTION=REPLACE, no warnings are issued.
OBJNAME=object-file-name
specifies the object filename that the publishing macro uses to register the SAS_COMPILEUDF function. The object filename is a file system reference to a specific object file, and the value entered for OBJNAME must match the name as it exists in the file system. For example, SAS_CompileUDF is mixed case.
Default:SAS_CompileUDF
Interaction:If the SAS_COMPILEUDF function is updated, you might want to rename the object file to avoid stopping and restarting the database. If so, the SAS_COMPILEUDF function needs to be reregistered with the new object filename.
OUTDIR=output-directory
specifies a directory that contains diagnostic files.
Tip:Files that are produced include an event log that contains detailed information about the success or failure of the publishing process.

Running the %INDB2_PUBLISH_DELETEUDF Macro

Overview of the %INDB2_PUBLISH_DELETEUDF Macro

The %INDB2_PUBLISH_DELETEUDF macro publishes the SAS_DELETEUDF function in the SASLIB schema of a DB2 database. The SAS_DELETEUDF function facilitates the %INDB2_PUBLISH_MODEL scoring publishing macro. The SAS_DELETEUDF function removes existing object files when the scoring publishing macro registers new ones by the same name.
You have to run the %INDB2_PUBLISH_DELETEUDF macro only one time.
The SAS_COMPILEUDF function must be published before you run the %INDB2_PUBLISH_DELETEUDF macro and the %INDB2_PUBLISH_MODEL macro. Otherwise, these macros fail.
Note: To publish the SAS_DELETEUDF function, you must have the appropriate DB2 user permissions to create and execute this function in the SASLIB schema and specified database. For more information, see DB2 Permissions for the SAS Accelerator Publishing Agent.

%INDB2_PUBLISH_DELETEUDF Macro Run Process

To run the %INDB2_PUBLISH_DELETEUDF macro, follow these steps:
  1. Ensure that you have created a SASLIB schema in the database where the SAS_DELETEUDF function is published. You must use “SASLIB” as the schema name for DB2 in–database processing to work correctly.
    The SASLIB schema should have been created when you ran the %INDB2_PUBLISH_COMPILEUDF macro to create the SAS_COMPILEUDF function. The SASLIB schema contains the SAS_COMPILEUDF and SAS_DELETEUDF functions and the SASUDF_DB2PATH and SASUDF_COMPILER_PATH global variables.
    The SAS_COMPILEUDF function must be published before you run the %INDB2_PUBLISH_DELETEUDF macro. The SAS_COMPILEUDF and SAS_DELETEUDF functions must be published to the SASLIB schema in the same database. For more information about creating the SASLIB schema, see %INDB2_PUBLISH_COMPILEUDF Macro Run Process.
  2. Start SAS 9.2 and submit the following commands in the Enhanced Editor or Program Editor.
    %indb2pd;
    %let indconn = server=yourserver user=youruserid password=yourpwd
       database=yourdb;
    %indb2_publish_deleteudf(
       database=database,
       action=create,
       outdir=youroutputdirectory);
    
You can verify that the function has been published successfully. For more information, see Validating the Publishing of SAS_COMPILEUDF and SAS_DELETEUDF Functions and Global Variables.
After the SAS_DELETEUDF function is published, the %INDB2_PUBLISH_MODEL macro can be run to publish the scoring model files.

%INDB2PD Macro

The %INDB2PD macro is an autocall library that initializes the %INDB2_PUBLISH_DELETEUDF macro.

INDCONN Macro Variable

The INDCONN macro variable provides the credentials to make a connection to DB2. You must specify the server, user, password, and database information to access the machine on which you have installed the DB2 database. You must assign the INDCONN macro variable before the %INDB2_PUBLISH_DELETEUDF macro is invoked.
The value of the INDCONN macro variable for the %INDB2_PUBLISH_DELETEUDF macro has this format.
SERVER=<'>server<'> USER=<'>userid<'> PASSWORD=<'>password<'>
DATABASE=<'>database<'>
SERVER=<'>server<'>
specifies the DB2 server name or the IP address of the server host. If the server name contains spaces or nonalphanumeric characters, you must enclose the name in quotation marks.
Requirement: The name must be consistent with the way that the host name was cached when PSFTP server was run from the command window. If the full server name was cached, use the full server name in the SERVER argument. If the short server name was cached, use the short server name. For example, if the long name, disk3295.unx.comp.com, is used when PSFTP was run, then server=disk3295.unx.comp.com must be specified. If the short name, disk3295, was used, then server=disk3295 must be specified. For more information, see DB2 Installation and Configuration Steps.
USER=<'>userid<'>
specifies the DB2 user name (also called the user ID) that is used to connect to the database. If the user name contains spaces or nonalphanumeric characters, you must enclose it in quotation marks.
PASSWORD=<'>password<'>
specifies the password that is associated with your DB2 user ID. If the password contains spaces or nonalphabetic characters, you must enclose it in quotation marks.
Tip:You can use only PASSWORD= or PW= for the password argument. Other aliases such as PASS= or PWD= are not supported and cause errors.
DATABASE=<'>database<'>
specifies the DB2 database that contains the tables and views that you want to access. If the database name contains spaces or nonalphanumeric characters, you must enclose the name in quotation marks.
Note: The SAS_DELETEUDF function is published to the SASLIB schema in the specified database. The SASLIB schema must be created before publishing the SAS_COMPILEUDF and SAS_DELETEUDF functions.

%INDB2_PUBLISH_DELETEUDF Macro Syntax

%INDB2_PUBLISH_DELETEUDF (
<DATABASE=database-name>
<, ACTION=CREATE | REPLACE | DROP>
<, OUTDIR=diagnostic-output-directory>
);
Arguments
DATABASE=database-name
specifies the name of a DB2 database to which the SAS_DELETEUDF function is published.
Interaction:The database that you specify in the DATABASE argument takes precedence over the database that you specify in the INDCONN macro variable. For more information, see Running the %INDB2_PUBLISH_DELETEUDF Macro.
Tip:This argument lets you publish the SAS_DELETEUDF function to a shared database where other users can access it.
ACTION=CREATE | REPLACE | DROP
specifies that the macro performs one of the following actions:
CREATE
creates a new SAS_DELETEUDF function.
REPLACE
overwrites the current SAS_DELETEUDF function, if a SAS_DELETEUDF function by the same name is already registered, or creates a new SAS_DELETEUDF function if one is not registered.
DROP
causes the SAS_DELETEUDF function to be dropped from the DB2 database.
Default: CREATE
Tip:If the SAS_DELTEUDF function was published previously and you specify ACTION=CREATE, you receive warning messages from DB2. If the SAS_DELETEUDF function was published previously and you specify ACTION=REPLACE, no warnings are issued.
OUTDIR=diagnostic-output-directory
specifies a directory that contains diagnostic files.
Tip:Files that are produced include an event log that contains detailed information about the success or failure of the publishing process.

Validating the Publishing of SAS_COMPILEUDF and SAS_DELETEUDF Functions and Global Variables

To validate that the global variables are created properly, follow these steps.
  1. Connect to your DB2 database using Command Line Processor (CLP).
  2. Enter the following command.
    values(saslib.sasudf_compiler_path)
    You should receive a result similar to one of the following.
    /usr/vac/bin      /* on AIX */
    /usr/bin        /* on Linux */
    
  3. Open a UNIX window; validate that the xlc compiler (on AIX) or gcc compiler (on Linux) is in the path that you received as a result.
  4. Connect to DB2 using CLP and enter the following command.
    values(saslib.sasudf_db2path)
    You should receive a result similar to the following.
    /users/db2v9/sqllib
    In this example, /users/db2v9 is the value of db2path that was specified during installation and when the SAS_COMPILEUDF function was published.
  5. Open a UNIX window; validate that sasudf_db2path is defined as the path that you received as a result.
  6. Connect to DB2 using CLP and enter the following command.
    select funcname, implementation from syscat.functions where
       funcschema='SASLIB'
    
    You should receive a result similar to the following.
    FUNCNAME                         IMPLEMENTATION
    -------------------------------------------------------------
    SAS_DELETEUDF
    /users/db2v9/sqllib/function/SAS/SAS_DeleteUDF!SAS_DeleteUDF
    SAS_COMPILEUDF
    /users/db2v9/sqllib/function/SAS/SAS_CompileUDF!SAS_CompileUDF
    
  7. Open a UNIX window; validate that the SAS_COMPILEUDF and SAS_DELETEUDF functions are installed in the paths that you received as results.
  8. To validate that the SAS_COMPILEUDF and SAS_DELETEUDF functions were built properly for the server box, enter an LDD command from the UNIX command line similar to this one.
    $ ldd path_to_sqllib_for_db2/function/SAS/SAS_CompileUDF
    The results should look similar to the following, depending on your operating system.
    SAS_CompileUDF needs:
         /usr/lib/libc.a(shr_64.o)
         /unix
         /usr/lib/libcrypt.a(shr_64.o)
    

DB2 Permissions for the SAS Accelerator Publishing Agent

There are two sets of permissions involved with the SAS Accelerator Publishing Agent software.
The first set of permissions is needed by the person who publishes the SAS_COMPILEUDF and SAS_DELETEUDF functions and creates the SASUDF_COMPILER_PATH and SASUDF_DB2PATH global variables.
These permissions must be granted before the %INDB2_PUBLISH_COMPILEUDF and %INDB2_PUBLISH_DELETEUDF macros are run. Without these permissions, running these macros fails.
The following table summarizes the permissions that are needed by the person who publishes the functions and creates the global variables.
Permission Needed
Authority Required to Grant Permission
Examples
CREATEIN permission for the SASLIB schema in which the SAS_COMPILEUDF and SAS_DELETEUDF functions are published and the SASUDF_COMPILER_PATH and SASUDF_DB2PATH global variables are defined
System Administrator or Database Administrator
Note: If you have SYSADM or DBADM authority or are the DB2 instance owner, then you have these permissions. Otherwise, contact your database administrator to obtain these permissions.
GRANT CREATEIN ON SCHEMA SASLIB 
TO compiledeletepublisheruserid
CREATE_EXTERNAL_ROUTINE permission to the database in which the SAS_COMPILEUDF and SAS_DELETEUDF functions are published
GRANT CREATE_EXTERNAL_ROUTINE ON 
DATABASE TO 
compiledeletepublisheruserid
The second set of permissions is needed by the person who publishes the scoring models. The person who publishes the scoring model functions is not necessarily the same person who publishes the SAS_COMPILEUDF and SAS_DELETEUDF functions and creates the SASUDF_COMPILER_PATH and SASUDF_DB2PATH global variables. These permissions are most likely needed by the scoring model developer. Without these permissions, the publishing of the scoring model functions fails.
Note: Permissions must be granted for every scoring model publisher and for each database that the scoring model publishing uses. Therefore, you might need to grant these permissions multiple times.
After the DB2 permissions have been set appropriately, the scoring model publishing macro should be called to register the scoring models.
The following table summarizes the permissions that are needed by the person who publishes the scoring models.
Permission Needed
Authority Required to Grant Permission
Examples
EXECUTE permission for functions that have been published.
This enables the person who publishes the scoring models to execute the SAS_COMPILEUDF and SAS_DELETEUDF functions.
System Administrator or Database Administrator
Note: If you have SYSADM or DBADM authority, then you have these permissions. Otherwise, contact your database administrator to obtain these permissions.
GRANT EXECUTE ON FUNCTION 
SASLIB.* TO 
scoringpublisheruserid
CREATE_EXTERNAL_ROUTINE permission to the database to create scoring model functions
GRANT CREATE_EXTERNAL_ROUTINE ON 
DATABASE TO 
scoringpublisheruserid
CREATE_NOT_FENCED_ROUTINE permission to create scoring model functions that are not fenced
GRANT CREATE_NOT_FENCED_ROUTINE 
ON DATABASE TO 
scoringpublisheruserid
CREATEIN permission for the schema in which the scoring functions are published if the default schema (SASLIB) is not used
GRANT CREATEIN ON SCHEMA 
scoringschema TO 
scoringpublisheruserid
READ permission to read the SASUDF_COMPILER_PATH and SASUDF_DB2PATH global variables
Note: The person who ran the %INDB2_PUBLISH_COMPILEUDF macro has these READ permissions and does not need to grant them to himself or herself again.
Person who ran the %INDB2_PUBLISH_COMPILEUDF macro
Note: For security reasons, only the user who created these variables has the permission to grant READ permission to other users. This is true even for the user with administrator permissions such as the DB2 instance owner.
GRANT READ ON VARIABLE 
SASLIB.SASUDF_DB2PATH TO 
scoringpublisheruserid

GRANT READ ON VARIABLE 
SASLIB.SASUDF_COMPILER_PATH
TO scoringpublisheruserid

Documentation for Publishing SAS Scoring Models in DB2

For information about how to publish SAS scoring models, see the SAS Scoring Accelerator for DB2 under UNIX: User's Guide located at http://support.sas.com/documentation/onlinedoc/scoraccldb2/index.html.