Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "1 ILE Component Programming Reference Presented By: Ric Slaten, Sr. Software Systems Engineer"— Presentation transcript:

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

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

3 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 4 Prototype Definition Example D***Prototype definition D getMLTSITEL01sitename... D pr 51a ExtProc('getMLTSITEL01sitename') D 5s 0 Value D***Program working storage (continued) D d$SiteDataStr ds INZ D d$SiteStatus 1a D d$SiteName 50a C***Begin program logic C Eval d$SiteDataStr = C getMLTSITEL01sitename(d$SiteDataStr) Procedure name Returned value specification Input parameter declaration Procedure call

5 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 6 Procedure Interface Definition Example PgetMLTSITEL01sitename... P b Export D pi 51a DR$SiteCode 5s 0 Value * * Local function variables and return value definition. * Dd$SiteName ds D d$RecordStatus 1a 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 If %Error C Eval d$RecordStatus = Locked Procedure Name and the beginning ‘P’ specification 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 EXPORT keyword allows procedure to be used in other modules and programs

7 7 Procedure Interface Definition Alternative Example PgetMLTSITEL01sitename... P b Export D pi 1a DR$SiteCode like(esitecode) D Value * * Local function variables and return value definition. * Dd$SiteName ds D d$RecordStatus 1a 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 If %Error C Eval d$RecordStatus = Locked Procedure Name and the beginning specification 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 EXPORT keyword allows procedure to be used in other modules and programs

8 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 9 Procedure Definition Example Procedure begin Local defined variables (inside the ‘P’ specifications (Procedure) Calculation specifications begin PgetMLTSITEL01sitename... P b Export * D pi 51a DR$SiteCode like(esitecode) D Value * * Work Variables Local Declaration * Dd$SiteName ds D d$RecordStatus 1a 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

10 10 Procedure Definition Example (continued) Calculation specifications (continued) Fill return value and pass back to calling program Ending ‘P’ specification 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 Return d$SiteName C Endif C If NOT %Found C Eval d$RecordStatus = NotFound C Eval d$Name = *Blanks C Return d$SiteName C Endif C Eval d$RecordStatus = Found C Eval d$Name = SITENAME C Return d$SiteName * PgetMLTSITEL01sitename... P e

11 11 Module Object Example Control specifications (H Specs) Input disk file definition Prototype definitions copybook Procedure (1) begin Procedure interface Work variables 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 1a DR$SiteCode like(esitecode) Value * * Work Variables Local Declaration

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

13 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 14 Service Program Binder Source Example Start Program Export (STRPGMEXP) Command Comments Exported Procedure names End Program Export (ENDPGMEXP) Command Signature can not exceed 16 characters ! /* ************************************************************************** */ STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('Vers 13JAug001') /* */ /* *MODULE MLTSITL01M MTGPRD4O 06/25/01 07:30:46 */ /* */ 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

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

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

17 17 Bind by Reference

18 18 Bind by Copy

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


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

Similar presentations


Ads by Google