Defragment

Hi guys

Any one know of a way i can run the database defragment from either a script of a GX. I am in the process of making a archive GX and would like to defragment the gdb as the last step in order to save disk space.

cheers

Comments

  • IanMacLeod
    edited October 2017
    disregard - see Jacques' correct answer below.
    Geosoft logo
  • JacquesBeaurain
    edited October 2017
    Hi @RichardWright,

    There is actually a way to achieve this with the GX API as long as one is running inside Oasis montaj and the database is current. The DoCommand_SYS call can send application command IDs. For entries like these in an OMN:

    ITEM "Defragment..." ,*ID_FILE_PACK {?gdb}

    One can do the following in GX API code:

    GXC: DoCommand_SYS("[ID] ID_FILE_PACK");
    C#: CSYS.DoCommand("[ID] ID_FILE_PACK");
    C++: GXSYS::do_command("[ID] ID_FILE_PACK");
    Python: GXSYS.do_command("[ID] ID_FILE_PACK");


  • @JacquesBeaurain, can that be scripted somehow?
    Geosoft logo
  • JacquesBeaurain
    edited October 2017
    Hi Ian,

    Although it is currently possible to script this by writing a GX to call the API function based on an INI parameter, the GUI prompt which the command shows will show regardless of being run from the menus or from within the script. The oms.exe /GUI parameter can be used to launch montaj for the duration of the script and make the API function usable.


    Here is an example of the GXC source code (runcommand.gxc):

    NAME = "Run an Oasis montaj command (useful for scripting via OMS /GUI)" VERSION = "1" DESCRIPTION = "RUNCOMMAND.CMD_STRING" #include <all.gxh> string(STR_FILE) sCommand; { GetString_SYS("RUNCOMMAND","CMD_STRING",sCommand); DoCommand_SYS(sCommand); }

    And script:

    CURRENT Database,"g:\path_to_gdb.gdb" SETINI RUNCOMMAND.CMD_STRING="[ID] ID_FILE_PACK" GX runcommand.gx

    Cheers,
    Jacques
  • Hi Jacques

    Thanks for this it is exactly what i was looking for. only draw back for now i guess is the fact that there is not option to run with out the GUI prompt so if running via OMS one a whole list of gdbs still need to press enter for each one. But that is better then then ~8Gb of bloated space that was being saved with each gdb for now.

    If it is possible to include this in the API in future releases that would be great. Possibly a CDB.commit with a defragment parameter?

    cheers
    Richard
This discussion has been closed.