lsatenstein
4th November 2005, 01:36
Can you show your code to retrieve the Unix job name for use in a Baan 4c4 session.

We have Baan jobs that run often, and are critical. We want to send a message from the script when a problem is detected. We do not want to wait for a postmortem.

That problem would result in a page being sent to several employes on duty.

I will post my solution a little later on, but I was wondering if there was an elegant solution that is better than mine.

Han Brinkman
4th November 2005, 14:31
The startjob script on my windhoze box contains:

start f:\baan5c\bin\bw.exe f:\baan5c\lib\user\job800.bwc -- -set BSH_JOB=%1 -set BSH_JOBOK="%2" -set BSH_FRSES="%3" ttaad5203m000

I expect that the environment variable BSH_JOB does contain the name of the job, probably is not much different on *nix.

Regards,
Han

lsatenstein
4th November 2005, 20:14
Yes,
I have the following code snippet:
In the before.program.... and the after.program:

What I will do is set an application lock with a !! as the first two characters followed by the job name. I am not using the application lock as a lock, but as a flag.

From another source, I will query the application lock, at certain times and verify that the session has completed without blowing up. (If it blows up, the after.program event would not have cleared the application lock flag.




before.program:
jobflag(1)

after.program:
jobflag(0)



function jobflag(domain tcmcs.long option) |Sn.
{
|*****************************************************************************
|** ... 05/10/29 07:17 ******************************************************
|***DESCRIPTION **************************************************************
|* job.flag: Used to ...
|* set,clear application lock
|*****************************************************************************
static string lockstr(32) |as per baan docs. It is a string of 32
static domain tcmcs.str6 jobname |
long ret.val | code de retour

if option = 1 then
if job.process then
jobname = getenv$("BSH_JOB")
lockstr="!!" & jobname
ret.val = appl.set(lockstr,APPL.WRITE)
if ret.val <> 0 then
if ret.val = -1 then
message("application-wide lock present")
endif
if ret.val = -3 then
message("internal error")
endif
if ret.val > 0 then
message("application lock already present" & str$(ret.val))
endif
endif
endif

else
ret.val =appl.delete(lockstr) |n.1038
endif

} | end function jobflag()

dnnslbrwn
7th November 2005, 22:22
Les,

I have one job that I have been burned on many times when it does not run hourly. In the rc.startjob script delivered by BAAN, there is the option to add a second parameter where an error/status file is written out. The only change I make to the delivered script is to remove the "&" at the end of the ba6.1 call so that it does not get processed in the backgroud.

The UNIX shell script that calls this job is as follows:

#${BSE}/scripts/rc.startjob SALES |Now called with 2nd parameter
${BSE}/scripts/rc.startjob SALES ${BSE}/tmp/350_SALES_$$

if [ `grep -c "jsta:OK" ${BSE}/tmp/350_SALES_$$` -eq 0 ]
then
mailx -s "350 SALES job DID NOT RUN" \
dennisb@xxxxxxxxx.com \
< ${BSE}/tmp/350_SALES_$$
#else |Echo for testing purposes only
# echo "Ran!"
fi

rm ${BSE}/tmp/350_SALES_$$ 2>/dev/null


Hope this helps.

Cheers,

-Dennis

yerramsetti
18th April 2008, 15:36
I am new to LN6.1. If any one knows how to run jobs
on this plz help me.And send me the docs or links related to it.

Thanks in Advance:)
yerramsetti