ile and rpg iv
DESCRIPTION
ILE and RPG IV. Logicalis Briefing, 9 September 2005. An iSeries developer’s roadmap. Interface. Web service, e.g. for .Net coexistence. Green screen. Web browser. Transport. WebFacing and/or HATS. 5250. Presentation and navigation. Struts/JSF. Display file. Connectors. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: ILE and RPG IV](https://reader033.vdocuments.us/reader033/viewer/2022061315/56814982550346895db6cbeb/html5/thumbnails/1.jpg)
© Logicalis Group
ILE and RPG IV
Logicalis Briefing, 9 September 2005
![Page 2: ILE and RPG IV](https://reader033.vdocuments.us/reader033/viewer/2022061315/56814982550346895db6cbeb/html5/thumbnails/2.jpg)
Green screen
5250
Display file
RPG or COBOL program
Physical or logical file
DB2/400
Interface
Presentation andnavigation
Transport
Application logic
Interface to data store
Database
Web browser
WebFacingand/or HATS
Struts/JSF
Entity bean
Session bean
ConnectorsJDBC, MQ, etc.
Web service, e.g. for.Net coexistence
Embedded SQL
An iSeries developer’s roadmap
![Page 3: ILE and RPG IV](https://reader033.vdocuments.us/reader033/viewer/2022061315/56814982550346895db6cbeb/html5/thumbnails/3.jpg)
Another view
RPG IV
RPG III
ILE
SEU/PDM/SDA
Remote Systems Explorer
Java
DDS
Separate presentation from logic (HTML/GUI)
Nativedatabaseaccess
SQL
WDSC J2EE IDE
Support, maintainability and reuseChange control and deployment techniquesPerformanceOpen standardsDebugging
Batch FTP, custom formats
Assured delivery messaging, message transformation, XML
Program-to-program calls
Open standards
component interaction
![Page 4: ILE and RPG IV](https://reader033.vdocuments.us/reader033/viewer/2022061315/56814982550346895db6cbeb/html5/thumbnails/4.jpg)
RPG IV and the Integrated Language Environment
RPG IV
Functionality
Syntax
Why ILE?
Flexibility
Performance
Ease-of-use
![Page 5: ILE and RPG IV](https://reader033.vdocuments.us/reader033/viewer/2022061315/56814982550346895db6cbeb/html5/thumbnails/5.jpg)
RPG/IV Highlights
Specification layout changes (no L or E specs)
New D(efinition) spec
Expanded names - underscore allowed - 10 chars
Upper/lower case source equivalency
Free-form Maths & logical expressions
Date, Timestamp support
Pointer support
Most limits raised or removed
You have to convert - not source compatible
Migration process is straightforward (CVTRPGSRC)
![Page 6: ILE and RPG IV](https://reader033.vdocuments.us/reader033/viewer/2022061315/56814982550346895db6cbeb/html5/thumbnails/6.jpg)
RPG/IV Examples
DQCUSTCDT C 'QCUSTCDT' DPROCDS DS D PTR1 * PROCPTR INZ(%PADDR(QCUSTCDT)) D PROCS 1 1600* PROCPTR DIM(100) DFILEDS DS D FIL1 10A INZ(QCUSTCDT) D FILES 1 1000A DIM(100) DPROC S * PROCPTR C FILE LOOKUP FILES(X) 50 C MOVE *NULL PROC C RETURN
If (A > 10 AND *IN02)EVAL Salary = Salary * 1.25Endif DOU CowsComHom = '1'Exsr MovCowsEval CowsComHom = (CowsInFld = 0 AND
CowsEnRte = 0)
EndDo IF NeedNameEval(P) WholeName = FirstName + ' ' + LastName + '.'EndIf
DName DS BASED(Ptr)D FirstNameD LastnameDARRA S 10 DIM(10)
![Page 7: ILE and RPG IV](https://reader033.vdocuments.us/reader033/viewer/2022061315/56814982550346895db6cbeb/html5/thumbnails/7.jpg)
ILE benefits
Original Program Model (OPM)
Single entry point
Single variable scope, no pointer support
One program = one compilation
Dynamic program-to-program calls with performance overhead
Integrated Language Environment (ILE)
Modular programming with good performance
No need for dynamic program-to-program calls
Mix programming languages without performance overhead
C, C++, COBOL, RPG, CL
Code re-use, multiple entry points
Nested variable scope, pointer support
Faster compilations
![Page 8: ILE and RPG IV](https://reader033.vdocuments.us/reader033/viewer/2022061315/56814982550346895db6cbeb/html5/thumbnails/8.jpg)
ILE example
PTSTSOCKET HOST(PACIFIC6) PORT(1352)If successful, a completion message will be returnedConnection successfully obtained to PACIFIC6 on port 1352Otherwise, an appropriate escape message will be returnedHost CAT32 name resolved but no connection was possible on port 1352
![Page 9: ILE and RPG IV](https://reader033.vdocuments.us/reader033/viewer/2022061315/56814982550346895db6cbeb/html5/thumbnails/9.jpg)
Invocation: dynamic (external) versus bound (internal)
Program A
Program A subroutine calls another subroutine in same program:INTERNAL CALL
Program B
Program C
SUB1
SUB2Program B calls Program CEXTERNAL CALL
![Page 10: ILE and RPG IV](https://reader033.vdocuments.us/reader033/viewer/2022061315/56814982550346895db6cbeb/html5/thumbnails/10.jpg)
Structure of a simple ILE program
Procedure CRTINVNBR
Procedure DATEHANDLE
RPGMOD1
Module MOD1
Module MOD3
Program INVMAST
CBLMOD1
Module MOD2
Programs
*PGM object. OPM via CRTxxxPGM, ILE via CRTPGM
*PGMs contain 1 or more modules
Modules
*MODULE object type
Contains translated but unexecutable code
Must be BOUND into a program to run
Input is a source member
May contain one or more procedures
Procedures
Executable code with entry point
Not an AS/400 object
RPG & Cobol: 1 per compilation, C: many per compilation
Appear on CALL stack
![Page 11: ILE and RPG IV](https://reader033.vdocuments.us/reader033/viewer/2022061315/56814982550346895db6cbeb/html5/thumbnails/11.jpg)
Binding
Procedure CRTINVNBR
Procedure DATEHANDLE
Module RPGMOD1
Module CMOD3
Module CBLMOD2
Program INVMAST
Module RPGMOD1
Module CBLMOD2
Module CMOD3
Procedure CRTINVNBR
Procedure DATEHANDLE
CRTPGM INVMASTMOD(RPGMOD1 +CBLMOD2 +CMOD3)Cobol
SRCMBR
CBLMOD2
RPG SRCMBR
RPGMOD1
C SRCMBR
CMOD3
CRTRPGMOD
CRTCBLMOD
CRTCMOD
CALLB CBLMOD2
CALL LINK CMOD3PROC CRTINVNBR
Program INVMAST is statically bound by copy
![Page 12: ILE and RPG IV](https://reader033.vdocuments.us/reader033/viewer/2022061315/56814982550346895db6cbeb/html5/thumbnails/12.jpg)
Service programs
Procedure CRTINVNBR
Procedure DATEHANDLE
Module MODX
Module CMOD3
Module MODY
*SRVPGM SRV1
Module MODX
Module MODY
Module CMOD3
Procedure CRTINVNBR
Procedure DATEHANDLE
CRTSRVPGM +SRV1 +MOD(MODX +MODY +CMOD3)
Cobol SRCMBR
MODY
RPG SRCMBR
MODX
C SRCMBR
CMOD3
CRTRPGMOD
CRTCBLMOD
CRTCMOD
Service program is analogous to subroutine library or DLL
![Page 13: ILE and RPG IV](https://reader033.vdocuments.us/reader033/viewer/2022061315/56814982550346895db6cbeb/html5/thumbnails/13.jpg)
Activation groups
Menu
FILEX
INV1 INV2 INV3
ActGrp INV
FILEX
OE1 OE2 OE3
ActGrp OE
Default Group
OPM Pgm
OPM Pgm
OPM Pgm
![Page 14: ILE and RPG IV](https://reader033.vdocuments.us/reader033/viewer/2022061315/56814982550346895db6cbeb/html5/thumbnails/14.jpg)
Activation groups
Applications can be separated more cleanly at run time
Activation groups own resources such as ODPs, Commit Scope, exception handlers and SQL cursors but not Overrides
A default activation group created for OPM and IBM code
CRTPGM and CRTSRVPGM commands specify activation groups:
By name
*CALLER
*NEW
Requires some design thought, especially if exception handling is used and if OPM and ILE programs are mixed
Watch out for third party usage!
![Page 15: ILE and RPG IV](https://reader033.vdocuments.us/reader033/viewer/2022061315/56814982550346895db6cbeb/html5/thumbnails/15.jpg)
Hints and tips
Don’t go overboard …
Change control and regression testing impact