Presentation is loading. Please wait.

Presentation is loading. Please wait.

ILE Component Programming Reference

Similar presentations


Presentation on theme: "ILE Component Programming Reference"— Presentation transcript:

1 ILE Component Programming Reference
Presented By: Ric Slaten, Sr. Software Systems Engineer

2 Introduction Using ILE components to build a 3-Tier application
Procedures Prototypes Parameters/Procedure Interface Modules Service programs Binder Source Binding Directories

3 Prototypes and Parameters
A prototype is a definition of the call interface. It includes the following information: Whether the call is bound (procedure) or dynamic (program) How to find the program or procedure (the external name) The number and nature of the parameters Which parameters must be passed, and which are optionally passed Whether operational descriptors should be passed The data type of the return value, if any (for a procedure)

4 Prototype Definition Example
D***Prototype definition D getMLTSITEL01sitename... D pr a ExtProc('getMLTSITEL01sitename') D s 0 Value D***Program working storage (continued) D d$SiteDataStr ds INZ D d$SiteStatus a D d$SiteName a C***Begin program logic C Eval d$SiteDataStr = C getMLTSITEL01sitename(d$SiteDataStr) Procedure name Returned value specification Input parameter declaration Procedure call

5 Procedure Interface If a prototyped program or procedure has call parameters or a return value, then a procedure interface definition must be defined, either in the main source section (for a main procedure) or in the subprocedure section. A procedure interface definition repeats the prototype information within the definition of a procedure. It is used to declare the entry parameters for the procedure and to ensure that the internal definition of the procedure is consistent with the external definition (the prototype).

6 Procedure Interface Definition Example
EXPORT keyword allows procedure to be used in other modules and programs Procedure Name and the beginning ‘P’ specification PgetMLTSITEL01sitename... P b Export D pi a DR$SiteCode s 0 Value * * Local function variables and return value definition. Dd$SiteName ds D d$RecordStatus a D d$Name like(esitename) C Open (e) MLTSITEL01 C If %Error C Eval d$RecordStatus = FileError C Eval d$Name = *Blanks C Return d$SiteName C Endif C R$SiteCode Chain (e) RMLTSITE C Close MLTSITEL01 C Eval d$RecordStatus = Locked Procedure Interface marks the beginning of the parameter list and allows the definition of a return value Method used to pass the parameter to the procedure

7 Procedure Interface Definition Alternative Example
EXPORT keyword allows procedure to be used in other modules and programs Procedure Name and the beginning specification PgetMLTSITEL01sitename... P b Export D pi a DR$SiteCode like(esitecode) D Value * * Local function variables and return value definition. Dd$SiteName ds D d$RecordStatus a D d$Name like(esitename) C Open (e) MLTSITEL01 C If %Error C Eval d$RecordStatus = FileError C Eval d$Name = *Blanks C Return d$SiteName C Endif C R$SiteCode Chain (e) RMLTSITE C Close MLTSITEL01 C Eval d$RecordStatus = Locked Procedure Interface marks the beginning of the parameter list and allows the definition of a return value Method used to pass the parameter to the procedure

8 Procedure A procedure is a set of self-contained high-level language statements that performs a particular task and then returns to the caller.

9 Procedure Definition Example
Procedure begin PgetMLTSITEL01sitename... P b Export * D pi a DR$SiteCode like(esitecode) D Value * Work Variables Local Declaration Dd$SiteName ds D d$RecordStatus a D d$Name like(esitename) * File status constants D FileError c '3' D Locked c '2' D NotFound c '1' D Found c '0' C Open (e) MLTSITEL01 C If %Error C Eval d$RecordStatus = FileError C Eval d$Name = *Blanks Local defined variables (inside the ‘P’ specifications (Procedure) Calculation specifications begin

10 Procedure Definition Example (continued)
Fill return value and pass back to calling program Calculation specifications (continued) C Return d$SiteName C Endif C R$SiteCode Chain (e) RMLTSITE C Close MLTSITEL01 C If %Error C Eval d$RecordStatus = Locked C Eval d$Name = *Blanks C If NOT %Found C Eval d$RecordStatus = NotFound C Eval d$RecordStatus = Found C Eval d$Name = SITENAME * PgetMLTSITEL01sitename... P e Ending ‘P’ specification

11 Module Object Example Control specifications (H Specs)
H NoMain AlwNull(*UsrCtl) H DatFmt(*iso) H Text(*srcmbrtxt) H Debug(*Yes) /If Defined(Dev) H Option(*NoDebugIO:*SrcStmt) H Optimize(*None) /Else H Option(*NoDebugIO:*NoSrcStmt) H Optimize(*Full) /EndIf FMLTSITEL01IF E K DISK USROPN * D/COPY Qrpglesrc,MLTSITL01H PgetMLTSITEL01sitecode... P b Export D pi a DR$SiteCode like(esitecode) Value * Work Variables Local Declaration Input disk file definition Prototype definitions copybook Procedure (1) begin Procedure interface Work variables

12 Module Object Example (continued)
Work variables (cont.) * C******* Calculation specifications go here PgetMLTSITEL01sitecode... P e PgetMLTSITEL01sitename... P b Export D pi a DR$SiteCode like(esitecode) Value Dd$SiteName ds D d$RecordStatus a D d$Name like(esitename) C****** Calculation specifications go here PgetMLTSITEL01siteaddr1... C specs Procedure (1) end Procedure (2) begin Procedure interface Work variables C specs Procedure (2) end Procedure (3) begin

13 Control Specifications
The control-specification statements, identified by an H in position 6, provide information about generating and running programs. The keywords listed below are a few that are presently being used within CSSD; these keywords allow the programmer to omit them as compiler options when promoting program source through Turnover or when a programmer simply wishes to compile the program for testing. BNDDIR('binding-directory-name' {:'binding-directory-name'...}) COPYRIGHT('copyright string') FIXNBR(*{NO}ZONED *{NO}INPUTPACKED) NOMAIN OPTION(*{NO}XREF *{NO}GEN *{NO}SECLVL *{NO}SHOWCPY *{NO}EXPDDS *{NO}EXT *{NO}SHOWSKP) *{NO}SRCSTMT) *{NO}DEBUGIO)

14 Service Program Binder Source Example
Signature can not exceed 16 characters ! Start Program Export (STRPGMEXP) Command /* ************************************************************************** */ STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('Vers 13JAug001') /* */ /* *MODULE MLTSITL01M MTGPRD4O /25/01 07:30: */ EXPORT SYMBOL('getMLTSITEL01sitecode') EXPORT SYMBOL('getMLTSITEL01sitename') EXPORT SYMBOL('getMLTSITEL01siteaddr1') EXPORT SYMBOL('getMLTSITEL01siteaddr2') EXPORT SYMBOL('getMLTSITEL01siteaddr3') EXPORT SYMBOL('getMLTSITEL01siteaddr4') EXPORT SYMBOL('getMLTSITEL01sitecity') EXPORT SYMBOL('getMLTSITEL01sitecnty') EXPORT SYMBOL('getMLTSITEL01sitectry') EXPORT SYMBOL('getMLTSITEL01sitepstcd') EXPORT SYMBOL('getMLTSITEL01sitetelno') EXPORT SYMBOL('getMLTSITEL01siteapprid') EXPORT SYMBOL('getMLTSITEL01siteappcd') EXPORT SYMBOL('getMLTSITEL01siteappnm') EXPORT SYMBOL('getMLTSITEL01CompleteAddress') EXPORT SYMBOL('getMLTSITEL01all') ENDPGMEXP Comments Exported Procedure names End Program Export (ENDPGMEXP) Command

15 Service Program Binder Source Example (Making multiple signatures)
Program levels used are *PRV (previous) and *CURRENT (current) Unique signatures Start Program Export (STRPGMEXP) Command /* ************************************************************************** */ STRPGMEXP PGMLVL(*PRV) SIGNATURE('Vers 13JAug001') /* */ /* *MODULE MLTSITL01M MTGPRD4O /25/01 07:30: */ EXPORT SYMBOL('getMLTSITEL01sitecode') EXPORT SYMBOL('getMLTSITEL01sitename') ENDPGMEXP STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('Vers 28Feb2002') /* *MODULE MLTSITL01M MTGPRD4O /20/02 10:14: */ EXPORT SYMBOL('getMLTSITEL01all') End Program Export (ENDPGMEXP) Command

16 Binding Directory Example
Work with Binding Directory Entries (WRKBNDDIR) Command Binding Directory Name Library name where Binding Directory is located Options to add or remove an object Service program name Types of *SRVPGM or *MODULE are allowed

17 Bind by Reference

18 Bind by Copy

19 Conclusion Prototypes and parameters Procedure Interfaces Procedures
Modules Control Specifications Service Programs Binder Source Binding Directory


Download ppt "ILE Component Programming Reference"

Similar presentations


Ads by Google