Forums >> Programming >> RPG Programming >>
Service Program Binder Language Part 1 - Exporting Procedures




Posted:
bvstone

Service Program Binder Language Part 1 - Exporting Procedures

 
Service Program Binder Language Part 1 - Exporting Procedures

In the previous article we saw how to create a service program from a module.  In this example we told the system to simply export all of the available procedures in the module.

In this article we will see how instead of using EXPORT(*ALL) we will use Binder Language to tell the system which procedures to export.  

If you recall in the beginning we created a source physical file named QSRVSRC.  This is where we are going to store our Binder Language.  We like to name the Binder Language member the same as the source module.  So in this case, it will be named F.MATH and look like the following:

             STRPGMEXP                              
             EXPORT     SYMBOL(#math_getSumInt)     
             ENDPGMEXP                              

We will see that we have source that starts with STRPGMEXP (Start Program Export List) and ends in ENDPGMEXP (End Program Export List).  Between these two keywords we will place the names of any procedures we wish to export from our module to be available for use in our newly created service program.

There can be more than one grouping of exported procedures for a service program between the STRPGMEXP and ENDPGMEXP keywords with different procedures being exported.  Each grouping will (or should) have it's own unique Signature.  This will be covered later, but just be aware that each Binder Language source member can contain from one to many different export groupings.

To create our service program we will use the following command:

CRTSRVPGM SRVPGM(ILESAMPLE/F.MATH) MODULE(ILESAMPLE/F.MATH) EXPORT(*SRCFILE) SRCFILE(ILESAMPLE/QSRVSRC) SRCMBR(*SRVPGM)

Take notice that instead of EXPORT(*ALL) we are not using EXPORT(*SRCFILE).  This value is most likely the default on your system and it should be.  It is in this example only so we see the difference between the above and the previous method of creating a service program.

The defaults for SRCFILE and SRCMBR also default nicely so that if we place our binder language in QSRVSRC and name it the same as the module source, we really only need to specify the following shorter command and take advantage of the system defaults:

CRTSRVPGM SRVPGM(ILESAMPLE/F.MATH) MODULE(ILESAMPLE/F.MATH)

Next we will take a look at what Service Program Signatures are and how they can be your friend, or your worst enemy.

 


Last edited 04/07/2015 at 14:11:03


Reply




Copyright 1983-2017 BVSTools
GreenBoard(v3) Powered by the eRPG SDK, MAILTOOL Plus!, GreenTools for Google Apps, jQuery, jQuery UI, BlockUI, CKEditor and running on the IBM i (AKA AS/400, iSeries, System i).