Navigation:  Reference > Functions >

LoadProgram()

Print this Topic Previous pageReturn to chapter overviewNext page

 

LOAD_PRG(1)

 

PURPOSE

This function will load an existing program into memory so that it can be called as though it were a DLL, or a series of subroutines that aren't attached to any single one program.

 

PARTS

 

1 f/c/eRequired - The name of the program to load, must include complete path

 

RETURN TYPE - R

Returns a numeric value that refers to the program loaded.  Whenever you want to call a routine in that program you will need this value.

 

NOTE:  If the program cannot be found, or is not loaded for some reason, this will be 0.

 

COMMENTS

We call these routines TLLs or TAS Loadable Libraries.  Once you have loaded one of these TLLs you can call it from any program run in that instance of the TAS Professional runtime.  The TLL will remain in memory until it is removed (REMOVE_PRG()) or until the instance of the runtime exits.  This will allow you to create a single program that contains some or all of the central subroutines for your application and access them from your other programs as though they were a part of that program.  For example, say you have a subroutine that makes sure a field has certain characters in it and you would use this in many programs.  Typically, you would include this routine in each program by either putting that routine into the appropriate programs, or including it in a library that would be compiled into the program.  By using a TLL you no longer have to do that.  Just load the program into memory and you can call the routine anywhere, from any program.  There's a little more overhead and you may have to pass some extra variables, but the efficiency is significantly enhanced.  Even more important, you can make changes to this TLL and never have to recompile the programs that call it, as long as you haven't changed the interface between the calling programs and the subroutine.  So, say you find a bug, or add a new feature to a subroutine.  If it's a TLL, and you have users already running your application, all you have to do is send out the new TLL program.  The next time they run your application, and the TLL is loaded, they will have the changes made to their program.  Even more important, if you have customers that have modifications made to their applications, maybe you can put those modifications into a TLL.  Then, when the next upgrade is available, all you have to do is copy the TLL back and the modifications are automatically there!

 

Use CALL_PRG() to access a subroutine in a previously loaded TLL. REMOVE_PRG() will delete the TLL from memory and IS_PRG_LOADED() will let you know if the TLL is already running.

 

We make extensive use of this feature in Advanced Accounting.

 

NOTE:  You can load programs that have forms/screens in them also.  If they don't you must use the ForceRWN compiler directive to make sure this is a RWN program.

 

NOTE:  All TLLs are automatically removed from memory when the runtime exits.

 

NOTE:  If there is a START label in the program you are loading, it will be called just like running a standard program.

 

 

 


Page url: http://www.cassoftware.com/tas/manual/loadprogram().htm