Q
Problem solve Get help with specific problems with your technologies, process and projects.

Call 'Recompile all LotusScript' option from LS or Java

View member feedback to this Ask the Expert Q&A.

Is there a way to programmatically call the "Recompile all LotusScript" option from LotusScript or Java? We are in the process of upgrading all of our applications to R6 and want to recompile the LotusScript on each database to validate the codes inside each design element. It would save us a lot of time if we can loop through all the databases on the server and call on this option to recompile all of the LotusScript.

There isn't a way to recompiled all LotusScript from LotusScript or Java. However, if you're really ambitious, it is possible to write code that uses the C API to compile LotusScript. The C API toolkit can be downloaded for free from the IBM Lotus Web site.

There isn't a single command to compile an entire database, so you would need to write code to loop through all forms, script libraries, agents, etc,. and compile them one-by-one. It can be tough to write this kind of code, but it should perform well, since API code runs at the operating system level and is very fast.

Below is the description of the NSFNoteLSCompile function from the API reference.

NSFNoteLSCompile - Compile a note containing LotusScript modules.

-------------------------------------------------------------------------

#include <nsfnote.h>

STATUS LNPUBLIC NSFNoteLSCompile(
DBHANDLE hDb,
NOTEHANDLE hNote,
DWORD dwFlags);

Description :

The API compiles all the LotusScript 
code found in a design document. This 
includes document classes such as 
Views, Agents, Forms, Pages, Navigators, 
Shared fields, script libraries, Help
 documents, using database documents, 
etc. It is a way of making sure that the 
object code of the script is up-to-
date. 
For the Agent note, the compiled object 
code is saved in the $AssistAction_Ex 
item.
Parameters :
Input :
hDb - Handle to the database.
hNote - Handle to the note containing 
LotusScript modules.
dwFlags - (Reserved for future use) Must be 0.

Output :
(routine) - (routine) - Return indicates 
either success or what the error is. 
The return codes include: 
NOERROR - Operation was successful.
ERR_NULL_NOTEHANDLE - if hNote was 
not specified.
ERR_xxx - STATUS returned from a lower 
level Notes function call.

Sample Usage :
...
/* Compile the Agent note */ 
if (error=NSFNoteLSCompile(hDb,hAgent,0))
{
printf("Error: LS Compilen");
goto Exit1;
}

/* Update the note */
if (error=NSFNoteUpdate(hAgent,0))
{
printf("Error: can't update note after LS Compilen");
goto Exit1;
}

MEMBER FEEDBACK TO THIS ASK THE EXPERT Q&A:

The exception I have to the answer for this question is that Brad was all too happy to answer the technical question without addressing the reason for the question being asked.

Compiling actually changes code, unlike signing, and if your company has rules about changing code on a production system without going through development phases, that should give you some direction. Besides, if a problem occurs with recompiling a production database, you now have a production system with a problem! If this were able to be done programmatically, you could have a huge mess on your hands the next morning.

I have seen Domino Designer save LotusScript without raising an eyebrow, and then have the "Compile" feature throw an error. I have run the "Compile" feature and gotten errors on databases that have otherwise been working fine for years. I have had the "Compile" feature completely lock up my Designer client if there are too many circular dependencies in script libraries -- in code that ran fine in production! Compiles are not something to be taken lightly and are tools for developers -- not a maintenance task like Compile, Fixup, or Updall.

—Kieras David J.

Do you have comments on this Ask the Expert question and response? Let us know.

Dig Deeper on LotusScript

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close