20
IBM Software Distance Learning hands-on Labs IBM Rational Developer for i Maintain an ILE RPG application using Remote System Explorer Verify/compile an RPG source member and work with the error list. Lab Exercises Lab03 Lab 3 Page 6 IBM Software 2009 IBM Corporation

Distance Learning hands-on Labs IBM Rational Developer for ......ibm software contents lab 3 verify/compile an ibm i application using remote system explorer (rse) 9 3.1 overview 9

  • Upload
    others

  • View
    9

  • Download
    0

Embed Size (px)

Citation preview

IBM Software

Rational Developer for IBM i (RDI)

Distance Learning hands-on LabsIBM Rational Developer for i

Maintain an ILE RPG application using

Remote System Explorer

Verify/compile an RPG source member and work withthe error list.

Lab Exercises Lab03

Lab 3 Page 6

IBM Software

�2009 IBM Corporation

IBM Software

© Copyright International Business Machines Corporation, 2009. All rights reserved.

US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contractwith IBM Corp.

Page 7 Rational Developer for i V7.5

IBM Software

Contents

LAB 3 VERIFY/COMPILE AN IBM I APPLICATION USING REMOTE SYSTEM EXPLORER(RSE) 93.1 OVERVIEW 93.2 VERIFYING THE SOURCE 103.3 COMPILING SOURCE REMOTELY 143.4 SUBMITTING IBM I COMMANDS IN THE OBJECT TABLE VIEW 163.5 RUNNING COMMANDS AND PROGRAMS 193.6 MODULE SUMMARY 21

Lab 3 Page 8

IBM Software

Lab 3 Verify/compile an IBM i application using Remote SystemExplorer (RSE)

3.1 OverviewThis module teaches you how to verify and compile RPG and use the error list in the Remote Systems Explorer.When errors are found by either the verify or the compile step, the Error List appears. The Error List is apowerful tool that manages errors found by verify and compile utilities. You will become familiar with thesetools, the various capabilities of the Error List and the RPG program that you have created.

3.1.1 Learning objectives• Check for semantic errors on your workstation• Start the Program Verifier tool• Use the Error List to locate each error in the source• Use content-assist to fix an error• Save your source• Re-verify source• Change compile preferences• Invoke the compile command• Change the current library using the Command field in the Object Table view• Start an interactive connection• Invoke the Payroll program

3.1.2 Skill levelIntroductory

3.1.3 AudienceIBM i developer

3.1.4 System requirements• IBM Rational® Developer for i, V7.5 and all software updates through the IBM Installation Manager.• IBM i V5R3, V5R4, or V6R1

3.1.5 Prerequisites• Basic Microsoft Windows operations such as working with the desktop and basic mouse operations such as

opening folders and performing drag-and-drop operations• It will also help if you understand DDS and ILE RPG.This tutorial is divided into a number of modules, each with its own learning objectives. You can choose toskip the modules on Edit and Compile. You can go directly to this module if you are only interested in that part,however you need to complete LAB01 to create a connection to an IBM i server. This connection will be used inthis LAB. Each module contains several lessons that should be completed in order for the tutorial to work asshown in this script.

3.1.6 Expected resultsUpon completion of this tutorial you will know how to verify/compile an IBM i application from the RemoteSystem Explorer. You will also know how to run an interactive program using the Remote System Explorer.

Page 9 Rational Developer for i V7.5

IBM Software

3.1.7 Conventions used in this tutorial• Bold font for user interface controls• Mono-spaced font for user input and code blocks• Italic font for variable names and glossary terms.

Important!You should go through Lab01 'Create a connection and get startedwith RSE' before you work on this Lab. Lab01 contains the followinginformation:

• Which IBM i server to connect to,

• Which userid to use,

• How to setup the correct library list for this lab.

3.2 Verifying the sourceNow you get to play with one of the most powerful and unique features of the Remote System Explorer– the Program Verifier. Before you compile your code on an IBM i system, you can make certain thatthere are no errors by invoking the Program Verifier. The verifier checks for semantic (compile) errorson your workstation so that you can guarantee a clean compile on your IBM i system. Think of thehost cycles you’ll save. It is especially handy when you are writing code but you are disconnectedfrom a server. You can do this because Remote System Explorer ported the parsing and checking codefrom the IBM i compilers to the workstation. The Error List view lists the errors that are found and theirseverity, displays the error messages directly within the source and helps you to navigate between theerrors.

To invoke the verifier:__1. Open member PAYROLL in QRPGLESRC in the editor if it is not already open. __2. With the focus on the editor, click Source > Verify from the workbench menu. (Similarly, you can

also use the pop-up menu for the source member in the Remote Systems View or the Verify toolbutton — you need the source in the editor for the button to appear.)

After a moment the verifier will display an Error List below the Editor window.

Lab 3 Page 10

IBM Software

The error list shows you:• The error message itself• The severity• The line number• The source location• The connection name

Next you will fix the errors in your source.__3. Double-click the error RNF7030.You are automatically brought back into the Editor window to the line where the error occurred.The error on line 365 is a typo. The variable EMES should be EMESS. One good way of finding thecorrect name is the content-assist tool.

Tip:The Outline view must be populated to use content-assist.

__4. Select the misspelled variable and press CRTL+spacebar.If the variable starts correctly the selection presented contains the correct name.__5. Double-click the variable EMESS in the list to correct the variable name.Another way to find the variable name is to use the Outline view and see what variables are declared.

Page 11 Rational Developer for i V7.5

IBM Software

The next error is a RNF7030 as well.__6. Double-click RNF7030. Fix it in the editor.__7. RSNTAX should really be RSNTAG. Make the appropriate change.__8. Go to the next error RNF5184.The next error is actually RNF7018 but it is related to the one you just fixed and can be ignored. Itshows the same line number, which is an indication that both errors are related.__9. Double-click RNF5184.__10. Fix this by replacing the 2 with a 1.Error RNF7515 is related to the first error you fixed. It has the same line number. You can ignore it. Theonly serious remaining error is RFN5178. This error is caused by a missing ENDSR.

Tip:The verifier could not determine where the ENDSR is missing so the linenumber reported is 1, for this reason you can’t just double-click on theerror message. You need to investigate where the missing statementbelongs. You can use the Indent view to determine where the ENDSR ismissing

__11. Move to line 398 in the editor.

Lab 3 Page 12

IBM Software

__12. Remove the asterisk (*) from the C-spec.You can use the Tab key to quickly move to the appropriate column. All the non-informational errorsare now fixed.You can filter out messages according to these severities by using the filter menu.

__13. Click the arrow in the Error List title bar.__14. Click Show Severity on the pop-up menu.__15. Clear the severities you don’t want to see in the list (Warning for example)__16. You can save the member using one of these ways:

__a. Click File > Save from the workbench menu.__b. Click the Save icon in the workbench toolbar__c. Press Ctrl+ S.

Changes are uploaded to the IBM i system.__17. Verify your source again

Everything should be ok. You should see only severity 0 messages. You are ready to compile the

Page 13 Rational Developer for i V7.5

IBM Software

program.You have verified your source and fixed any errors.

3.3 Compiling source remotelyThe remote compile capability is part of the Remote System Explorer. It gives you a workstationinterface to submit requests to compile, bind, or build objects on the IBM i host. It allows for easy accessto all the compile options available for all the supported CRTxxx commands.If you used the local program verifier, then your host compiles should be successful -- no wasted IBMi cycles. However, if there are errors, the host compiler will send the error information back to theworkstation and they will be loaded into the Error List view, which behaves just as it did when you dida local verify.The default for compiling programs is to submit the compile to the batch job queue. Here in this exerciseyou can run the compile interactive.To change the preferences to run the compile interactive:__1. Click Window > Preferences from the workbench menu __2. In the left pane of the Preferences window, expand Remote Systems__3. Expand IBM i under Remote Systems__4. Click Command Execution under IBM i.__5. In the right pane of the Preferences window, clear the Compile in batch check box.__6. Click OK to return to the Remote System Explorer perspective.You will now use the prompt for the CRTBNDRPG command to specify your compile parameters. Allentry fields pertaining to names are already filled in with the correct information.To compile source:__7. Right-click the PAYROLL member in QRPGLESRC.

=

__8. Click Compile (Prompt) > CRTBNDRPG on the pop-up menu. The Create Bound RPGProgram (CRTBNDRPG) dialog opens.

Lab 3 Page 14

IBM Software

__9. In the Debugging views drop down list, select the *ALL parameterIf you want to see the other parameters available, click Advanced. __10. Click OK when you are finished.The progress bar on the workbench (bottom right corner) will indicate that the compile runs. Then theerror list will be shown, with no errors, just information messages.You can also check the Commands Log view to verify that your program was created.

__11. Click the Commands Log tab at the bottom of the workbench. This log shows a list of allcommands run on the remote system and the messages returned for each command.

You have set compile preferences, invoked the compile command, and checked for a successful compile.

Page 15 Rational Developer for i V7.5

IBM Software

3.4 Submitting IBM i commands in the Object Table viewYou can use the Object Table view inside the Remote System Explorer to submit commands to theIBM i system. You can run commands from the Commands field beneath the Object Table view, andview messages in the Messages field. After you populate the table, you can enter a command and clickeither Prompt to specify parameters and then Run or just click Run. When you run a command, theMessages field is populated with the messages from the command. When you select a message, theDetails button is enabled. When you click this button, the message and its help is displayed.Also note that besides the Object Table view, you can also use the Remote Systems view to runcommands and programs. Which one you choose depends on your personal preference. In the ObjectTable view, you can see the properties of all items at the same time; they are displayed as rowsacross the table.In the Remote Systems view, you have greater ease of navigation; you can work from your Librarylist in the Objects subsystem, and you can see the contents of many items before selecting the one youwant to run.In the Commands field, you select where you want to run the command. The choices are Normal, whichmeans that the command will run in the RSE communication server job, Batch or Interactive.To change the library list:

__1. Click the Object Table view tab from the views at the bottom of the workbench.__2. In the Command field type, CHGCURLIB RSELABxx for example.

Tip:If you are not using an IBM supplied IBM i server, use a library that is onyour own IBM i system.

__3. Click Run.

TroubleshootingIf you haven’t used the Object Table view to show IBM i objects, you willsee an error message because the Table view is not linked to an activeconnection.

Lab 3 Page 16

IBM Software

If you see this message:__i. click OK.__ii. In the Remote Systems view, right-click QRPGLESRC.

__iii. Click Show in Table on the pop-up menu. The Table view is now populated with the member in the selected source file.

__iv. Run the CHGCURLIB command again.The command will run on the IBM i system and after completion you will see the completion message onthe bottom of the Object Table view.

Back in the workbench in the Remote Systems view

__4. Right-click Library list __5. Click Refresh.

Page 17 Rational Developer for i V7.5

IBM Software

You will see a small green asterisk beside the RSELABxx library to indicate it as your current library.You can also connect to other than IBM i systems with the Remote System Explorer and launchcommands for these systems as well, for example, your local system, or Linux®.You have submitted a command to change the current library in the command line of the Object Tableview.

Lab 3 Page 18

IBM Software

3.5 Running commands and programsAs you know, you can run programs and commands from the Remote Systems view or the Table view inthe following ways:1. In the Remote System Explorer communications server job. (Your current method)2. In a batch job.3. In an interactive job (for 5250 applications).4. In a server job (Multi-threaded action in the menu)Using the first option lets you run the program in the same job as the communications server. With batchand interactive jobs, you cannot monitor the status as easily, however, you do not tie up yourcommunications server and you are notified when the program command ends. Batch jobs work as youwould expect and do not require any initial setup. Running an application as multi-threaded creates a BCIjob and runs the application in that job. Interactive programs require a 5250 emulator, and you need tofirst run a STRRSESVR connectionName command to associate the emulator with a particularconnection in the Remote System Explorer communications server. A multi-threaded run creates a newserver job and this way keeps the RSE communications server job free for other tasks.To start an interactive connection:__1. Start a 5250-emulation session.__2. Sign-on to the server with your User ID and password.

Tip:Instead of the Enter key, you may have to use the Ctrl key in your 5250-emulation session.

__3. In the command line, type the command STRRSESVR connectionName__4. Press Enter.

Page 19 Rational Developer for i V7.5

IBM Software

Tip:The connectionName parameter is the name of your connection defined inthe Remote Systems view. This associates the interactive job with theRemote System Explorer communications server.

Now you are ready to run the program that you just compiled. __5. Return to the workbench.

To run the program:

__6. In the Remote Systems view, locate the PAYROLL program that you created.

Lab 3 Page 20

IBM Software

__7. Right-click the PAYROLL program.__8. Click Run As > Interactive on the pop-up menu.__9. Switch to your 5250-emulation session.You will see the payroll program menu.

__10. Type x beside Employee Master Maintenance.__11. Press Enter.__12. Type 234 for the Employee Number.__13. Type A for the Action Code to add employee 234.__14. Press Enter.__15. Type any information you like about the employee.__16. Press Enter.__17. Play in the application as much as you like.__18. Press F3 to end the applications.To get control of the interactive job:__19. Right-click Objects and click Release Interactive Job on the pop-up menu.

Tip:You can also choose to disconnect a session. You would right-click theconnection and click Disconnect on the pop-up menu.

You ran programs and commands from the Remote Systems view or the Objects Table view.

3.6 Module summaryIn this module you learned how to verify and compile RPG from the Remote Systems LPEX Editor.When errors are found by either the verify or the compile step, the Error List appears. Error List is apowerful tool that manages errors found by verify and compile utilities. You became familiar with thesetools, the various capabilities of the Error List and the RPG program that you created. You also learnedhow to associate an interactive session with your IBM i connection, run your program, and release the

Page 21 Rational Developer for i V7.5

IBM Software

interactive job.

Congratulations!You have successfully completed the introduction to compiling with RDi.

Feel free to exploit the other Labs that are available, the next logical Lab to work through would be

the 'Debug a CL/RPG program member with RDi', Lab04.

More information and material can be found at our RPG CAFEhttp://www-949.ibm.com/software/rational/cafe/community/rpg

Look for the RDi hub

Enjoy Rational Developer for IBM i!

Lab 3 Page 22

IBM Software

Notices© Copyright IBM Corporation 1992, 2009 All rights reserved.

U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP ScheduleContract with IBM Corp.

This information was developed for products and services offered in the U.S.A. IBM may not offer the products,services, or features discussed in this documentation in other countries. Consult your local IBM

representative for information on the products and services currently available in your area. Any referenceto an IBM product, program, or service is not intended to state or imply that only that IBM product, program,or service may be used. Any functionally equivalent product, program, or service that does not infringe any IBMintellectual property right may be used instead. However, it is the user’s responsibility to evaluate and verifythe operation of any non-IBM product, program, or service.

IBM may have patents or pending patent applications covering subject matter described in thisdocumentation. The furnishing of this documentation does not give you any license to these patents. You cansend license inquiries, in writing, to:

IBM Director of Licensing IBMCorporationNorth Castle DriveArmonk, NY 10504-1785 U.S.A.

For license inquiries regarding double-byte (DBCS) information, contact the IBM Intellectual PropertyDepartment in your country or send inquiries, in writing, to:

IBM World Trade Asia Corporation Licensing2-31 Roppongi 3-chome, Minato-ku Tokyo106, Japan

The following paragraph does not apply to the United Kingdom or any other country where such provisionsare inconsistent with local law: INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THISPUBLICATION ″AS IS″ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OR CONDITIONS OF NON-INFRINGEMENT,MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer ofexpress or implied warranties in certain transactions, therefore, this statement may not apply to you.

This information could include technical inaccuracies or typographical errors. Changes are periodically madeto the information herein; these changes will be incorporated in new editions of the publication. IBM maymake improvements and/or changes in the product(s) and/or the program(s) described in this publication at anytime without notice.

Any references in this information to non-IBM Web sites are provided for convenience only and do not in anymanner serve as an endorsement of those Web sites. The materials at those Web sites are not part of thematerials for this IBM product and use of those Web sites is at your own risk.

Licensees of this program who wish to have information about it for the purpose of enabling: (i) the exchangeof information between independently created programs and other programs (including this one) and (ii) themutual use of the information which has been exchanged, should contact:

Page 23 Rational Developer for i V7.5

IBM Software

Intellectual Property Dept. for WebS phere Software IBMCorporation3600 Steeles Ave. EastMarkham, OntarioCanada L3R 9Z7

Such information may be available, subject to appropriate terms and conditions, including in some cases, paymentof a fee.

The licensed program described in this documentation and all licensed material available for it are providedby IBM under terms of the IBM Customer Agreement, IBM International Program License Agreement or anyequivalent agreement between us.

Any performance data contained herein was determined in a controlled environment. Therefore, the resultsobtained in other operating environments may vary significantly. Some measurements may have been made ondevelopment-level systems and there is no guarantee that these measurements will be the same on generallyavailable systems. Furthermore, some measurements may have been estimated through extrapolation. Actual resultsmay vary. Users of this document should verify the applicable data for their specific environment.

Information concerning non-IBM products was obtained from the suppliers of those products, their publishedannouncements or other publicly available sources. IBM has not tested those products and cannot confirm theaccuracy of performance, compatibility or any other claims related to non-IBM products. Questions on thecapabilities of non-IBM products should be addressed to the suppliers of those products.

All statements regarding IBM’s future direction or intent are subject to change or withdrawal without notice,and represent goals and objectives only.

Copyright license

This information contains sample application programs in source language, which illustrates programmingtechniques on various operating platforms. You may copy, modify, and distribute these sample programs inany form without payment to IBM, for the purposes of developing, using, marketing or distributingapplication programs conforming to the application programming interface for the operating platform forwhich the sample programs are written. These examples have not been thoroughly tested under all conditions.IBM, therefore, cannot guarantee or imply reliability, serviceability, or function of these programs.

Each copy or any portion of these sample programs or any derivative work, must include a copyright notice asfollows:

© (your company name) (year). Portions of this code are derived from IBM Corp. Sample Programs. © CopyrightIBM Corp. 1992, 2009. All rights reserved

Trademarks and service marks

The following terms are trademarks or registered trademarks of International Business MachinesCorporation in the United States, other countries, or both.

• i5/OS• IBM• OS/400• Rational• WebSphere

Microsoft, Windows, and the Windows logo are trademarks of Microsoft Corporation in the United States,other countries, or both.

Lab 3 Page 24

IBM Software

Other company, product or service names may be trademarks or service marks of others.

Page 25 Rational Developer for i V7.5