Automic Workload Automation

 View Only
  • 1.  Strange behavior (or bug?) when running uc script in a task within a workflow

    Posted Oct 10, 2019 03:11 AM
    Hello, I have found very strange behavior (possibly a bug?) when running a process within a task in a workflow.

    Scenario:

    Job 1 - transferring a file(s) from A to B
    Job 2 - listing files in B through pre-process and sending the files over through SFTP

    Job 1 transfers files from as/400 to linux using filetransfer job. Assuming that the files are already in B, when job ENDED_OK
    Job 2 lists files in B and sends a report to the customer with the list of files, then passes the files to SFTP

    When the (1) ended OK, the files are already in the B location. However, when i pre-process following script in job 2, it reports that there are no files and variable COUNT1=0, even the files are present.

    Pre-process:

    ! set variables

    :set &NL# = UC_CRLF()

    ! get the filenames

    :SET &HND# = PREP_PROCESS("HOST_B", "UNIXCMD", , "CMD=ls -1 /tmp/test/*.csv | wc -l", "UC_LOGIN=LOGIN")
    :PROCESS &HND#
    : SET &COUNT1# = GET_PROCESS_LINE(&HND#)
    : PRINT &COUNT1#
    : IF &COUNT1# = "0"
    : SET &OUTPUT1# = "...No files..."
    : SET &NEWLINE1# = "...No files..."
    : ELSE
    : SET &HND1# = PREP_PROCESS("HOST_B", "UNIXCMD", , "CMD=ls /tmp/test/ | grep csv", "UC_LOGIN=LOGIN")
    : PROCESS &HND1#
    : SET &OUTPUT1# = GET_PROCESS_LINE(&HND1#)
    : SET &NEWLINE1# = "&NEWLINE1#&NL#&OUTPUT1#"
    : ENDPROCESS
    : CLOSE_PROCESS &HND1#
    : ENDIF
    :ENDPROCESS
    :CLOSE_PROCESS &HND#


    ! send email with above list

    :SET &FINAL_MAIL# = SEND_MAIL("email@domain.com", , "Files", "List of files:&NL#&NEWLINE1#", , ,)​


    My question is: Why the COUNT1 variable is 0 even the files are already in place? Does it mean, that the script is somehow ran in advance, before the files lands in B location?

    If I run the script in an additional workflow after the first workflow (only transferring the files is completed) it works as it should.

    Do you have any similar experience? How to prevent this kind of strange behavior?

    Thanks a lot for your help!


  • 2.  RE: Strange behavior (or bug?) when running uc script in a task within a workflow
    Best Answer

    Posted Oct 10, 2019 03:48 AM
    Hi,
    If the second job is not 'Generate at runtime', yes, the script part is executed when the workflow is activated.

    You can prevent this by activating 'Generate at Runtime' in the Attributes Tab.

    ------------------------------
    Best regards,
    Thierry

    Banque de Luxembourg
    ------------------------------



  • 3.  RE: Strange behavior (or bug?) when running uc script in a task within a workflow

    Posted Oct 10, 2019 03:53 AM
    wooow, so easy :) thanks a lot for your help!