Using Scripting to automatically create, and control transfers in Data Transport / TransportIT

Document ID : KB000056166
Last Modified Date : 14/02/2018
Show Technical Document Details

Using Scripting to automatically create, and control transfers in Data Transport / TransportIT.

    DTS SP1 added scripting support for users of Unicenter Data Transport / TransportIT. Using the DTS specific scripting extensions is a very easy way to build user-defined scripts which can create, activate, resume and monitor transfers. The scripts are executed by dmscript or casdips which is a synonym for dmscript.

    Example: dmscript <script.ips>

    The following example demonstrates:
      Step 1 how a new transfer may be created without activating it.
      Step 2 activates a transfer. In this case the transfer created in step 1.
      Step 3 shows how to monitor a certain transfer. In this case the loop continues until the transfer ends either successfully or with an error.
      For more details see the "CA Reference Guide" and search for "scripting". The topic: "scripting functions (Data Transport Service transfer-specific scripting language)" gives an overview of the existing functions and how to use them.

      Attention:

        The following script assumes that the included script "dts.ips" is stored in same directory as the script itself! If this is wrong, please use the full path of the dts.ips file.


        Include dts.ips
        DIM Sscratch as string
        DIM Iscratch as integer
        DIM IxferID as integer
        DIM IgrpID as integer

        print
        print OSSTRING
        Sscratch = "Script version is " + SCRIPTVERSION
        print Sscratch

        rem STEP 1
        rem create a transfer but do not execute it yet
        IxferID = TransferFile("source_pc::c:\temp\lsm_run.up",
        "target_pc::c:\temp\lsm_run.up",
        "source_uid","targetuid",
        "password1","password2",
        "TOS_server",0,0, TRUE , FALSE ,FALSE , FALSE , FALSE, "" )
        print "The transfer id is " + str(IxferID)

        rem STEP 2
        rem Get the Id to activate and control the transfer
        IgrpID = GetGrpID( IxferID )
        print "The group ID is " + str(IgrpID)
        If IgrpID = 0 THEN
        print "Illegal Group ID: exit"
        GOTO ScriptEnd
        EndIF

        rem Activate a transfer
        Iscratch = ActivateTransferGrp( IgrpID )

        If Iscratch then print "Activation Failed!" goto ScriptEnd


        rem STEP 3
        rem Monitor a certain transfer
        Sscratch = ""
        while ((Sscratch <> "COMPLETE") and (Sscratch <> "FAILED"))
        Sscratch = GetTransferStatus (IxferID, "pcname","user_id","password")
        Sscratch = trim (Sscratch)
        print Sscratch
        sleep (500)
        Wend
        ScriptEnd: