1 © 2008 IBM Corporation Topic EGL Calls to Remote Programs (Overview)  EGL Calls to Remote Programs (Overview)  Calling RPG program  Calling a CL program.

Slides:



Advertisements
Similar presentations
Microsoft Expression Web-Illustrated Unit J: Creating Forms.
Advertisements

Microsoft Office 2007 Access Chapter 3 Maintaining a Database.
Using Eclipse. Getting Started There are three ways to create a Java project: 1:Select File > New > Project, 2 Select the arrow of the button in the upper.
Microsoft Office 2010 Access Chapter 1 Creating and Using a Database.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 2 1 Microsoft Office Access 2003 Tutorial 2 – Creating And Maintaining A.
® IBM Software Group © 2006 IBM Corporation Additional AJAX Examples and Workshops This learning module provides additional AJAX use cases and examples.
® IBM Software Group © 2006 IBM Corporation EGL / SOA – Creating and Consuming EGL Web Services This Learning Module shows how to utilize the RBD tooling.
® IBM Software Group © 2006 IBM Corporation The Eclipse Data Perspective and Database Explorer This section describes how to use the Eclipse Data Perspective,
® IBM Software Group © 2006 IBM Corporation EGL/Web Project QuickStart – 3 of 4 – Creating the U.I. Layer These slides walk you through the process of.
COMPREHENSIVE Excel Tutorial 8 Developing an Excel Application.
® IBM Software Group © 2006 IBM Corporation How to read/write XML using EGL This Learning Module shows how to utilize an EGL Library to read/write an XML.
® IBM Software Group © 2006 IBM Corporation JSF Tab Controls This Learning Module shows how to develop server-side EGL applications with dynamic content.
® IBM Software Group © 2006 IBM Corporation EGL Calling RPG Programs This Learning Module shows how to use EGL to call RPG programs, running on System.
® IBM Software Group © 2006 IBM Corporation Creating JSF/EGL Template Pages This section describes how to create.JTPL (Java Template Pages) using the Page.
8 Copyright © 2004, Oracle. All rights reserved. Creating LOVs and Editors.
® IBM Software Group © 2006 IBM Corporation JavaScript – and EGL and.JSP Pages This learning module describes the use of JavaScript in your EGL and.JSP.
Copyright © Texas Education Agency, All rights reserved. 1 Web Technologies Website Development with Dreamweaver.
by Chris Brown under Prof. Susan Rodger Duke University June 2012
® IBM Software Group © 2006 IBM Corporation JSF Tree Control This Learning Module describes the use of the JSF Tree Control – for hierarchical organization.
Web Technologies Website Development Trade & Industrial Education
Lesson No:9 MS-Word Tools, Mail Merge and working with Tables CHBT-01 Basic Micro process & Computer Operation.
Creating a Web Site to Gather Data and Conduct Research.
Website Development with Dreamweaver
® IBM Software Group © 2006 IBM Corporation Programmatically Rendering and Hiding JSF Controls This section describes how to hide and show JSF controls.
Office 2003 Advanced Concepts and Techniques M i c r o s o f t Access Project 5 Enhancing Forms with OLE Fields, Hyperlinks, and Subforms.
Alice 2.0 Introductory Concepts and Techniques Project 1 Exploring Alice and Object-Oriented Programming.
Office 2003 Advanced Concepts and Techniques M i c r o s o f t Access Project 5 Enhancing Forms with OLE Fields, Hyperlinks, and Subforms.
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
® IBM Software Group © 2006 IBM Corporation EGL/Web Project QuickStart – 2 of 4 – Creating the Business Logic Layer These slides walk you through the process.
Microsoft Access 2010 Chapter 10 Administering a Database System.
® IBM Software Group © 2006 IBM Corporation Duplicating Your Workspace You may need to copy files from one workspace to another (example – you’ve developed.
 To begin you first need to sign up to Weebly by going to or alternatively and we will create an account.
® IBM Software Group © 2006 IBM Corporation Using JSF Mini-Calendar Controls This section describes how to use a JSF Mini-Calendar Control with EGL It.
® IBM Software Group © 2006 IBM Corporation JSF File Upload Control This Learning Module describes the use of the JSF File Upload component – for allowing.
® IBM Software Group © 2006 IBM Corporation Web JSF Overview – RBD Tooling – for Web Development This unit introduces you to the aspects of the RBD tooling.
Fall 2003Sylnovie Merchant, Ph.D. ACCESS Tutorial Note: The purpose of this tutorial is to provide an introduction to some of the functions of ACCESS in.
® IBM Software Group © 2006 IBM Corporation Finding Out Which Submit Button Was Clicked – and Other JSF Command Button Techniques This section describes.
Gold – Crystal Reports Introductory Course Cortex User Group Meeting New Orleans – 2011.
® IBM Software Group © 2006 IBM Corporation EGL/Web Project QuickStart – 1 of 4 – Creating the Data Access Layer These slides walk you through the process.
® IBM Software Group © 2006 IBM Corporation JSF Panel – Section Controls This Learning Module shows how to develop server-side EGL applications with dynamic.
® IBM Software Group © 2006 IBM Corporation JSF Rich Text Area Component This Learning Module describes the use of the JSF Rich Text Area component – for.
Chapter 12© copyright Janson Industries Java Server Faces ▮ Explain the JSF framework ▮ SDO (service data objects) ▮ Facelets ▮ Pagecode classes.
Creating and Editing a Web Page
1 Week # 4 Introduction to PDM PDM is a workbench environment that lets programmers and system operators navigate the three levels of the AS/400’s object-based.
Creating and Editing a Web Page Using Inline Styles
® IBM Software Group © 2006 IBM Corporation EGL.CSV (Excel) File Reading and Writing This section describes how to access.CSV (Excel Spreadsheet) files.
Emdeon Office Batch Management Services This document provides detailed information on Batch Import Services and other Batch features.
® IBM Software Group © 2006 IBM Corporation Create EGL/JSF HelloWorld Pages This learning module walks you through the process of creating two simple “hello.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 11 Creating Web Applications and Writing Data to a Database.
Excel Tutorial 8 Developing an Excel Application
Running a Forms Developer Application
Using Macros, Switchboards, PivotTables, and PivotCharts
Creating Oracle Business Intelligence Interactive Dashboards
Creating LOVs and Editors
Forms and Reports 09.
IBM Rational Rhapsody Advanced Systems Training v7.5
Writing simple Java Web Services using Eclipse
Building a User Interface with Forms
EGL and IBM i Connectivity, Calling things, JDBC properties
Enhancing Forms with OLE Fields, Hyperlinks, and Subforms
Multi-host Internet Access Portal (MIAP) Enhancement Guide
Exploring Microsoft® Access® 2016 Series Editor Mary Anne Poatsy
MODULE 7 Microsoft Access 2010
Microsoft Office Access 2003
Tutorial 7 – Integrating Access With the Web and With Other Programs
Java IDE Dwight Deugo Nesa Matic Portions of the notes for this lecture include excerpts from.
Dynamically Populating a Multiple Selection List Box
Exploring Microsoft® Office 2016 Series Editor Mary Anne Poatsy
Creating Additional Input Items
Presentation transcript:

1 © 2008 IBM Corporation Topic EGL Calls to Remote Programs (Overview)  EGL Calls to Remote Programs (Overview)  Calling RPG program  Calling a CL program  Invoking a command  Calling a procedure in RPG Service Program  Getting a list of records from RPG program  Accessing a DataArea Sub-Topics: EGL and Remote Programs on IBM i

2 © 2008 IBM Corporation Calling RPG Programs  In this section you will learn how to call RPG programs running on an IBM iSeries server.  This lab requires you to have open Internet (TCP/IP) access on your PC  You will be calling (up to) four RPG transactions, running in an IBM System i in Toronto, Canada.  The steps you learn here should be generalize-able to your specific shop’s enablement Here’s what you’ll do: 1. Add the iSeries JT400 toolkit to your project 2. (For each RPG program to call) Add to the EGL Linkage Part for your Build File 3. Create the business logic to call the RPG Program First we will start with an overview of the system architecture and process  EGL Logic Part call program… call program…

3 © 2008 IBM Corporation Calling RPG Programs - Overview call “myProgram” (parm1, parmN);  Calling a RPG, COBOL, CL, or other program on the System i from EGL is as simple as coding: call “myProgram” (parm1, parmN);  The facility is however extremely flexible and supports the many options that may be required to support many possible options and configurations. EGL takes into account the many possible runtime options that may affect how you run your jobs and call the RPG programs.  EGL uses the System i Toolbox for Java™ to call programs on the System i. The toolbox in turn uses the i5/OS Remote Command server that is a part of the i5/OS Host Servers.  The Remote Command server in i5/OS consists of a server daemon program that listens for TCP/IP requests from “clients”. This program is QZRCSRVSD which runs in the QSYSWRK sub-system.  When the Remote Command Server starts, it starts a number of “worker” jobs that process requests in the QUSRSYS sub-system. These jobs are all named QZRCSRVS.  The next slide describes this process in graphical and technical (in the Notes section) detail

4 © 2008 IBM Corporation Calling RPG Programs – System Architecture JT400.JAR  Your EGL application calls RPG through a series of Qxxx system modules, via the JT400.JAR (Java) toolbox See ***Notes on i5 module installation, and on calling an external RPG program and Firewalls. If calling COBOL on the i IfcallingRPGDirectlyremotePgmType: Stateless or Stateful

5 © 2008 IBM Corporation Topic  EGL Calls to Remote Programs (Overview) Calling RPG programs  Calling RPG programs  Calling CL program  Invoking a command  Calling a procedure in RPG Service Program  Getting a list of records from RPG program  Accessing a Dataarea Sub-Topics: EGL and Remote Programs on IBM i

6 © 2008 IBM Corporation Calling RPG Programs – Steps (Revisited)  Here’s what you’ll do:  One time step - Add the iSeries JT400 toolkit to your project and Java Build Path  Once for each RPG program to call - Add an EGL Linkage Part for the program  For each call - Code the business logic to call the RPG Program, from an EGL “client” logic part: - Service - JSFHandler - Program - Library

7 © 2008 IBM Corporation  Add to the JT400 Toolkit to your Project Calling RPG programs on an iSeries box requires the JT400 toolkit in your build path.  There are 2 ways to do this (you only need to do one of these) 1. Add the file to the build path  Right-click over your project and select Properties  In the window that pops up, select Java Build Path on the left side of the screen  Select Add External Jars… Find the jt400.jar file on your pc, select Open, Select OK to close the properties window. 2. Put the file in the WEB-INF  Lib folder.  Switch to the Resource perspective  Expand Web Content  WEB-INF  lib folder –Drag jt400.jar into this folder  Drag Here

8 © 2008 IBM Corporation  Add to the Build File’s Linkage Option – 1 of 2 EGLWeb  From Project Explorer, Open EGLWeb.eglbld using the EGL Build Parts Editor  From the Window menu, open the Outline View  (It should be located at the bottom left corner of the tool, next to “Page Data” View)  From the Outline View, select “externalPrograms”  (you should have created this during the calling Cobol workshop) part: From the externalPrograms part: Add  Click: Add In the CallLink Elements: RPG1  Name the program: RPG1 remoteCall  Type: remoteCall Enter the following properties:  Alias: RPGCLSP1 CSOE037  conversionTable (type): CSOE037  Library: EGLPOT iseriesd.demos.ibm.com  location (type): iseriesd.demos.ibm.com SERVER  luwControl (select): SERVER GENERATION  remoteBind: GENERATION JAVA400  remoteComType (select): JAVA400 STATELESS  remotePgmType (select): STATELESS  Close SaveClose/Save Build File  Close and Save your Linkage Options – and Close/Save the Build File N ote: if you specify remotePgmType stateless or stateful you will not need QEGL on IBM i

9 © 2008 IBM Corporation  Add to the Build File’s Linkage Option – 2 of 2 Open with Text editor  From Project Explorer, Right-Click over EGLWeb.eglbld and select: Open with Text editor  Scroll down to the line <remoteCall pgmName=“RPG1”…  Click your mouse at the beginning of the line (to set focus)  Press Shift/End – to select the entire line (see reverse video line below)  Press Ctrl/C – to copy the line  Enter a new line, and press Ctrl/V 3 times – to copy/paste the entire line three times  Modify the pgmName’s and Alias’ in the new lines to: RPG2RPGCLSP2 RPG2RPGCLSP2 RPG3RPGCLSP3 RPG4RPGZIPCK  Close and save your edits

10 © 2008 IBM Corporation 2. Replicate the Linkage Options for Additional Programs – 3 of 3  Close and save your edits to the Linkage Options  Open EGLWeb.eglbld with the EGL Build Parts Editor  Un-check: Show only specified options  From the linkage Option, open the drop-down list and select:externalPrograms  Close and save your Build file  Right-click over your EGLWeb project and Generate

11 © 2008 IBM Corporation 3. Create a New Page to Test Your RPG Program Calls Before creating the page you need to generate the new Build-file entries to Java Generate  Right-click over the \EGLSource\ folder and select Generate Now let’s create a page that calls your RPG programs  Right-click over \WebContent\ and select, New > Web Page callRPG.jsp  Name the page: callRPG.jsp  Change the boiler-plate page heading text as shown here…  Right-click and edit the Page Code From inside the JSFHandler  Select and replace all of the boiler-plate code with the code in the Notes section of this slide  Note that there is a lot of source code, as the four RPG programs are included as comments at the bottom  Details of the program calls are covered on the next slide

12 © 2008 IBM Corporation 3. EGL RPG Program Calls So – you can see from this example, that there is nothing complex whatsoever about calling RPG programs from EGL. This JSFHandler has several different scenarios:  Passing individual parameters to RPG  Passing a single record  Passing a record that contains an array  Here are the record definitions (nothing new…hope you’re not disappointed ) Press Ctrl/S (save) your JSFHandler

13 © 2008 IBM Corporation 4. Create the Page Results From Page Designer: csRec  From Page Data – drag csRec on to the page   Make the top three fields input  Make ShipCost output  From options, specify no Submit buttons (un-check) )  From Page Data – select all three ( callRPG1, callRPG2 and callRPG3) functions, and drag them onto the page, to create three submit buttons. You can optionally add HTML Horizontal Rule tags between the controls csRecArray  From Page Data – drag csRecArray onto the page   Make the first three columns Input Text type ShipCostoutputText  Make ShipCost outputText

14 © 2008 IBM Corporation  Run the Page – and Call RPG  Run the page on the server.  Enter the values shown below – and click the buttons.  Note that callRPG2 passes the same data (just using a fixed record instead of individual parms)  Note also that you must fill in the input values in the array and click callRPG3 to return the 4 ShipCosts ***Notes

15 © 2008 IBM Corporation Topic  EGL Calls to Remote Programs (Overview)  Calling RPG programs Calling a CL program  Calling a CL program  Invoking a command  Calling a procedure in RPG Service Program  Getting a list of records from RPG program  Accessing a DataArea Sub-Topics: EGL and Remote Programs on IBM i

16 © 2008 IBM Corporation  Here’s what you’ll do: The steps for calling a CL program are the same as for calling an RPG program, but the linkage part needs to point the CL program  One time step - Add the iSeries JT400 toolkit to your project and Java Build Path For this step, follow the instructions for calling an RPG program  Once for each CL program to call - Add an EGL Linkage Part for the program  For each call - Code the business logic to call the RPG Program, from an EGL “client” logic part: - Service - JSFHandler - Program - Library Calling CL Programs – Steps ***Notes

17 © 2008 IBM Corporation  Add to the Build File’s Linkage Option  From Project Explorer, Open the.eglbld file using the EGL Build Parts Editor  From the Window menu, open the Outline View  (It should be located at the bottom left corner of the tool, next to “Page Data” View)  From the Outline View, select “externalPrograms”  (you should have created this during the calling Cobol workshop) part: From the externalPrograms part: Add  Click: Add In the CallLink Elements: CLZIPCK  Name the program: CLZIPCK remoteCall  Type: remoteCall Enter the following properties:  Alias: (the CL program name is CLZIPCK, therefore no alias entry is needed) CSOE037  conversionTable (type): CSOE037  Library: EGLPOT iseriesd.demos.ibm.com  location (type): iseriesd.demos.ibm.com SERVER  luwControl (select): SERVER GENERATION  remoteBind: GENERATION JAVA400  remoteComType (select): JAVA400 STATELESS  remotePgmType (select): STATELESS  Close SaveClose/Save Build File  Close and Save your Linkage Options – and Close/Save the Build File ***Notes

18 © 2008 IBM Corporation 3. Create a New Page to Test Your CL Program Calls Before creating the page you need to generate the new Build-file entries to Java Generate  Right-click over the \EGLSource\ folder and select Generate Now let’s create a page that calls your COBOL programs  Right-click over \WebContent\ and select, New > Web Page callCLzipck.jsp  Name the page: callCLzipck.jsp  Change the boiler-plate page heading text as shown here…  Right-click and edit the Page Code From inside the JSFHandler  Select and replace all of the boiler-plate code with the code in the Notes section of this slide  Note that there is a bit of source code, as the CL program is included as comments at the bottom There is nothing complex in this code Press Ctrl/S (save) your JSFHandler

19 © 2008 IBM Corporation 3. Create the Page Results From Page Designer: the fields  From Page Data – drag the fields 1.StateAbrv 2.zipCode 3.Message on to the page (see below)  Make the top two fields input  Make Message output  From options, specify no Submit buttons (un-check) )  From Page Data – select the ( callBLZIPCHK) function, and drag it onto the page, to create a submit button.

20 © 2008 IBM Corporation  Run the Page – and Call CL  Run the page on the server.  Enter the values shown below – and click the button.

21 © 2008 IBM Corporation Topic  EGL Calls to Remote Programs (Overview)  Calling RPG programs  Calling a CL program Invoking a command  Invoking a command  Calling a procedure in RPG Service Program  Getting a list of records from RPG program  Accessing a DataArea Sub-Topics: EGL and Remote Programs on IBM i

22 © 2008 IBM Corporation  Here’s what you’ll do: The steps for invoking commands on IBM i is similar as for calling a program, but the linkage part needs to point the QCMDEXC program.  One time step - Add the iSeries JT400 toolkit to your project and Java Build Path For this step, follow the instructions for calling an RPG program  Once for a program to be called - Add an EGL Linkage Part for the QCMDEXC program  For each call to QCMDEXC - Code the logic to add the command string as a parameter and to call the QCMDEXC Program, from an EGL “client” logic part: - Service - JSFHandler - Program - Library Invoking IBM i comands – Steps ***Notes

23 © 2008 IBM Corporation  Add to the Build File’s Linkage Option the  From Project Explorer, Open the.eglbld file using the EGL Build Parts Editor  From the Window menu, open the Outline View  (It should be located at the bottom left corner of the tool, next to “Page Data” View)  From the Outline View, select “externalPrograms”  (you should have created this during the calling Cobol workshop) part: From the externalPrograms part: Add  Click: Add In the CallLink Elements: COMANDONI  Name the program: COMANDONI remoteCall  Type: remoteCall Enter the following properties:  Alias: QCMDEXC CSOE037  conversionTable (type): CSOE037  Library: %LIBL% iseriesd.demos.ibm.com  location (type): iseriesd.demos.ibm.com SERVER  luwControl (select): SERVER GENERATION  remoteBind: GENERATION JAVA400  remoteComType (select): JAVA400 STATEFUL  remotePgmType (select): STATEFUL  Close SaveClose/Save Build File  Close and Save your Linkage Options – and Close/Save the Build File ***Notes

24 © 2008 IBM Corporation 3. Create a New Page to Test Your CL Program Calls Before creating the page you need to generate the new Build-file entries to Java Generate  Right-click over the \EGLSource\ folder and select Generate Now let’s create a page that calls your COBOL programs  Right-click over \WebContent\ and select, New > Web Page callcmd.jsp  Name the page: callcmd.jsp  Change the boiler-plate page heading text as shown here…  Right-click and edit the Page Code From inside the JSFHandler  Select and replace all of the boiler-plate code with the code in the Notes section of this slide  Note that there is a bit of source code, as the CL program is included as comments at the bottom There is nothing complex in this code We added a try and onException statement for exception handling Press Ctrl/S (save) your JSFHandler

25 © 2008 IBM Corporation 3. Create the Page Results From Page Designer: addthis  From Page Data, drag: addthis on to the page  Make the field input  From options, specify no Submit buttons (un-check) invokeCMD()  From Page Data – select the invokeCMD() function, and drag it onto the page to create a submit button.

26 © 2008 IBM Corporation  Run the Page – and Call CL  Run the page on the server.  Enter the values shown below – and click the button.  Click the button again, to get the error message that the library already exists. ***Notes

27 © 2008 IBM Corporation Topic  EGL Calls to Remote Programs (Overview)  Calling RPG programs  Calling a CL program  Invoking a command  Calling a procedure in RPG Service Program  Getting a list of records from RPG program  Accessing a DataArea Sub-Topics: EGL and Remote Programs on IBM i

28 © 2008 IBM Corporation Invoking an RPG procedure in a Service Program – Steps  Here’s what you’ll do: The steps for invoking procedures are different than for calling a program, no linkage part is need instead you will use a deployment descriptor instead. No Call statement is needed instead you invoke the procedure like a function, the procedure interface is described in an EGL interface.  One time step - Add the iSeries JT400 toolkit to your project and Java Build Path For this step, follow the instructions for calling an RPG program  Once for each procedure to invoke - Add an EGL deployment descriptor entry  For each invocation - Code the business logic to call the RPG Program, from an EGL “client” logic part: - Service - Interface - JSFHandler - Program - Library ***Notes

29 © 2008 IBM Corporation  Add to the Build File’s Linkage Option  From Project Explorer, in the EGLSource folder: Open the.egldd file using the EGL Build Parts Editor  Select the Service Client Bindings Tab  From the Service Bindings Configuration dialog  Click the ADD button  Select the Native binding Radio button En  On the Add Native Binding Dialog Enter the following attributes: CSOE037  conversionTable (type): CSOE037  Library: EGLPOT iseriesd.demos.ibm.com  location (type): iseriesd.demos.ibm.com  Userid(type): EGL4RPG  Password(type): EGL4YOU  Press the Finish button  Close Save  Close and Save your Deployment Descriptor –

30 © 2008 IBM Corporation 3. Create a New Page to Test Your Procedure invocation Before creating the page you need to generate the new Build-file entries to Java Generate  Right-click over the \EGLSource\ folder and select Generate Now let’s create a page that calls your COBOL programs  Right-click over \WebContent\ and select, New > Web Page custrpg.jsp  Name the page: custrpg.jsp  Change the boiler-plate page heading text as shown here…  Right-click and edit the Page Code From inside the JSFHandler  Select and replace all of the boiler-plate code with the code in the Notes section of this slide  Note that there is a bit of source code, as the RPG program is included as comments at the bottom There is nothing complex in this code Press Ctrl/S (save) your JSFHandler

31 © 2008 IBM Corporation 3. Create the Page Results From Page Designer: the fields  From Page Data – drag the fields 1.Custnoi 2.Fdback on to the page   Make the top field input  Make fdback output  From options, specify no Submit buttons (un-check)  Make some space between the fields gestcustproc()  From Page Data – select the gestcustproc() function, and drag it onto the page, to create a submit button.  Insert 2 blank lines underneath the error messages  From Page data –  Drag Myds onto the page

32 © 2008 IBM Corporation 4. Create the Interface and record definition for procedure invocation First create the record definition for the data to be returned New  Package  Right-click over the \EGLSource\ folder and select New  Package  Package name: basicrecords New ->EGL source file  Right-click on package basicrecords and select New ->EGL source file  EGL source file name: custrpgrecords From inside the source file  Select and replace all of the boiler-plate code with the code in the Notes section of this slide Before finishing the project you need to create the EGL interface New  Interface  Right-click over the \EGLSource\ folder and select New  Interface  Package name: Interfaces  EGL source file name: getdssol From inside the getdssol source file  Select and replace all of the boiler-plate code with this code : package Interfaces; import basicrecords.cstruc; // interface interface getdssol function getrecord(custnoi char(7),myds cstruc, fdback char(20)) ; end

33 © 2008 IBM Corporation  Run the Page – and invoke the RPG procedure  Run the page on the server.  Enter the value for customer number shown below – and click the button. ***Notes

34 © 2008 IBM Corporation Topic  EGL Calls to Remote Programs (Overview)  Calling RPG programs  Calling a CL program  Invoking a command  Calling a procedure in RPG Service Program Getting a list of records from RPG program  Getting a list of records from RPG program  Accessing a DataArea Sub-Topics: EGL and Remote Programs on IBM i

35 © 2008 IBM Corporation Calling an RPG Program returning multiple records  Here’s what you’ll do:  One time step - The setup steps are the same as in the previous RPG samples Things that make life easier - If you have external defined data structures that you use to exchange data between RPG and EGL, make sure to specify in the EGL workbench preferences for SQL character types to use EGL char type. - The default string will not work when exchanging parameter data between EGL and RPG. - Use the data access wizard to create the EGL record layout This will create a dynamic record layout, you will need to change this to a fixed record by prefixing the column(field) with a level number - Remember to add the JT400.jar file to your project

36 © 2008 IBM Corporation  Add to the Build File’s Linkage Option – 1 of 2  Create a new dynamic Web project named call_getrec  Change the linkage info in the.eglbld file In the CallLink Elements: GETREC  Name the program: GETREC remoteCall  Type: remoteCall Enter the following properties:  Alias: GETREC (or blank, since the program name is the same) CSOE037  conversionTable (type): CSOE037  Library: EGLPOT iseriesd.demos.ibm.com  location (type): iseriesd.demos.ibm.com SERVER  luwControl (select): SERVER GENERATION  remoteBind: GENERATION JAVA400  remoteComType (select): JAVA400 STATEFUL (important, you depend on having a stateful RPG program that continues to read records from the table.  remotePgmType (select): STATEFUL (important, you depend on having a stateful RPG program that continues to read records from the table.  Close SaveClose/Save Build File  Close and Save your Linkage Options – and Close/Save the Build File

37 © 2008 IBM Corporation 3. Create a New Page to Test Your RPG Program Calls Before creating the page you need to generate the new Build-file entries to Java Generate  Right-click over the \EGLSource\ folder and select Generate Now let’s create a page that calls your RPG programs  Right-click over \WebContent\ and select, New > Web Page getcust.jsp  Name the page: getcust.jsp  Change the boiler-plate page heading text as shown here…  Right-click and edit the Page Code From inside the JSFHandler  Select and replace all of the boiler-plate code with the code in the Notes section of this slide  Note that there is a lot of source code, as the RPG program is included as comments at the bottom  Details of the program calls are covered on the next slide

38 © 2008 IBM Corporation 3. EGL RPG Program Calls Like in the previous samples the call environment is not very complex.  The RPG program returns up to 10 records  Parameters are: 1.A fixed array of fixed records 2.A boolean variable eof that indicates whether we have reached the last record. We use this to disable the push button that allows to get more records. 3.An integer value that returns the actual number of records read in the RPG program.  Records used 1.Single record with a fixed array of records to pass as parameter This has to be defined this way since EGL doesn’t have a concept of fixed arrays and RPG doesn’t understand dynamic arrays 2.Fixed record of the customer file 3.A dynamic array of records that receives and stores the records to be displayed on the page. This array custsubf acts similar to a subfile in the 5250 environment. Press Ctrl/S (save) your JSFHandler

39 © 2008 IBM Corporation 4. Create the Page Results From Page Designer/ From Page Data custsubf  Drag custsubf array on to the page  Make all fields output  From Page Data - Actions getCustomerRecords  Drag function getCustomerRecords onto the page  Enhance the text on the button

40 © 2008 IBM Corporation Customizing button To disable the button when at the end of file …from Page Designer:  Select the button  go to properties and select to show all attributes  From the list of properties  Find disabled  Select the pulldown  Select compute  From the tree view  Expand Data eof  Select the eof boolean  Click Ok  Save and try

41 © 2008 IBM Corporation  Run the Page – and call same RPG program a couple of times  Run the page on the server.  Press the push button, the table will get filled  Press the push button a couple of more times until it gets disabled

42 © 2008 IBM Corporation Topic  EGL Calls to Remote Programs (Overview)  Calling RPG programs  Calling a CL program  Invoking a command  Calling a procedure in RPG Service Program  Getting a list of records from RPG program Accessing a DataArea  Accessing a DataArea Sub-Topics: EGL and Remote Programs on IBM i

43 © 2008 IBM Corporation Accessing a DataArea on IBM i – Steps  Here’s what you’ll do: The steps for accessing a data area are as follows  One time steps  As in the Call examples you will nee the jt400.jar file in your project  In addition: EGL with i5/OS objects support You will need to specify when you create the EGL project that you want to add capabilities to access IBM i resources (DataAreas or data queues). This is done in the New project wizard or in the project properties by checking the EGL with i5/OS objects support checkbox.  this will put the 2 iseriesobjects packages in EGL source -  For each dataarea, code the logic using the iseriesobjects package. - from an EGL “client” logic part: - Service - Interface - JSFHandler - Program - Library

44 © 2008 IBM Corporation  Specify system definitions and dataarea definitions  You use the record Systemdefinition to define:  the location of the dataarea  the location of the dataarea systeminfo.systemName = “iseriesd.demos.ibm.com"  The userid to sign on to the IBM i system  The userid to sign on to the IBM i system systeminfo.userId = “EGL4RPG";  The password to sign on to the IBM i system  The password to sign on to the IBM i system systeminfo.password = EGL4YOU";  You use record DataAreaDefinition to define:  Areaname  Areaname dataarea1.areaname ="QESTELE";  Libname  Libname dataarea1.libname ="QUSRSYS";  NoBytes  NoBytes dataarea1.noBytes = 200;  Areatype, one of these: Char, numeric, or logical  DATA_AREA_TYPE_CHAR  DATA_AREA_TYPE_DEC  DATA_AREA_TYPE_LOG  dataarea1.areaType = iJavalib.DATA_AREA_TYPE_CHAR;  systemDef (from above)  Access the dataarea by writng an assignment statement  datacontent = iJavaLib.getDataArea(dataarea1);  (Datacontent is of type string) ***Notes

45 © 2008 IBM Corporation 3. Create a New Page to Test the data area access Create a new project with jsf support  Create a new project eglDtaara  Remember to specify EGL with i5/OS object support on the EGL Settings wizard page Now let’s create a page that writes to dataareas and reads from dataareas  Right-click over \WebContent\ and select, New > Web Page taara.jsp  Name the page: eglDtaara.jsp  Change the boiler-plate page heading text as shown here…  Right-click and edit the Page Code From inside the JSFHandler  Select and replace all of the boiler-plate code with the code in the Notes section of this slide  Note that there is a bit of source code, as the RPG program is included as comments at the bottom There is nothing complex in this code Press Ctrl/S (save) your JSFHandler

46 © 2008 IBM Corporation 3. Create the Page Results From Page Designer: the fields  From Page Data – drag the fields 1.datacontenti 2.datadeccontenti 3.datalgleontenti on to the page   Make all fields input  From options, specify no Submit buttons (un- check)  Make some space between the fields )  From Page Data – select the ( get_dataara_content) function, and drag it onto the page, to create a submit button.  From Page Data – drag the fields 1.datacontento 2.datadeccontento 3.datalglcontento

47 © 2008 IBM Corporation  Run the Page – and access the data area  Run the page on the server.  Press the button,  Change the values and press the button.

48 © 2008 IBM Corporation Topic  EGL Calls to Remote Programs (Overview)  Calling RPG programs  Calling CL program  Invoking a command  Calling a procedure in RPG Service Program  Getting a list of records from RPG program  Accessing a DataArea Accessing members in database files  Accessing members in database files Sub-Topics: EGL and Remote Programs on IBM i

49 © 2008 IBM Corporation Accessing Members in Database Files  How to access members in database files :  Create an SQL Alias  Use an SQL statement in your EGL …or…  Use SQL on i to create the alias  Alias is an  Example: SQL Alias create statement:  CREATE ALIAS QLINK FOR WFLABXX/MYFILE(mymember)  WFLABXX.MYFILE(mymember)  SQL name also works WFLABXX.MYFILE(mymember)  Alias will show in RSE as well as OPS Navigator Use SQL Select statement with Alias name select * from WFLABXX/QLINK

50 © 2008 IBM Corporation  Create Sample Application to Access Source Members Create a new project with JSF support  Create a new project: multimem1  Change the project properties EGL Runtime Data Source to a Data Source name that points to iseriesd.demos.ibm.com or your own system. Now let’s create a page that allows to enter a member name \WebContent\  Right-click over \WebContent\ and select, New > Web Page.jsp  Name the page: lookatmember.jsp  Change the boiler-plate page heading text as shown here…  Right-click and edit the Page Code From inside the JSFHandler  Select and replace all of the boiler-plate code with the code in the Notes section of this slide There is nothing complex in this code Press Ctrl/S (save) your JSFHandler

51 © 2008 IBM Corporation 3. Create the Page Results From Page Designer: the field  From Page Data – drag the field membername - membername - on to the page   Make all fields input  From options, specify no Submit buttons (un- check)  Make some space between the fields getNewMember()  From Page Data/Actions select the getNewMember() function, and drag it onto the page, to create a submit button.  From Page Data – drag the fields qdds qdds - onto the page

52 © 2008 IBM Corporation  Run the Page – and look at members  Run the page on the server.  Press the button,  You can see source in member QDSIGNON2  Switch to the other member the is by default in QDDSSRC QDSIGNON

53 © 2008 IBM Corporation Some Notes for accessing DB2 on i In the jdbc data source for your EAR file properties: Specify these properties:  dateformat : iso  timeformat: iso  For working with the library list, use  Naming: system  Setting a date to  Assign an EGL date variable value to: “01/01/0001” ; use double-quotes  Or assign NULL to Null out the date field: –dateVar date? = null –dateVar date? = null ;