Thanks for reply and not sure I fully understand reply.
I use the print statements to display for troubleshooting and to have in normal/scheduled jobs.
You make a statement about 'They might impact the environment your restarting job meets.'
I believe this is my issue as they are impacting but cannot figure out why on a restart 'values' are retained from prior failure. Makes no sense from any batch perspective.
A restarted job should have RC/status flushed and be new.
Also to note I am trying to combine 2 jobs that used to run in a workflow that acted as a single job, the jobP has a 'trigger' job and a 'done' job that initiated a distributed script. The trigger job would launch and the done job would monitor for the update of a file that has completion/RC code. This was written by UC4 sometime ago as a solution when we converted.
I am trying to combine those 2 jobs into single job with tabs as below.
This works fine for triggering the external script, the issue is only for a restart and retaining the &STATUS code from first run.
!!! step005 !!!
!!! step010 !!!
copy empty.txt Script_Name.done
!!! step020 !!!
:set &date = sys_date("YYYY-MM-DD")
:set &time = sys_time("HH:MM:SS")
!!! step030 !!!
echo '&date &time Triggered' >> D:\Directory\Logs\Script_Name.trigger
Post Process Tab
:SET &FOUND = 'FALSE'
:WHILE &FOUND = 'FALSE'
: SET &HND#=PREP_PROCESS_FILE(WIN_AgentName,"D:\Directory\Logs\Script_Name.done","*return code*")
: PROCESS &HND#
: SET &LINE#=GET_PROCESS_LINE(&HND#)
: PRINT &LINE#
: SET &FOUND = 'TRUE'
: SET &CODE = STR_FIND(&LINE#,'code',1)
: SET &CODE = ADD(&CODE,7)
: SET &RET = STR_CUT(&LINE#,&CODE)
: PRINT 'RC=&ret'
: IF &RET <> '0'
: SET &END_STATUS = '100'
: RSET &STATUS# = &END_STATUS
: SET &END_STATUS = '0'
: CLOSE_PROCESS &HND#
: wait 1
! Modify status of job if not equal to 0 at exit.
:PRINT 'Status of job is &STATUS#'
:IF &STATUS# <> '0'
: MODIFY_STATE RETCODE=&STATUS#
Ok, I would focus on the postprocess.:RSET will retain the STATUS# value when the job is restarted. It's sufficient to use :SET here.This part:
:IF &STATUS# <> '0': MODIFY_STATE RETCODE=&STATUS#:ENDIFDoes not need any if-condition check. The result will be the same.:MODIFY_STATE RETCODE=&STATUS#If I interpret the script right, you add a line to the trigger-file that triggers an external process (which watches the file for changed content or updated modified-timestamp) and then you wait in the done-file for a "return code" string to appear. That seems all to be fine.Can you post a post process report of a restarted job that does not act the way you expect?Greetings to Idaho. Lovely state, been there some years ago.
:IF &STATUS# <> '0': MODIFY_STATE RETCODE=&STATUS#
I have to step away but will test this first thing, greatly appreciated.
Yes Idaho is nice...being overrun with people right now...changing a lot.
Where are you from?
And yes you understand the process exactly.
Thanks again for information, I have changed and tested successfully, very good.
But...I am confused, this is a section out of the book. What you have told me and I have tested successfully does not align with this...I am confused but not the first time the book has been incorrect.
Well...the behavior is odd but is what it is...
The :SET is working and again appreciate the information, I have been trying this every which away with no success.
The behavior without the :RSET is what I was after.
I hear you have some stellar skiing, resorts and good folks over there. A co-worker was over there last year...I have always wanted to do some skiing there.
Thanks again for clearing this up.