IBM Sterling Transformation Extender

Sterling Transformation Extender

Come for answers, stay for best practices. All we're missing is you.

 View Only
  • 1.  Execute map from Shell script

    Posted Mon May 13, 2019 03:24 AM

    Originally posted by: RT123


    Hi,

     

    I need to call a ITX map form within a shell script. The map should do the following:

     

    • The script should run an  ITX map (mmc file)
    • The map started should continue to use ITX configuration file (config.mrn). The variable put on the map will be replaced by the file from the configuration file.
    • The script should return the value "1" if it's failed or just echo when it's OK. 

    Any help would be greatly appreciated.

     

     


    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 2.  Re: Execute map from Shell sript

    Posted Mon May 13, 2019 09:01 AM

    Originally posted by: PaulBrett


    You need to use the Command Server (dtxcmdsv).  The Resource Registry file MRC will be picked up if you have referenced it in both place in the dtx.ini file.  The MRC file will use the MRN file referenced in the Command Server section.

    Usual errorlevel checking can be used, as per any other type of script.

    Thank you.

    Paul

    Follow me on Twitter


    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 3.  Re: Execute map from Shell sript

    Posted Tue May 14, 2019 01:02 AM

    Originally posted by: RT123


    Thank You Response Paul. 

     

    Can you please elaborate on what it means by referencing the MRC file in both the place in dtx.ini file. 

    I have used the dtxcmdsv command server command: My script is pasted below:

    The below script fails to pickup values from the config.mrn file. Please suggest.

     

    #!/bin/ksh
    ## --------------------------------------------------------------------------- #
    ##                                                   #
    ## --------------------------------------------------------------------------- #

    . /$MACHINE/apps/common/librairies_communes.ksh
    . /$MACHINE/apps/common/jobInitialize.ksh ${0} "$*"

    # --------------------------------------------------------------------------- #
    # VARIABLES
    # --------------------------------------------------------------------------- #

    #export PARM="/abcdefgh/apps/xyz/config/"
    #export _GEDPARM="/abcdefgh/apps/xyz/config/config.mrn"
    FLOG=${SYSOUT}
    #PARAM=${PARM}

    # --------------------------------------------------------------------------- #
                                                     #
    # --------------------------------------------------------------------------- #
    f_GenDateFromDB()
    {         
                    
            echo "*-------------------------------------------------------*"
            echo "* Launch the map           *"
            echo "*-------------------------------------------------------*"
            echo $_GEDPARM
            #echo $PARAM
                    ${DTX_HOME_DIR}/bin/dtxcmdsv /abcdefgh/apps/xyz/map/DATE_MAP.mmc         
            CODE_RET=$?
            
            if [ $CODE_RET -ne 0 ]
            then
                    echo "Failed to execute DATE_MAP.mmc  - KO" > ${FLOG}
                    exit 1
            else
                    echo "Successful executution of DATE_MAP.mmc OK" > ${FLOG}
            fi
    }a

    # --------------------------------------------------------------------------- #
    # MAIN
    # --------------------------------------------------------------------------- #

    jobDebut
    f_GenDateFromDB 
    jobFin


    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 4.  Re: Execute map from Shell sript

    Posted Tue May 14, 2019 01:44 AM

    Originally posted by: PaulBrett


    Did you open and view the file?  In dtx.ini you will find:

    ; this defines what resource configuration file to use for the Command Server:                                    
    ;ResourceCfgFile=resource.mrc

    and

    ; this defines what resource configuration file to use for the Launcher:
    ;ResourceCfgFile=resource.mrc

    I recommend you set the location of your MRC file in both these places (and remove the semi colon to un-comment the lines).  Example:

    ; this defines what resource configuration file to use for the Command Server:                                    
    ResourceCfgFile=/opt/IBM/itx900/config/resource.mrc

    Thank you.

    Paul

    Follow me on Twitter


    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 5.  Re: Execute map from Shell sript

    Posted Tue May 14, 2019 04:44 AM

    Originally posted by: RT123


    Thank you so much Paul. It works perfectly. :)


    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 6.  Re: Execute map from Shell script

    Posted Fri May 24, 2019 05:15 AM

    Originally posted by: RT123


    Hi Paul,

     

    The shell script pasted above works, but it doest return the correct error code when it fails. I am trying to call a series of maps using shell. My Shell script will call the first map which will consequently call the second map. 

     

    Now if my second map fails i get the error on screen "Exit call failed". I want to fail the map, but the return code is 0 and hence the map completes successfully. Can you let me know how i can modify the below script to fail base don error code. 

     

    Thanks

     

    #!/bin/ksh
    ## --------------------------------------------------------------------------- #
    ##                                                   #
    ## --------------------------------------------------------------------------- #

    . /$MACHINE/apps/common/librairies_communes.ksh
    . /$MACHINE/apps/common/jobInitialize.ksh ${0} "$*"

    # --------------------------------------------------------------------------- #
    # VARIABLES
    # --------------------------------------------------------------------------- #

    #export PARM="/abcdefgh/apps/xyz/config/"
    #export _GEDPARM="/abcdefgh/apps/xyz/config/config.mrn"
    FLOG=${SYSOUT}
    #PARAM=${PARM}

    # --------------------------------------------------------------------------- #
                                                     #
    # --------------------------------------------------------------------------- #
    f_GenDateFromDB()
    {         
                    
            echo "*-------------------------------------------------------*"
            echo "* Launch the map           *"
            echo "*-------------------------------------------------------*"
            echo $_GEDPARM
            #echo $PARAM
                    ${DTX_HOME_DIR}/bin/dtxcmdsv /abcdefgh/apps/xyz/map/DATE_MAP.mmc         
            CODE_RET=$?
            
            if [ $CODE_RET -ne 0 ]
            then
                    echo "Failed to execute DATE_MAP.mmc  - KO" > ${FLOG}
                    exit 1
            else
                    echo "Successful executution of DATE_MAP.mmc OK" > ${FLOG}
            fi
    }a

    # --------------------------------------------------------------------------- #
    # MAIN
    # --------------------------------------------------------------------------- #

    jobDebut
    f_GenDateFromDB 
    jobFin


    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 7.  Re: Execute map from Shell script

    Posted Fri May 24, 2019 06:54 AM

    Originally posted by: PaulBrett


    You would need to force the first map to fail, by wrapping the call to the RUN() function in a VALI()/FAIL() pair.  Example

    =RUN("ChildMap.mmc",ECHOIN(1,Input1)+" -OE5")

    would change to 

    =VALID(RUN("ChildMap.mmc",ECHOIN(1,Input1)+" -OE5"),FAIL("Child map failed to run : "+LASTERRORMSG()))

    Only then would your script be able to detect that the call to the Command Server failed.

    Thank you.

    Paul

    Follow me on Twitter


    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 8.  Re: Execute map from Shell script

    Posted Mon May 27, 2019 04:14 AM

    Originally posted by: RT123


    Thank you Paul.

    Can you explain what OE5 includes here in the RUN command. What Input1 carries?

     


    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 9.  Re: Execute map from Shell script

    Posted Tue May 28, 2019 02:50 AM

    Originally posted by: RT123


    Hi Paul,

     

    I executed the above script and it always fails with error code 30. The error message being "Fail function aborted the map". The user defined error "Child map failed to run" isn't thrown back. Please suggest.

     

    Thanks


    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange