Create A Replica Stub With LotusScript

In Lotus Script it's possible to create a new replica from a Lotus Notes Database using the Method CreateReplica from the NotesDatabase Class. This method creates the replica and replicates instantly. See the code on how to create a replica stub only using Notes API in Lotus Script. The Code has been developed with Notes 4.x that's why we consider OS/2 as plattform. In R5 you may use it on a server running OS/2 '%If OS2 Declare Function...

OS2_NSFDBOPEN Lib "INOTES.DLL" Alias "NSFDBOPEN" _ (Byval dbname As String, dbHandle As Long ) As Long Declare Function OS2_NSFDBCLOSE Lib "INOTES.DLL" Alias "NSFDBCLOSE" _ (Byval dbHandle As Long ) As Long Declare Function OS2_NSFDBCREATE Lib "INOTES.DLL" Alias "NSFDBCREATE" _ (Byval dbname As String, Byval dbClass As Single, Byval forceIt As Single) As Long Declare Function OS2_NSFDBREPLICAINFOSET Lib "INOTES.DLL" Alias "NSFDBREPLICAINFOSET" _ (Byval dbHandle As Long, replInfoStruct As Long) As Long Declare Function OS2_NSFDBREPLICAINFOGET Lib "INOTES.DLL" Alias "NSFDBREPLICAINFOGET" _ (Byval dbHandle As Long, replInfoStruct As Long) As Long '%Elseif WIN32 Declare Function W32_NSFDbOpen Lib "nnotes.dll" Alias "NSFDbOpen" _ (Byval dbname As String, dbHandle As Long ) As Long Declare Function W32_NSFDbClose Lib "nnotes.dll" Alias "NSFDbClose" _ (Byval dbHandle As Long ) As Long Declare Function W32_NSFDBCREATE Lib "NNOTES.DLL" Alias "NSFDbCreate" _ (Byval dbname As String, Byval dbClass As Single, Byval forceIt As Single) As Long Declare Function W32_NSFDBREPLICAINFOSET Lib "NNOTES.DLL" Alias "NSFDbReplicaInfoSet" _ (Byval dbHandle As Long, replInfoStruct As Long) As Long Declare Function W32_NSFDBREPLICAINFOGET Lib "NNOTES.DLL" Alias "NSFDbReplicaInfoGet" _ (Byval dbHandle As Long, replInfoStruct As Long) As Long Sub Click(Source As Button) Dim s As New NotesSession Dim db As NotesDatabase Set db = s.currentdatabase rc = CreateReplStub(db.server, db.filepath, "", "myrepl.nsf", True) End Sub Function CreateReplStub(S_Server As String, S_Db As String, T_Server As String, T_Db As String, forceit As Single) As Long Dim S_DbString As String Dim T_DbString As String Dim dbhandle As Long Dim retNoteID As Long Dim noteClass As Long Dim replInfo(5) As Long Select Case Ucase$(S_Server) Case "LOCAL" S_DbString = S_Db Case "LOKAL" S_DbString = S_Db Case "" S_DbString = S_Db Case Else S_DbString = S_Server + "!!" + S_Db End Select Select Case Ucase$(T_Server) Case "LOCAL" T_DbString = T_Db Case "LOKAL" T_DbString = T_Db Case "" T_DbString = T_Db Case Else T_DbString = T_Server + "!!" + T_Db End Select 'get the replica info struct from Source DB If isdefined("WIN32") Then rc = W32_NSFDBOPEN(S_DbString, dbhandle) rc = W32_NSFDBREPLICAINFOGET(dbhandle, replInfo(0)) rc = W32_NSFDBCLOSE(dbhandle) Elseif isdefined("OS2") Then rc = OS2_NSFDBOPEN(S_DbString, dbhandle) rc = OS2_NSFDBREPLICAINFOGET(dbhandle, replInfo(0)) rc = OS2_NSFDBCLOSE(dbhandle) End If 'crete new DB and asign replikaInfo If isdefined("WIN32") Then rc = W32_NSFDBCREATE(T_DbString, DBCLASS_NOTEFILE, forceIt) Print "Create",rc rc = W32_NSFDBOPEN(T_DbString, dbhandle) Print "Open", rc rc = W32_NSFDBREPLICAINFOSET(dbhandle, replInfo(0)) Print "Set", rc rc = W32_NSFDBCLOSE(dbhandle) Print "close", rc Elseif isdefined("OS2") Then rc = OS2_NSFDBCREATE(T_DbString, DBCLASS_NOTEFILE, forceIt) rc = OS2_NSFDBOPEN(T_DbString, dbhandle) rc = OS2_NSFDBREPLICAINFOSET(dbhandle, replInfo(0)) rc = OS2_NSFDBCLOSE(dbhandle) End If End Function

This was first published in November 2000

Dig deeper on Domino Resources - Part 2

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWinIT

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 ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.UK

Close