Execute API Scripts via DFC code

NidhiJayas
NidhiJayas Member
edited February 10, 2012 in Documentum #1

Documentum 6 : We have multiple scripts generated by DM_Clean Job (setting -clean_now FALSE) which looks like below :

# Content object 060186bf81f2936d has parent count of zero.

apply,c,060186bf81f2936d,DESTROY_CONTENT

getmessage,c

close,c,q0

# Content object 060186bf81f28fe1 has parent count of zero.

apply,c,060186bf81f28fe1,DESTROY_CONTENT

getmessage,c

close,c,q0

As the dm_clean had not run for a long time for this environment, it generated huge file, which we had broken down into various small files.

Is there a way we can execute these script files via DFC ? I am aware that api execute methods have been deprecated and would not work for D6 environment.

Any suggestions how do we execute thousands of these script files. We are reluctant to manually run each file via iapi.

Environment : Windows , Documentum 6, Attaching sample file

Best Answer

  • NidhiJayas
    NidhiJayas Member
    edited February 10, 2012 #2 Answer ✓

    I achieved this by creating a batch file (.bat) and putting scripts and logging in there.

    I can run the batch to execute thousands of scripts, and no need to manually run each script via IAPI.

    set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_23

    set PATH=%PATH%;C:\Program Files\Java\jdk1.6.0_23\bin

    iapi32 TMO_FMA_TEST -Udmadmin -Pdmadmin -RC:\reportaaaa001.api -lC:\Log1.txt

    iapi32 TMO_FMA_TEST -Udmadmin -Pdmadmin -RC:\reportaaaa002.api -lC:\Log2.txt

                                                     .

                                                     .

    iapi32 TMO_FMA_TEST -Udmadmin -Pdmadmin -RC:\reportaaaa10000.api -lC:\Log10000.txt

Answers

  • Hartmut_Clausen
    edited February 9, 2012 #3

    You can still use API. Try iapi32.exe to execute the (splitted) script.

  • NidhiJayas
    NidhiJayas Member
    edited February 9, 2012 #4

    Thanks for your reply Clausen. I assume you meant running the scripts via OTB iapi utility (under Documentum/product/6.5/bin)

    We don't wish to manually run each script (more than 10,000) via IAPI/iapi32.exe.

    Though we can run multiple instances of iapi32, but it would still be a difficult task to manage thousands of files.

    Any other suggestion to achieve this via DFC code or any other alternative ?

  • DCTM_Guru
    DCTM_Guru Member
    edited February 9, 2012 #5

    The dm_Clean job will query for the docbase for objects it can delete at the time the job is run.  So, the "thousands" of script files probably have duplicate entries.  Any reason, why you dont just re-run the job again and then execute the script afterwards?

  • NidhiJayas
    NidhiJayas Member
    edited February 9, 2012 #6

    Johnny,

    We ran dm_clean job via command line and single run took some 2-3 days to complete. As I mentioned earlier, we had not run the dm_clean for a very long time in this particular environment, and so it had accumulated millions of orphans over the time.

    I have checked the reports randomly and there is no duplicate entry at all. There is no point running the job again, as it would again generate the same amount of data, and we know the reason why.

    I will try creating a .bat file to call multiple iapi instances, let me see if that works out. Will post if I hit success.

    Keep writing for any alternatives/suggestions. Thanks

  • Hartmut_Clausen
    edited February 9, 2012 #7

    There is a problem with the dm_DMClean job when it has to delete many files. The job can generate a very large file. It then paases that file to iapi. iapi tries to load that file as a whole in memory. So your approach was correct. Generate the file with the option "-clean_now false", which supresses the direct call of iapi from within the job. Then splitt the file and pass the parts separately to iapi (manually or via a batch script). The parts are smaler and can be loaded in memory without problems and will be executed much faster.

  • NidhiJayas
    NidhiJayas Member
    edited February 10, 2012 #8 Answer ✓

    I achieved this by creating a batch file (.bat) and putting scripts and logging in there.

    I can run the batch to execute thousands of scripts, and no need to manually run each script via IAPI.

    set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_23

    set PATH=%PATH%;C:\Program Files\Java\jdk1.6.0_23\bin

    iapi32 TMO_FMA_TEST -Udmadmin -Pdmadmin -RC:\reportaaaa001.api -lC:\Log1.txt

    iapi32 TMO_FMA_TEST -Udmadmin -Pdmadmin -RC:\reportaaaa002.api -lC:\Log2.txt

                                                     .

                                                     .

    iapi32 TMO_FMA_TEST -Udmadmin -Pdmadmin -RC:\reportaaaa10000.api -lC:\Log10000.txt