View previous topic :: View next topic
|
Author |
Message |
Huzefa
New User
Joined: 05 Dec 2006 Posts: 83 Location: Bangalore
|
|
|
|
I developed a REXX code to notify team when there are more than 200 jobs running in Queue or when a job takes CPU time more than 20.
Any suggestions to improve this code will be of use.
Code: |
Do Forever
RC=ISFCALLS("ON")
ISFPREFIX='USERID*'
ADDRESS SDSF "ISFEXEC ST"
IF ISFROWS > 200 THEN CALL NOTIFY_TEAM
ISFCOLS="JNAME JOBID CPU "
ADDRESS SDSF "ISFEXEC DA"
COLDTL=WORD(ISFCOLS,1)
DO IX=1 TO ISFROWS
DO JX=1 TO WORDS(ISFCOLS)
COL=WORD(ISFCOLS,JX)
END
IF CPU.IX > 20 THEN CALL NOTIFY_TEAM
END
RC=ISFCALLS("OFF")
End
NOTIFY_TEAM:
this procedure will prepare a job to send email to team.
|
|
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
Try to add the NOMODIFY option.
O. |
|
Back to top |
|
|
Huzefa
New User
Joined: 05 Dec 2006 Posts: 83 Location: Bangalore
|
|
|
|
i really appreciate that. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2594 Location: Silicon Valley
|
|
|
|
Have you tried to run it?
1. I think you need a SLEEP statement within your loop. Otherwise, it will run continuously with no waiting. That is, the loop will execute 1000s of times each second. If you ever get more than 200 jobs, it will generate many, many messages before the team can respond. Your program may turn into a denial of service attack on yourself because a flood of messages will prevent you from doing any work (do not try this at home).
<update>I think you should wait several minutes before each iteration.
2. You have some setup statements that can be done before FOREVER statement. Likewise, you have some cleanup that can be done after the last END.
3. It is not clear why you need this:
Code: |
DO JX=1 TO WORDS(ISFCOLS)
COL=WORD(ISFCOLS,JX)
END |
|
|
Back to top |
|
|
Huzefa
New User
Joined: 05 Dec 2006 Posts: 83 Location: Bangalore
|
|
|
|
Hi,
Thanks a lot for your response.
My bad, did not try testing with DO FOREVER LOOP.
1. Wil chk SLEEP statement.
2. ok.
3. Good Catch.I was trying to get individual columns from sdsf and forgot to remove it. |
|
Back to top |
|
|
Huzefa
New User
Joined: 05 Dec 2006 Posts: 83 Location: Bangalore
|
|
|
|
How does this look?
RC=ISFCALLS("ON")
ISFPREFIX='USERID*'
ISFCOLS="JNAME JOBID CPU "
Do Forever
ADDRESS SDSF "ISFEXEC ST (NOMODIFY"
IF ISFROWS > 200 THEN CALL NOTIFY_TEAM
ADDRESS SDSF "ISFEXEC DA (NOMODIFY"
DO IX=1 TO ISFROWS
IF CPU.IX > 20 THEN CALL NOTIFY_TEAM
END
CALL SYSCALLS ON
ADDRESS SYSCALL
"SLEEP" 900
CALL SYSCALLS OFF
End
RC=ISFCALLS("OFF") |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Would it not be better to submit the job every 10-15 minutes rather than hog an initiator all of the time, thus preventing anyone else using that initiator. |
|
Back to top |
|
|
Huzefa
New User
Joined: 05 Dec 2006 Posts: 83 Location: Bangalore
|
|
|
|
Thanks for suggestion. If we get to put this job in production, will definitely put forward this idea. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2594 Location: Silicon Valley
|
|
|
|
Code: |
CALL SYSCALLS ON
ADDRESS SYSCALL
"SLEEP" 900
CALL SYSCALLS OFF |
Again, do your setup and cleanup outside of the loop. |
|
Back to top |
|
|
Huzefa
New User
Joined: 05 Dec 2006 Posts: 83 Location: Bangalore
|
|
|
|
I have the sleep statement inside "Do forever" so the pgm dose not chk sdsf unnecessarily. I want the pgm to chk sdsf once in 15 mins. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
You need to implement as Expat has suggested. . .
What you have now is unacceptable on every well-managed system i've ever seen. What you have is another of the things that can be done, but should not be done. All this method does is waste resources pretty much forever. . .
Taking an initiator permanently out-of-service is not acceptable. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2594 Location: Silicon Valley
|
|
|
|
Your rexx program seems to be a poor man's system health checker. If this is part of your site's system management plan, you should be able to start the rexx program as a started task. Or if there is a shortage of initiators, then define another for this purpose. |
|
Back to top |
|
|
|