How to get exit code in CDM

Categories: Scripts; Tagged with: ; @ January 14th, 2013 15:18

Requirement:

Need to catch the exit code, handle the Error based on the exit code.

Solution:

Use %ErrorLevel% – Almost all applications will set an exit code when complete (by conversion, 0 means successful).

 

Example 1:
copy file1.txt file3.txt
ECHO ...%ErrorLevel%

copy fileNotExisting.txt f.txt
ECHO %ErrorLevel%

Output:

“1 file(s) copied”
0

“The system cannot find the file specified.”
1

 

Example 2:

SET SSIS_EXIT_CODE=%ErrorLevel%
copy "%PKG_PATH%\Logs\….dtsx.log" ..
IF %SSIS_EXIT_CODE% NEQ 0 (
    EXIT /B %SSIS_EXIT_CODE%
)

 

Links:

http://ss64.com/nt/errorlevel.html
http://ss64.com/nt/exit.html

How to check the exit code of the last command in batch file?

AutoSys Job multiple dependencies issue: s(1) & s(2) & s(3) job triggered multiple time

Categories: Development Notes; Tagged with: ; @ January 4th, 2013 19:15

Problem:

I got 4 jobs: 1, 2, 3, 4.

2’s condition: s(1); 3’s condition: s(2); 4’s condition: s(1) & s(2) & s(3)

all these jobs are daily jobs

the first day is ok. the second day, the 4th job triggered mutilple times:

I think when 1 success, because the status of 2 and 3 are still ‘success'(the last days status), so the job 4 triggered,

then 2 success, 4 triggered again…

but I only want these jobs run in the same period.

Solution:

1. the first solution I can found is using ‘Look-Back Dependencies’:

Example: Define Starting Conditions Based on Job Success in a Given Duration
This example (specified in the job definition for JobA) runs JobA if JobB has completed successfully in the last 12 hours:
condition: success(JobB,12)
Example: Define Starting Conditions Based on the Status of Multiple Jobs in a Given Duration
This example (specified in the job definition of JobA) runs JobA if JobB has failed in the last 30 minutes and JobC has completed successfully on external instance XYZ in the last 90 minutes:
condition: failure(JobA,00.30) AND success(JobC^XYZ,01.30)

This should can work, but I based on my test, seems still cannot fix my issue.

http://stackoverflow.com/questions/10825544/autosys-r11-job-dependency-with-dependent-job-run-time-condition

2.  Using Box.

Put all these jobs in one Box, and when the Box is triggered, all the jobs’s status  in this box will be reset. 

AutoSys can get the failure in Java application

Categories: Java; Tagged with: ; @ January 4th, 2013 19:07

Problem:  Java application invoke SSIS package using ‘Process’, when the package failed, Auto-sys treat as success.

Solution: When ‘Process’ exit with a non-zero status code:

System.exit(10); // by convention, a nonzero status code indicates abnormal termination.

(Actually, we can config this status in Auto-Sys)

http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/System.html#exit(int)

 

Auto-sys Reference Guide:

http://totalcomputerps.com/mdpilarf/UAJM_Ref_ENU.pdf



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.