MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Passing control to an external routine in REXX

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
jim haire
Beginner


Joined: 30 Dec 2002
Posts: 140
Topics: 40

PostPosted: Thu Jun 02, 2011 9:44 am    Post subject: Passing control to an external routine in REXX Reply with quote

I am posting this finding that I came upon the other day in the hope that it will help other developers. I invite the moderator or other experts to reply.

I have written a lot of REXX subroutines in order to re-use code that is common in different programs. Most of the programs I have written are not compiled.

I was running a program I had written to add a column of numbers, about 20000 records total. I found that if I was adding the numbers and didn't call a certain subroutine, the REXX program returned the results in about a second. However, if I called the subroutine, the program would take over a minute to add a similar number of records.

Using the time elapsed function, TIME("E"), I found that calling an external subroutine, even if no logic was being executed took about .02 seconds to execute. (I coded the subroutine to EXIT immediately after being called).

While .02 seconds doesn't seem like a lot of time, when you are executing the same command against 20000 records, it really adds up. I took the logic out of the subroutine and moved it into the main program, re-ran, and it took about a second to add the numbers.

My advice would be not to code commonly executed subroutines to be called from a main program, but to always put all your code in the main program. (I don't know if the same holds true for REXX programs which are compiled.)

REXX experts, care to discuss?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12370
Topics: 75
Location: San Jose

PostPosted: Thu Jun 02, 2011 11:00 am    Post subject: Reply with quote

jim haire,


The poor performance of using subroutines is attributed to the search order of the subroutines. Internal labels take first precedence, then built-in functions, and finally external functions/subroutines. Interpreted REXX execs are not an ideal candidates for high volume processing.

You might want to read this

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IKJ4A390/12.3

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group