We are moving certain AutoSys command jobs from UNIX to Windows. "Sleep" and "exit" are fairly elementary; adjusting stdout/stderr are the typical hurdles to be crossed.
There are more complex commands that users have created that depend on UNIX shell command syntax. We could put Cygwin or other work-alikes on Windows, but I'd prefer to "go native" so future maintenance is more controlled.
Here is one example:
autorep -J JOBNAME | grep " FA "
As a start, I thought to replace autorep with autostatus as more appropriate to the task at hand. It would be nice if it returned an exit code that corresponded to the internal intcode, but that's an idea for another day. Normally, autostatus would do this:
E:\tmp>autostatus -j GOODJOB
SUCCESS
E:\tmp>autostatus -j BADJOB
FAILURE
Capturing those string values with switch logic is left as an exercise for the student. My question, though, is on defensive programming such that deleting the target job will produce a replicable result.
E:\tmp>autostatus -j NOSUCHJOB
CAUAJM_E_50004 Invalid job/box name: NOSUCHJOB
The first 2 commands return DOS %errorlevel% as 0, while the last command returns a 1.
E:\tmp>echo %errorlevel%
1
However, a global variable quest returns a 0 status no matter what?
E:\tmp>autostatus -G JIM
UPGRADED
E:\tmp>echo %errorlevel%
0
E:\tmp>autostatus -G JIMI
CAUAJM_E_50005 Invalid Global Variable Name: JIMI
E:\tmp>echo %errorlevel%
0
Shouldn't both commands fail with the same status (1) on undefined values? (UNIX command line autostatus behaves the same as Windows command).