Created On:  06 August 2012

Problem:

Customer is trying to invoke a user defined function from SQLWizard and he’s wondering how to set the LOADLIB for the XDB server to find the binary.

Resolution:

Even though SQLWizard can be started from the MFE menu, SQLWizard is outside of the project.  It doesn’t have access to the project settings.  You have two options.  The behavior can be controlled either by XDB specific SQL statements or it can be specified in the XDB.INI file.
 
There are three XDB SQL statements used to specify stored procedure behavior.  When COBOL programs are run by the MFE IDE, they have access to variables set to contain the values needed.  That is why it will work from COBOL.  When the COBOL programs are logging in to the XDB Server, the following commands instruct the server about the desired environment:
 

1.      SET XDB_STORED_PROC ANIMATE [ON|OFF] – This is used to debug the stored procedure (SP).  Once this command has been run, the XDB Server to launch the COBOL RTS with a flag to pop up a second IDE and animate the code.  If you need the SP project open at the time, you should use the XSRVN.EXE server instead of the XDB Service.

2.      SET XDB_STORED_PROC PATH loadlib-directory – This is used to pass the LOADLIB path into the server so it can find the SP binaries.  The path should be quoted in to avoid problems with tokenizing of the string.  Multiple directories may be specified separated by the semicolon character.  For example,

“C:\\ mfuser\\projects\\mfe31.ws12\\LOADLIB\\;C:\\ mfuser\\projects\\Rob\\LOADLIB\\"

3.      SET XDB_STORED_PROC ENVIRONMENT  environment-settings – This is used to pass environment variables you would like the XDB Server to set for the SP process.  Again, this string should be quoted.  For example, the statement is automatically passed by COBOL programs to specify the location of the “Entry Name Mapping” file, MFENTMAP.DAT.  The string to do that would look as follows.  This statement can also be used to specify


"ENTRYNAMEMAP = C:\\ mfuser\\projects\\mfe31.ws12\\MFENTMAP.DAT"

This statement may also be used to enable the Test Coverage for any COBOL compiled with the TESTCOVER directive set.  The string specifies the location of the Test Coverage configuration file:

 

“"TESTCOVER = C:\\ mfuser\\projects\\mfe31.ws12\\TestCover.TCF"

 

This statement will take multiple strings.  Supply one quoted string for each environment variable you want to set.

 
These statements may be placed into an SQL script.  You may also need to use the SET CURRENT PATH statement.  The script may be executed normally or it can be executed using the SQLWizard “Run Batch” dialog accessed under the “File” menu.
 
Within the XDB.INI file, the LOADLIB and debugging settings can be configured in the [SERVER] section.  The variables StProcAnimate and StProcLoadLib will provide the values to the server.  StProcLoadLib can take multiple paths separated by semicolons.  Here’s an example of the server section with these variables set:
 
[SERVER]
XDBSERVE=ROCKROBD
XSRVCFG=C: \\mfuser\\config
XDBCP=850
StProcAnimate=Y
StProcLoadLib= C:\\ mfuser\\projects\\mfe31.ws12\\LOADLIB\\
 
You can also use both methods.  SET XDB_STORED_PROC PATH should concatenate its value onto the end of the he XDB.INI LOADLIB setting.  The values set in the XDB.INI file cannot be replaced without modifying the XDB.INI file and restarting the server.  The SQL statements provide more flexibility allowing you to turn debugging on and off, alter the path to the LOADLIB, etc.
 
Please choose whichever is most convenient for you.