170 likes | 446 Views
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.
E N D
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 JDBC, MQ, etc. Application logic Session bean RPG or COBOL program Physical or logical file Embedded SQL Entity bean Interface to data store Database DB2/400
Another view DDS Batch FTP, custom formats RPG III Native database access SEU/PDM/SDA Assured delivery messaging, message transformation, XML Separate presentation from logic (HTML/GUI) RPG IV Program-to-program calls ILE Remote Systems Explorer SQL Open standards component interaction Support, maintainability and reuse Change control and deployment techniques Performance Open standards Debugging WDSC J2EE IDE Java
RPG IV and the Integrated Language Environment • RPG IV • Functionality • Syntax • Why ILE? • Flexibility • Performance • Ease-of-use
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)
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.25 • Endif • DOU CowsComHom = '1' • Exsr MovCows • Eval CowsComHom = (CowsInFld = 0 AND CowsEnRte = 0) • EndDo • IF NeedName • Eval(P) WholeName = FirstName + ' ' • + LastName + '.' • EndIf DName DS BASED(Ptr) D FirstName D Lastname DARRA S 10 DIM(10)
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
ILE example PTSTSOCKET HOST(PACIFIC6) PORT(1352) If successful, a completion message will be returned Connection successfully obtained to PACIFIC6 on port 1352 Otherwise, an appropriate escape message will be returned Host CAT32 name resolved but no connection was possible on port 1352
Program B Program A Program A subroutine calls another subroutine in same program: INTERNAL CALL Program C SUB1 SUB2 Program B calls Program C EXTERNAL CALL Invocation: dynamic (external) versus bound (internal)
Module MOD1 RPGMOD1 Module MOD2 CBLMOD1 Module MOD3 Procedure CRTINVNBR Procedure DATEHANDLE Program INVMAST Structure of a simple ILE program • 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
Binding Module RPGMOD1 RPG SRCMBR RPGMOD1 Module RPGMOD1 CALLB CBLMOD2 CRTRPGMOD CRTPGM INVMAST MOD(RPGMOD1 + CBLMOD2 + CMOD3) Module CBLMOD2 Cobol SRCMBR CBLMOD2 Module CBLMOD2 • CALL LINK CMOD3 • PROC CRTINVNBR CRTCBLMOD Module CMOD3 Module CMOD3 C SRCMBR CMOD3 Procedure CRTINVNBR Procedure CRTINVNBR CRTCMOD Procedure DATEHANDLE Procedure DATEHANDLE Program INVMAST • Program INVMAST is statically bound by copy
Service programs Module MODX RPG SRCMBR MODX Module MODX CRTRPGMOD CRTSRVPGM + SRV1 + MOD(MODX + MODY + CMOD3) Module MODY Cobol SRCMBR MODY Module MODY CRTCBLMOD Module CMOD3 Module CMOD3 C SRCMBR CMOD3 Procedure CRTINVNBR Procedure CRTINVNBR CRTCMOD Procedure DATEHANDLE Procedure DATEHANDLE *SRVPGM SRV1 • Service program is analogous to subroutine library or • DLL
Activation groups ActGrp OE Menu OE1 OE2 OE3 OPM Pgm FILEX OPM Pgm OPM Pgm ActGrp INV INV1 INV2 INV3 FILEX Default Group
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!
Hints and tips • Don’t go overboard … • Change control and regression testing impact