Vous êtes sur la page 1sur 3

What is a Service Program? An ILE Service Program in CA 2E / Synon is similar to a regular program.

Before we look at what a Service Program is like in CA 2E / Synon we must learn what a Service Program is on the IBMi. It is an executable object on the IBMi. The Service program contains procedures that you can run, with some exceptions. A Service Program has many points of entry, that is one entry point for each sub proceedure. You cannot call a Service Program from the command line, it must be called from code in another program. A Service Program cannot be called with a Call command. It must be called the s ame way you call another sub procedure. Service Program calls are much faster then calling external programs using a call statement. Can be considered a container for one or more modules. CA 2E Service Program Design A Service program is the function type *SRVPGM . You can work with a Service Progra m in 2E in the same way you work with other function types. However, a Service Program has no parameters and no action diagram. Instead, it has a source memb er associated with it, just like a user function. Once the Service Program is created, the developer is able to attached modules t o the services program. CA 2E / Synon has a series of screens that are used to attach modules. Finally, a developer can generate the Service Program like any other function. When this occurs, the source member is created with includes both the export lis t as well as the necessary preprocessor directives needed for proper implementat ion of the Service Program. CA 2E Service Program Overview An external function can be given the attribute of MOD instead of PGM. MOD functions are automatically added to the 2E model binding directory. The default compile command for ILE uses the default 2E binding directory. Call to the MOD function are generated as call bound instead of call commands. Service Program Compile When you compile a Service program in 2E the program is generated in QSRVSRC of the generation library. This source member contains both the export list associ ated with the *SRVPGM object, as well as several compile preprocessor directives which will be used by the CA 2E / Synon Toolkit to actually create the *SRVPGM object. The actual CRTSRVPGM command, specifying the bound modules and also specifying t he same source member as the export list definition member. the ADDBNDDIRE command, can be used to add the*SRVPGM object to the YBNDDIR bind ing directory. Multiple RMVBNDDIRE commands (one for each 2E module bound into the Service P), to remove that module from the YBNDDIR binding directory. When you compile a Service Program function using the YSBMMDLCRT command, the 2E model generation/compile processing executes the YEXCOVR command against the so urce member. This command invokes the Toolkit compile preprocessor, which proces ses the compile directives in the source member. (This information is taken from the 2E manual: Building Applications ) Synon/CA 2E ILE in 2E Introduction June 18, 2012 Mark No comments ILE programming has been around a while but many CA 2E / Synon shops still have not converted over to generating ILE RPG or ILE COBOL. I would like to give a sh ort overview of ILE and then go into how to generate and work with ILE programs

within CA 2E / Synon. What is ILE? The Integrated Language Environment on the IBM i is an environment for creating programs that bind modules of code into one program. Code can be written in ILE versions of C, CL, RPG or COBOL on the IBM i. Since code is reused you can end u p writing programs with less code, less time and more efficiently. Structure of an ILE Program An ILE program contains one or more modules. A module contains one or more proce dures. Basic ILE Terminology 1. Activation This is the process of getting the final ILE program ready to run. It consists o f allocating the static data needed for running the program and sets physical ad dress links to service programs. 2. Binding Binding the process of connecting all the items needed for an ILE program to run . 3. Binding Directory A binding directory is a way to identify in sort of a list y to bind into an ILE program. the components necessar

4. ILE Program An ILE Program is the combination of modules and other necessary objects that ma ke up a functional program. 5. Module / Module Object A module is code that cannot run by alone. Modules must be combined into a progr am in order to be run. 6. Procedure A procedure is a set of statements in one of the ILE languages that performs a s pecific function. Once it is finished with its task it returns to the code that called it. 7. Service Program A service program is a collection of procedures that can be run by other service programs or ILE programs. They are building blocks to the ILE similar to how su broutines are used in RPG or COBOL. How does CA 2E /Synon handle ILE? 1. Define ILE components CA 2E / Synon lets you identify which external functions are programs and which programs are modules. When on the Edit Functions Screen Details screen there is an option to toggle the compilation type, T. This option will toggle between com pilation as an ILE Program or an ILE Module. In order for this function to work you do need to be targeting either RP4 (RBG ILE) or CBI (COBOL ILE). You might a lso need to use the O for compiler overrides to for the binding directory. Your environment will already be set up with a default binding directory. 2. Include components In order to utilize the benefits of ILE in CA 2E / Synon be sure to follow the m odel of having the Program consist of several reusable functions. This is simple in 2E as you just need to define the functions correctly and then they will cor rectly be reused in your ILE programs when they are bound together. 3. Generating ILE Source

There is no difference in the actual process of generating source. It is normall y best to generate code with a J. If you generally generate code with a G you ca n continue with that method as well. 4. Introduction to Service Programs in CA 2E / Synon CA 2E includes a function type of service program (*SRVPGM). Just like in native ILE, a service program refers to one or more functions that are defined as modu les. When used correctly service programs can improve performance. In order to modules simply select M from Edit Function Details and then add exis ting modules to the service program. Conclusion This short introduction should get you started with ILE in CA 2E / Synon. Keep w atching this blog and there will be more discussions about ILE in 2E.

Vous aimerez peut-être aussi