1 / 48

Informix 4GL and EGL

Jerry Keesee, Director of the Informix lab S. Venkatesh Gopal, Development, Informix R&D. Informix 4GL and EGL. Disclosure Information. PLANS ARE SUBJECT TO CHANGE OR CANCELLATION WITHOUT NOTICE. Agenda. Informix 4GL Today Why EGL? Overview of some EGL capabilities

efrat
Download Presentation

Informix 4GL and EGL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Jerry Keesee, Director of the Informix lab S. Venkatesh Gopal, Development, Informix R&D Informix 4GL and EGL

  2. Disclosure Information • PLANS ARE SUBJECT TO CHANGE OR CANCELLATION WITHOUT NOTICE

  3. Agenda • Informix 4GL Today • Why EGL? • Overview of some EGL capabilities • 4GL / EGL Syntax Comparison • JSF & EGL – Web Application Development Overview • Conversion of 4GL to EGL

  4. Current I4GL Development/Runtime Environment • A well established development environment. • Can be deployed as either pseudo-code (P code) or C code applications • P code primarily is used for development – debugger works with P code only • most develop with P code and deploy with C code • Connectivity to Informix database servers only • unless an Informix Gateway server is added • Small disk/memory footprint delivers very good runtime performance • Wide platform coverage.

  5. Primary Requirements for I4GL • Provide application database connectivity to IDS & DB2 • Provide a modern integrated development environment • Provide the capability to create modern applications with: • graphical user interfaces • and character-based user interfaces • Maintain and grow user base • enhancements should “fit” existing users • and be compelling for new ones…

  6. EGL • A language as easy as I4GL to use and develop with. • Provides an industry standard IDE (Rational Application developer) for developing EGL, Java, Web and COBOL applications. • Provides an enriched set of the same capabilities. • Text user interface (Curses based). • Calls to “C” functions. • SQL (embedded, dynamic and more). • Interactive debugging capability. • Powerful reporting capability. • Command line based application development. • Data types (all of I4GL and some more in addition).

  7. EGL ..... • In addition to the I4GL feature set provides • Development and runtime capabilities for Windows platforms. • More general programming capabilities. • Web Application development and deployment. • Same business logic can be shared in both deployments. • Multiple Database connectivity. • Uses JDBC and allows to connect to any DB. • Service Oriented Architecture (Web Services). • MQ Access. • File I/O • Provides for COBOL generation options (deployable in i-Series and z-Series). • Calling out Java code from EGL. • and more…

  8. EGL (similarities to I4GL). • Lots of similarities. • Basic statements and looping constructs are similar. • SQL statements are similar to 4GL (prepare, execute, open, get (fetch), close and for each). • Text user interface similar (with a more general programming model) to I4GL with extended capabilities. • Reporting framework provides for a wider set of output formats (PDF, Text, XML, CSV, HTML). • A highly interactive and visual debugging environment based on the Eclipse framework.

  9. INTVAL INT; Record myRecordType intval int; floatval float; decimalval decimal; End myRecord myRecordType; myotherRecord myRecordType; intval = 10; myRecord.intval = 10; funcName(param1,param2); Examples (Comparing I4GL to EGL). DEFINE INTVAL INTEGER DEFINE myRecord RECORD intval INTEGER, floatval FLOAT, decimalval DECIMAL END RECORD LET intval = 10 LET myrecord.intval = 10 CALL funcName(param1,param2)

  10. while(i < 10) let i = i + 1 end while case (i) when 10 … when 20 … otherwise … End case while(i < 10) i = i+1; End case(i) when (10) … when (20) … otherwise … end Examples (Comparing I4GL to EGL).

  11. insert into mytable (code, quantity) values (‘abc’, 10) prepare stmtid from "select fname,lname from customer where customer_num=10" declare secondSet cursor for select fname,lname from customer open secondSet fetch secondset into fname,lname; execute #sql{ insert into mytable(code,quantity) values('abc',10)}; prepare stmtid from "select fname,lname from customer where customer_num=10"; open secondSet with #sql{select fname,lname from customer }; get next from secondSet into fname,lname; Examples (SQL in I4GL compared to EGL)

  12. Some Infrastructure differences… • EGL being IDE based requires knowledge of Eclipse Workspace paradigms. • Everything exists in a workspace • Workspace has projects. • Projects have packages. • Packages have files. • Files can be either EGL source files, EGL programs or EGL libraries. • A program is equivalent to a I4GL file having the main function. • A library is equivalent to any I4GL modules that provides functions for use by other I4GL modules or I4GL globals file.

  13. PACKAGE PlayerStatsApplication; import InfxDbSchema.sports.stats.*; PROGRAM player_main use player_ba; player_bats rec_like_informix_atbats; batting_ave rec_like_informix_battingaverage; FUNCTION main() BA DECIMAL (4,3); PREPARE $_STMT_curs_at_bats FROM "select * from informix.atbats"; open curs_at_bats with $_STMT_curs_at_bats; WHILE (SQLCODE = 0) get next from curs_at_bats into player_bats.lname, player_bats.atbats, player_bats.hits, player_bats.walks; IF (SQLCODE = 100) EXIT WHILE; END BA = compute_BA(player_bats.atbats, player_bats.hits); execute #sql{INSERT INTO informix.battingaverage VALUES (:player_bats.lname, :BA) }; END //WHILE commit() ; CLOSE curs_at_bats; END // FUNCTION END // PROGRAM IDS Informix 4GL Today EGL Today DATABASE stats GLOBALS DEFINE player_bats RECORD LIKE informix.atbats.* DEFINE batting_ave RECORD LIKE informix.battingaverage.* END GLOBALS ------------------------------------------ MAIN ------------------------------------------ DEFINE BA DECIMAL (4,3) DECLARE curs_at_bats cursor for select * from informix.atbats OPEN curs_at_bats WHILE (SQLCA.SQLCODE = 0) FETCH curs_at_bats into player_bats.* IF (SQLCA.SQLCODE = 100) THEN EXIT WHILE END IF CALL compute_BA(player_bats.atbats, player_bats.hits) RETURNING BA INSERT INTO informix.battingaverage VALUES (player_bats.lname, BA); END WHILE COMMIT WORK CLOSE curs_at_bats END MAIN FUNCTION compute_BA(at_bats, hits) DEFINE at_bats INTEGER DEFINE hits INTEGER DEFINE BA DECIMAL (4,3) LET BA = hits/at_bats RETURN BA END FUNCTION PACKAGE PlayerStatsApplication; LIBRARY player_ba FUNCTION compute_BA(at_bats INT IN, hits INT IN) returns (DECIMAL (4,3)) BA DECIMAL (4,3); BA = hits/at_bats; RETURN( BA); END // FUNCTION END // LIBRARY

  14. Compiling and running applications. • Set up the compilation options in the build descriptor. • Generate to Java • Run the application. • Take the generate Java and deploy it to any other machine with the runtime libraries. • If you have created a web application, deploy the web archives to the test server or any J2EE server from within the IDE.

  15. Some extended capabilities…

  16. Integrated development environment • An industry standard IDE • Based on the Eclipse framework • Provides for different development perspectives • EGL • EGL/Web • Java and more. • Context Sensitive editor • Debugging capability (Interpretive debugger). • Page designer for JSPs and page handlers. • Code Assist (using Ctrl + Space)

  17. Records • Different types… • Basic Records • SQL Records • Serial Records • Indexed Records • MQ Records. • Record type identifies the I/O that can be done • Same statements are used for different Record types • No I/O with Basic records.

  18. Records

  19. Records (SQL Records) • Record definition Record CustomerRecord type SQLRecord {tableNames=("customer") } customer_num int {column=customer_num}; fname char(15) {column = fname}; lname char(15) {column = lname}; company char(20) {column = company}; address1 char(20) {column = address1}; address2 char(20) {column = address2}; city char(15) {column = city}; state char(2) {column = state}; zipcode char(5) {column = zipcode}; phone char(18) {column = phone}; end • A default SQL statement is generated for every SQLRecord • The SQL column information can be extracted using the IDE.

  20. SQL Records (example) mycustomer CustomerRecord; myCustomerArray customerRecord[]; open resultSet for mycustomer; try while(sqlcode = 0) get next from resultSet; //mycustomer.customer_num has the value. if(sqlcode = 100) exit while; end end onException End get myCustomerArray;

  21. File I/O using Records • Create a serialRecord. Record FileRecord type serialRecord {filename="customer"} customer_num num(10); fname char(15); lname char(15); End • Create a Resource Association. • Write your code. myfilerecord FileRecord; myfilerecord.customer_num = 100; myfilerecord.fname = “John”; myfilerecord.lname = “Doe”; add myfilerecord;

  22. Message Queue Access • Easy MQ handling. • Create Record definitions. Record myMQRecord type MQRecord { queueName = "mqRA" } fname char(10); lname char(10); End • Create a Resource Association between the queueName attribute and the MQ system. • Write your code. mqr myMQRecord; mqr.fname="Venkatesh"; mqr.lname="Gopal"; add mqr; get mqr; • Take full advantage using a package called “MQReusableParts”, a part of your standard distribution.

  23. Web Development with EGL. Sun PetStore Reference Application: WebSphere Studio JSF & EGL* Hand-Coded in Java IDE MDD Competitor 507.5 Hours 330 Hours 55 Hours *Internal Study

  24. Web Development using JSF • JSF is a J2EE Web UI / programming framework • User interface component model - Set of standard widgets • Specification allows creation of custom UI components • Event handlers to process client-driven events • Actions to call business logic • Validation framework to allow server side validation • Internationalization/Localization

  25. How do JSF and EGL fit together? Controller Model EGL JSF Servlet (Faces Servlet) Request EGL Invokes JSP (View) Response EGL

  26. How do JSF and EGL fit together? • A perspective (EGL Web) that allows users to create a view (JSP) containing standard controls and widgets. • Easy Drag and Drop to bind the data components to presentation items in the view. • Automatic creation of a page handler that implements the controller • Has an onPageLoad function, which is invoked the first time the web page is rendered. • A set of event handlers, each of which is invoked in response to a specific user action (like clicking on a button or a link). • Validation functions to validate web-page input fields. • Page handler can call other EGL library functions that implement the actual business logic. • Data can be passed between pages using simple EGL statements.

  27. Taking your applications from 4GL to EGL

  28. What is the Conversion Strategy? • Goal is to convert an I4GL application to the equivalent EGL application that uses: • the same display device • the same database server • I4GL TUI applications will be converted to EGL TUI applications • Convert, on a program-by-program basis, using the conversion utilities: • provided as part of the IDE • also available from the command line • Separate conversion passes required for: • database metadata extraction • shared libraries (C code or combination of C and I4GL code) • I4GL source code • Automated conversion should convert most 4GL source code • but, some 4GL programs may require manual intervention

  29. Conversion Assumptions • I4GL code is “legal” • it will compile with I4GL 7.32 compiler • conversion will not “fix” invalid I4GL code • Multiple passes are required • Functions that can not be resolved during conversion are assumed to be C code functions • if function is later found to be an I4GL function, re-conversion would be required • C code functions do not use undocumented I4GL internal functions

  30. How is this Going to be Done? • WebSphere Studio conversion plug-in • runs within the EGL development environment (Windows or Linux) • I4GL source directories can be mounted from current environments • or copied to the EGL development environment • GUI wizard collects information about I4GL source environment: • I4GL source and EGL destination directories • I4GL source files (.4gl, .per, .c, .so, message files, etc) • database connection information • locale information • generates configuration XML files • invokes the conversion utility • displays conversion log upon completion

  31. How is this Going to be Done? • Command line conversion utility • Java program can be run in current I4GL build environments • perhaps via current makefiles • requires XML configuration file describing current 4GL environment: • could be generated using the IDE plugin • or generated via shell script • generates EGL conversion “projects” containing • database meta data • makefiles to re-link C code with new EGL stack library • EGL source files • report designs and other reporting artifacts

  32. Conversion Artifacts • Configuration file • XML file generated from interaction with conversion wizard • contains required conversion project information • Manifest file • XML file generated during conversion of shared libraries • contains declaration and usage information about each of the functions (C and I4GL) used in the shared library • used to resolve function declarations in dependent I4GL shared libraries • required for subsequent I4GL source code conversions • Log file • contains warnings and errors • status of each source file • summary of conversion

  33. Order of Conversion is Important! • Database metadata • conversion creates EGL packages for each database used in the project • schema metadata will become a separate EGL project which can be referenced by other EGL projects • Shared libraries • conversion generates Manifest file and makefile • I4GL source files • .4gl files • .per (form) files • message files

  34. Pre-Conversion Tasks • Identify & locate all the components of the 4GL application to be converted • (.4gl, .per, message files, shared libraries) • Identify connection information for each database used • Start Informix database instances • Mount/copy source code to EGL development machine, if required • Determine destination directory for converted EGL source code & conversion artifacts • Identify “Client” locale – used to convert message files

  35. Conversion Utility Processing • Map all I4GL constructs into equivalent EGL constructs • Convert existing “.4gl” source files into “.egl” source files • Convert existing “.per” form specification files into “.egl” TUI specification files • No special file extensions for EGL form definitions • Migrate existing I4GL error message files into EGL error messages • Convert existing I4GL reporting logic into equivalent EGL reporting logic • Generate a “makefile” that will be used to link the C shared libraries to the converted EGL project • makefile will have targets for different operating systems • Report all warnings and errors • Generate log file to indicate the status of conversion • Create default EGL build descriptor file for the project

  36. Conversion tool within the IDE….

  37. Conversion tool…

  38. Conversion tool….

  39. Conversion tool (artifacts)…

  40. Conversion tool (conversion log).

  41. Post-Conversion Tasks • Review log file • Fix identified problems • on the 4GL side and re-convert or • in the new EGL file • shared libraries may have to be re-converted if functions cannot be resolved • Open the project in the IDE • Verify EGL packages and source files • View/update EGL build descriptor file • “Generate” Java code for the project • fix problems in the EGL code • Set runtime properties from existing environment variables • Launch new EGL project

  42. Conversion Limitations • Database connections cannot be shared between EGL and C code • C code cannot call EGL functions • Default values set in syscolval table are not accessed • I4GL Dynamic Arrays (7.32 release) will not be converted in initial release

  43. BL BL C functions C functions BL c_code.so c_code.so BL Text Reports BL SchemaLib.egl inventory.egl inventory.4gl catalog.egl catalog.4gl main.4gl main.egl form.per form.egl IDS BL BL BL Typical I4GL Program … Becomes Typical EGL Program I4GL to EGL Conversion Text Reports

  44. BL C functions c_code.so DB2 IDS Webinventory.egl SchemaLib.egl Webmain.egl inventory.egl catalog.egl main.egl BL BL BL Now What Can You Do With It … Use your I4GL Business Logic in EGL Web Services Use your I4GL Business Logic in whatever comes next!!! Use your I4GL Business Logic with Message Queues HTML Output XML Output PDF Output Text Reports

  45. EGL Releases… • 6.0 ega 12/3/2004, GA 1/7 • fix001 ega 12/20/2004 (first release for Informix) • ifix003 ega 2/28/2005 (Release with conversion tool available through Rational updater). • 6.0.0.1 ega 4/8/2005 (Conversion tool available through Rational updater)

  46. EGL information • EGL site http://www-128.ibm.com/developerworks/rational/products/egl/ • EGL downloads http://www-106.ibm.com/developerworks/rational/library/egldoc.html

  47. http://www.ibm.com/software/data/informix

More Related