Mike Preece wrote:

On Apr 8, 3:45 am, Jim Idle <[email protected]> wrote:
  
Praveen wrote:
    
Hi Micev,
      
T24 programming standards refrains you from calling T24 API's outside
T24 environment. But still if you insist on calling T24 API's from
jsh, you can follow this(only if you wish)
you can initialize the Global COMMON variables and then invoke GLOBUS
API's. If you're working post T24 R07 release, replace the call to
GLOBUS.INITIALISE with T24.INITIALISE
*----------
SPFFile = 'F.SPF'
SPFFileHandler = ''
SPFFileID = 'SYSTEM'
SPFFileRec = ''
SPFReadErr = ''
CALL GLOBUS.INITIALISE
CALL OPF(SPFFile,SPFFileHandler)
CALL F.READ(SPFFile,SPFFileID,SPFFileRec,SPFFileHandler,SPFReadErr)
*---------
      
I hate to think of the performance overhead of calling asubroutine
every time you want to do a single READ :-(

Jim
    

I missed this earlier. Was it a serious concern - or a wind up? How
expensive is a subroutine call?
A subroutine is a C function call and as such is fairly inexpensive in and of itself. However, when a subroutine is called:

The system must initialize the call heap with any local (C level) variables (not too expensive if there are relatively few storage locations, which jBASE tries to minimize,
jBASE must initialize any local jBC variables to the value required for the emulation and allocate the storage in some cases such as when the default is ""
jBASE must tear down any jBC variables that were local to the subroutine.

If all variables used in the subroutine are COMMON, then the overhead is/can be greatly reduced. But if the subroutine is called a million times in a batch program, and if this is compounded with a subroutine call for everything, such as getting the next element from a list and so on, then the overhead of calling subroutines vs using the native language constructs is enormous in relative terms. Obviously, a READ statement goes pretty much straight to the runtime and while subroutines are call-by-reference (so at least you don't need to copy the READ buffer to return the value), a call to the runtime is always going to be better than a call to a subroutine.

On the upside, calling subroutines in jBASE is much less of an overhead than it is in say UniVerse, so overall programs using this behavior will be lots better under jBASE.

Also, we should remember that some of the reasons for calling T24 subroutines are to do with security and best practices as well as providing more of an API than just reading a file (at least I believe so for most things), so the overhead involved may be somewhat necessary.

Jim

--~--~---------~--~----~------------~-------~--~----~
Please read the posting guidelines at: http://groups.google.com/group/jBASE/web/Posting%20Guidelines

IMPORTANT: Type T24: at the start of the subject line for questions specific to Globus/T24

To post, send email to [email protected]
To unsubscribe, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to