I would like to build a job that polls a mailbox for one of several emails with attachments (don't ask me why the business won't fork out for the web service, but there we are). The emails can appear in arbitrary order, and the process will poll the mailbox, download the attachments it finds, and then return a status code that contains a bit mask of status bits based on which files were encountered.
I want the autosys batch to then kick off a processing job for each file, depending on whether the relevant bit in the status result was set. A fallback position for a small number of jobs is that we check for each unique combination of bits and kick off the appropriate jobs that correspond to the number returned. However, beyond 2-3 status bits this will start to get unwieldy.
Is it possible for Autosys to look at specific bits in a return value in some manner - equivalent to:
- If bit 0 is set (result & 0x01 = 0x01) then run Job A
- If bit 1 is set (result & 0x02 = 0x02) then run Job B
- If bit 2 is set (result & 0x04 = 0x04) then run Job C
... and so on?
It sounds like you're looking to implement some sort of flow control. Please bear in mind that Autosys doesn't know anything about your emails or custom code or whatnot. It makes decisions based on preconditions and job flow.
In your case, I would do something like this where I have box MAIL_BATCH. Inside, there's a command MAIL_CHECK which goes and does your polling and whatnot, then returns an exit code of (0,1,2,3). So, 0-2 are your conditions for either Job A,B,C and 3 is your error condition. Next you have your MAIL_JOB_A, MAIL_JOB_B, MAIL_JOB_C commands and you base your execution decision on the return code from before. So MAIL_JOB_A has the precondition S(MAIL_JOB_CHECK) AND E(MAIL_JOB_CHECK)=0. The next job would check that E(MAIL_JOB_CHECK)=1 etc.