Calling Programs and Procedures. ILE RPG Programmer's Guide. In ILE, it is possible to call either a program or procedure. The syntax for calling and passing parameters to prototyped. For this reason, a prototyped. ILE. programs consist of one or more modules which in turn consist of one or more. An ILE RPG module contains an optional main procedure and. In this chapter, the term. A program entry. procedure is the procedure that is designated at program creation time to. If the entry module of the. ILE RPG module, then the main procedure of that module is called. A. program call is a call that is made to a program object. PGM). The called program's name is resolved to an address at run. For this reason, program calls are often referred to as. A call to a non- bindable API is also an example of a. If you use the CALL and PARM operations, then the. In. addition, all procedures within the program become available for procedure. ILE programs can also use static procedure calls or procedure. Procedure calls are also. As a result, run- time performance using static. Static calls allow operational descriptors, omitted parameters. For example, you can pass a procedure pointer as a. You can also manipulate arrays of. If the called procedure is in the same activation. For examples of using procedure. Web. Sphere Development Studio: ILE RPG. Reference. You can also call a prototyped procedure with an expression if. If you use the CALLB and PARM. A call stack entry is a call. There is one call stack per job. The system then automatically performs a procedure. When a procedure is called, only the user's procedure (a. The RPG main procedure of the ILE. RPG subprocedure, which in turn calls a C procedure. Therefore, from now on, the two steps of a program call will. A recursive. call is one where procedure A calls itself or calls procedure B which. A again. Each recursive call causes a new. The new. invocation has new storage for all data items in automatic storage, and that. Therefore, be careful not to call a procedure. For example, suppose there are three modules, as shown in Figure 5. You are not aware of what procedure B does except that it. Procedure B in turn calls procedure C, which in. A. Once procedure C calls procedure A, a recursive. The call stack sequence is shown in Figure 6. Note that the most recent call stack entry is at the. Infinite recursion can be avoided. In general, a proper recursive procedure. If it has been obtained, then the recursive procedure returns. When designing a call interface, you must make a number of decisions in. On the other hand, if you are. These may. include: passing a pointer to the parameter value, passing a copy of the. In this case you may request that operational descriptor. If you pass fewer parameters than are. If changing the parameter, you may overwrite. If using the parameter, you may misinterpret the. By prototyping the parameter, the compiler will check to see. This fact may be important, if a parameter occurs more than once. In general, you should only pass data which has a data type. It has a much simpler call interface and. For example, using a prototyped call you can call. Programs that are on the system at run time. CL Programming. Changing a Module Object. You can change the module object that is shown on the Display Module Source display by using option 5 (Display module source. At CALL TRANSACTION the calling program and its. I have a requirement like 'calling an executable program within a function module and the output of the program. The ability of a module to call another module is an interesting component. By changing the original program from a CALL opcode to a. Call Module Cl Program MaExported procedures in other modules or service programs that are bound in. Subprocedures in the same module. In RPG, prototyped calls are also known as free- form calls. It contrasts with fixed- form call, where the. There are two ways to. If there is no return value, use the CALLP operation. This makes it easier to distinguish procedure. The CALLP. operation uses the following extended- factor 2 syntax. C CALLP NAME. The free- form operation can use either of the following. Factor 1 must be. If the keyword. EXTPGM is specified on the prototype, the call will be a dynamic external. If the value is required. Use the procedure name in a manner that is consistent with the. For example, if a procedure is. Figure 6. 2 shows how the procedure might be used in an. However, there is no such requirement for. ILE RPG allows three methods for passing and receiving. By read- only reference. Parameters that are not prototyped may only be passed by reference. Consequently, you do not have to code any keywords on the. You should. pass parameters by reference to a procedure when you expect the callee to. You may also want to pass by reference to. May have to use the Create CL Module. create with a single command an ILE CL program which does not call any other ILE. Calling a procedure from CL. The SAP Toolbar control. I have an RPG program. In that program I want to CALL a RPGLE program and pass parameters to it. Contact Center Agent Development Program. Module 4: Controlling the Call; Module 5: Presenting the Solution. Note also that parameters that are passed on external program. When a parameter is passed by value, the compiler passes. For example, if the. A packed, zoned or binary constant or variable, with any number of digits. A built- in function returning a numeric value. A procedure returning a numeric value. A complex numeric expression such as. Min(Length(First) + Length(Last) + 1): %size(Name)). If the prototype requires an array of 4 elements, the passed parameter can. An array with fewer than 4 elements. In this case, the remaining. In this case, each element of the. In this case, some of the. In this case, each element of the received parameter. Passing by read- only. In particular, this method allows you to pass. It is important, however, that you know that. Some conditions that would cause this are: the passed. In this case, the person. Figure 6. 5 shows an example of a prototype definition for the. ILE CEE API CEETSTA (Test for omitted argument). Presence flag Output Binary(4). Argument number Input Binary(4). D CEETSTA PR EXTPROC('CEETSTA'). D Present 1. I 0. D Arg. Num 1. I 0 CONST. D Feedback 1. A OPTIONS(*OMIT). In these instances you can use. The additional. information allows the procedure to properly interpret the string. You. should only use operational descriptors when they are expected by the called. If any. parameter is defined as 'by descriptor', then you should pass. API. An example of this is the ILE CEE. API CEEDATM (Convert Seconds to Character Timestamp). The second and. third parameters require an operational descriptor. Operational descriptors are. In addition. operational descriptors are not available for data of type numeric, date. When a procedure is passed operational. For prototyped parameters, you specify the. OPDESC on the prototype definition. For non- prototyped. D) as the operation code extender of the CALLB. In either case, operational descriptors are then built by. Operational descriptors will not be built for omitted. The example consists of a service program which. The service program uses operational descriptors to. It may be that it is not relevant to the called. For example, this situation might arise when you are calling. ILE bindable APIs. Another reason might be that you are calling an. If you. need to omit a parameter on a call, you have two choices. Specify OPTIONS(*OMIT) and pass *OMIT. Specify OPTIONS(*NOPASS) and do not pass the parameter. In either case, an omitted. So if the called procedure is. If *OMIT is passed, it will. In other words, you can pass *OMIT if. OPTIONS(*OMIT) is specified on the corresponding parameter. When *OMIT is specified, the compiler will. You can also use. CEETSTA (Check for Omitted Argument) bindable API. In this. example, a procedure calls the ILE bindable API CEEDOD in order to decompose. The CEEDOD API expects to receive seven. The last parameter of CEEDOD (and of most bindable APIs) is. API ended. Consequently, on the. CEEDOD, the procedure must indicate that the parameter for the. This must be expected by the called procedure, which means that. To indicate that a prototyped. OPTIONS(*NOPASS) on the corresponding parameter definition. Note that. all parameters following the first *NOPASS one must also be specified with. OPTIONS(*NOPASS). To allow for this. QCMDEXC could be written as shown in Figure 6. Depending on how the procedure has been written, this. For example, suppose that you want to write a procedure which. This might arise when a new parameter is required. New calls may. pass the parameter. Old calls can remain unchanged. The value returned by %PARMS. OMIT has been passed. For the. main procedure, %PARMS returns the same value as contained in the *PARMS field. PSDS, although to use the *PARMS field, you must also code the. RPG always passes one on a call; however other ILE languages may. If the main procedure is not active, *PARMS is unreliable. FMTADDR is called by three different procedures. The. procedures differ only in the number of parameters they use to process the. That is, new requirements for the FMTADDR have. However. old procedures calling FMTADDR are still supported and do not have to be. Thus, the city and province could be. The number may vary from 3 to 5. The number tells the. Figure 6. 8 shows the source for this procedure. Figure 6. 9 shows the source for /COPY member. This. built- in function returns the number of passed parameters. Address character(7. Street number packed(5,0). Street name character(2. City character(1. Province character(1. Pull in the prototype from the /COPY member. COPY FMTADDRP. DFmt. Addr PI. D Address 7. D Street# 5 0 CONST. D Street 2. CONST. procedure serves to illustrate the use of FMTADDR. For convenience, the. FMTADDR are combined into this single. Also, for the purposes of the example, the data is. Similarly, there are three parts in. After printing the address, the procedure PRTADDR ends. The output is shown below. Bumble Bee Drive, Toronto, Ontario. Hummingbird Lane, Toronto, Ontario. Cowslip Street, Toronto, Ontario. Eglinton Avenue, North York, Ontario. Jasper Avenue, Edmonton, Alberta. Avenue Road, Sudbury, Ontario. When a parameter is prototyped, the compiler will check to see that the. If the callee has indicated. Note that OPTIONS *VARSIZE. This fact may be important when using parameters that cause side. For example. consider this call statement. Assume also that fld starts off with the value 3. B modifies fld to be 5, and returns 1. Depending. on the order in which the parameters are evaluated, proc. A will receive either. Or possibly, 5, 1. In particular, if you are providing an application for.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2017
Categories |