wissel.net

Usability - Productivity - Business - The web - Singapore & Twins

Identifying platform dependent code in your Domino application


Domino runs on many platforms, so you have the freedom of choice what to use. My personal favorite currently is zLinux 64Bit, the mainframe I/O capabilites are delightful. However you might have limited your choices by the way you developed your applications. Luckily LotusScript is case insensitive on all platforms, so you only have to pay attention to pieces of code that interact with the world around you. In specific you need to watch out for:
  • DECLARE: where in LotusScript you refer to OS level DLLs that most likely won't be available on other platforms
  • Execute: There could be anything inside, you don't know
  • Evaluate (and @Eval): Again there could be anything inside
  • SHELL: Executing OS level calls
  • Anything that reads/writes a file: NotesStream, Standard file I/O etc.
  • @DBCommand (and the other @DB functions): When using ODBC that driver must be on the new platform. @DBCommand also allows you to actually call a DLL (a very little known extension point) when you use a keyword other than "Domino" or "ODBC". That DLL needs to be available on the target platform
  • All statements that need attention: ActivateApp, ChDir, ChDrive, CreateObject, CurDir, CurDir$, CurDrive, CurDrive$, Date, Date$, Declare, Dir, Dir$, FileLen, Len, LenB, LenBP, LOF, GetFileAttr, GetObject, Input #, Input, Input$, InputB, InputB$, Line Input, Print, Write #, IsObject, IsUnknown, Open, Lock, Unlock, SendKeys, SetFileAttr, Shell, Time, Time$
Now when you are tasked with evaluating a server move to a different platform, you can use DXLMagic to get an idea how many problem areas you might deal with. These are the steps:
  1. Export your databases using the GUI:
    Export NSF
    Make sure you checked the option "Create metric files"
  2. In your target directory you will find 2 files com.ibm.sg.dxlmagic.DocumentDesignMetrics.properties and com.ibm.sg.dxlmagic.DocumentDesignTags.properties. The first one determines what goes into the CSV file, the second one generates additional tags based on code fragments. You can edit both files and run the extraction from the command line (much faster than the initial export) to get the "how much to pay attention to" report. Edit the com.ibm.sg.dxlmagic.DocumentDesignTags.properties and change it to the following content
    #***** Platform investigation ******
    Declare\ =C_CALL
    ActivateApp=OLE_CALL
    GetObject=OLE_CALL
    CreateObject=OLE_CALL
    IsObject=OLE_CALL
    IsUnknown=OLE_CALL
    ChDrive=DRIVE_OP
    CurDrive=DRIVE_OP
    ChDir=DIR_OP
    CurDir=DIR_OP
    Dir=DIR_OP
    FileLen=FILE_IO
    Len=FILE_IO
    LenB=FILE_IO
    LenBP=FILE_IO
    LOF=FILE_IO
    GetFileAttr=FILE_IO
    SetFileAttr=FILE_IO
    Input\ \#=FILE_IO
    Input=FILE_IO
    InputB=FILE_IO
    Line\ Input=FILE_IO
    Write\ \#=FILE_IO
    Open=FILE_IO
    Lock=FILE_IO
    Unlock=FILE_IO
    NotesStream=FILE_IO
    Print=PRINT
    Date=TIME_OP
    Time=TIME_OP
    Shell=SHELL_CALL
    SendKeys=SHELL_CALL
    @dialogbox=UI_formula
    @prompt=UI_formula
    .dialogbox=UI_script
    as\ notesui=UI_script
    source\ as=UI_event
    @db=DB_formula
    

    Then edit the com.ibm.sg.dxlmagic.DocumentDesignMetrics.properties file and add the new tags (you can keep the existing ones if you want):
    C_CALL
    OLE_CALL
    DRIVE_OP
    DIR_OP
    FILE_IO
    PRINT
    TIME_OP
    SHELL_CALL
    DB_formula
    LOC_formula
    LOC_java
    LOC_javascript
    LOC_lotusscript
    UI_event
    UI_formula
    UI_script
    action
    agent
    button
    column
    field
    form
    formula
    java
    javascript
    lotusscript
    par
    role
    sharedcolumn
    sharedfield
    subform
    view
    

    (you might want to skip the PRINT statement since it is often used in web agents and there nothing is special)
  3. Run DXLMagic from the Command Line to extract and document based on the new property files. The result will be a new CSV file with extra columns
    java com.ibm.sg.dxlmagic.DocumentDesignTags [DirectoryWithTheDXL]
    java com.ibm.sg.dxlmagic.DocumentDesignMetrics [DirectoryWithTheDXL] CsvFileName
Just to be clear: this steps show you how many instances are there, but not where or if changes are required. Most likely all PRINT and @db commands will be just fine. But it is a fast method to get a first impression. Based on the DXL you could devise an XSLT report to show the problem spots in detail.
As usual YMMV

Posted by on 15 August 2012 | Comments (0) | categories: DXLMagic Show-N-Tell Thursday

Comments

  1. No comments yet, be the first to comment