IBM WebSphere Development Studio Client for iSeries Tutorial: Maintaining an ILE RPG application using Remote System Explorer Version 6.0 Contents 1.0 Introduction to this tutorial 1.1 Learning objectives 1.2 Prerequisite knowledge 1.2.1 System Prerequisites 2.0 Introducing Development Studio Client and Remote System Explorer (optional) 2.1 Introducing Development Studio and Development Studio Client 2.2 Introducing iSeries Application Development Tools 2.2.1 Remote System Explorer 2.2.2 LPEX Editor 2.2.3 Shells and Commands in the Remote Command view 2.2.4 Program Verifier 2.2.5 iSeries Debugger 2.2.6 CODE Designer 2.3 Checkpoint 2.4 Recap 3.0 Reviewing the 5250 payroll application (optional) 3.1 Exercise 2.1: Starting the 5250 application 3.2 Exercise 2.2: Maintaining an employee record 3.3 Exercise 2.3: Maintaining a project code 3.4 Exercise 2.4: Maintaining a reason code 3.5 Recap 4.0 Starting Development Studio Client and the Remote System Explorer 4.1 Exercise 3.1: Starting Development Studio Client 4.2 Exercise 3.2: Opening the Remote System Explorer perspective 4.3 Checkpoint 4.4 More practice 4.5 Recap 5.0 Configuring a connection to an iSeries system and connecting to an iSeries 5.1 Exercise 4.1: Configuring a connection to an iSeries system 5.2 Exercise 4.2: Connecting to an iSeries system 5.3 Exercise 4.3: Viewing and accessing objects in the Remote System Explorer perspective 5.4 Exercise 4.4: Opening a second source member 5.5 Exercise 4.5: Displaying an outline of an ILE RPG member 5.6 Checkpoint 5.7 More practice 5.8 Recap 6.0 Editing ILE RPG 6.1 Exercise 5.1: Introducing the editor 6.2 Exercise 5.2: Changing default editor settings 6.3 Exercise 5.3: Entering SEU commands 6.4 Exercise 5.4: Requesting undo and redo operations 6.5 Exercise 5.5: Invoking language-sensitive help 6.6 Exercise 5.6: Prompting language specifications 6.7 Exercise 5.7: Indenting source 6.8 Exercise 5.8: Finding and replacing text 6.9 Exercise 5.9: Filtering lines by string 6.10 Exercise 5.10: Filtering lines by type 6.11 Exercise 5.11: Searching multiple files 6.12 Exercise 5.12: Comparing file differences from the Remote Systems view 6.13 Exercise 5.13: Comparing files in the CODE Editor (optional) 6.14 Exercise 5.14: Checking syntax 6.15 Checkpoint 6.16 More practice 6.17 Recap 7.0 Verifying and compiling ILE RPG 7.1 Exercise 6.1: Verifying the source 7.1.1 Fixing errors 7.1.2 Saving the source member 7.2 Exercise 6.2: Compiling source remotely 7.2.1 Compiling source 7.3 Exercise 6.3: Submitting iSeries commands in the iSeries table view 7.4 Exercise 6.4: Running commands and programs 7.4.1 Starting an interactive connection 7.4.2 Running the payroll program 7.5 Checkpoint 7.6 More practice 7.7 Recap 8.0 Debugging a CL and ILE RPG program 8.1 Exercise 7.1: Introducing the Integrated iSeries Debugger 8.2 Exercise 7.2: Starting the integrated debugger 8.3 Exercise 7.3: Setting breakpoints 8.3.1 Adding a conditional breakpoint 8.4 Exercise 7.4: Monitoring variables 8.5 Exercise 7.5: Stepping into a program 8.6 Exercise 7.6: Listing call stack entries 8.7 Exercise 7.7: Setting breakpoints in PAYROLLG 8.8 Exercise 7.8: Removing a breakpoint in PAYROLLG 8.9 Exercise 7.9: Monitoring variables in PAYROLLG 8.10 Exercise 7.10: Adding a storage monitor 8.11 Exercise 7.11: Setting watch breakpoints 8.12 Exercise 7.12: Closing the debug session 8.13 Checkpoint 8.14 More practice 8.15 Recap 9.0 Exploring Remote System Explorer 9.1 Exercise 8.1: More about the Remote System Explorer 9.2 Exercise 8.2: Creating a library filter 9.2.1 Changing the library filter 9.3 Exercise 8.3: Creating an object filter 9.3.1 Editing a member from your own object filter 9.4 Exercise 8.4: Creating a user action 9.4.1 Specifying user action parameters 9.4.2 Specifying a restriction on a user action 9.4.3 Trying the user action 9.5 Exercise 8.5: Running commands from the Remote System Explorer 9.6 More practice 9.7 Recap 10.0 Designing screens 10.1 Exercise 9.1: Opening a DDS member in the Remote Systems view 10.2 Exercise 9.2: Viewing the DDS tree 10.3 Exercise 9.3: Selecting the DDS object 10.4 Exercise 9.4: Designing the DDS screen 10.5 Exercise 9.5: Creating groups from existing records 10.6 Exercise 9.6: Creating new screens 10.7 Exercise 9.7: Adding fields to the subfile record 10.7.1 Creating an additional column 10.8 Exercise 9.8: Switching between multiple records 10.8.1 Copying the employee name field 10.9 Exercise 9.9: Adding field error handling 10.10 Exercise 9.10: Accessing field properties 10.11 Exercise 9.11: Adding new keywords 10.12 Exercise 9.12: Verifying the source changes 10.13 Exercise 9.13: Switching between designing and editing the screen 10.14 Exercise 9.14: Compiling your source changes and closing the Designer 10.15 Checkpoint 10.16 More practice 10.17 Recap 11.0 Tutorial summary and checkpoint answers Appendix. Notices A.1 Programming interface information A.2 Trademarks 1.0 Introduction to this tutorial The iSeries(TM) server development capabilities of the new integrated development environment (IDE) provides many compelling reasons for you to upgrade from Application Development Toolset (ADTS) or CoOperative Development Environment (CODE). The IDE reduces the learning curve by providing a consistent interface for developing server applications and e-business applications. This allows you to progress to new levels of application development. The IDE delivers on the promise of tool integration with best-of-breed tools from IBM(R) and several partners to support the end-to-end application development life cycle. The IDE also includes a robust, easy-to-use development environment for creating, building and maintaining iSeries RPG, COBOL, C, C++ applications, and Web-enabled applications using the IBM WebFacing Tool. ADTS has been the traditional method for developing and maintaining server-side iSeries applications. But now there is a new set of highly integrated and highly extendible tools for iSeries RPG, COBOL, C, C++, CL and DDS development. These new tools offer you a development experience that is consistent with the experience for developing Java(TM), Web, Web Services, and XML applications. The new tools also allow you to leverage the classic CODE tools for extremely rich editing and DDS design support. These new generation tools offer rich support for exploring the file system, compiling/building, editing, running, and debugging. They offer significant productivity and usability gains, support for disconnected and team development, and a common harness for the tight integration of IBM and partner-supplied tools for server development. In this tutorial you will follow the typical iSeries application development life cycle tasks using a payroll application written in RPG. You will work through a series of exercises that will teach you what the new tools are and how to use them. By the end of this tutorial you will be able to realize significant productivity and usability gains in your iSeries server application development and be on your way to increasing your skills to make the transition into new programming models such as Java, Web, Web Services, and XML. Tutorial purpose Before you begin, take a minute to read the learning objectives for the tutorial. Length of time This tutorial takes approximately 2 hours to complete. Chapters Work on the chapters in sequence. However, you can complete chapters 7, 8 and 9 in any order after chapter 4. The pictures in the chapters show similar tasks. Some of the names and icons may be different from the environment you will be working with when you complete the chapters. Following each chapter it is recommended that you take the checkpoint quiz. Taking each quiz will help you to determine if you have mastered the chapter content and are ready to move on to the next chapter. The quiz answers are included at the end of this tutorial so you can check your answers. Following each chapter checkpoint is an opportunity for more practice. This gives you the chance to apply what you have learned in the exercise. Often you will complete different but similar tasks to what you have just learned in the chapter. The Development Studio Client for iSeries online help can assist you in completing the practice tasks. Prerequisites You should also learn about the prerequisite knowledge for the tutorial before beginning. This section describes the type of knowledge you need to already have to fully benefit from this tutorial. 1.1 Learning objectives In order to successfully edit, compile and debug the sample payroll application, you will need to understand many concepts. This tutorial is designed to help you learn about those concepts while working through maintaining a simple payroll application written in RPG. In this tutorial, you will learn how to take the first step in modernizing your iSeries applications by moving to the next generation of iSeries application development tools. The first application development tool you will learn about is the Remote System Explorer which has its own tools and views. Remote System Explorer is similar to Programming Development Manager (PDM) in that it allows you to drill down to the QSYS file system, or use filters to list specific objects within the QSYS file system. You will learn that the Remote Systems Explorer goes well beyond PDM however! You will learn how to explore iSeries jobs and commands, and the IFS file system. Further, you will learn that it can also be used to explore the file system of remote Linux, UNIX(R) and Windows(R) systems. This tutorial is broken into nine chapters, each with their own specific learning objectives. Each chapter is composed of several exercises. These exercises must be completed in order to successfully achieve the chapter's goals. 2.0, "Introducing Development Studio Client and Remote System Explorer (optional)" introduces you to IBM WebSphere(R) Development Studio for iSeries and describes its relationship to IBM WebSphere Development Studio Client for iSeries. You learn which product makes up the host components and which product makes up the workstation components. You learn about the iSeries application development tools included with Development Studio Client for iSeries. Finally you learn about the Remote System Explorer, the launching point for the iSeries application development tools. 3.0, "Reviewing the 5250 payroll application (optional)" introduces you to the iSeries application that you will be using to demonstrate the features of IBM WebSphere Development Studio for iSeries in this tutorial. 4.0, "Starting Development Studio Client and the Remote System Explorer" helps you learn about the workbench, a perspective, and specifically the Remote System Explorer perspective. You will learn how to start Development Studio Client and how to open the Remote System Explorer perspective. 5.0, "Configuring a connection to an iSeries system and connecting to an iSeries" explains how to create a connection to an iSeries server and select objects using the Remote System Explorer perspective. You will learn the steps to create a connection, how to find a library in the library list and finally how to open a member in the Remote Systems LPEX Editor. You will also learn about several views such as the Remote Systems view, iSeries Table view, and the Outline view. 6.0, "Editing ILE RPG" helps you learn about some of the language features available in the Remote Systems LPEX Editor while you edit ILE RPG source. 7.0, "Verifying and compiling ILE RPG" explains how to verify and compile ILE RPG source in the Remote Systems LPEX Editor. Program verifying and compiling are the final steps in compiling a program or module. When errors are found by either, the iSeries Error List appears. The iSeries Error List is a powerful tool that manages errors found by verify and compile utilities in the Remote Systems LPEX Editor. You will become familiar with these tools, the various capabilities of the iSeries Error List and the RPG program that you will create. 8.0, "Debugging a CL and ILE RPG program" explains the Debug perspective and how to start the debugger, set breakpoints, monitor variables, run and step into a program, view the call stack in the Debug view, remove a breakpoint, add a storage monitor, and set watch breakpoints. 9.0, "Exploring Remote System Explorer" helps you learn more about using the Remote System Explorer perspective to work with the iSeries objects that you used in the previous chapters. You will learn how easy it is to define filters, perform actions and define your own actions. You will learn how Remote System Explorer can organize and integrate your work and make that work easier. 10.0, "Designing screens" helps you learn about the various aspects of the CODE Designer, which you launch from the Remote Systems view, while modifying a display file to add a screen. Be sure to read about the Prerequisite knowledge for the tutorial before beginning. This section describes the type of knowledge you need to already have to fully benefit from this tutorial. 1.2 Prerequisite knowledge In order to complete this tutorial end to end, you should already have working knowledge of the following: * Basic Microsoft(R) Windows operations such as working with the desktop and basic mouse operations such as opening folders and performing drag-and-drop operations. It is also useful, but not necessary, for you to have basic knowledge of the following: * ILE RPG * DDS When you are ready to begin, start with 2.0, "Introducing Development Studio Client and Remote System Explorer (optional)". 1.2.1 System Prerequisites To run this tutorial you will need specific hardware and software. See the section key prerequisites in the Development Studio Client 6.0 announcement letter at http://ibm.com/software/awdtools/iseries. Finally you will need to restore the iSeries save file provided. Go to http://ibm.com/software/awdtools/wdt400/library to find the pdf and savefile for this tutorial. To restore the savefile: 1. Create a save file named RSELABXX in library QGPL or any other library you have access to on the iSeries by typing the following on an OS/400 command prompt: CRTSAVF QGPL/RSELABXX 2. From a DOS Command Prompt window, go to the directory where you downloaded the save file and use FTP to send the RSELABXX.savf file to the iSeries. (press enter after each statement) ftp iSeriesName user id password binary put rselabxx.savf qgpl/rselabxx quit 3. Restore the library on the iSeries by running the following command from an OS/400 command prompt: RSTLIB RSELABXX DEV(*SAVF) SAVF(QGPL/RSELABXX) The library has now been restored to the iSeries. 2.0 Introducing Development Studio Client and Remote System Explorer (optional) In this chapter you will be introduced to IBM WebSphere Development Studio for iSeries and its relationship to IBM WebSphere Development Studio Client for iSeries. You learn which product makes up the host components and which product makes up the workstation components. You recognize the iSeries application development tools included with Development Studio Client for iSeries programmers. You then are introduced to Remote System Explorer the launching point for iSeries application development tools. In order to accomplish these learning objectives, there are several steps that are involved, including: * 2.1, "Introducing Development Studio and Development Studio Client" * 2.2, "Introducing iSeries Application Development Tools" Start with 2.1, "Introducing Development Studio and Development Studio Client" when you are ready to begin. Length of time: This chapter will take approximately 10 minutes to complete. 2.1 Introducing Development Studio and Development Studio Client Development Studio Client is the ideal set of workstation development tools for creating, testing, deploying and maintaining traditional and e-business applications for your iSeries server. Development Studio Client is included with the compiler-based server product, WebSphere Development Studio. The following diagram illustrates the interaction between host and client tools: WebSphere Development Studio Development Studio Client is designed to help you: 1. Develop and maintain iSeries applications using the Remote System Explorer. 2. Develop Web-enabled front-ends to iSeries business logic. 3. Create GUI front-ends to iSeries business logic. Development Studio Client comes in two editions for iSeries programmers. Both editions come with an additional base WebSphere Studio product: * IBM WebSphere Development Studio Client for iSeries includes WebSphere Studio Site Developer. * IBM WebSphere Development Studio Client Advanced Edition for iSeries includes WebSphere Studio Application Developer. Either edition can also coexist with WebSphere Application Developer -- Integration Edition or WebSphere Studio Enterprise Developer (represented by the dotted lines). The following diagram illustrates how Development Studio Client fits into the WebSphere Studio family of products: WebSphere Development Studio Client Site Developer includes support for Web services, XML development tools, and core support for Java and Web development tools. Application Developer provides end-to-end support for the creation and maintenance of J2EE applications and Web services. It also provides extensive support for Enterprise Java Beans and Java Messaging services. 2.2 Introducing iSeries Application Development Tools Now, you know what the two flavors are of Development Studio Client and why you would want to use each one. Next let's look at those next generation iSeries server application development tools mentioned at the beginning of this tutorial. What are they and what do they do? 2.2.1 Remote System Explorer You can manage your development tasks in the Remote System Explorer. This is an enhanced and more flexible workstation version of Program Development Manager (PDM). You can create and manage development projects on your iSeries system from your Windows-based workstation with the Remote System Explorer and iSeries projects. With these tools, you can connect to an iSeries remote host, view iSeries libraries, files, and members. You can also launch the host compilers, the workstation editor, a program verifier and various debuggers all from the Remote System Explorer. This tool also supports other system types, such as UNIX(R), Linux, and Windows. 2.2.2 LPEX Editor Your program editing tasks are simplified with the Remote Systems LPEX Editor. This is a powerful language-sensitive editor that you can customize. Token highlighting of source makes the various program elements stand out. It has SEU-like specification prompts for RPG and DDS to help enter column-sensitive fields. Local syntax checking and semantic verification for your RPG, COBOL and DDS source makes sure it will compile without errors on an iSeries system. If there are verification errors, an Error List lets you locate and resolve problems quickly. On-line programming guides, language references, and context-sensitive help make finding the information you need just a keystroke away. 2.2.3 Shells and Commands in the Remote Command view You can use the Remote Commands view to run and interact with commands and command shells on universal systems. A universal system includes Windows, Linux, and UNIX system types. Specifically, you use the view to: * Run commands in a command shell * Display and interpret the output of a program * Enter input to a program * Display and manage different commands and shells from the same view. Multiple commands can be run in a single shell (one command at a time per shell), multiple shells may be run on a single system, and multiple systems may be running shells. Whenever a command shell is launched or a command is run from the Remote System Explorer, the Remote Commands view displays the output and provides a way to work with that output. 2.2.4 Program Verifier One of the most powerful and unique features of the Remote System Explorer is the Program Verifier. Before you compile your code on an iSeries system, you can ensure that there are no errors by invoking the Program Verifier. The verifier checks for semantic (compile) errors on your workstation so that you can guarantee a clean compile on the iSeries. Think of the host cycles you'll save. It is especially handy when you are writing code but you are disconnected from an iSeries system. You can do this because Remote System Explorer ported the parsing and checking code from the iSeries host compilers to the workstation. The Error List window lists the errors that are found and their severity, inserts the error messages directly into the source and helps you to navigate between the errors. 2.2.5 iSeries Debugger With the Integrated iSeries debugger you can debug an application that is running on an iSeries system. It provides an interactive graphical interface that makes it easy to debug and test your iSeries programs. It is fully integrated into the workbench. You can also set breakpoints before running the debugger, by inserting breakpoints directly in your source while editing. The Integrated iSeries debugger client user interface also enables you to control program execution. For example, you can run your program, set line, watch, and service entry point breakpoints, step through program instructions, examine variables, and examine the call stack. You can also debug multiple applications, which may be written in different languages, from a single debug window. Each session you debug is listed separately in the Debug view. 2.2.6 CODE Designer Using an editor to create and maintain DDS source for your display and printer files can be a frustrating and difficult task. What would be great is a graphical design tool that lets you design your screens and reports visually and then generate the DDS source for you. Well, that's exactly what the CODE Designer does for you. The CODE Designer interface was designed to help the novice DDS programmer create screens, reports and databases quickly and easily without worrying about the details of the DDS language, while at the same time letting the expert DDS programmer get access to all the features and power of the language. CODE Designer is not fully integrated into the workbench, but you can launch it as a separate tool from the workbench. In this tutorial you are going to learn some of the basic features and functions of each of the workbench tools. We are confident that Development Studio Client will save you lots of time and effort in your day-to-day programming tasks. It will make you a more efficient and effective programmer. At the same time, it will save cycles on your iSeries and better yet it will get you ready for the next step and that is moving your iSeries applications to the Web. 2.3 Checkpoint Complete the checkpoint below to determine if you are ready to move on to the next chapter. See 11.0, "Tutorial summary and checkpoint answers" to check your answers. 1. WebSphere Development Studio for iSeries: a. Includes all four host compilers b. Includes all four host compilers and the workstation-based tools named Development Studio Client c. Includes only the workstation-based tools named Development Studio Client 2. WebSphere Development Studio Client for iSeries includes: a. WebSphere Studio Site Developer for e-business development b. Cooperative development environment (CODE) c. VisualAge(R) RPG d. Java tools e. Web tools f. WebFacing tool g. All of the above 3. WebSphere Development Studio Client for iSeries Advanced includes: a. WebSphere Studio Application Developer for e-business development b. Cooperative development environment (CODE) c. VisualAge RPG d. Java tools e. Web Tools f. WebFacing Tool g. All of the above 4. WebSphere Studio Application Developer includes support for: a. Creation and maintenance of J2EE applications b. Creation and maintenance of Web services c. Enterprise Java Beans d. Java Messaging Services e. All of the above 5. WebSphere Studio Site Developer includes support for: a. Web services b. XML development tools c. Java tools d. Web tools e. All of the above 6. The editor can access source files on your workstation or on your iSeries system directly. When a compilation or verify action results in errors, you can jump from the compiler messages to an editor containing the source. The editor opens with the cursor positioned at the offending source statements so that you can correct them. (T, F) 7. You can debug your program running on the iSeries system from your workstation using the Integrated iSeries Debugger. (T, F) 8. Before you compile your code on an iSeries system, you can ensure that there are no errors by invoking the: a. The Remote System Explorer b. CODE Designer c. The IBM WebFacing tool d. The LPEX Editor e. The Integrated iSeries Debugger f. Program Verifier 9. You can use the Remote Commands view to: a. Run commands in a command shell b. Display and interpret the output of a program c. Enter input to a program d. Display and manage different commands and shells from the same view e. All of the above 10. The integrated iSeries Debugger enables you to run your program, set line, watch, and service entry point breakpoints, step through program instructions, examine variables, and examine the call stack. (T, F) 11. The graphical design tool that lets you design your screens and reports visually and then generates DDS source for you is: a. The Remote System Explorer b. CODE Designer c. The IBM WebFacing tool d. The LPEX Editor e. The Integrated iSeries Debugger 2.4 Recap Congratulations! You have completed 2.0, "Introducing Development Studio Client and Remote System Explorer (optional)". You should now understand: * What components make up Development Studio and Development Studio Client editions * What components are included in Application Developer and Site Developer * What tools you use to manage your development cycle tasks * What the benefits are of Remote System Explorer Now that you have this introductory knowledge of Development Studio Client , you can continue with 3.0, "Reviewing the 5250 payroll application (optional)". 3.0 Reviewing the 5250 payroll application (optional) In this chapter, you are going to explore the application by invoking it from a 5250 session and working with the applications green screens and command keys. You will learn about the 5250 application, before you start to use the new iSeries Development tools to maintain it. This will allow you to become familiar with the 5250 screens and the behavior of the application. In order to accomplish these learning objectives, there are several steps that are involved, including: * 3.1, "Exercise 2.1: Starting the 5250 application" * 3.2, "Exercise 2.2: Maintaining an employee record" * 3.3, "Exercise 2.3: Maintaining a project code" * 3.4, "Exercise 2.4: Maintaining a reason code" The exercises in this chapter must be completed in order. Start with 3.1, "Exercise 2.1: Starting the 5250 application" when you are ready to begin. Length of time: This chapter will take approximately 5 minutes to complete. 3.1 Exercise 2.1: Starting the 5250 application To start the payroll application you need a 5250 emulator on your workstation. On the 5250 emulation screen on your desktop, displaying the sign-on screen: 1. Enter your User ID. 2. Enter your password. 3. Type ADDLIBLE RSELABxx in the command line. 4. On the command line of a 5250 screen, invoke the Payroll Application: CALL PAYROLL The application starts and shows the first panel. This first screen asks you to enter an X beside the task you want to accomplish. 5. Choose the task that you want to accomplish. 3.2 Exercise 2.2: Maintaining an employee record To maintain an employee record: 1. Type x beside Employee Master Maintenance. Payroll Start Menu 2. Press Enter. 3. Type 123 for the Employee Number. 4. Type A for the Action Code to add employee 123. 5. Press Enter. 6. Type any information you like about the employee. 7. Press Enter. 8. Play in the employee records as much as you like. 9. Press F4 to return to the maintenance selection. 3.3 Exercise 2.3: Maintaining a project code To maintain a project code: 1. Type x beside Project Master Maintenance. Project Master Maintenance 2. Press Enter. 3. Type 123 for the Project Code. 4. Type A for the Action Code to add project 123. Project Code 123 and Action code A 5. Press Enter. 6. Type any information you like about the project. 7. Press Enter. 8. Play in the project records as much as you like. 9. Press F4 to return to the maintenance selection. 3.4 Exercise 2.4: Maintaining a reason code To maintain a reason code: 1. Type x beside Reason Code Master Maintenance. 2. Press Enter. 3. Type 123 for the Reason Code. 4. Type A for the Action Code to add reason code 123. 5. Press Enter. 6. Type any information you like about the reason code. 7. Press Enter. 8. Play in the reason codes as much as you like. 9. Press F3 to end the PAYROLL program. 3.5 Recap Congratulations! You have completed 3.0, "Reviewing the 5250 payroll application (optional)". You should now understand what all the panels are in the payroll application and how to use them. Continue to 4.0, "Starting Development Studio Client and the Remote System Explorer". 4.0 Starting Development Studio Client and the Remote System Explorer In this chapter you are introduced to the workbench, the workspace, a perspective and specifically the Remote System Explorer perspective. You then learn how to start Development Studio Client and how to open the Remote System Explorer perspective. Remember: Before beginning this chapter, you should learn about the Prerequisite knowledge for the tutorial. In order to accomplish these learning objectives, you are going to complete the following steps: * 4.1, "Exercise 3.1: Starting Development Studio Client" * 4.2, "Exercise 3.2: Opening the Remote System Explorer perspective" The exercises within this chapter must be completed in order. Start with Exercise 3.1 when you are ready to begin. Length of time: This chapter will take approximately 5 minutes to complete. 4.1 Exercise 3.1: Starting Development Studio Client To start Development Studio Client: 1. Click Start on the task bar of your desktop. 2. Select Programs > IBM WebSphere Studio > Development Studio Client Advanced Edition for iSeries 6.0 WDSC AE Note: If the Advanced Edition Version of the product is not installed on your workstation then you will not see the words "Advanced Edition" in the Start menu. 3. A dialog will appear. Here you specify the directory of the workspace where your projects and other resources such as folders, subfolders and files that you are developing in the workbench will reside. Setting Workspace 4. (Optional) Change the field in this dialog and use a unique directory name, for example, RSELABxx (where xx is a unique number). 5. Click OK to open the workbench. RSE Perspective 6. Click the maximize button to maximize the workbench. Maximize window button The workbench refers to the desktop development environment. The workbench aims to achieve seamless tool integration and controlled openness by providing a common paradigm for the creation, management, and navigation of workbench resources. Each workbench window contains one or more views and an editor. 4.2 Exercise 3.2: Opening the Remote System Explorer perspective To open the Remote System Explorer perspective: 1. Check for the name of the perspective. RSE A perspective defines the initial set and layout of views in the Workbench window. Within the window, each perspective shares the same set of editors. Each perspective provides a set of capabilities aimed at accomplishing a specific type of task or working with specific types of resources. For example, the Java perspective combines views that you would commonly use while editing Java source files, while the Debug perspective contains views that you would use while debugging a program. Perspectives contain views and editors and control what appears in certain menus and tool bars. If you see a different perspective, not the Remote System Explorer open in the workbench or no perspective: 2. Click Window > Open Perspective > Remote System Explorer from the workbench menu. Open RSE Perspective The Remote System Explorer perspective opens. You work in the Remote System Explorer perspective in the workbench. This perspective is for an iSeries programmer to display the connections that you have already configured, create a new connection, connect to and disconnect from the connections that you have defined, work with iSeries files, commands, jobs, and integrated file system files. This perspective will be active when you start Development Studio Client with a new workspace. If you had used the workspace before then, the workbench would come up with the perspective that you last opened. You will learn more about the Remote System Explorer perspective in the coming exercises as this is where you launch the iSeries programmer tools and use the views from the workbench. 4.3 Checkpoint Complete this checkpoint to determine if you are ready to move on to the next chapter. See 11.0, "Tutorial summary and checkpoint answers" for the answers. 1. A workspace: a. Aims to achieve seamless tool integration and controlled openness by providing a common paradigm for the creation, management, and navigation of workbench resources. b. Defines the initial set and layout of views in the Workbench window. c. Refers to the desktop development environment. d. Specifies where your projects and other resources such as folders, subfolders and files that you are developing in the workbench will reside. 2. A workbench: a. Aims to achieve seamless tool integration and controlled openness by providing a common paradigm for the creation, management, and navigation of workbench resources. b. Defines the initial set and layout of views in the Workbench window. c. Refers to the desktop development environment. d. Specifies where your projects and other resources such as folders, subfolders and files that you are developing in the workbench will reside. e. A and C 3. A perspective: a. Aims to achieve seamless tool integration and controlled openness by providing a common paradigm for the creation, management, and navigation of workbench resources. b. Defines the initial set and layout of views in the Workbench window. c. Refers to the desktop development environment. d. Specifies where your projects and other resources such as folders, subfolders and files that you are developing in the workbench will reside. 4. Match the perspective with its correct definition: a. Combines tools and views that you would commonly use while editing Java source files b. Contains tools and views that you would use while debugging programs c. Contains tools and views that you would use while developing Web applications d. Contains tools and views that you would use while maintaining iSeries applications. a. Java perspective b. Web perspective c. Remote System Explorer perspective d. Debug perspective 5. In the Remote System Explorer perspective you can: a. Display configured connections b. Create a new connection c. Connect and disconnect defined connections d. Work with iSeries files, commands, jobs, IFS files e. All of the above 4.4 More practice Given your experience in opening the Remote Systems Explorer perspective, now open the Web perspective. See the list of tools and views available to the Web developer. Next open the Java perspective. See the list of tools and views available to the Java developer. Now since you are supposedly in the Java perspective, open the Web perspective. Be careful not to open another Web perspective. Tip: Look in the workbench left-frame for the Web perspective icon. Now close both the Java perspective and the Web perspective. 4.5 Recap Congratulations! You have completed 4.0, "Starting Development Studio Client and the Remote System Explorer". You should now understand: * The concepts of the workbench, the workspace, a perspective and more specifically the Remote System Explorer perspective * How to start Development Studio Client and open the Remote System Explorer perspective Now that you have started Development Studio Client and have opened the Remote System Explorer perspective, you can move on to getting connected to an iSeries system. Continue to 5.0, "Configuring a connection to an iSeries system and connecting to an iSeries". 5.0 Configuring a connection to an iSeries system and connecting to an iSeries In this chapter, you will create a connection to an iSeries server and select objects using the Remote System Explorer perspective. You will learn the steps to create a connection. You will then learn how to find a library in your library list. Finally you open a member in the Remote Systems LPEX Editor. You also learn about several views such as the Remote Systems view, iSeries Table view, and the Outline view. In order to accomplish these learning objectives, there are several steps involved, including: * 5.1, "Exercise 4.1: Configuring a connection to an iSeries system" * 5.2, "Exercise 4.2: Connecting to an iSeries system" * 5.3, "Exercise 4.3: Viewing and accessing objects in the Remote System Explorer perspective" * 5.4, "Exercise 4.4: Opening a second source member" * 5.5, "Exercise 4.5: Displaying an outline of an ILE RPG member" The exercises within this chapter must be completed in order. Start with 5.1, "Exercise 4.1: Configuring a connection to an iSeries system" when you are ready to begin. Length of time: This chapter will take approximately 10 minutes to complete. 5.1 Exercise 4.1: Configuring a connection to an iSeries system When you first open the Remote System Explorer, you are not connected to any system except your local hard drive on your workstation. To connect to a remote iSeries system, you need to define a connection. When you define a connection, you specify the name or IP address of the remote system and you give your connection a unique name that acts as a label in your workspace so that you can easily connect and disconnect. When you connect to the iSeries system, the workbench prompts you for your user ID and password on that host. The first time you connect to an iSeries system, you need to specify a profile. All connections, filters, and filter pools belong to profiles. Filters are described in a later exercise. Profiles are discussed when you create your first connection. Ok, let's get started. Remember you have already opened the Remote System Explorer perspective in the previous chapter. To configure a connection: 1. In the Remote Systems view, New Connection is automatically expanded to show the various remote systems types you can connect to through the Remote System Explorer. Configure a connection Click the plus sign + beside iSeries to configure a connection to an iSeries system. The Name personal profile page opens. Name personal profile 2. Click Next to accept the default value. The profile defaults to the name of the workstation. Your profile will be different from the one shown here. The Remote iSeries System Connection page opens. Connection information page On this second page you specify the information for your connection. The cursor on this page is positioned in the Host Name field. 3. In the Host name field, type the IP address or the name of your host system. The Connection name is automatically filled with the host name. Leave it this way. This name displays in your Remote Systems view and must be unique to the profile. 4. Leave the Parent profile default value. You don't need to change it. 5. Leave the Verify host name check box selected. 6. Click Finish to define your system. 5.2 Exercise 4.2: Connecting to an iSeries system After you configure a connection to an iSeries system, you can easily connect and expand your new connection to reveal your subsystems. Subsystems are pre-defined filters grouping the various types of remote resources that can be explored in the remote system. There are four subsystems. iSeries Objects A PDM-like group, allowing access to libraries, objects and members. iSeries Commands Contains predefined commands and allows you to create command sets each of which contain one or more often used commands. When run, all commands in a command set are sent to the remote system and executed, and the results are logged in the iSeries Commands log view. iSeries Jobs Allow you to see various jobs, subset by job attributes, and to perform a number of operations on those jobs. IFS Files Allow you to explore folders and files in the Integrated File System of the remote iSeries system. Remote Systems view with iSeries connection To connect to an iSeries system: 1. In the Remote Systems view, your new connection is expanded to reveal your subsystems. The iSeries Objects subsystem is the subsystem you will use most often! It is very similar to PDM, in that it allows you to access objects in the QSYS file system, and perform actions on those objects. 2. Notice the first three entries under the iSeries Objects subsystem are named after the PDM options, because they have similar capabilities: * Work with libraries (similar to WRKLIBPDM) * Work with objects (similar to WRKOBJPDM) * Work with members (similar to WRKMBRPDM) In addition there are entries for working with library lists and user libraries: * Library list (to simulate PDMs WRKLIBPDM you can start with the pre-defined Library list filter, that when expanded lists all libraries in your library list.) * User libraries (allows you to work with all user libraries you can access on that iSeries server.) You also have more entries to work with under the connection itself and you can see from these entries that Remote System Explorer goes well beyond PDM! It allows you to explore iSeries jobs and commands and the IFS file system. Now let's work with a library in our library list and add the library that you'll be using in this tutorial: a. Right-click iSeries Objects and click Properties on the pop-up menu. iSeries Objects Properties b. Select Initial Library List on the left pane. c. Type RSELABXX in the Library field and click Add. Set Initial Library List d. Click OK. This will add the library RSELABxx to your library list every time you use this connection. Note: You can also change your library list using the pop-up menu items Add Library List Entry or Change Current Library on the Library list folder in the iSeries Objects subsystem. These changes are only valid until you disconnect. 3. Expand the Library list folder. Expand Library List Now the connection will be activated and you will be prompted for a user ID and password. password window 4. Enter your user ID and password. 5. Select the Save user ID check box. 6. Select the Save password check box. 7. Click OK. As you know, you can use the properties of any of the subsystems to set connection information such as adding a library to a library list. Back in the workbench in the Remote Systems view you will see the libraries in your job's library list. Remote Systems view with libraries in the library list Notice that the s400a folder now has a small green arrow in the icon to indicate it is an active connection. For each library, you can right-click and select from a number of actions. For example, there is an action to create a new source file within the selected library. Common actions like delete, move, copy, etc. are valid for all kinds of objects. 5.3 Exercise 4.3: Viewing and accessing objects in the Remote System Explorer perspective Now you are ready to view and access objects in your library RSELABXX. To view and access an object: 1. Expand library RSELABXX. You will see all objects in this library appear in the Remote Systems view. For each object you can right-click and select from a number of actions. The list of actions depends on the object selected and whether you selected one or multiple objects. For example, for a source file the pop-up menu has an action to create a new member within the selected file. 2. Drill-down through the files in the Remote Systems view until you find QDDSSRC source file and then expand it. 3. Scroll down through the files in the Remote Systems view until you find QRPGLESRC source file and expand it as well. Remote Systems view with expanded source files Now you can see and access the members in these two source files. For each member you can right-click and select from a number of actions. The exact list of actions depends on whether the member is a data file or source file and whether you select one or multiple members. For a RPG source member, the pop-up menu actions include: * open with * browse with * verify * compile Before you go ahead and work with these members, let's see the members in the iSeries Table view as well because that is similar to the view you are used to from PDM. You use this view to display a list of items, for example, members or objects, in a table format similar to PDM. You can also perform actions against these items such as editing and compiling. 4. Right-click the QDDSSRC file and then click Show in Table on the pop-up menu. Select Show in table for QDDSSRC file The iSeries Table view takes the selected object in the Remote Systems view as input, and displays the contents in the table. For source physical files, this step displays the members inside, their names, types, attributes, text descriptions, and status. Table view with lock/unlock button The top of the iSeries Table view contains a lock icon Lock/Unlock buttonthat controls the correlation between the Remote Systems view and the iSeries Table view. If the lock is disabled then whenever you click an object or library in the Remote Systems view, the associated contents of that item automatically populate the iSeries Table view. If the lock is enabled then when you click on various items in the Remote Systems view, this view does not change the content of the iSeries Table view. To enable or disable the lock, you can click it once to change its state. You can click on the columns heading to sort the view by column. 5. In the iSeries Table view toolbar make sure the lock/unlock button Lock/Unlock buttonis in the unlock position. Leave the mouse pointer over the tool button for a second or two to display the flyover help. That way you can check if the view is locked or unlocked. This means now the table will automatically be updated when a different object is selected in the Remote Systems view. This is a shortcut to open the pop-up menu for an object in the Remote Systems view and to select Show in Table. You can also modify which specific columns you want to see in the iSeries Table view. 6. To modify the iSeries Table properties: a. Click Window > Preferences from the workbench menu. The Preferences Window opens. iSeries Table Properties b. In the left pane of the Preferences window, expand Remote Systems. c. Expand iSeries under Remote Systems. d. Click Table View under iSeries. e. In the right pane of the Preferences window, select Last modified in the Available columns list. f. Click the Add button. g. Click OK. Now, let's update the iSeries Table view. h. Click the down arrow on the iSeries Table view title bar. Show customized columns in iSeries Table View i. Click Show columns > Customized in the pop-up menu. Now you'll see the extra column that you've added. Last modified column added You can also sort the objects in the iSeries Table view by column. j. To sort the objects in ascending order by Last modified, click on the heading. Sort columns by date k. If you click the heading the second time, it will sort it in descending order. 7. In the Remote Systems view, select QRPGLESRC. The table shows the members in QRPGLESRC. iSeries Table view for QRPGLESRC Now you are ready to use the Remote Systems LPEX Editor to edit the member MSTDSP found in QDDSSRC. 8. From the Remote Systems view double-click member MSTDSP in the QDDSSRC source file. You can do this in the Remote Systems view or in the iSeries Table view. The Remote Systems LPEX Editor opens. It is built right into the workbench, with rich editing functions and is iSeries aware! It is a superset of SEU! The syntax checker is ported from SEU, and the reference manuals are built-in and F1 cursor sensitive. 9. Double-click the MSTDSP tab to maximize the Editor window. 10. Double-click the MSTDSP tab again to return the view to its original size. Editor in Workbench context 5.4 Exercise 4.4: Opening a second source member Next let's open a second member in the editor. To open a second source member: 1. In the Remote Systems view, double-click member PAYROLL in the QRPGLESRC source file. This member will be loaded into the editor as well. Your Editor window will look something like: Editor with RPG source member and Outline view frame Notice the two tabs in the Editor window. 2. Click on each tab to switch from one edit session to another edit session. Notice the Outline view which you will see in the next exercise. 5.5 Exercise 4.5: Displaying an outline of an ILE RPG member The Outline view acts as an excellent resource when you want to edit RPG and COBOL source in the Remote Systems LPEX editor. The Outline view displays a structural outline of items defined in the file that you currently have open in the Remote Systems LPEX editor window. With the editor active, you can expand the file structure in the Outline view, and click various elements in the view to jump to that location in the source itself. To see an Outline view of your RPG source: 1. Click the PAYROLL tab in the editor and click Refresh on the Outline view toolbar. The Outline view contains your source program in a tree view without the lines containing logic. Outline view with file and record format expanded Now you want to see more details of your source member. 2. Expand Files. 3. Expand the MSTDSP workstation file. 4. Expand the EMPSEL record format. 5. Double-click on any of the entries in the Outline view. This will position the source editor accordingly. Click the tab to give focus to the edit session 6. Stay in the PAYROLL tab to get the PAYROLL Editor window in focus for the next chapter. 5.6 Checkpoint Complete the checkpoint below to determine if you are ready to move on to the next chapter. See 11.0, "Tutorial summary and checkpoint answers" for the answers. 1. When you first open Remote System Explorer, you are not connected to any system except your local workstation. To connect to a remote iSeries system, you need to: a. Start Remote System Explorer communication server b. Start a 5250 session c. Define a connection. Specify the name or IP address of a remote system. d. Define a profile 2. Subsystems include: a. iSeries Objects b. iSeries Jobs c. IFS Files d. iSeries Commands e. All of the above 3. The subsystem iSeries objects includes: a. Work with libraries b. Work with objects c. Work with members d. Library list e. All of the above 4. The iSeries Table view is used to: a. Display a list of items, for example, members or objects in a table format similar to PDM b. Perform actions against a list of items, such as editing and compiling c. Both 5. The lock icon controls the correlation between the Remote Systems view and the iSeries Table view. (T, F) 6. You can maximize the Editor window by double-clicking on its window heading. You can get back to its original size, by double-clicking on the heading again (T, F). 7. The Outline view: a. Displays a structural outline of items defined in the file that you currently have open in the editor b. Lists structural elements c. Shows editor specific contents and toolbar d. All of the above 5.7 More practice Given that you have access to your own iSeries systems, configure a new connection and connect to this iSeries system. Now rename the connection, move the connection up or change the properties of the connection. Then use the iSeries objects subsystem to list the libraries in your library list. Use the iSeries Table View to see the objects in your library. Subset objects in the iSeries Table View. Open the Remote Systems LPEX Editor from the iSeries Table view. Use the Development Studio Client for iSeries online help to assist you in these tasks. 5.8 Recap Congratulations! You have completed 5.0, "Configuring a connection to an iSeries system and connecting to an iSeries". You should now understand: * The concepts of subsystems, the Outline view, the iSeries Tables view, and the Remote Systems view * How to define connection information for an iSeries server * How to select the iSeries Objects subsystem and view the libraries in the library list * How to expand a library and populate the iSeries Table view * How to lock and unlock the iSeries Table view * How to open several source members in the Remote System LPEX Editor * How to maximize the Editor window * How to populate the Outline view and how the Outline view links to the member in the editor. Now that you have opened a member for edit, you can move on to simplifying your editing tasks with the Remote Systems LPEX Editor. Remember you are editing right from the Remote Systems view! And keep in mind you can use SEU like format line rulers, SEU specification prompting and SEU style commands in the Remote Systems LPEX Editor. Continue with 6.0, "Editing ILE RPG". 6.0 Editing ILE RPG In this chapter, you will edit ILE RPG source member PAYROLL, which should already be open and learn about some of the Remote Systems LPEX Editor's language features. In order to accomplish these learning objectives there are several steps involved, including: * 6.1, "Exercise 5.1: Introducing the editor" * 6.2, "Exercise 5.2: Changing default editor settings" * 6.3, "Exercise 5.3: Entering SEU commands" * 6.4, "Exercise 5.4: Requesting undo and redo operations" * 6.5, "Exercise 5.5: Invoking language-sensitive help" * 6.6, "Exercise 5.6: Prompting language specifications" * 6.7, "Exercise 5.7: Indenting source" * 6.8, "Exercise 5.8: Finding and replacing text" * 6.9, "Exercise 5.9: Filtering lines by string" * 6.10, "Exercise 5.10: Filtering lines by type" * 6.11, "Exercise 5.11: Searching multiple files" * 6.12, "Exercise 5.12: Comparing file differences from the Remote Systems view" * 6.13, "Exercise 5.13: Comparing files in the CODE Editor (optional)" * 6.14, "Exercise 5.14: Checking syntax" The exercises within this chapter must be completed in order. Start with 6.1, "Exercise 5.1: Introducing the editor" when you are ready to begin. Tip: You might want to maximize the Editor window during this chapter. Length of time: This chapter will take approximately 20 minutes to complete. 6.1 Exercise 5.1: Introducing the editor Your program editing tasks are simplified with the Remote Systems LPEX Editor. The editor can access source files on your workstation or your iSeries system directly. When a compilation results in errors, you can jump from the compiler messages to an editor containing the source. The editor opens with the cursor positioned at the offending source statements so that you can correct them. Here is a list of some of the basic editor features that you would expect in a workstation editor: * Cut, copy, and paste * Block marking of lines, characters, or rectangles with copy, move, and delete operations * Powerful find and replace function * Unlimited undo and redo In addition there are a few more functions that you may not have seen in a workstation editor: * Token highlighting where different language constructs are highlighted using different colors to help identify them in a program * SEU-like format-line rulers to show the purpose of each column for column-sensitive languages like RPG and DDS. These rulers can automatically update themselves to reflect the current specification. * SEU-like specification prompting for RPG and DDS * Sequence numbers, which allow SEU-style commands in the prefix area * Intelligent tabbing between columns for column-sensitive languages * Automatic uppercasing for languages that expect uppercase * Settings for column-sensitive languages that simplify text insertions and deletions * On-line language reference Now let's try some of these features. 6.2 Exercise 5.2: Changing default editor settings The LPEX Editor has predefined settings, but also has an associated preferences page containing settings that you can modify. The name of the category is LPEX Editor and it appears in the left pane of the Preferences window. Preferences ILE RPG You will change the default settings of LPEX Editor Parsers, Appearance and User Key Actions. LPEX provides special support for insertion and deletion in column-sensitive languages. When column-sensitive editing is selected, each column is considered as a separate entry space. For example, in an RPG source member, if you are inserting or deleting characters into a string that is in the Factor 2 entry, the Result field entry does not move. The default editor preference is that column-sensitive editing is off. You can switch this support on by going to the workbench preferences window. To set preferences: 1. Click Window > Preferences from the workbench menu. The Preferences window opens. Preference window 2. In the left pane of the Preferences window, expand Remote Systems. 3. Expand iSeries under Remote Systems. 4. Select LPEX Editor Parsers under iSeries. The right pane allows you to set preferences for this feature. 5. In the right pane of the Preferences window, select the Column sensitive editing check box. When selected, each column is considered as a separate entry space. 6. In the right pane of the Preferences window, select the Highlight current line check box. This option highlights the line that the cursor is currently on. The option applies to all source files opened in the editor area. 7. In the right pane of the Preferences window, click the button next to Background color. The Color palette opens. 8. Select light yellow from the Color palette. 9. Click OK. The Preferences window shows. Other interesting preference settings are located under LPEX Editor. Appearance allows you to modify color settings and font used by the Editor. a. In the left pane of the Preferences window, expand LPEX Editor. b. Select Appearance under LPEX Editor. c. Select formatLine under the Styles list. d. Change the Foreground color to dark green. e. Change Font to 12. f. Change Background color to light green. Notice how your changes are reflected in the sample edit view. Sample edit view g. If you don't like the changes you made, you can click Restore Defaults to return to the original settings. To modify the default behavior of the Enter key to split the current line in the source instead of creating a new one: a. Expand LPEX Editor then select User Key Actions. Set user key actions b. Type enter in the Key field. Note: The Key and Action fields are case sensitive. Make sure that the values typed in the Key and Action fields are exactly as shown above. c. Type splitLine in the Action field. d. Click Set. 10. Click OK on the Preferences window. Now let's see what this does. Notice that the line the cursor is on is now highlighted in the color you selected for the it in the preference setting for highlight current line. Editor in Insert mode with highlighted line 27 Return to the Editor window. To see what column sensitive editing does: 1. Move the cursor to line 27, column 10. 2. Make sure the editor is in Insert mode. If the status area shows Replace press the Insert key. 3. Press the spacebar 3 times. Notice that only the filename is shifted but none of the other columns to the right are effected. Inserted blanks in file name, none of the other columns has been shifted 4. Press the Backspace 3 times. Once again the filename is shifted but no other columns are effected. To see what splitLine does: 1. Place the cursor somewhere on line 26 and press Enter. The text to the right of the cursor is moved to the next line. 6.3 Exercise 5.3: Entering SEU commands You can configure the LPEX Editor to adopt the keyboard and command personalities of many popular editors. Most editor profiles differ only in the keys and commands used to perform various editor tasks. Some base editor profiles, listed below, also add prefix information and a command area at the start of each line: * ispf * seu * xedit The editor recognizes prefix commands used by these editor profiles. Depending on which profile you are using, you can enter SEU, XEDIT, or ISPF commands when the prefix area is active. If you are an SEU expert you will appreciate the ability to use SEU commands. To enter SEU commands: 1. Move the cursor into the gray sequence number area to the left of the edit area. Gray sequence number area 2. On any sequence number type dd. 3. Go down a few lines and type dd again and press Enter. Notice that the lines have been deleted. 4. Now type i5 in the sequence number area. 5. Make sure the cursor is within the sequence number area. 6. Press Enter. Five new lines are inserted. 6.4 Exercise 5.4: Requesting undo and redo operations The editor records each set of changes you make to a file in the Editor window. The number of changes made since the last file save is displayed on the status line. If you want to undo a set of changes made to a file you use the Undo operation. You can also cancel the effects of an Undo operation by using the Redo operation. Now you are going to undo some of the changes you just made to the file. Then you will cancel the Undo operation by using the Redo operation. Finally you will reload the source so that it is back to its original content. To undo and redo edit changes: 1. Click Edit > Undo from the workbench menu. Notice that the 5 new lines disappear. 2. Press Ctrl+Z to undo the last change. Notice that the deleted lines reappear. 3. Click Edit > Redo from the workbench menu. Notice that the lines are deleted again. At this point you will reload the source from the iSeries to make sure that it is back in its original form. 4. Click File > Close on the workbench menu. Tip: You can also click the X on the PAYROLL tab. Click X to close the Payroll source A Save Resource dialog opens asking if you want to save the latest changes. Confirmation window 5. Click No. 6. Go back to the workbench to the Remote Systems view and open the PAYROLL member in the QRPGLESRC file. 6.5 Exercise 5.5: Invoking language-sensitive help Inside the editor, there is cursor-sensitive language-reference help available. This help is invaluable if you cannot remember the order of fields in an RPG specification or the allowed values for a variable field. This help is available from the LPEX Editor window. To receive language sensitive help, press F1 in an Editor window. If the cursor is on an operation code, you receive help for that operation code; otherwise, you receive help for the current specification. To access language sensitive help: 1. Position the cursor over the word MOVE in line 112 of the ILE RPG source. 2. Press F1. Language-sensitive help for the MOVE operation code appears in a Help window. Text marked in blue in the Help window contains the link to detailed information about the topic in blue. Help for MOVE 3. Click the link Date Data Type. The Help page for Date Data Type is displayed. Help for Date Data Type 4. Play around in the Help window to see what else is available. 5. Minimize the Help window. 6. Select Help > Help Contents on the workbench menu to see a list of all help that is available in the product. Main Help 7. In the left pane of the Help window, click Reference. 8. Expand Language Reference. 9. Expand iSeries programming information. 10. Expand High-level languages. 11. Expand ILE RPG. 12. Select Language Reference. 13. Scroll down to Moving Date-Time Data. Finding the RPG IV manuals Having the latest version of the manuals at your fingertips will make it easier to find programming information. There is also the option to search the help by specifying a search string. By default, the complete help will be searched. To limit the search to specific documents: 1. Click Search scope. The Select Search Scope dialog opens. 2. Select Search only the following topics radio button. Setting the search scope 3. Click New. The New Search List dialog opens. Creating the search topic list 4. In the List name field, type MyList for example. 5. Expand Reference. 6. Select the Language Reference check box. 7. Click OK on the New Search List dialog. The Select Search Scope dialog reopens again with MyList selected in the topic list. Search List dialog with Mylist 8. Click OK on the Select Search Scope dialog. 9. In the Search field, type iSeries and programming for example. Completing the search query 10. Searching requires a help index and it takes approximately 10 minutes to create the index in your workspace. If you want to complete the search query, click GO. The search results display. Search results 6.6 Exercise 5.6: Prompting language specifications Instead of entering or changing code directly in the Editor window, you can use prompts. When you request a prompt for a specification line, a window appears where you can enter or change that line using entry fields. To access prompts: 1. Return to the workbench. In the Editor window move your cursor to the D-spec on line 33. 2. Press F4 (You can also click Source from the workbench menu and then click Prompt). You see the iSeries Source Prompter at the bottom of the workbench. The iSeries Source Prompter shows the specification line broken down into its individual fields. Prompt window On the iSeries Source Prompter toolbar you can use the three push buttons to: Disable source prompt view, Disable syntax checking, and Change to insert mode. To display context sensitive help for any field in the iSeries Source Prompter: 1. Tab to the Keywords field. 2. Press F1 to see help for this field. The Help window with help for the D spec keywords opens. If it doesn't appear automatically, you might have to bring it to the foreground by clicking on its icon on the Windows taskbar. Prompt help You will see words in the help that appear in a different color than the regular text. These are help links, and they show that there is additional help available on that word or phrase. 3. Click on any link to see specific help for that item. 4. Minimize the Help window. 5. In the workbench, double-click the PAYROLL tab to return the Editor window to its original size. 6.7 Exercise 5.7: Indenting source When editing ILE RPG source, it can be difficult to determine the beginning and ending of constructs. The iSeries Indent view allows you to see your source with constructs in an indented mode. To indent source: 1. Click Source > Show Indentation from the workbench menu. The iSeries Indent view opens at the bottom of the workbench. Indent view at bottom of workbench You can display the iSeries Indent view as a full view. 2. Double-click the iSeries Indent view title bar. Maximized Indent view 3. Scroll down to line 150. The Row shown on the status bar is the cursor position. In the iSeries Indent view you see some nested conditions with indented lines. As you will notice this helps to recognize the beginning and ending of these conditions. Note: The Indented view is Browse mode only and cannot be edited. 4. Click the X in the top right corner of the view to close the iSeries Indent view. 5. This returns you to the Editor window with the PAYROLL program. 6.8 Exercise 5.8: Finding and replacing text The LPEX Editor also has a powerful find and replace text feature. You use the Find and Replace window to search for an item. You can search for a word, a partial word, or a sequence of such. You can also enter a pattern you want to match, provided that the pattern follows the rules of regular expression. You can replace the found search item. If the entered text or pattern is found, the cursor moves to either the next or previous occurrence of the search item, according to your chosen search direction, and replaces the found text according to your selections. To find and replace text: 1. Press Ctrl+Home to go to the top of the file. Tip: When you press Ctrl+Home to go to the top of a file or Ctrl+End to go to the bottom of a file, a quick mark is set at your cursor position. This allows you to return to that line by pressing Alt+Q. Ctrl+Q will set a quick mark. 2. Click Edit > Find/Replace from the workbench menu or press Ctrl+F. The Find/Replace window opens at the bottom of the Editor window. Find/Replace window At the bottom of this window, you will notice that you have some options to select from, for example, search only in certain columns, etc. You want to find the first occurrence of BEGSR. 3. In the Find field, enter BEGSR to find the start of a subroutine. 4. Make sure the Replace field is blank. You would use this field for text replacement. The Editor moves the active line to line 52, which contains the first BEGSR phrase in the file. 5. Click Next to go to the next location of BEGSR in the file. 6. Click in the Editor window to close the Find/Replace window. 6.9 Exercise 5.9: Filtering lines by string The editor allows you to filter or subset your source so that you see only lines containing a given string. Filtering lines makes it quick and easy to find lines without having to scroll through your source. To filter source by string: 1. Double-click the variable EMPAPL in the Editor window. 2. Select Edit > Selected > Filter Selection from the workbench menu. Editor window showing all lines with BEGSR phrase 3. Move the cursor down a few lines to line 79. 4. Expand line 79. This expands the section up to the next instance of EMPAPL. Section expanded Now you want to show the entire source again. 5. Click Edit > Show all from the workbench menu or press Ctrl+W. Your cursor is still positioned on the same line that you moved the cursor to, even though all lines are now showing. 6.10 Exercise 5.10: Filtering lines by type To help you navigate quickly through your ILE RPG source the editor allows you to filter lines based on the line type. Imagine you want to see where all the subroutines are defined in your source. Editor pop-up menu with Filter sub menu To filter lines by type: 1. Right-click in the Editor window with the PAYROLL program. 2. Click Filter view > Subroutines on the pop-up menu. All source lines with BEGSR or ENDSR are displayed allowing you to move quickly and easily to the desired subroutine in your file. Subroutine filter in action 3. Move your cursor to the line with the subroutine declaration CHGCDE (line 444). 4. Expand the declaration to show all lines in this subroutine. Now you could work with the source inside this subroutine. 5. Right-click in the Editor window and click Show All on the pop-up menu. 6.11 Exercise 5.11: Searching multiple files If you would like to search through the members in a source physical file or through the files in a local directory, you can use the Search tool. The Multi-File Search utility allows you to search for a particular string of text in many members on the host. This function can also be used on local files. To search multiple files: 1. Click Search > iSeries from the workbench menu. Search > iSeries The Search window opens. 2. In the Search string field, type ENHRS. File Search window The Connection field should contain your iSeries server name, otherwise enter it there. 3. Under Target in the Library field, type RSELABXX. 4. Under Target in the File field, type QDDSSRC to search all members in this source physical file. 5. Under Target in the Member field, select *ALL. 6. Click Search. The Multi-File Search window lists all the lines in all the files that reference ENHRS. Search result 7. Double-click the last line in the list. A ENHRS 3 1 TEXT('EMPLOYEE NORMAL WEEK HOURS') The member REFMST is automatically loaded into the editor and the cursor is placed on the correct line. REFMST loaded into the editor 8. Click the X in the REFMST tab to close the REFMST file. 6.12 Exercise 5.12: Comparing file differences from the Remote Systems view If your product undergoes many changes, you will find the Compare utility useful. It allows you to compare different versions of a program and find the differences. There are two ways to do a compare: use the Compare utility in the workbench or use the Compare utility in the CODE tool. The compare in the CODE tool is more intuitive but requires you to start the CODE Editor outside of the workbench. Using the compare utility in the workbench you can view the differences between two files by comparing them. You can compare different files, and you can compare versions in the Workbench with versions in the repository or with the local edit history. After a comparison is carried out, the Compare Editor opens in the editor area. In the compare Editor, you can browse through all the differences and copy highlighted differences between the compared resources. You can save changes to resources that are made in the comparison editor. Using the compare utility in CODE you can also view the differences between two files by comparing them. You enter a name of a file to compare against the file in the CODE Editor view. You can type the name of a file, or you can select one from the list of files already open in the editor. If you type the name of the file that is not already open in the editor, it is loaded into the editor. If no file is specified, the current file is compared against a new, untitled file. The current file appears on the left side of the Compare view, and the specified file on the right. You use the Compare menu to view the next and previous mismatch and to select options such as ignore case, font, protect view and show mismatches only. Note: Make sure all lines show in the source before starting the Compare tool. To compare files in the workbench: 1. Click Window > Preferences from the workbench menu. The Preferences window opens. 2. In the left pane of the Preferences window, expand LPEX Editor. LPEX Preference 3. Click Compare under LPEX Editor. In the right pane of the Preferences window make sure that the Ignore blanks check boxes are selected. 4. Click OK in the Preferences window. 5. Back in the Editor window of the PAYROLL member double-click the PAYROLL tab. 6. Click Edit > Compare > Compare on the workbench menu. Compare The Compare window opens. 7. Expand your connection. 8. Expand *LIBL. 9. Expand RSELABXX. 10. Expand QRPGLESRC. 11. Select member PAYROLLG. 12. Click OK. Compare window The editor now will show the differences of these two members PAYROLL and PAYROLLG . You can move from mismatch to mismatch by using the Compare menu under the Edit menu. Mismatches in PAYROLL and PAYROLLG are highlighted in different colors so that you know where the mismatched lines are in each file. Compare results Next, end the compare session. 13. Click Edit > Compare > Clear from the workbench menu. 14. Double-click the PAYROLL tab to return the Editor window to its original size. 6.13 Exercise 5.13: Comparing files in the CODE Editor (optional) The CODE tool provides a side-by-side view of the members being compared. If you prefer this type of view follow the steps described next. You might want to skip this section if the Compare Tool you just used provides sufficient information for you. Now you will open a couple of files and edit them and use the CODE compare utility. To compare files in the CODE Editor: 1. In the Remote Systems view, right-click member PAYROLL in QRPGLESRC. 2. Click Open With > CODE Editor on the pop-up menu. This opens the CODE Editor window with the PAYROLL member. It will open in browse mode since it is locked by the LPEX Editor session. 3. In the CODE Editor, open the PAYROLLG member. 4. Click File > Open from the CODE Editor menu. The Select file - Open for Edit dialog opens. Select file -- Open for Edit dialog 5. In the left pane of the Select file - Open for Edit dialog expand the R0S400A connection (the Remote System Explorer connection). 6. Expand library RSELABXX. 7. Select file QRPGLESRC. 8. In the right pane of the Select file-Open for Edit dialog, select member PAYROLLG from the member list. 9. Click OK. 10. Click Actions > Compare from the CODE Editor menu. The Compare dialog opens: Compare dialog All entries are preloaded. 11. Click Compare. The editor now has the PAYROLLG member loaded on the left and member PAYROLL loaded on the right. In between the two members are two long vertical blue lines with horizontal yellow and red bars highlighting the differences in these members. Compare of two files 12. Use the vertical scroll bars to move within the files. As you scroll, you will see where the differences are in the members. RPG experts will notice that PAYROLL has some errors in it. You will fix these in a few moments. 13. Click Compare > Exit Compare from the CODE Editor menu (which was inserted while performing this action). The CODE Editor window re-opens. Close the CODE Editor. 14. Click File > Exit from the CODE Editor menu. The workbench re-opens. Continue working in the workbench. 6.14 Exercise 5.14: Checking syntax One of the powerful features that the LPEX Editor shares with SEU is its ability to syntax check your source. Syntax checking can be done either when the cursor leaves each line of source or all at once on either the currently selected source or on the entire source member. Now you will create a syntax error and watch for the prompt to correct it. To syntax check the file: 1. In the PAYROLL Editor window move the cursor to line 211 which contains EXSR ACDESR. You might already be on that line but if not, type the line number in the sequence number column, or scroll down. 2. Append an X to the EXSR op-code to make it EXSRX. 3. Move the cursor off of the line. An error message appears to draw attention to the error. Editor window with syntax error 4. Move the cursor onto the pink error message. 5. Press F1. Second level help for syntax error This opens a window with second level help for the error. 6. Minimize the Help window. 7. Change EXSRX to EXSR to correct the error. (Similarly, you can use Edit > Undo to correct this). 8. Move the cursor off the line you just fixed. The error message is automatically removed from the editor. Tip: You can toggle automatic syntax checking. Click Window > Preferences from the workbench menu and then expand Remote Systems, iSeries, LPEX Editor Parsers and select the language you want to change the settings for in the left pane of the Preferences window, select the Automatic syntax checking check box and then click OK. Tip: You can syntax check the whole source member currently in the editor by clicking Source > Syntax Check All. Preferences window to turn syntax checking on or off 6.15 Checkpoint Complete the checkpoint below to determine if you are ready to move on to the next chapter. See 11.0, "Tutorial summary and checkpoint answers" for the answers. 1. When column sensitive editing is selected: a. Each column is considered a separate entry space b. If you are inserting or deleting characters into a string that is in the Factor 2 entry, the result field entry does not move c. The default editor preference is that column sensitive editing is off d. All of the above 2. The LPEX Editor has predefined settings, but also has an associated preference page containing settings that you can define. (T, F) 3. LPEX Editor preferences are set in the: a. Preferences window b. Editor window c. New wizard d. Remote Systems view 4. You can configure the LPEX Editor to adopt the keyboard and command personalities of many popular editors. (T, F) 5. If you want to undo a set of changes made to a file you must use the _______ operation. Name the operation. a. Insert b. Replace c. Redo d. Undo 6. You can also cancel the effects of an undo operation by using the _______ operation. Name the operation. a. Insert b. Replace c. Redo d. Undo 7. This help is invaluable if you cannot remember the order of fields in an RPG specification or the allowed values for a variable field. Name the help. Choose the best answer. a. Context sensitive help b. Language sensitive help c. Display help d. Field help 8. To receive language sensitive help, press the ____ key in an Editor window. Name the key: a. F2 b. F3 c. F1 d. F4 9. If the cursor is ________ an operation code, you receive help for that operation code; otherwise, you receive help for the current specification. a. before b. after c. on d. off 10. Instead of entering or changing code directly in the Editor window, you can use ________. a. Prompts b. Filters c. SEU commands d. Format line e. All of the above 11. The ______ view allows you to see your source with constructs in an indented mode. By default, the ________ view will show the indented view in the bottom pane. a. Outdent b. iSeries Indent c. Edit 12. The iSeries Indent view is browse mode only and cannot be edited. (T, F) 13. You use the _______ window to search for an item in the current source. Choose the best answer. a. Search b. Find c. Edit d. Find/Replace 14. You can search for: a. A word b. A partial word c. A sequence of words d. A pattern if it follows the rules of regular expression e. All of the above 15. The LPEX Editor allows you to ____ or subset your source so that you see only lines containing a given string. a. search b. find c. sort d. filter 16. To help you navigate quickly through your ILE RPG source the editor allows you to filter lines based on the _________. Choose the best answer. a. string b. line type c. both 17. If you would like to search through the members in a source physical file or through the files in a local directory, you can use the _______ tool. Choose the best answer. a. Compare b. Search c. Find d. Edit 18. The ________ tool allows you to compare different versions of a program and find the differences. Choose the best answer. a. Convert b. Migrate c. Compare d. Search 19. There are two ways to compare files. They are Compare tool in the workbench and the Compare tool in the CODE Editor. (T, F) 20. Syntax checking can be done either when the cursor leaves each line of source or all at once on either the currently selected source or on the entire source member. (T, F) 6.16 More practice Given your experience using the Remote Systems LPEX Editor, try these new tasks: Check out how token highlighting works in your ILE RPG source. Display a format line and use it to enter your source. Filter source by comments. Set auto-uppercase on. Use the Development Studio Client for iSeries online help to assist you in these tasks. 6.17 Recap Congratulations! You have completed 6.0, "Editing ILE RPG". You should now understand: * The benefits of each language editing feature * How to do column sensitive editing * How to enter SEU commands * How to undo and redo editing * How to access help for language elements * How to prompt on language elements * How to indent source * How to find and replace language elements * How to filter the source by string and by line type * How to search files * How to compare files * How to syntax check files Now that you have mastered editing source, you can move on to verifying your source to ensure you have a clean compile on the iSeries system. This approach saves you iSeries cycles! And you perform both verify and compile from the Remote Systems view! Continue to 7.0, "Verifying and compiling ILE RPG". 7.0 Verifying and compiling ILE RPG In this chapter, you will learn how to verify and compile RPG in the Remote Systems LPEX Editor. When errors are found by either the verify or the compile step, the iSeries Error List appears. The iSeries Error List is a powerful tool that manages errors found by verify and compile utilities. You will become familiar with these tools, the various capabilities of the iSeries Error List and the RPG program that you have created. In order to accomplish these learning objectives, there are several steps that are involved, including: * 7.1, "Exercise 6.1: Verifying the source" * 7.2, "Exercise 6.2: Compiling source remotely" * 7.3, "Exercise 6.3: Submitting iSeries commands in the iSeries table view" * 7.4, "Exercise 6.4: Running commands and programs" The exercises within this chapter must be completed in order. Start with 7.1, "Exercise 6.1: Verifying the source" when you are ready to begin. Length of time: This chapter will take approximately 10 minutes to complete. 7.1 Exercise 6.1: Verifying the source Now 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 iSeries, you can make certain that there are no errors by invoking the Program Verifier. The verifier checks for semantic (compile) errors on your workstation so that you can guarantee a clean compile on the iSeries. Think of the host cycles you'll save. It is especially handy when you are writing code but you are disconnected from an iSeries. You can do this because Remote System Explorer ported the parsing and checking code from the iSeries system compilers to the workstation. The iSeries Error List view lists the errors that are found and their severity, inserts the error messages directly into the source and helps you to navigate between the errors. To invoke the verifier: 1. 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 tool button -- you need the source in the editor for the button to appear.) After a moment the verifier will display an iSeries Error List below the Editor window. Verifier error list The error list shows you: * The error message itself * The severity * The line number * The source location * The connection name 7.1.1 Fixing errors Next you will fix the errors in your source. To fix an error in your source go to the error list: 1. 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 the correct name is the content assist. Content Assist Note: The Outline view must be populated to use content assist. 2. Select the misspelled variable and press CRTL+spacebar. If the variable starts correctly the selection presented contains the correct name. 3. 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. Outline view with expanded fields The next error is a RNF7030 as well. 4. Double-click RNF7030. Fix it in the editor. 5. RSNTAX should really be RSNTAG. Make the appropriate change. 6. 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. It shows the same line number, which is an indication that both errors are related. 7. Double-click RNF5184. 8. 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. The only serious remaining error is RFN5178. This error is caused by a missing ENDSR. Note: The verifier could not determine where the ENDSR is missing so the line number reported is 1, for this reason you can't just double-click on the error message. You need to investigate where the missing statement belongs. You can use the Indent view to determine where the ENDSR is missing. 9. Move to line 398 in the editor. ENDSR commented out by mistake 10. Remove the asterisk (*) from the C-spec. You can use the Tab key to quickly move to the appropriate column. All the non-informational errors are now fixed. You can filter out messages according to these severities by using the filter menu. Filter for severity levels 11. Click the arrow in the iSeries Error List title bar. 12. Click Show Severity on the pop-up menu. 13. Clear the severities you don't want to see in the list (Warning for example). 7.1.2 Saving the source member Now before you loose any of your changes, it's a good idea to save them. Make sure the PAYROLL member is selected. You then verify the source again to make sure that all the errors are fixed. You can save the member using one of these ways: 1. Click File > Save from the workbench menu. 2. Click the Save icon save icon in the workbench toolbar. 3. Press Ctrl+S. Changes are uploaded to the iSeries. 4. Verify your source again. Error list, only informational message are left Everything should be ok. You should see informational messages only. You are ready to compile the program. 7.2 Exercise 6.2: Compiling source remotely The remote compile capability is part of the Remote System Explorer. It gives you a workstation interface to submit requests to compile, bind, or build objects on the iSeries host. It allows for easy access to 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 iSeries cycles. However, if there are errors, the host compiler will send the error information back to the workstation and they will be loaded into the iSeries Error List view, which behaves just as it did when you did a program verify. The default for compiling programs is to submit the compile to the batch job queue. Here in this exercise you can run the compile interactive. To change the preferences to run the compile interactive: 1. Click Window > Preferences from the workbench menu. Change Compile command default 2. In the left pane of the Preferences window, expand Remote Systems. 3. Expand iSeries under Remote Systems. 4. Click Command Execution under iSeries. 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. 7.2.1 Compiling source You will now use the prompt for the CRTBNDRPG command to specify your compile parameters. All entry fields pertaining to names are already filled in with the correct information. To compile source: 1. Right-click the PAYROLL member in QRPGLESRC. Select member to compile 2. Click Compile (Prompt) > CRTBNDRPG on the pop-up menu. The Create Bound RPG Program (CRTBNDRPG) dialog opens. 3. In the Debugging views list, select the *ALL parameter. Prompt for CRTBNDRPG If you want to see the other parameters available, click Advanced. 4. Click OK when you are finished. The progress bar on the workbench (bottom right corner) will indicate that the compile runs. Then the error list will be shown, with no errors, just information messages. If you are not sure that the compile was successful, you can check the iSeries Commands Log. iSeries Command Log 5. Click the iSeries Commands Log tab at the bottom of the workbench. This log shows a list of all commands run on the remote system and the messages returned for each command. 7.3 Exercise 6.3: Submitting iSeries commands in the iSeries table view You can use the iSeries Table view inside the Remote System Explorer to submit commands to the iSeries. You can run commands from the Commands field beneath the iSeries Table view, and view messages in the Messages field. After you populate the table, you can enter a command and click either Prompt to specify parameters and then Run, or just click Run. When you run a command, the Messages field is populated with the messages from the command. When you select a message, the Details button is enabled. When you click this button, the message and its help is displayed. Also note that besides the iSeries Table view, you can also use the Remote Systems view to run commands and programs. Which one you choose depends on your personal preference. In the iSeries Table view, you can see the properties of all items at the same time; they are displayed as rows across the table. In the Remote Systems view, you have greater ease of navigation; you can work from your Library list in the iSeries Objects subsystem, and you can see the contents of many items before selecting the one you want to run. In the Command field, you select where you want to run the command. The choices are Normal, which means that the command will run in the RSE communication server job, Batch or Interactive. To change the library list: iSeries Table view with command entry 1. Click the iSeries Table View tab from the views at the bottom of the workbench. 2. In the Command field type, CHGCURLIB RSELABXX for example. Note: Use a library that is on your iSeries system. 3. Click Run. If you haven't used the iSeries Table view to show iSeries objects in this view you will get this error message because the table view is not linked to an active connection. Error message when using iSeries Table view without active connection If you see this message, click OK. a. In the Remote Systems view, right-click QRPGLESRC. Select Table view to connect it to iSeries b. Click Show in Table on the pop-up menu. The table view is now populated with the member in the selected source file. c. Run the CHGCURLIB command again. The command will run on the iSeries and after completion you will see the completion message on the bottom of the iSeries Table view. Completion message for command 4. Back in the workbench in the Remote Systems view, right-click Library list and click Refresh. Refresh Library list to see current library 5. You will see a small green asterisk beside the RSELABxx library to indicate it as your current library. 6. You can also connect to other than iSeries systems with the Remote System Explorer and launch commands for these systems as well, for example, your local system, or LINUX. 7.4 Exercise 6.4: Running commands and programs As you know already, you can run programs and commands from the Remote Systems view or the iSeries Table view in three ways: 1. In the Remote System Explorer communications server job. This is the one you are using currently. 2. In a batch job. 3. In an interactive job (to test 5250 applications). Using the first option lets you run the program in the same job as the communications server. With batch and interactive jobs, you cannot monitor the status as easily, however, you do not tie up your communications server and you are notified when the program command ends. Batch jobs work as you would expect and do not require any initial setup. Interactive programs require a 5250 emulator, and you need to first run a STRRSESVR connectionName command to associate the emulator with a particular connection in the Remote System Explorer communications server. 7.4.1 Starting an interactive connection To start an interactive connection: 1. Start a 5250-emulation session. 2. Sign-on to the iSeries with your User ID and password. Note: Instead of the Enter key, you may have to use the Ctrl key in your 5250-emulation session. Start Remote System Explorer interactive connection 3. In the command line, type the command STRRSESVR connectionName RMTLOCNAME(*RESOLVE) 4. Press Enter. The connectionName parameter is the name of your connection defined in the Remote Systems view. This associates the interactive job with the Remote System Explorer communications server. The *RESOLVE keyword will get the IP address of your workstation and with this information the Remote System Explorer communications server will communicate with the Remote System Explorer daemon that runs on your workstation. Notes: a. The connection name is case sensitive and must already be defined in the Remote System Explorer. Remote System Explorer connection screen b. This screen will stay this way. Don't wait for it to finish. This session is the interactive session for interactive commands started from the Remote System Explorer. c. If you try to run an interactive command without running the STRRSESVR command on your 5250 screen first, you will get prompted with a message. The message will be removed automatically, once the interactive connection has been established. 7.4.2 Running the payroll program Now you are ready to run the PAYROLL program that you just compiled. Return to the workbench. To run the payroll program: Run program interactive 1. In the Remote Systems view, locate the PAYROLL program that you created. 2. Right-click the PAYROLL program. 3. Click Run As > Interactive on the pop-up menu. 4. Switch to your 5250-emulation session. You will see the payroll program menu. Payroll Start Menu 5. Type x beside Employee Master Maintenance. 6. Press Enter. 7. Type 234 for the Employee Number. 8. Type A for the Action Code to add employee 234. 9. Press Enter. 10. Type any information you like about the employee. 11. Press Enter. 12. Play in the application as much as you like. 13. Press F3 to end the PAYROLL program. 14. To get control of the interactive job, right-click iSeries Objects and click Release Interactive Job on the pop-up menu. You can also choose to disconnect a session or disconnect all sessions. You would right-click the connection and click Disconnect or Disconnect All on the pop-up menu. 7.5 Checkpoint Complete the checkpoint below to determine if you are ready to move on to the next chapter. See 11.0, "Tutorial summary and checkpoint answers" for the answers. 1. The ______ tool checks for semantic (compile) errors on your workstation so that you can guarantee a clean compile on the iSeries. a. Compile b. LPEX Editor c. Program Generator d. Program Verifier 2. The ____________ view identifies each error with the severity level of the error, the ID of the error, the message, the severity, the line in the source member that caused the error, the location of the source member that produced the error, and the connection name. a. Remote Systems b. Outline c. Navigator d. iSeries Error List 3. You can sort the entries in the iSeries Error List view by: a. ID b. Message c. Severity d. Line e. Location f. Connection g. All of the above 4. If you used the local program verifier, then your host compiles should be successful; no wasted iSeries cycles. (T, F) 5. A compile command can be run on an iSeries server from the Remote System Explorer, and you can retrieve error feedback from the compile. (T, F) 6. From the iSeries Table view you can: a. List and sort libraries, objects, and members b. Copy, rename, delete, edit, compile and run (for programs), open with and browse (for members) in the view from the pop-up menu c. Transfer files from one system to another d. All of the above 7. You can run programs and commands from the Remote Systems view or the iSeries Table view in: a. A Remote System Explorer communications server job b. A batch job c. An interactive job d. All of the above 8. Interactive programs require a 5250 emulator, and you need to first run a STRRSESVR connectionName command to associate the emulator with a particular connection in the Remote System Explorer. (T, F) 7.6 More practice Given your experience using the Program Verifier and Compile command, and that you have your own RPG source on your own iSeries system, try these new tasks: Check out Compile (Prompt) Work with Compile commands. Assuming you receive errors in your source (add some errors into your source if you don't have any) when you verify your source, choose insert all error messages into the editor from the Error list. Use the Development Studio Client for iSeries online help to assist you in these tasks. 7.7 Recap Congratulations! You have completed 7.0, "Verifying and compiling ILE RPG". You should now understand: * The purpose of the Program Verifier, iSeries Error List and the iSeries Table view * How to invoke the Program Verifier from the Remote Systems view * How to view and fix errors using the iSeries Error list * How to save the fixed source * How to run a remote compile from the Remote Systems view * How to use the iSeries Table view to enter an iSeries command * How to start an interactive connection to the iSeries * How to run a program from the Remote Systems view Now that you know how to verify and compile RPG source from the Remote Systems view, you can move onto debugging your payroll program. Continue to 8.0, "Debugging a CL and ILE RPG program". 8.0 Debugging a CL and ILE RPG program In this chapter, you will review the Debugger features. You then learn how to start the debugger, set breakpoints, monitor variables, run and step into a program, view the call stack in the Debug view, remove a breakpoint, add a storage monitor, and set watch breakpoints and all from the Debug perspective. In order to accomplish these learning objectives, there are several steps that are involved, including: * 8.1, "Exercise 7.1: Introducing the Integrated iSeries Debugger" * 8.2, "Exercise 7.2: Starting the integrated debugger" * 8.3, "Exercise 7.3: Setting breakpoints" * 8.4, "Exercise 7.4: Monitoring variables" * 8.5, "Exercise 7.5: Stepping into a program" * 8.6, "Exercise 7.6: Listing call stack entries" * 8.7, "Exercise 7.7: Setting breakpoints in PAYROLLG" * 8.8, "Exercise 7.8: Removing a breakpoint in PAYROLLG" * 8.9, "Exercise 7.9: Monitoring variables in PAYROLLG" * 8.10, "Exercise 7.10: Adding a storage monitor" * 8.11, "Exercise 7.11: Setting watch breakpoints" * 8.12, "Exercise 7.12: Closing the debug session" The exercises within this chapter must be completed in order. Start with 8.1, "Exercise 7.1: Introducing the Integrated iSeries Debugger" when you are ready to begin. Length of time: This chapter will take approximately 20 minutes to complete. 8.1 Exercise 7.1: Introducing the Integrated iSeries Debugger The Integrated iSeries Debugger is a source-level debugger that enables you to debug and test an application that is running on an iSeries system. It provides a functionally rich interactive graphical interface that allows you to: * View source code or compiler listings, while the program is running on the iSeries system. * Set, change, delete, enable and disable line breakpoints in the application program. You can easily manage all your breakpoints using the Breakpoints view. * Set watch breakpoints to make the program stop whenever a specified variable changes. * View the call stack of your program in the Debug view. As you debug, the call stack gets updated dynamically. You can view the source of any debug program by clicking on its call stack entry. * Step through your code one line at a time. * Step into or step over program calls and ILE procedure calls. * Display a variable and its value in the Monitors view. The value can easily be changed to see the effect on the program's execution. * Locate procedure calls in a large program quickly and easily using the Chapters/Programs view. * Debug multithreaded applications, maintaining separate stacks for each thread with the ability to enable and disable any individual thread. * Load source from the workstation instead of the iSeries - useful if you don't want the source code on a production machine. * Debug client/server and distributed applications. The Debugger supports RPG/400(R) and ILE RPG, COBOL and ILE COBOL, C, C++ and CL. In the following exercises you will be given the opportunity to learn about some of the basic features of the Debugger. For the purpose of these exercises you will debug a CL and an ILE RPG program. Don't worry if you don't know RPG. 8.2 Exercise 7.2: Starting the integrated debugger You will be working with the ILE RPG program PAYROLLG. Note: PAYROLLG is the same RPG program as PAYROLL but without compile errors. You are using it instead of PAYROLL in this exercise, to accommodate anyone who decided to skip right to this exercise without completing the editor exercises in 6.0, "Editing ILE RPG". You can start the Debugger in several ways: directly from the pop-up menu of a program or service program in the Remote Systems view, or from a Launch Configurations window. Starting directly from the Remote Systems view doesn't allow you to specify parameters to be passed to the program. The Launch Configurations window allows you to modify how the program is invoked and to specify parameters. To make the exercise interesting you will use CL program CLR1 to call PAYROLLG and you will pass one parameter to CLR1. This means you will use the Launch Configurations window. To start the debugger: 1. In the Remote Systems view expand the Library list filter, if it isn't expanded already. Start Debug session 2. Expand library RSELABXX, if it isn't expanded already. 3. Select program CLR1 in library RSELABXX. 4. Click the arrow beside the DEBUG icon Debug Icon on the workbench toolbar. 5. Select Debug from the list. The Debug Launch Configurations window opens. 6. Select iSeries: Debug Interactive Application under the Configurations list. Debug window 7. Click New. Note: You could also use Debug(prompt) > Interactive from the pop-up menu. The right pane of the Debug Launch Configurations window opens. Debug config 8. In the Name field, type the program name CLR1. 9. Select the Update production files check box. 10. Click the How To Start tab. The How To Start page opens. Debug: How to start section By default, the page contains a call for the program selected in the Remote Systems view. 11. Click Prompt. The Call Program (CALL) window opens. Call Program window 12. In the Parameters field, type 'XX'. Click Add. The parameter value will appear in the lower list. 13. Click OK. The complete start command for the program appears. Debug window 14. Click Debug. The Debug perspective opens. If not, you may see this error message. Error message The Remote System Explorer communications server has been shut down in the meantime. Go to your 5250 emulator and restart the Remote System Explorer communications server following the instructions in the message. You don't have to cancel the message. It will be removed as soon as the connection between the Remote System Explorer communications server and the interactive session has been established. Now the Debug perspective is loaded in the workbench. Now that the program is active on the iSeries and stopped at the first executable statement, the debugger displays the source. Debug Perspective 8.3 Exercise 7.3: Setting breakpoints You can only set breakpoints at executable lines. All executables lines are displayed in blue. One way to set a breakpoint is to right-click on the line in the Source view. To set a breakpoint: 1. Position the cursor on line 11. 2. Right-click anywhere on line 11. Break point 3. Click Add breakpoint on the pop-up menu. A dot with a checkmark in the prefix area indicates that a breakpoint has been set for that line. The prefix area is the small grey margin to the left of the source lines. Now you add a conditional breakpoint to stop in the loop when it loops the 99th time. 8.3.1 Adding a conditional breakpoint To add a conditional breakpoint: 1. Position the cursor on line 8. 2. Right-click on line 8. 3. Click Add breakpoint on the pop-up menu. Break point 4. Click the Breakpoints tab in the upper right pane of the Debug perspective. The Breakpoints view opens. Edit break point 5. In the Breakpoints view right-click the breakpoint for line 8. 6. Click Edit Breakpoint on the pop-up menu. The Edit a Line Breakpoint window opens. 7. Under Views, click the *SOURCE radio button, if it is not already selected. Edit break point 8. Click Next. Edit break point You only want to stop in the loop when it executes for the 99th time or more. You can do that by setting the From field of the Frequency group to 99. 9. Under Frequency, in the From field, type 99. 10. Click Finish. 8.4 Exercise 7.4: Monitoring variables You can monitor variables in the Monitors view. Now you will monitor the variable &count. To monitor a variable: 1. In the Source view, double-click the variable &count. Monitor Expression 2. Right-click &count. 3. Click Monitor Expression on the pop-up menu. The Monitors view opens. Monitor Expression The variable appears in the Monitors view. Its current value is zero. Tip: If you quickly want to see the value of a variable without adding it to the Monitor, leaving the mouse pointer on a variable for a second or so will display its value in a pop-up window. Now that some breakpoints are set, you can start to run the application. Resume icon on Debug toolbar 4. Click the Resume Resume button icon from the Debug toolbar. The program starts running and stops at the breakpoint at line 8. (Be patient, the Debugger has to stop 98 times but because of the condition continues to run until the 99th time.) Notice in the Monitors view, that &count now has the value 99. 5. Click the Resume icon again. The program stops at the breakpoint at line 8 again and &count now has the value 100. 6. Click the Resume icon once more so that the program runs to the breakpoint at line 11. 8.5 Exercise 7.5: Stepping into a program The Debugger allows you to step over a program call or step into it. When you step over a program call, the called program runs and the Debugger stops at the next executable statement in the calling program. You are going to step into the PAYROLLG program. To step into a program: 1. Click the Step into icon on the Debug toolbar. Step into The source of PAYROLLG is displayed. Depending on the option you used to compile the program (*SRCDBG or *LSTDBG for RPG, or *SOURCE, *LIST, or *ALL for ILE RPG), this window displays either the Source or Listing View. 2. Right-click anywhere in the Source view. Show Listing 3. Click Switch view > Show *LISTING on the pop-up menu. Expanded input specs for described files 4. Page down in the source and take a look at the expanded file descriptions. You don't have any /Copy member in your PAYROLLG program but these would also be shown in a Listing view. Switch back to the Source view. 5. Right-click anywhere in the Source view. 6. Click Switch view > Show *SOURCE on the pop-up menu. 8.6 Exercise 7.6: Listing call stack entries The Debug view in the upper left pane, lists all call stack entries. It contains a tree view for each thread. The thread can be expanded to show every program, module, and procedure that is on the stack at the current execution point. If you double-click on a stack entry you will display the corresponding source if it is available. Otherwise the message No Debug data available appears in the Source view. In the Debug view, expand the stack entry of Thread1 if it is not expanded already. Call Stack in Debug view The stack entry allows you to work with and switch between different programs and/or ILE modules. 8.7 Exercise 7.7: Setting breakpoints in PAYROLLG Now you add some breakpoints in PAYROLLG. To add breakpoints: 1. Select PAYROLLG in Thread1. 2. In the source view (also called the Debug editor) scroll to line 57. 3. Double-click the prefix area of line 57. A breakpoint icon is added to the prefix area of this line to indicate that a breakpoint is set. 4. Repeat the above step for line 58. Break point 5. Right-click in the prefix area of line 87 and click Add Breakpoint on the pop-up menu. To view all breakpoints, select the Breakpoints tab from the top left pane. Breakpoint view This view shows all breakpoints currently set in your Debug session. This is a convenient place to work with breakpoints. You can remove, disable/enable, add, or edit a breakpoint. These tasks are available from the pop-up menu when you right-click in the view area. Double-click any entry to show the source where the breakpoint is set. 8.8 Exercise 7.8: Removing a breakpoint in PAYROLLG It is also easy to remove breakpoints from the Source view. To remove a breakpoint: 1. Right-click the prefix area of line 58. 2. Click Remove Breakpoint on the pop-up menu. Remove break point The icon is removed from the prefix area indicating that no breakpoint is set on that line. Now you are ready to run the PAYROLLG program. 3. Click the Resume Resume buttonicon from the Debug toolbar. 4. The program starts running and runs to the breakpoint at line 57. 5. Click the Resume icon again. The program waits for input from the 5250-emulation session. Emulator session 6. Type an X beside the Project Master Maintenance option. 7. Press Enter in the emulation session. The program runs to the breakpoint at line 87. 8.9 Exercise 7.9: Monitoring variables in PAYROLLG Now lets monitor variables and change them in PAYROLLG. To monitor variables: 1. In the source view, double-click the variable EMPAPL on line 88. 2. Right-click the variable. 3. Click Monitor Expression on the pop-up menu. Monitor expression 4. Click the Monitors tab in the upper right pane. The variable appears in the Monitors view. Its value is blank because you did not select the Employee Master Maintenance option. 5. In the same way add the variables PRJAPL on line 91 and RSCDE on line 113 to the monitor. Variable PRJAPL equals X because you did select the Project Master Maintenance option. 6. In the Monitors view, double-click the variable RSCDE. The value changes into an entry field. 7. In the entry field, type in the new value X for the variable. Monitor Expression view 8. Press Enter. The variable is successfully changed. 8.10 Exercise 7.10: Adding a storage monitor Adding a storage monitor for a variable allows you to view the storage starting with the address where the variable is located. The storage is displayed in hexadecimal and text format. To add a storage monitor: 1. In the Source view, double-click the variable ERR in line 33. 2. Right-click and select Monitor Storage on the pop-up menu. Monitor Storage A new page is added to the Storage view. The tab shows the name of the variable. Change storage monitor 3. Use the scroll bar on the right of the Storage view to scroll down. You can see the current content of the memory. 4. Right-click in the view area. 5. Click Reset Table to Monitored Address on the pop-up menu to return to the starting address. 6. Right-click the view area. 7. Click Remove Storage Monitor on the pop-up menu to remove the storage monitor. 8.11 Exercise 7.11: Setting watch breakpoints A watch breakpoint provides a notification to the user when a variable changes. It will suspend the execution of the program until an action is taken. To set a watch breakpoint: 1. If you know the line number where the variable is used, click somewhere in the Source view and press Ctrl+L. A Line number field is added to the bottom of the source area. In this field enter 116 to go to that line. Enter line number 2. Double-click variable *IN60 to highlight it. 3. Right-click and click Add Watch Breakpoint on the pop-up menu. The Add a Watch Breakpoint window opens. The Expression field is pre-filled with the highlighted variable *IN60. By default the Number of bytes to watch field is set to zero, which means the variable will be watched in its defined length. Add Watch Breakpoint 4. Click Finish. The watch breakpoint is now set. 5. Click the Resume button on the Debug toolbar. The application waits for input from the 5250-emulation session. 5250-emulation session 6. In the 5250 emulation session, type 123 for Project Code and D (for delete) in the Action Code field. 7. Press Enter. A message is displayed indicating that the variable *IN60 has changed. Watch breakpoint message 8. Click OK. The program stops at line 465. This line is located immediately after the statement which caused the variable *IN60 to change. 8.12 Exercise 7.12: Closing the debug session To close the debugger: 1. Click the Resume icon on the Debug toolbar. The application waits for input from the 5250-emulation session. 2. Switch to the 5250 emulation session. 3. Press F3 to end the job. A message Program terminated appears: Debugger Message 4. Click OK. Close debug perspective 5. Right-click the Debug icon on the left taskbar of the workbench. 6. Click Close on the pop-up menu to close the Debug perspective. 8.13 Checkpoint Complete the checkpoint below to determine if you are ready to move on to the next chapter. See 11.0, "Tutorial summary and checkpoint answers" for the answers. 1. You can start the debugger: a. From the Remote Systems view b. Launch Configurations window c. Both 2. You can only set breakpoints at executable lines. (T, F) 3. To set a breakpoint you: a. Right-click on the line and click Add Breakpoint on the pop-up menu. b. Double-click in the prefix area. c. Right-click in the Breakpoints view and click Add Breakpoint on the pop-up menu. d. Right-click in the prefix area and click Add Breakpoint on the pop-up menu. e. All of the above 4. You can change variables and indicators in the: a. Remote Systems view b. Debug view c. Monitors view d. Source view e. All of the above 5. The debugger allows you to: a. Step over a program call b. Step into a called program c. Both 6. The Debug view lists all call stack entries. It contains a tree view for each thread. (T, F) 7. You can perform which actions on breakpoints: a. Delete b. Add c. Disable/Enable d. Edit e. All of the above 8. Adding a storage monitor for a variable allows you to view the storage starting with the address where the variable is located. (T, F). 9. The Storage monitor supports these display formats: a. Hexadecimal and text b. Character c. Text only d. Decimal e. A and B 10. A _________ breakpoint provides a notification to a user when a variable changes. It will suspend the execution of the program until an action is taken. a. Watch b. Line c. Conditional 8.14 More practice Given your experience in working with the debugger features, in your own source, try setting, changing, deleting, enabling, disabling line breakpoints, setting watch breakpoints, displaying and changing variables and viewing the call stack as you debug your program. Use the Development Studio Client online help to assist you in these tasks. 8.15 Recap Congratulations! You have completed 8.0, "Debugging a CL and ILE RPG program". You should now understand: * The purpose of the Debug view, the Monitors view, the Storage Monitor, the Call Stack and the roles of different types of breakpoints * The actions you can perform on breakpoints * How to start the debugger * How to set breakpoints * How to monitor variables * How to run and step into a program * How to view the call stack in the Debug view * How to remove a breakpoint * How to add a storage monitor * How to set watch breakpoints Now that you know how to debug a program, you can move to learning how to create filters and actions to manage your iSeries objects. Continue to 9.0, "Exploring Remote System Explorer". 9.0 Exploring Remote System Explorer In this chapter, you will use the Remote System Explorer perspective to work with the iSeries objects that you used in the previous chapters. You will learn how easy it is to define filters, perform actions and define your own actions. In short, you'll see how Remote System Explorer can organize and integrate your work and make that work easier. In order to accomplish these learning objectives, there are several steps that are involved, including: * 9.1, "Exercise 8.1: More about the Remote System Explorer" * 9.2, "Exercise 8.2: Creating a library filter" * 9.3, "Exercise 8.3: Creating an object filter" * 9.4, "Exercise 8.4: Creating a user action" * 9.5, "Exercise 8.5: Running commands from the Remote System Explorer" The exercises within this chapter must be completed in order. Start with 9.1, "Exercise 8.1: More about the Remote System Explorer" when you are ready to begin. Length of time: This chapter will take approximately 15 minutes to complete. 9.1 Exercise 8.1: More about the Remote System Explorer Most of the functions of CODE Project Organizer have been replaced by WebSphere Studio functions with the exception of accessing ADM parts. The Remote System Explorer is replacing PDM (Program Development Manager) on the workstation. It currently doesn't have all the function of PDM but will over time eventually be a full replacement for PDM. Remote System Explorer allows you to: 1. Simplify your work by giving you quick access to lists of iSeries libraries, objects, members, IFS files, UNIX files, and local files. 2. Use the context-sensitive pop-up menus on these lists to perform actions such as start the Remote Systems LPEX Editor, CODE Designer, or Integrated Debugger or other common iSeries actions. 3. Use the Work with User Actions option to create and manage your own user-defined actions and have them appear in the pop-up menus. 4. Use the command support to increase your productivity by allowing you to enter and repeat iSeries or local commands without switching to an emulator session. 9.2 Exercise 8.2: Creating a library filter In the Remote System Explorer perspective, you now need to get to the iSeries objects you want to work with. In the previous chapters you have worked with the Library list. Now you will create your own library filter. Library filters list a set of libraries from your iSeries system in the Remote Systems view. But first let's understand what filters are all about. Filters allow you to easily organize elements within your system. Use the filter function to list iSeries native file system objects (such as libraries, objects, or members). Work with libraries To create a library filter: 1. In the Remote Systems view expand the connection that connects to your iSeries system if its not already expanded. 2. Expand iSeries Objects if its not already expanded. 3. Expand Work with Libraries. (You can also right-click iSeries Objects and click New > Library Filter on the pop-up menu). Expanding Work with libraries corresponds to the WRKLIBPDM command, plus creates the filter in the Remote Systems view. The Create a new iSeries library filter page opens: Library filter You are going to create a filter to specify the libraries you want to work with, so they will show in iSeries Objects. You want to create a filter that shows all libraries on the iSeries with the name RSExxxxxx and VARxxxxxxx, xxx being any character. Note: You may need to select different libraries that appear on your system if libraries with the above names do not exist. You specify the first filter string that selects the libraries starting with RSE. 4. Type RSE* into the Library field, using the * wild card character. 5. Click Next. The Name the new filter page opens. Library filter Note: You can choose between creating the filter for all connections or for this specific one only. 6. In the Filter name field, type All RSE and VARPG libraries. You give your filters a name because the Remote System Explorer saves them for future use, unlike PDM, which does not save filters. 7. Click Finish. Back in the Remote Systems view under iSeries Objects you will see the new filter expanded, listing all RSE* libraries. Now you need to add the VARPG libraries. 9.2.1 Changing the library filter To change the library filter: 1. Right-click the filter All RSE and VARPG libraries and click Change. Select the Change option The Change Library Filter window opens. Add second filter string 2. Select New filter string from the Filter strings list. 3. In the Library field, type VAR*. 4. Click Create. The VAR* filter string is added to the list. 5. Click OK. You are now back in the Remote Systems view. Expanded filter You will see the list expanded to include your filter. Now you can work with the libraries directly and can drill down to the object you want to work with. 9.3 Exercise 8.3: Creating an object filter Now create an object filter. Object filters list a set of objects from your iSeries host in the Remote Systems view. To create an object filter: 1. In the Remote Systems view, expand your connection and then expand iSeries Objects if not already expanded. Create object filter 2. Expand Work with objects. You can also right-click iSeries Objects and click New > Object filter on the pop-up menu. Note: Expanding Work with objects corresponds to the WRKOBJPDM command. The Create a new iSeries object filter page opens: Now create a filter to show all your source files in your RSELABXX library. Specify filter string 3. In the Library field, type RSELABXX. 4. Click Browse beside the Object type field. The Select Object Type window opens. Select Object type 5. Select *FILE under the Select an object type list. 6. Click OK. The Create a new iSeries object filter page displays with the object type updated. Object filter 7. Click Browse beside the Object attribute field. The Select Object Attribute window opens. 8. Select PF-SRC under the Select an object attribute list. 9. Click OK. Select Object Attribute dialog 10. Click Next. The Name the new filter page opens. Object filter 11. In the Filter name field, type My source files. 12. Click Finish. The new object filter displays in the Remote Systems view under iSeries Objects: Object filter shows all source files in library Note: If you end up with too many filters, you can create filter pools. They allow you to group filters. Now you know how to create filters and tailor your development environment. Filters can also be specified for non iSeries servers and your local system. Now you can work with the objects you have in your Remote Systems view like you worked in PDM with a subset of libraries, objects, or members. Let's assume you want to edit the member PAYROLL in the source file QRPGLESRC using this object filter. 9.3.1 Editing a member from your own object filter To edit the member PAYROLL: 1. Expand QRPGLESRC. 2. Right-click member PAYROLL. 3. Click Open With > Remote Systems LPEX Editor on the pop-up menu. This will download the source member and open the editor with this member. After you have edited the member you could save it and then compile it from the Remote Systems view by using the pop-up menu options on this member. You can also create your own actions in addition to the default actions. 9.4 Exercise 8.4: Creating a user action In PDM you can create user actions in addition to the pre-supplied system actions. In Remote System Explorer you can do the same. You define user actions through the Work With User Actions window. User actions can be defined for iSeries libraries, objects, members and jobs as well as folders and files in any remote UNIX, Windows, Linux, Local, or IFS system. To open the Work with User Actions wizard: 1. Expand your iSeries connection and expand iSeries Objects if not already expanded. Work with user actions 2. Expand the Library list filter if not already expanded. 3. Right-click RSELABXX. 4. Click User Actions > Work with User Actions on the pop-up menu. The Work with User Actions window opens. Create new object action 5. In the right pane of the Work with User Actions window, expand New in the list, if it is not expanded already. 6. Select Object action. You want to create a user action that copies a source file with data to a new source file called QJUNKSRC in the same library. Specify new object name 7. In the Action field, type Copy source file for the user action name. 8. In the Comment field, type Copy source files with data. 9. In the Command field, type CRTDUPOBJ for the command to execute. 10. Click Prompt to open the command prompter for this command. Specify parameters for create duplicate object This is the command you will be running: CRTDUPOBJ OBJ(&N) FROMLIB(&L) OBJTYPE(&T) NEWOBJ(QJUNKSRC) DATA(*YES) 9.4.1 Specifying user action parameters To specify user action parameters: 1. In the From Object field, type &N to indicate to use the name of the selected object in the Remote Systems view. 2. In the From Library field, type &L to pick up the library name from the selected object. 3. In the Object Type field, type &T to pick up the object type from the selected object. 4. In the New Object field, type QJUNKSRC. 5. Select the All parameters check box to see the additional Duplicate data parameter. Now the Duplicate data parameter is also shown on the prompt window. 6. Select *YES from the Duplicate data list. 7. Click OK. You return to the Work with User Actions window. 8. Select the Refresh after check box, so that the Remote Systems view gets refreshed after the action has been run. Complete parameters for new object action Note: Clicking the Insert variable push button displays a list of valid replacement variables with the explanation of what they do. This user action is only valid for Source physical files. You need to specify this restriction so this user action will only show in pop-up menus when you right-click on a source physical file. 9.4.2 Specifying a restriction on a user action To specify this restriction: 1. Under the Defined Types list box, click FILE_SRC. 2. Click Add beside the Defined Types list box. FILE_SRC is now one of the selected types. Actually since you only selected this one it is the only one. 3. Click Create then Close. Now, only when you right-click on a source file, will this user action appear on the pop-up menu. For any other object type it will not appear. Back in the workbench and the Remote System view, give it a try. Note: Remember to close the PAYROLL member if you opened it earlier. 9.4.3 Trying the user action To try your user action: 1. Locate your filter My source files. Select Copy source file user action 2. Expand the filter My source files, if it is not already expanded. 3. Right-click the QRPGLESRC file. 4. Click User Actions > Copy source file on the pop-up menu. The file gets duplicated and the list gets refreshed. Your new source file will show in the list. You can check the messages of the CL commands you are running in the RSE Communications server job by looking at the iSeries Commands log in the right hand side bottom pane of the workbench. Check iSeries Command log for user action completion 5. To delete the source file QJUNKSRC that you just created, right-click QJUNKSRC. 6. Click Delete on the pop-up menu. The Delete Confirmation dialog opens. 7. Click Delete. 9.5 Exercise 8.5: Running commands from the Remote System Explorer The Command entry is part of the Remote Systems view. To run a command: 1. Check if you have an iSeries Table View tab in the bottom right pane where your command log appeared in the previous exercise. 2. If you have it, click on it. 3. If you don't have it: a. In the Remote Systems view, right-click My source files filter. b. Click Show in table on the pop-up menu. As you have seen already you can now run commands on the iSeries server that the table is connected to. You can enter commands in the Commands field beneath the iSeries Table view, and view messages in the Messages field. You can enter a command and click either Prompt to specify parameters and then Run, or just click Run. When you run a command, the Messages field is populated with the messages from the command. When you select a message, the Details button is enabled. When you click this button, the message and its help is displayed. 4. Type an iSeries command, for example ?ADDLIBLE. Table view with command entry The question mark is there to display a prompt screen. Instead of specifying a question mark you could use the Prompt push button. 5. Click Run. The Command Prompt window for the ADDLIBLE command opens. 6. In the Library field, type RSELAB00 and click OK. Add Library List Entry dialog That will add this library to the library list of your Remote System Explorer job on the iSeries server. Note: You may need to add a different library if the library RSELAB00 does not exist on your iSeries system. The messages field will confirm the successful completion of this command. To get to the command history, similar to F9 on the 5250 screen, select the appropriate value from the Command list (down arrow beside the Messages field. Message indicating library added to the library list You could also use the iSeries Commands subsystem in the Remote Systems view underneath the iSeries Objects subsystem and run predefined commands or define your own commands. 7. To prepare for the next exercise you want to work with your library RSELABXX again. Right-click RSELAB00 and click Remove From Library List. 9.6 More practice Given your own libraries on your iSeries system, create a member filter and a job filter. Then move libraries up, down and within your library list. Finally create a filter pool. Use the Development Studio Client for iSeries online help to assist you in these tasks. 9.7 Recap Congratulations! You have completed 9.0, "Exploring Remote System Explorer". You should now understand: * How to use the Remote System Explorer perspective to work with the iSeries objects that you used in the previous chapters. * How easy it is to perform actions and define your own actions * How Remote System Explorer can organize and integrate your work and make that work easier Now that you know how to debug and test the payroll application on an iSeries system you can learn how to visually design screens. Continue with 10.0, "Designing screens". 10.0 Designing screens In this chapter, you will become familiar with the various aspects of the CODE Designer while modifying a display file to add a screen. You will step through each part of the CODE Designer tool interface and update some DDS as well. In the workbench, in the Remote System Explorer perspective you will use the connection that you used in the chapter before. In order to accomplish these learning objectives, there are several steps that are involved, including: * 10.1, "Exercise 9.1: Opening a DDS member in the Remote Systems view" * 10.2, "Exercise 9.2: Viewing the DDS tree" * 10.3, "Exercise 9.3: Selecting the DDS object" * 10.4, "Exercise 9.4: Designing the DDS screen" * 10.5, "Exercise 9.5: Creating groups from existing records" * 10.6, "Exercise 9.6: Creating new screens" * 10.7, "Exercise 9.7: Adding fields to the subfile record" * 10.8, "Exercise 9.8: Switching between multiple records" * 10.9, "Exercise 9.9: Adding field error handling" * 10.10, "Exercise 9.10: Accessing field properties" * 10.11, "Exercise 9.11: Adding new keywords" * 10.12, "Exercise 9.12: Verifying the source changes" * 10.13, "Exercise 9.13: Switching between designing and editing the screen" * 10.14, "Exercise 9.14: Compiling your source changes and closing the Designer" The exercises within this chapter must be completed in order. Start with 10.1, "Exercise 9.1: Opening a DDS member in the Remote Systems view" when you are ready to begin. Length of time: This chapter will take approximately 30 minutes to complete. 10.1 Exercise 9.1: Opening a DDS member in the Remote Systems view Using an editor to create and maintain DDS source for your display, printer and physical files can be a frustrating and difficult task. What would be great is a graphical design tool that let's you design your screens and reports visually and then generate the DDS source for you. Well, that's exactly what CODE Designer does for you. CODE Designer helps the novice DDS programmer create screens, reports and databases quickly and easily without worrying about the details of the DDS language, while at the same time letting the expert DDS programmer get access to all the features and power of the language. Note: Make sure MSTDSP is closed from the previous LPEX Editor exercises. To open a DDS file member from the Remote Systems view: 1. Expand the Library List filter if it is not already expanded. 2. Expand the QDDSSRC file in library RSELABXX. Edit using Code Designer 3. Right-click the MSTDSP member. 4. Click Open with > CODE Designer on the pop-up menu. The member MSTDSP will be downloaded to the workstation and loaded into CODE Designer. CODE Designer is a separate tool not integrated into the workbench. 10.2 Exercise 9.2: Viewing the DDS tree What you are looking at now is basically an explorer view of the DDS. The DDS Tree view on the left-hand side of the Designer displays the DDS source in its file, record, field, and keyword hierarchy. It is a familiar and intuitive way to see the overall structure of the DDS source and to navigate through it quickly. Don't worry if you're not a DDS expert, everything will be explained to you. The DDS Tree shows groups of records, which represent the screens or reports you are designing, as peers of the file in the tree hierarchy. In this view, you can create groups, and copy or move keys, keywords, fields, and records. If any DDS object contains an error, the icon representing it displays a red X. To show file-level keywords and the record SELECT in the DDS tree: 1. Expand the RSELABXX/QDDSSRC(MSTDSP) folder. 2. Expand the File Keywords folder. 3. Expand the SELECT record. 4. Expand the Record Keywords folder. 5. Expand the EMESS field. DDS Tree The DDS tree now shows you a summary of the file-level keywords and of the record SELECT. 10.3 Exercise 9.3: Selecting the DDS object In the upper right-hand side of the Designer is the Workbook with several different tabbed pages. The Workbook is the area of the CODE Designer where you design display files, printer or physical files. You can view this notebook on the top right-hand side of the CODE Designer window. The top page is called Details and it provides a detailed view of the DDS objects selected by the DDS Tree. You can view this page in either details mode or list mode by clicking View > List from the CODE Designer menu. In the Details page columns display information about the selected DDS object. You can use this page to display for example, details of all the fields in the record SELECT or keywords and conditions of a field or record. The Listing page is a listing of the source statements generated by the Program Verifier. In the bottom right-hand side of the Designer is the Utility notebook. This notebook contains several pages: Selected DDS, Web Settings, Comments and Error List. The Selected DDS page in the notebook shows the actual DDS source for the currently selected item. Note: The Web Settings page allows you to specify attributes that are used by the WebFacing tool. To work with the DDS record SELECT: 1. In the DDS tree click the SELECT record. The Details page lists all the fields in the record SELECT and summarizes some of their properties. The Selected DDS page shows the DDS for the SELECT record. DDS Page 2. In the DDS tree click Record keywords immediately below SELECT. The Details page shows the current record-level keywords. The Selected DDS page still shows the DDS for the SELECT record. Current record-level keywords and DDS for SELECT record 3. In the DDS tree click the EMESS field. The Details page shows its field-level keywords. The Selected DDS page now shows the DDS for the EMESS field. EMESS field Even this relatively small and simple DDS source member demonstrates how much easier it is to use the Designer to navigate through your DDS source. The syntax is being interpreted in intuitive graphical ways making it an ideal tool for learning DDS. But to get orders of magnitude improvement in your productivity what you really need is to work with your screens and reports in a WYSIWYG fashion, completely independent of the DDS required to make things appear the way they do. You need the Design Page. 10.4 Exercise 9.4: Designing the DDS screen You will spend most of your time creating, updating, and designing your DDS screens and reports in the Design page. The Design pages allow you to design your screens or reports visually using an intuitive graphical user interface. The Design page shows the DDS source as it would appear on either a screen (for display files) or a printed page (for printer files). It allows you to design your application's screens or reports by laying out records and fields in a graphical user interface. On the Design page, you can easily create, edit, resize, and move DDS objects graphically. Create new records, fields, and constants directly on the Design page by using the palette push buttons to the left of the Design area or from the pop-up menus. The toolbar above the Design area allows quick access to many of the editing features as well as information about the currently selected object. 1. Click the MAIN-MENU tab in the workbook. DDS Main Menu In order to understand where MAIN_MENU came from, you need to understand the concept of a group. A group is simply a collection of one or more DDS records that represent how a screen or report would be assembled at runtime. It allows you at development time to work with screens or reports as they would appear when they get assembled by your programs at runtime. To work with groups in CODE Designer you need to tell CODE Designer which record formats make up a screen. In this case this has been done for the screen you see in the Design page. A group MAIN_MENU has been created for you and CODE Designer has saved this information in the DDS source in comment lines. Any groups that you create are persisted as comment lines in the DDS so you can re-use these groups in subsequent CODE Designer sessions. The groups you create will appear in the tree view as well as in the workbook as a Design page tab for each group defined, to allow quick access to each group of records. 10.5 Exercise 9.5: Creating groups from existing records If you are working with existing DDS, you will want to create groups that will correspond to how the records are being used. In this example you will create a group for the next screen, where the user selects which employee in the payroll database to maintain. The screen is made up of the record format EMPSEL. To create a new group: 1. Scroll to the bottom of the DDS tree and expand the MAIN_MENU group. The SELECT record appears as the only record in this group. Main Menu 2. Right-click the MAIN-MENU group. 3. Click Insert group on the pop-up menu. A Group Properties notebook opens and a blank Design page for the group SCREEN1 also opens. Group properties and Design page The Properties notebook lets you view and update the properties of the currently selected DDS object. You can open this notebook from any view, pop-up menu, or menu of the CODE Designer. The Properties notebook is modeless. When you change an object's properties, the selected object changes immediately. 4. In the Group Properties notebook, select the EMPSEL record from the Available list and click the arrow button button. For simplicity this is the only record you will add for now. The Design page now shows you what the record EMPSEL looks like. Design page 5. In the group field, type EMPL_SELCT over SCREEN1 to rename the group. Group properties 6. Close the Group properties notebook. Click the X in the top right corner of the Group properties notebook. You have finished creating a group. You could now work in the Design page with the record formats contained in this group. Now you'll create a new record format. It appears that this is one of those unusable applications where you have to know the employee number ahead of time instead of being able to browse what is in the database. What we really need is a subfile. But aren't those difficult to code, you ask? Not with CODE Designer. 10.6 Exercise 9.6: Creating new screens To create a new record screen on the Design page you need to create a group that will create an empty page you can work with. To create a new group: 1. Right-click the new EMPL_SELCT group in the DDS tree. 2. Click Insert group on the pop-up menu. A Group properties notebook appears and a blank Design page for the group SCREEN1 also appears. Group Properties and Design page 3. Rename the group to EMPL_LIST and close the Group properties notebook. 4. You can create things on the Design page by selecting the appropriate tool from the palette on the left-hand side and then click on the Design page where you want it to be created. Right now, most things are disabled in the palette because there is no record in which to create fields. The only two buttons available are Create standard record and Create subfile record. If you leave the mouse over a button for a second or two, flyover help will appear describing the indicated button. Create subfile record button 5. Click the Create subfile record button and then click in the dark gray area. A subfile and a subfile control record pair are created. Subfile created 10.7 Exercise 9.7: Adding fields to the subfile record Now you add some columns to the subfile using the Design page. The subfile should be positioned on row eight. You use the cursor to specify the location of the part you want to put on the screen, in this case your subfile. To add fields on the subfile: 1. Click the Create named field button and then click somewhere on row 8. Six fields appear in a vertical column. This is because the subfile you created, currently specified a SFLPAGE (visible list size) of six. 2. Click the top field and hold the mouse button down and move it to row 8, column 5. Note the current row and column appear just above the field as you move it. location of current row and column 3. Move the cursor over to the right edge of the field. It turns into a double-headed arrow. Hold down the mouse button and move it to the left. The size of the field will be reduced. The current size will appear just above the field. When the size is 3, let go of the mouse button. Reduce field The toolbar at the top of the Design page is a very convenient place to monitor and manipulate the currently selected parts. 4. Rename the record from RECORD1 to EMPLSTSFL and the field from FIELD1 to OPCODE by typing over the text in each list. Tool bar 5. Click the Color palette color button button and select pink to change the color of the field. 6. Click the input button button to change the usage of the field to input. input field Now you will create an additional column in the subfile. 10.7.1 Creating an additional column To create an additional column: 1. Position the cursor at row 8, column 9. Note: The bottom right of the CODE Designer window shows the current cursor position cursor position. If you can't see the field with the cursor position on your screen, click the Maximize button in the top right corner of the screen. You can use the cursor keys or the mouse to move the cursor. 2. If you are creating a long field with an exact length, the SDA syntax can be easier. Type: +O(30) and then press the back arrow (not Backspace!) to select the text you created. Notice from the Selected DDS page that you have created a text constant containing +O(30). 3. Click the Convert string to field Convert string to field button button on the toolbar or press F11 to convert the SDA syntax into a character output field of length 30. Output field Convert string to field button 4. Rename the new field to ENAME using the toolbar. This will show the name of the employee. Rename to ENAME 5. Position the cursor to 8, 41. 6. Now you will add a field for the employee's salary. Type $666,666.66 and then press the back arrow. Now wouldn't it be better if we could just tell the Designer what we wanted the number to look like and then have Designer generate all the cryptic EDTCDEs to make it happen? 7. Press F11 to convert this field into an output numeric field with comma delimiters, two decimal positions, a currency symbol and no sign. Look at the Selected DDS page to see what was generated for you. Impressive! Selected DDS 8. Rename the field to SALARY and change its color to yellow, using the toolbar. 9. The subfile seems compacted to the left. It would be better to space it out evenly. Just select a field and click the space horizontally horizontal alignment button button on the far right side of the toolbar. The other alignment buttons will align fields, left, right, center and top. Space Horizontally Align columns horizontally Just below the palette on the left there are three spin buttons. The top one, Subfile size, specifies the total number of entries in the list that will be filled in by the application. The second one, Subfile page size, is how many entries appear on the screen. 10. In the Subfile size field, type 300. 11. In the Subfile page size field, type 9. 12. Click in the Design page. Subfile size and Subfile page The Design page is updated accordingly. 10.8 Exercise 9.8: Switching between multiple records Now let's fix up the Subfile control record. The group you created contains 2 records. You can verify this by looking at the record list in the toolbar: Record list 1. Change the current record by selecting RECORD1CTL from the record list or click next record next record button or press Alt+End. The fields in the subfile still appear so that column heading can be lined up, but they appear at half-intensity so that they can be distinguished from the fields of the current record. half intensity 2. Rename the record to EMPLSTCTL using the toolbar. Let's provide a 'Position to' entry in the subfile control header. 3. Position the cursor at 4, 9 and type: Position to: Add position to field Now you need an employee name field. You could create a named field with the right characteristics like you did in the subfile, or you could create a source reference using the Create source reference field Source Reference button button in the palette, or you could reference the original database field using either the Create database reference field button or the Create database reference field button Create database reference field(s) by selection Create database reference field(s) by selection button button. But there is an even simpler way. Use copy and paste! 10.8.1 Copying the employee name field To copy the employee name field: 1. In the DDS tree expand the EMPMNT record. 2. Click the ENAME field and press Ctrl+C. Locate EMPMNT then ENAME (The pop-up menu or Edit menu shows the Copy menu item as well). 3. Position the cursor to 4, 23 and press Ctrl+V. Now that was easy! 4. Click the field and change the name from ENAME to POS_TO. Rename field to POS_TO 10.9 Exercise 9.9: Adding field error handling Let's put in some error handling for the 'position to employee name' field. If the employee name is not found in the database, the program will set on indicator 60. In this case the field should turn red, reverse image and position the cursor to it. Now wouldn't it be better if you had something easier to remember than some arbitrary number from 1 to 99. To set indicators: 1. Click the Change named indicator sets Change named indicator sets button button on the Design page toolbar (or press F7). The Named indicator sets window opens. 2. In the Settings name field, type: Not Found. 3. Click Create. Named indicator sets window 4. Select the check box next to 60 and click OK. The Not found indicator set is now in effect. The Design area is shown as if indicator 60 was on and all other indicators were off. The Design page toolbar shows the current indicator set in the Select named indicator set list on the bottom left. Select named indicator set list 5. Now select the POS_TO field. 6. On the toolbar, select the color red and the display attributes reverse image and position cursor. (The set of toolbar buttons representing the current display attributes is found just below the color button). The toolbar should look as follows: Toolbar 7. Examine the DDS generated in the Selected DDS page. Selected DDS Notice that all the new keywords were created with a condition of 60. (The DSPATR(PR) was pasted with the field originally). 8. Now let's try it out! From the Select named indicator sets list, select All indicators are off. Indicators Off Wow! This really works! 9. From the Select named indicator sets list, select Not found. The field appears red and reverse imaged. 10.10 Exercise 9.10: Accessing field properties Second to the direct manipulation and the toolbar on the Design page, the easiest and quickest ways of getting access to the properties of a field, record, or entire file is the Properties notebook. The Properties notebook lets you view and update the properties of the currently selected DDS object. You can open this notebook from any view, pop-up menu, or menu of the CODE Designer. The Properties notebook is modeless. When you change an object's properties, the selected object changes immediately. You can get to a Properties notebook from the Selected menu, by pressing F4, or double-click on anything in the DDS tree or the Details page or Design page. To open the Properties notebook: 1. In the DDS tree, click the record SELECT and press F4 to see the Record properties. Record properties page As you select different items, the Properties notebook will continuously update itself to show you the properties of the selected item. 2. Click the *DATE field in the SELECT record. (You may have to move the Properties notebook out of the way.) This field has a different set of pages describing its properties. DATE field 3. Change the year from 2 to 4 digits. Select the Length of year check box. 4. Select 4 digits from the list. Field Properties Notice how the sample is updated on the Properties notebook. 5. To test the Design page, click the MAIN_MENU tab in the workbook and look at the upper right corner of the screen. The year now has 4 digits. 6. Click the EMPAPL field in the SELECT record. On the Field properties notebook click the Basics tab. On this page you can change the field's name, usage, length, type, and screen position. The other pages give you quick access to other properties of this field. Field Properties 10.11 Exercise 9.11: Adding new keywords CODE Designer helps you manage the visual aspects of your displays and reports. But you also need to access the full power of DDS. You need to access keywords. To add keywords: 1. Click the EMPAPL field in the DDS tree. 2. Press F5 or right-click and click Insert keywords on the pop-up menu. Insert Keywords You see the Details page for the EMPAPL field and the Create keywords tab is added to the Utilities notebook. This page shows you the subset of keywords that are allowed for the selected file, record or field and it takes into account the field's type, usage, shift and what record it is in. It is very powerful to know exactly what your options are. This information cannot be quickly ascertained from the Reference manual. Keyword List 3. With the EMPAPL Properties notebook at the Basics page, click the numeric field Numeric type button to change the field to numeric type. Field Properties Notice that the list of keywords in the Create keywords page has changed. 4. Click the alphanumeric button button to change the field back to alphanumeric. Notice that the list of keywords in the Create keywords page has changed again. 5. Click the ALIAS keyword and press F1. The DDS Reference help for the ALIAS keyword appears. Tip: CODE Designer has lots of on-line help. Press F1 anywhere you want to see help for an item, icon or notebook. You will see help relevant to what you are currently trying to do. From the Help menu you have quick access to the DDS Language Reference as well as several other useful sources of information. DDS Alias keyword help 6. Minimize the Help window. 7. In the Create keywords page, double-click the INDTXT keyword. (You may have to scroll to the right to find it). The keyword is created with default values which can be changed when you want. 8. Double-click the INDTXT keyword again. The keyword is created with the same default values creating a conflict. Duplicate INDTXT keyword 9. Close the Keyword Properties dialog. 10.12 Exercise 9.12: Verifying the source changes You have just added a new record and some new fields to your DDS source. Everything that the CODE Designer adds to your DDS source is certain to have the correct syntax. Now you need to make sure that there are no semantic errors. You just introduced one in the last section by creating two INDTXT keywords describing the same indicator. To verify your source: 1. Click Tools > Verify file (or click the verify Verify Button button on the main toolbar) on the CODE Designer menu. Verify Button The DDS source is checked using the same verifier that the CODE Editor or LPEX Editor uses. A message appears on the status line at the bottom of the Designer stating that the verify process completed with errors. 2. In the DDS tree, there is a trail of red x's leading to the problem. Error shown with red x's The file icon has a red x, as does the SELECT record, the EMPAPL field and finally the second INDTXT keyword. 3. Click the MAIN_MENU tab in the workbook. The EMPAPL field is highlighted in red. 4. Click the Listing tab in the workbook. This page shows you the listing generated by the most recent program verify. A warning message is buried somewhere in the listing but it's not easy to find. 5. If there are problems, they will show up in the Error list page in the Utility notebook. It behaves exactly like the Error list in the CODE Editor or LPEX Editor. Click the Error list tab. 6. Double-click the warning DDS7861 in the Error list. (Press F1 to see detailed help on the message). The Source page appears and the cursor is placed exactly where the error is in the source. The Source page is a tokenized read-only view of the current state of the DDS source. Read-only? Wouldn't it be great if you could just clear the error right here. There are some things that are just plain faster in the editor and many others that are faster in the visual environment. It would be great to switch between the two modes at the push of a button. Well, let's just do that. Error line 10.13 Exercise 9.13: Switching between designing and editing the screen To switch between the Design mode and the Edit mode: 1. Click the Edit DDS source Edit DDS source button button or click File > Edit DDS Source from the Editor menu. You now have access to the full power of the editor. 2. Explore the Edit and View menu items. 3. Press Ctrl-F to open the Find/Replace window. 4. In the Find field, type INDTXT and click Find. Find and Replace window 5. Press Ctrl-N to find the next occurrence. 6. Delete the second INDTXT line. Type D in the number column and press Enter. 10.14 Exercise 9.14: Compiling your source changes and closing the Designer Now you will compile the source on the iSeries just as you did in the Remote Systems LPEX Editor and then close the Designer. To compile your source: 1. Click File > Save from the Designer menu to save your source to the iSeries. 2. Click Tools > Compile from the Designer menu and then click No prompt (or click the compile Compile button button on the CODE Designer toolbar). 3. A message indicates when the compile is complete. Click OK in the Message dialog. If you re-compile and run the PAYROLL program, you will see the 4 digit year change you made to the opening screen of the program. To close the Designer: 1. Click File > Exit from the Designer menu. 10.15 Checkpoint Complete the checkpoint below. See 11.0, "Tutorial summary and checkpoint answers" for the answers. 1. There is a graphical design tool that let's you design your screens and reports visually and then generate the DDS source for you. This tool is named: a. Page Designer b. CODE Designer c. Screen Design Aid d. None of the above 2. Match the item with its correct description. a. Utility notebook b. Design page c. Properties notebook d. Group a. Contains several different tabbed pages b. For visually designing screens c. A collection of one or more DDS records that make up a single screen or report d. Access properties of a field, record, or entire file 3. The Utility notebook contains: a. Selected DDS page b. Error List page c. Web Settings page d. Comments page e. All of the above 4. On the Design page, you can easily: a. Create DDS objects b. Edit DDS objects c. Resize DDS objects d. Move DDS objects e. Create records f. Create fields g. Create constants h. All of the above 5. Grouping records together allows you to work on one record while still seeing the related records in the background. (T, F) 6. The Properties notebook is modeless. When you change an object's properties, the selected object changes immediately. (T, F) 7. The DDS source is checked using the same verifier that the LPEX Editor or CODE Editor uses. (T, F) 8. You can switch between design mode and edit mode in CODE Designer. (T, F) 9. You can compile source on the iSeries just as you do in the LPEX Editor. (T, F) 10.16 More practice Given your experience in using the CODE Designer from the Remote Systems view, try creating a printer report. You can use the physical file specification REFMST in member QDDSSRC in library RSELABXX. Take time to explore the fields and information for this physical file. You may want to refer back to the exercises in this chapter as you create your report. When you are familiar with the file REFMST, you can create your printer file. Use the Development Studio Client for iSeries online help to assist you in this task. 10.17 Recap Congratulations! You have completed 10.0, "Designing screens". You should now understand: * The purpose of a workbook, details page, utility notebook, design page, properties notebook, and group * How to modify a display file to add a screen * How to add groups, records and fields * How to save your DDS source * How to verify your DDS source * How to compile your DDS source 11.0 Tutorial summary and checkpoint answers See how easy it is to be more productive building new or traditional iSeries applications. The Remote System Explorer gives you PDM-like access to iSeries(R) objects. The PDM-like table view means you can right-click on objects to perform actions that are the same as PDM's and use a command line at the bottom of the table just like PDM. There are also user-defined actions that support all PDM substitution variables and of course the editing, verifying, compiling, running and debugging tasks which are tightly integrated with the Remote System Explorer. You have been introduced to a highly integrated and productive environment, offering a consistent experience for all development work. This new generation of tools offers rich support for exploring the file system, compiling, building, editing, running and debugging. The new tools allow you to leverage the classic tools for extremely rich editing and DDS design support. The Remote System Explorer tools offers a superset of functions over the classic, and feature frozen ADTS tools. It offers significant productivity and usability gains, support for disconnected and team development and a common harness for the tight integration of IBM and partner-supplied tools for server application development. Using these new generation tools also implicitly increases your skills and will make the transition into new programming models easier, such as the IBM WebFacing Tool, Web, Web Services, Java and XML. Step aside ADTS the traditional method for developing and maintaining server-side iSeries applications. Here comes Development Studio Client which includes new highly integrated and highly extendible tools for iSeries RPG, COBOL, C, C++, CL and DDS development. These new tools offer you a development experience that is consistent with the experience for developing Java, Web, Web Services, and XML applications, lowering the learning curve for all and making your transition to these e-business application programming models that much easier. Note: For more information on Development Studio Client and the Remote System Explorer, see http://ibm.com/software/awdtools/iseries. Here are the answers to each chapter checkpoint quiz. +---------+---------+---------+---------+---------+---------+---------+ | 1 | 3 | 4 | 5 | 6 | 7 | 8 | +---------+---------+---------+---------+---------+---------+---------+ | 1b | 1d | 1c | 1d | 1d | 1b | 1c | +---------+---------+---------+---------+---------+---------+---------+ | 2g | 2e | 2e | 2T | 2d | 2 aa, | 2T | | | | | | | bb, cd, | | | | | | | | dc | | +---------+---------+---------+---------+---------+---------+---------+ | 3g | 3b | 3e | 3a | 3g | 3e | 3e | +---------+---------+---------+---------+---------+---------+---------+ | 4e | 4 aa, | 4c | 4T | 4T | 4h | 4c | | | bd, cb, | | | | | | | | dc | | | | | | +---------+---------+---------+---------+---------+---------+---------+ | 5e | 5e | 5T | 5d | 5T | 5T | 5c | +---------+---------+---------+---------+---------+---------+---------+ | 6T | | 6T | 6c | 6d | 6T | 6T | +---------+---------+---------+---------+---------+---------+---------+ | 7T | | 7d | 7b | 7d | 7T | 7e | +---------+---------+---------+---------+---------+---------+---------+ | 8f | | | 8c | 8T | 8T | 8T | +---------+---------+---------+---------+---------+---------+---------+ | 9e | | | 9c | | 9T | 9a | +---------+---------+---------+---------+---------+---------+---------+ | 10T | | | 10a | | | 10a | +---------+---------+---------+---------+---------+---------+---------+ | 11b | | | 11b | | | | +---------+---------+---------+---------+---------+---------+---------+ | | | | 12T | | | | +---------+---------+---------+---------+---------+---------+---------+ | | | | 13d | | | | +---------+---------+---------+---------+---------+---------+---------+ | | | | 14e | | | | +---------+---------+---------+---------+---------+---------+---------+ | | | | 15d | | | | +---------+---------+---------+---------+---------+---------+---------+ | | | | 16c | | | | +---------+---------+---------+---------+---------+---------+---------+ | | | | 17b | | | | +---------+---------+---------+---------+---------+---------+---------+ | | | | 18c | | | | +---------+---------+---------+---------+---------+---------+---------+ | | | | 19T | | | | +---------+---------+---------+---------+---------+---------+---------+ | | | | 20T | | | | +---------+---------+---------+---------+---------+---------+---------+ +---------+---------+---------+---------+---------+---------+---------+ Appendix. Notices Note to U.S. Government Users Restricted Rights -- Use, duplication or disclosure restricted by GSA ADP Schedule Contract 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 document in other countries. Consult your local IBM representative for information on the products and services currently available in your area. Any reference to 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 IBM intellectual property right may be used instead. However, it is the user's responsibility to evaluate and verify the operation of any non-IBM product, program, or service. IBM may have patents or pending patent applications covering subject matter described in this document. The furnishing of this document does not give you any license to these patents. You can send license inquiries, in writing, to: IBM Director of Licensing IBM Corporation North Castle Drive Armonk, NY 10504-1785 U.S.A. For license inquiries regarding double-byte (DBCS) information, contact the IBM Intellectual Property Department in your country or send inquiries, in writing, to: IBM World Trade Asia Corporation Licensing 2-31 Roppongi 3-chome, Minato-ku Tokyo 106-0032, Japan The following paragraph does not apply to the United Kingdom or any other country where such provisions are inconsistent with local law: INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer of express 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 made to the information herein; these changes will be incorporated in new editions of the publication. IBM may make improvements and/or changes in the product(s) and/or the program(s) described in this publication at any time without notice. Any references in this information to non-IBM Web sites are provided for convenience only and do not in any manner serve as an endorsement of those Web sites. The materials at those Web sites are not part of the materials for this IBM product and use of those Web sites is at your own risk. IBM may use or distribute any of the information you supply in any way it believes appropriate without incurring any obligation to you. Licensees of this program who wish to have information about it for the purpose of enabling: (i) the exchange of information between independently created programs and other programs (including this one) and (ii) the mutual use of the information which has been exchanged, should contact: Lab Director IBM Canada Ltd. Laboratory 8200 Warden Avenue Markham, Ontario Canada L6G 1C7 Such information may be available, subject to appropriate terms and conditions, including in some cases, payment of a fee. The licensed program described in this information and all licensed material available for it are provided by IBM under terms of the IBM Customer Agreement, IBM International Program License Agreement, or any equivalent agreement between us. Information concerning non-IBM products was obtained from the suppliers of those products, their published announcements or other publicly available sources. IBM has not tested those products and cannot confirm the accuracy of performance, compatibility or any other claims related to non-IBM products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of those products. This information contains examples of data and reports used in daily business operations. To illustrate them as completely as possible, the examples include the names of individuals, companies, brands, and products. All of these names are fictitious and any similarity to the names and addresses used by an actual business enterprise is entirely coincidental. COPYRIGHT LICENSE: Each copy or any portion of these sample programs or any derivative work, must include a copyright notice as follows: (C) (your company name) (year). Portions of this code are derived from IBM Corp. Sample Programs. (C) Copyright IBM Corp. 1992, 2004. All rights reserved. If you are viewing this information softcopy, the photographs and color illustrations may not appear. A.1 Programming interface information Programming interface information is intended to help you create application software using this program. General-use programming interfaces allow you to write application software that obtain the services of this program's tools. However, this information may also contain diagnosis, modification, and tuning information. Diagnosis, modification and tuning information is provided to help you debug your application software. Warning: Do not use this diagnosis, modification, and tuning information as a programming interface because it is subject to change. A.2 Trademarks IBM iSeries OS/400 RPG/400 VisualAge WebSphere Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. ActiveX, Microsoft, SourceSafe, Visual C++, Visual SourceSafe, Windows, Windows NT(R), Win32, Win32s and the Windows logo are trademarks of Microsoft Corporation in the United States, other countries, or both. UNIX is a registered trademark of The Open Group. Other company, product, and service names may be trademarks or service marks of others.