ESP Workload Automation

  • 1.  VAR from ESP-->REXX--> ESP

    Posted Sep 24, 2012 09:29 AM
    We have a Generic file trigger.
    We want to capture the filename (without the directory) in a variable, to pass into another wob.

    We can’t get the variable ‘ftrig’ to resolve correctly…
    Pretty sure it is getting set correctly in the REXX, but not sure what we are doing wrong to move a variable between ESP REXX  ESP

    So if the file that causes the trigger is:
    /home/cindy05/ftp_fileA.txt

    In the cpy2xiq WOB, we would want ARGS to look like:
    ARGS /home/cindy05/ftp_fileA.txt /home/cindy05/backup/ftp_fileA.txt.complete




    FILE_TRIGGER TEST_CREATE
    AGENT inbtlsap17
    FILENAME '/home/cindy05/ftp_file*.txt' CREATE
    RUN NOW
    RELEASE REXXSET
    ENDJOB

    JOB REXXSET LINK PROCESS
    REXXON PROC
    xftrig = CLANGVAR('%ESPFTFILE')
    xftrig = TRANSLATE(xftrig,' ','/')
    wds = WORDS(xftrig)
    xftrig = WORD(xftrig,wds)
    "ftrig='"xftrig"'" /*allows ftrig to be used outside of rexx*/
    REXXOFF
    RELEASE (cpy2xiq)
    ENDJOB

    UNIX_JOB cpy2xiq
    AGENT inbtlsap17
    CMDNAME /bin/mv
    ARGS %ESPFTFILE /home/cindy05/backup/%ftrig..complete
    user cindy05
    RUN NOW
    ENDJOB


    Any suggestions would be great. I’m sure it is something simple we have overlooked.
    Thanks
    Sal


  • 2.  RE: VAR from ESP-->REXX--> ESP

    Posted Sep 24, 2012 12:05 PM
    I created a PROC similar to yours and it also did not set the value for FTRIG.

    I upated the PROC listed below, with the following changes.
    - FILETRIG is a symbolic
    - REXX code moved after the FILETRIF symbolic and before APPL statement

    [font=Courier New]PROCEDURE_SECTION:

    FILETRIG="/home/cindy05/ftp_fileA.txt"

    REXXON
    XFTRIG = CLANGVAR('%FILETRIG')
    XFTRIG = TRANSLATE(XFTRIG,' ','/')
    WDS = WORDS(XFTRIG)
    XFTRIG = WORD(XFTRIG,WDS)
    "FTRIG='"XFTRIG"'"
    REXXOFF

    APPL FILTRGCA WAIT

    JOB SENDMSG TASK SELFCOMPLETING
    SEND '>>>FTRIG:%FTRIG' U(*)
    RUN ANYDAY
    ENDJOB .[font]


  • 3.  RE: VAR from ESP-->REXX--> ESP

    Posted Sep 24, 2012 01:01 PM
    Rick

    FILENAME '/home/cindy05/ftp_file*.txt' CREATE - This uses an '*' because we never know what the complete jobname will be until it gets created. We need that filename in the var, so it has to be part of a WOB, not outside.
    In your example, FILETRIG is a hardcoded value.
    Trying to get the filename that satisfies the file trigger, so it can be used as an argument in another wob.

    Sal


  • 4.  RE: VAR from ESP-->REXX--> ESP
    Best Answer

    Posted Sep 25, 2012 09:54 AM
    I created 2 PROCS, PROC1 is a FILE_TRIGGER using CONTINOUS that triggers PROC2. PROC1 path is changed to a valid path for my environment.

    PROC2 is similar to yours. I upated the PROC2 listed below, with the following changes.
    - FILETRIG is a set to the symbolic ESPFTFLE
    - REXX code moved after the FILETRIG symbolic and before APPL statement.

    I have tested this in my environment and it seems to do what you need.

    I belive the REXX logic must be at the top of the proc to be able to set the variable for use in the WOB below.

    PROC1

    [font=Courier New]PROCEDURE_SECTION:

    PATH="/home/compops/filetrig/"
    FILEMASK="ftp_file*.txt"

    APPL FILTRGC WAIT

    FILE_TRIGGER FILTRGC
    AGENT LJ_GALPORA0259
    FILENAME '%PATH%FILEMASK' CREATE CONTINUOUS(SCHTESP.FILTRGCA)
    RUN DAILY
    ENDJOB [font]


    PROC2

    [font=Courier New]PROCEDURE_SECTION:

    FILETRIG="%ESPFTFILE" "

    REXXON
    XFTRIG = CLANGVAR('%FILETRIG')
    XFTRIG = TRANSLATE(XFTRIG,' ','/')
    WDS = WORDS(XFTRIG)
    XFTRIG = WORD(XFTRIG,WDS)
    "FTRIG='"XFTRIG"'"
    REXXOFF

    APPL FILTRGCA WAIT

    JOB SENDMSG TASK SELFCOMPLETING



    SEND '>>>FTRIG:%FTRIG' U(*)
    RUN ANYDAY
    ENDJOB [font]


  • 5.  RE: VAR from ESP-->REXX--> ESP

    Posted Sep 25, 2012 10:38 AM
    Could you use this in the second WOB and in args put !file. instead of REXX?

    integer x
    x = length(!espftfile)
    file = '!espftfile(53:!x)'


  • 6.  RE: VAR from ESP-->REXX--> ESP

    Posted Sep 26, 2012 12:59 PM
    Thanks for the examples and suggestions. I passed this to my colleague and she got it working.
    Appreciate the help!
    Sal