Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Suggestions to improve code

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Huzefa

New User


Joined: 05 Dec 2006
Posts: 85
Location: Bangalore

PostPosted: Tue Nov 24, 2009 3:00 pm    Post subject: Suggestions to improve code
Reply with quote

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
View user's profile Send private message

ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Tue Nov 24, 2009 5:47 pm    Post subject:
Reply with quote

Try to add the NOMODIFY option.

O.
Back to top
View user's profile Send private message
Huzefa

New User


Joined: 05 Dec 2006
Posts: 85
Location: Bangalore

PostPosted: Tue Nov 24, 2009 7:04 pm    Post subject:
Reply with quote

i really appreciate that.
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2038
Location: Silicon Valley

PostPosted: Tue Nov 24, 2009 9:18 pm    Post subject: Reply to: Suggestions to improve code
Reply with quote

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
View user's profile Send private message
Huzefa

New User


Joined: 05 Dec 2006
Posts: 85
Location: Bangalore

PostPosted: Wed Nov 25, 2009 12:23 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Huzefa

New User


Joined: 05 Dec 2006
Posts: 85
Location: Bangalore

PostPosted: Wed Nov 25, 2009 1:07 pm    Post subject:
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed Nov 25, 2009 1:15 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Huzefa

New User


Joined: 05 Dec 2006
Posts: 85
Location: Bangalore

PostPosted: Wed Nov 25, 2009 6:05 pm    Post subject:
Reply with quote

Thanks for suggestion. If we get to put this job in production, will definitely put forward this idea.
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2038
Location: Silicon Valley

PostPosted: Wed Nov 25, 2009 10:30 pm    Post subject: Reply to: Suggestions to improve code
Reply with quote

Code:
CALL SYSCALLS ON
ADDRESS SYSCALL
"SLEEP" 900
CALL SYSCALLS OFF


Again, do your setup and cleanup outside of the loop.
Back to top
View user's profile Send private message
Huzefa

New User


Joined: 05 Dec 2006
Posts: 85
Location: Bangalore

PostPosted: Thu Nov 26, 2009 10:36 am    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Nov 26, 2009 10:44 am    Post subject:
Reply with quote

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
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2038
Location: Silicon Valley

PostPosted: Thu Nov 26, 2009 9:05 pm    Post subject: Reply to: Suggestions to improve code
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Job failing with USER = 4093 REASON C... Pradeepa S ABENDS & Debugging 1 Wed May 17, 2017 3:35 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts IMS region inactive - User abend code... gthmrj IMS DB/DC 5 Tue Mar 07, 2017 12:29 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us