0% found this document useful (0 votes)
4 views363 pages

C DOCUME 1 Sscott - Cts LOCALS 1 Temp Plugtmp Plugin-RDi StudentExerciseGuide

The document is an IBM certified course material for System i Application Development using WebSphere Development Studio Client, Version 7.0. It includes student exercises covering topics such as managing i5/OS objects, editing and compiling source code, creating screens with Screen Designer, and debugging source code. The material is intended for educational purposes and cannot be reproduced without permission from IBM.

Uploaded by

afau
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views363 pages

C DOCUME 1 Sscott - Cts LOCALS 1 Temp Plugtmp Plugin-RDi StudentExerciseGuide

The document is an IBM certified course material for System i Application Development using WebSphere Development Studio Client, Version 7.0. It includes student exercises covering topics such as managing i5/OS objects, editing and compiling source code, creating screens with Screen Designer, and debugging source code. The material is intended for educational purposes and cannot be reproduced without permission from IBM.

Uploaded by

afau
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 363

V4.

cover

 Front cover

System i Application
Development Using
WebSphere Development
Studio Client, Version 7.0

(Course code OW86)

Student Exercises
ERC 2.0

IBM certified course material


Student Exercises

Trademarks
IBM® is a registered trademark of International Business Machines Corporation.
The following are trademarks of International Business Machines Corporation in the United
States, or other countries, or both:
System i i5/OS Integrated Language
Environment
iSeries Language Environment WebSphere
OS/400 Rational
Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the
United States, other countries, or both.
Microsoft, Windows, Windows NT, Windows XP, 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 in the United States and other
countries.
Linux is a trademark of Linus Torvalds in the United States, other countries, or both.
Other company, product, or service names may be trademarks or service marks of others.

January 2008 edition

The information contained in this document has not been submitted to any formal IBM test and is distributed on an “as is” basis without
any warranty either express or implied. The use of this information or the implementation of any of these techniques is a customer
responsibility and depends on the customer’s ability to evaluate and integrate them into the customer’s operational environment. While
each item may have been reviewed by IBM for accuracy in a specific situation, there is no guarantee that the same or similar results will
result elsewhere. Customers attempting to adapt these techniques to their own environments do so at their own risk.

© Copyright International Business Machines Corporation 2005, 2008. All rights reserved.
This document may not be reproduced in whole or in part without the prior written permission of IBM.
Note to U.S. Government Users — Documentation related to restricted rights — Use, duplication or disclosure is subject to restrictions
set forth in GSA ADP Schedule Contract with IBM Corp.
V4.1
Student Exercises

TOC Contents
Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v

Exercises description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii

Exercise 1. Exploring and managing i5/OS objects and connections . . . . . . . . . . 1-1


1.1. Exercise instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
1.2. Common track . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
1.3. COBOL Track . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-21
1.4. RPG Track . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-52
1.5. Quiz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-82
1.6. Exercise Review/Wrap-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-84

Exercise 2. Editing and compiling source code . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1


2.1. Exercise instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
2.2. COBOL track . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5
2.3. RPG track . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-53
2.4. Quiz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-114
2.5. More practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-116
2.6. Exercise Review/wrap-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-117

Exercise 3. Creating a screen with Screen Designer . . . . . . . . . . . . . . . . . . . . . . . . 3-1


3.1. Exercise instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
3.2. Quiz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-51
3.3. Exercise Review/Wrap-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-52

Exercise 4. Debugging source code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1


4.1. Exercise instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3
4.2. Debugging COBOL source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4
4.3. Debugging RPG source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-49
4.4. Quiz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-94
4.5. More practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-95
4.6. Exercise Review/Wrap-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-96

© Copyright IBM Corp. 2005, 2008 Contents iii


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

iv System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

TMK Trademarks
The reader should recognize that the following terms, which appear in the content of this
training document, are official trademarks of IBM or other companies:
IBM® is a registered trademark of International Business Machines Corporation.
The following are trademarks of International Business Machines Corporation in the United
States, or other countries, or both:
System i® i5/OS™ Integrated Language
Environment®
iSeries™ Language Environment® WebSphere®
OS/400® Rational®
Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the
United States, other countries, or both.
Microsoft, Windows, Windows NT, 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 in the United States and other
countries.
Linux is a trademark of Linus Torvalds in the United States, other countries, or both.
Other company, product, or service names may be trademarks or service marks of others.

© Copyright IBM Corp. 2005, 2008 Trademarks v


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

vi System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

pref Exercises description


Exercise instructions - This section describes what you should
accomplish. You are given the opportunity to work through the
exercise given what you learned in the unit presentation.
• Exercise 1 - Exploring and managing i5/OS objects and
connections
- Start the product
- Specify the workspace for project resources
- Connect to an iSeries system
- Work with objects on i5/OS, including:
• Add a library to your library list
• View libraries in your interactive job’s library list
• Work with source physical files and members
• Run i5/OS commands
- Customize the workspace
- Familiarize yourself with the workbench and the LPEX editor
- Work with objects in the iSeries Table view
- Create and use resource filters
- Create a user action for launch from Remote System Explorer
• Exercise 2 - Editing and compiling source code
- Change the default settings of the LPEX Editor Parsers
- Use SEU commands to edit source
- Undo and redo source changes
- View and search product and language-sensitive help
- Prompt specification lines for RPG
- Search, filter, and subset your source
- Compare different versions of a program and identify the
differences
- Save and verify your source
- Check source syntax and resolve syntax errors
- Change compile preferences and invoke the compile command
- Start an interactive connection

© Copyright IBM Corp. 2005, 2008 Exercises description vii


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

• Invoke a programExercise 3 - Creating a screen with Screen


Designer
- Open a DDS member for editing with Screen Designer
- Explain the different functions within the Screen Designer and
Outline views
- Show file-level keywords and record keywords
- View the details of records, record-level keywords and
field-level keywords
- View the design of the payroll application main menu
- Create a group from an existing record format
- Create a new group and add a subfile record and a subfile
control record
- Add columns to the subfile record
- Add fields to the subfile control record
- Create a field via source reference
- Set indicators to handle field errors
- View and update record and field properties
- View keywords and the properties of a keyword
- Insert a keyword
- Check there are no semantic errors in the DDS source
- Save source changes
- Compile your source changes
- Open a DDS printer file source member in CODE Designer
- Add time and date fields to the printer record with formatting
- Verify and compile the DDS printer file source member
• Exercise 4 - Debugging source code
- Define a service entry point
- Launch debugger via service entry point trigger
- Add a breakpoint
- Add a conditional breakpoint
- Edit a breakpoint
- Monitor a variable through the Monitors view
- Step into your payroll program

viii System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

pref - List the call stack entries in the Debug view


- View topology of your program via the Application Diagram
function
- Remove a breakpoint
- Monitor memory
- Set a watch breakpoint
- Invoke the debugger from the Launch Configurations window
- Pass a parameter into the program to be debugged
• Debug a batch job in message-wait statusExercise 5 - iSeries
Projects Perspective
- Download selected files or members to your workstation
- Verify downloaded source members
- Launch the LPEX editor on a local source member under an
iSeries Project
- Put an i5/OS connection into offline mode
- Edit a local source member under an iSeries Project
- View an outline of the local RPG source
- Open a local DDS member via Screen Designer for edit from
the iSeries Projects Navigator
- Compile a single member
- Create a personal development library (single developer
sandbox)
- Create an empty iSeries Project
- Populate the empty iSeries Project
- Select a build style for the iSeries Project
- Build the iSeries Project
- View all the remote objects in the iSeries Project Navigator
- Filter the objects to remove the remote only objects from the
iSeries Project Navigator
- Remove the Local/Remote Flags from the iSeries Project
Navigator
- Push only a changed file to i5/OS

© Copyright IBM Corp. 2005, 2008 Exercises description ix


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

x System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Exercise 1. Exploring and managing i5/OS objects


and connections

What this exercise is about


This module teaches you about the WebSphere Development Studio
Client workbench, the workspace, and perspectives. The exercises
specifically focus on the Remote System Explorer perspective and
using this perspective to access and work with i5/OS objects.

Important

WebSphere Development Studio Client 7.0 still refers to “iSeries” on product panels and
menus instead of “i5/OS”. The convention used in this course is that we will use “iSeries”
when needing to refer to product panel or menu text, but will use “i5/OS” in other instruction
text to accurately reflect the current system name. We are using “i5/OS” instead of “System
i” to be more accurate in the situation where System i has multiple partitions (i.e. i5/OS,
Linux, AIX).
In any case, “iSeries” and “i5/OS” should be considered interchangeable and equivalent,
and use of both terms in these exercises is intentional.

What you should be able to do


At the end of the lab, you should be able to:
• Start the product
- Set the default workspace
- Access unique tools and views targeted towards i5/OS
application development tasks
• Create a connection to an i5/OS system
- Connect to an i5/OS system
- Add a library to your library list
- View libraries in your interactive job's library list from the
Remote Systems view
- Find a source physical file in your library
- View members in a source physical file using the iSeries Table
view
- Customize the columns in the iSeries Table view

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

- Open a member for edit from the iSeries Table view or the
Remote Systems view
- Maximize the editor window
- Open another member for edit
- Switch from one edit session to another edit session
- Display a structural outline of items defined in a source member
• Describe the features of Remote System Explorer
- Create a filter to show specific i5/OS libraries
- Change the filter to add more i5/OS libraries
- Create a filter to show all the source files in a library
- Access members to edit from your filter
- Create a user action that copies a source file with data to a new
source file in the same library
- Specify user action parameters
- Specify a restriction on a user action
- Test the user action
- Run an i5/OS command from the iSeries Table view

Introduction
In this lab, you will learn how to create a connection to an i5/OS
system, find a library in your library list, select objects from a library,
and 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.
You also customize the Remote System Explorer perspective to work
with i5/OS objects by defining filters, performing actions, and defining
your own actions. In short, you'll see how Remote System Explorer
can organize and integrate your work and make that work easier.

1-2 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty 1.1. Exercise instructions


This exercise contains tracks for working with particular programming languages: COBOL
and RPG. The same WDSC concepts are taught for either language. You should choose
the programming language you are most comfortable with. First you will perform exercise
steps in a “Common track” - these steps are the same regardless of whether you are using
COBOL or RPG. At the end of the “Common track”, there will be instructions for branching
to either the “COBOL track” or the “RPG track”.

Hint

Throughout the exercises, you will need to refer to your lab information sheet for userids or
i5/OS names, etc. The convention we use is to indicate a substitution variable in the
exercise text/screenshots enclosed in bracket characters ‘<‘ and ‘>. For example, you may
see <i5/OS_system> listed in a prompt within a WDSC panel screenshot. Find this
variable on the left-hand column of your lab information sheet, and get the appropriate
value from the right-hand column to enter into the product panels/prompts to completely
replace <i5/OS_system>. Do not enter the actual ‘<‘ and ‘>’ characters - those are just to
indicate a substitution variable lookup to the lab information sheet.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

1.2. Common track


Part 1: Starting the product
First you must start the product. Follow these steps to start the product:
__ 1. Click Start on the task bar of your desktop.
__ 2. Select Programs or All Programs, depending on your system.
__ 3. Select IBM Software Development Platform > WebSphere Development Studio
Client for iSeries > WebSphere Development Studio Client for iSeries.

Hint

If you are working with the Advanced Edition of the product you will see the words
“Advanced Edition” in the product name.

__ 4. A Workspace Launcher dialog will appear. Here, in the next step, you will 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.

__ 5. Replace the final subdirectory name in the default workspace name in this
Workspace Launcher dialog and use the directory name from your lab worksheet,
<i5/OS_userid>. For example, rselabxx (where xx is your team number, such as
rselab01).
Make sure the Use this as the default and do not ask again checkbox is not
selected.

1-4 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 6. Click OK to open the workbench. You should see a Welcome tab with circular
hotspot links to information topics. If you do not see this Welcome tab, from the
menu bar, Help -> Welcome will display this tab.

If you move the mouse over the circular icons on this Welcome panel, you will see
circular hotspot links to the following topics:
• Overview of features
• What’s New
• Samples
• First Steps
• Tutorials

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-5
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

• Web Resources
• Migrate to new release information
At the bottom of the window are icons displaying currently active user roles, and a
large icon to select or de-select user roles. Specifying user roles allows you to see
just the functions you need to perform your job, simplying the user interface within
WDSC that you need to deal with.
__ 7. Click the icon in the far right of the Welcome page to go to the workbench.

You will notice that the hotspot links to samples, tutorials, etc are now minimized and
docked to the bottom right corner of your workbench. We will examine these further
later in this lab. From the menu bar, you can always use Help -> Welcome to show
this Welcome tab information again.
__ 8. Click the maximize button to maximize the workbench.

A workbench is a desktop development environment. The workbench aims to


achieve seamless tool-integration and controlled openness by providing a common

1-6 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty paradigm for the creation, management, and navigation of workbench resources.
Each workbench window contains one or more views and an editor.

Part 2: Opening the Remote System Explorer perspective


In these steps, you will open the Remote System Explorer perspective.
__ 1. Check for the name of the perspective.

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.
__ 2. If you see a different perspective (not the Remote System Explorer) in the
workbench or no perspective, click Window > Open Perspective > Remote
System Explorer from the workbench menu.

The Remote System Explorer perspective opens.


You will work in the Remote System Explorer perspective in the workbench. This
perspective is for an i5/OS 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 i5/OS files, commands, jobs, and
integrated file system files.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-7
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

This perspective will be active when you start the product with a new workspace. If
you had used the workspace before, 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 i5/OS
programmer tools and use the views from the workbench.
__ 3. Examine the iSeries RSE Getting Started tab in the middle pane of the workbench.
This iSeries Remote System Explorer Introduction is new for WDSC 7.0, and assists
developers currently using PDM and SEU to migrate to the WDSC RSE
Eclipse-based integrated development environment (IDE).
Subject areas include information and help links regarding:
• Creating connections
• Library lists
• Table views
• Opening and compiling members
• Running and debugging programs
• Filters
Close the iSeries RSE Getting Started tab by clicking on the ‘X’ in the tab title area.
You can view this introduction information again whenever you need it by going to
the WDSC menu bar and selecting Help -> iSeries RSE Getting Started.

1-8 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Part 3: Examining connection types and Local system


When you first open the Remote System Explorer, you are not connected to any system
except your local hard drive on your workstation.
__ 1. In the Remote Systems view, you’ll see a New Connection and Local node. Click the
plus sign (+) in front of Local to expand this node, then Local Files, then Drives,
and finally C:\ to see the directories on the local Windows PC.

__ 2. We will not cover editing, copying, renaming, moving, or deleting local files, at this
time, however, we do want to mention the capability here. You have the ability to
copy or move files and directories from your local Windows PC to a remote system
that you define, and also copy or move files and directories from the remote system
to your local Windows PC.
__ 3. Click the minus sign (-) in front of Local to close this node.
__ 4. Click the plus sign (+) in front of New Connection to expand that node, if New
Connection is not already expanded.

__ 5. You will see connections for iSeries, Windows, Linux, Unix, and AIX systems. Once
defined, these are system types that you can copy/move files and directories to/from
your local Windows PC.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-9
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Part 4: Configuring a connection to i5/OS


To connect to a remote i5/OS 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 i5/OS, the workbench prompts you for
your user ID and password on that host.
The first time you connect to i5/OS, 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.
__ 1. In the Remote Systems view, New Connection should be already expanded to
show the various remote systems types you can connect to through the Remote
System Explorer.

Click the plus sign (+) in front of iSeries to configure a connection to an i5/OS
system.

1-10 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty The Name personal profile page opens.

__ 2. Click Next to accept the default value.


The profile defaults to the name of the workstation. Your default profile name will be
different from the one shown in the screenshot above.
The Remote iSeries System Connection page opens.
On this second page you specify the information for your connection. The cursor on
this page is positioned in the Host name field.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-11
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 3. In the Host name field, type <i5/OS_system> (refer to your lab information sheet
for the system name to enter).

The Connection name is automatically filled with the host name specified. You can
leave it this way to work better with the values on your lab information sheet. 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. The information in the Description field will appear in the Properties view for the
connection - you can leave this blank, or put in a description of your choice.
__ 6. Leave the Verify host name check box selected.
__ 7. Click Finish to define your system. Clicking Next would bring up a panel with
informational tips, and you would then click Finish from that panel.

Information

Since you specified to verify the host name, WDSC will ping the i5/OS host name you
specified, and the connection configuration will halt if the i5/OS can not be accessed. If you
know the i5/OS host name is correct and your PC is currently not connected to the network,
uncheck Verify host name, and the connection configuration will complete.

You have configured a connection.

1-12 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Part 5: Connecting to i5/OS


After you configure a connection to i5/OS, 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
five subsystems.
• iSeries Objects
A PDM-like group, allowing access to libraries, objects and members.
• iSeries Commands
Contains predefined commands and also allows you to create command sets,
each of which contain one or more frequently 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
Allows you to see various jobs, subset by job attributes, and to perform a number
of operations on those jobs.
• IFS Files
Accesses your i5/OS integrated file system (IFS). You can view and manipulate
files and folders within the Root file system, and also expand shortcuts to explore
the QSYS.LIB folder, and Home folders.
• Qshells
Qshells is another node under the connection, but this is a different type of
subsystem that does not involve any pre-defined groupings. From Qshells you
can launch a qsh shell interpreter, very similar to the STRQSH i5/OS command.
An interactive shell session will open as a view in your workbench, where you will
be able to issue qsh commands. As you open additional shell sessions, they will
group under the Qshells node for navigation and management purposes

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-13
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

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 to 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 is similar to WRKLIBPDM.
• Work with objects is similar to WRKOBJPDM.
• Work with members is similar to WRKMBRPDM.
In addition there are entries for working with library lists and user libraries:
• Library list is similar to WRKLIBPDM in PDM. 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
i5/OS system.

1-14 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty 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 i5/OS jobs and commands and the integrated file system.
__ 3. Work with a library in your library list and add the library that you'll be using in this
tutorial:
Right-click iSeries Objects and click Properties on the pop-up menu.

__ 4. Select Initial Library List on the left pane.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-15
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 5. Type the value of <team_lib> in the Library field and click Add.

__ 6. Click OK.
This will add the library to your library list every time you use this connection. The
library list specified on this panel is added to any library list that may be associated
with your user profile’s (*USRPRF) job description’s (*JOBD) initial library list.
The Current library by default will come from the *CURLIB setting in your user profile
(*USRPRF).
Since the WDSC connection is typically a prestart batch job and is not an interactive
job on i5/OS, the initial command associated with the user profile (*USRPRF) is not
run at connection time. To associate an initial command with the connection, that
must be done via the Initial command prompt on this Initial Library List panel.

1-16 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty
Note

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.

__ 7. Expand the Library list folder.

Now the connection will be activated and you will be prompted for a user ID and
password.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-17
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 8. Enter <i5/OS_userid> and <i5/OS_password>.

__ 9. Select the Save user ID check box.


__ 10. Select the Save password check box.
__ 11. 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.

1-18 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Back in the workbench in the Remote Systems view you will see the libraries in your
job's library list.

Notice that the <i5/OS_system> folder now has a small green arrow in the icon to
indicate it is an active connection.
Let’s take a moment to examine the libraries in the library list. Any library with
prod-sys means it comes from the system portion of the library list, defined by
*SYSVAL QSYSLIBL.
prod-cur is the current library and is indicated by a green asterisk. In your case,
RSEWDSC was specified as *CURLIB in your user profile when the *USRPRF was
created.
RSEWDSC2 was specified in the job description (*JOBD) associated with your user
profile as your initial library list.
<team_lib> was the library you specified a few steps ago on the Initial Library List
panel. It is added to any library list associated with your user profile. You also
specified it to be *LAST in the library list, which is why it shows up last on this list.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-19
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

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 physical file within the selected
library. Common actions like delete, move, and copy are valid for all kinds of objects.
You have connected to an i5/OS system.

Important

If you prefer to work with COBOL, go to and follow the instructions in “COBOL Track” on
page 1-21.
If you prefer to work with RPG, go to and follow the instructions in “RPG Track” on
page 1-52.

1-20 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty 1.3. COBOL Track


Part 1: Viewing and accessing objects in the Remote System Explorer
perspective
Now you are ready to view and access objects in your library.
To view and access an object:
__ 1. Expand library <team_lib>.
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. Navigate through the files in the Remote Systems view until you find the QDDSSRC
source file and then expand it.
__ 3. Scroll up through the files in the Remote Systems view until you find QCBLLESRC
source file and expand it as well.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-21
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

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 COBOL source member, the pop-up menu
actions include:
• Open with
• Browse with
• Verify
• Compile
Before you work with these members, examine the iSeries Table view, which is similar to
the view in 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.

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, the iSeries

1-22 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Table view displays the members inside, their names, types, attributes, text
descriptions, and status.

The top of the iSeries Table view contains a lock icon that controls the correlation
between the Remote Systems view and the iSeries Table view.

If the lock is disabled, 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, when you click on various items in the Remote Systems
view, this view does not change the contents of the iSeries Table view. To enable or
disable the lock, you can click it once to change its state.
In the iSeries Table view, you can click on a column heading to sort the rows in the
table based on the data in the column.
__ 5. In the iSeries Table view toolbar, click the lock button to unlock the table view. (If the
button appears pressed into the toolbar, it is in the locked position.) Leave the
mouse pointer over the tool button for a second or two to display the fly-over 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 instead of using the pop-up
menu for an object in the Remote Systems view and selecting Show in Table.
You can also modify which specific columns you want to see in the iSeries Table
view.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-23
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 6. To modify the iSeries Table properties, click Window > Preferences from the
workbench menu.
The Preferences Window opens.
__ 7. In the left pane of the Preferences window, expand Remote Systems.
__ 8. Expand iSeries under Remote Systems.
__ 9. Click Table View under iSeries.

__ 10. In the right pane of the Preferences window, select Last modified in the Available
columns list.
__ 11. Click the Add button.
__ 12. Now click on Last modified in the Selected columns list and click once on the
Move Up button to move Last modified ahead of the Text entry in the list.
__ 13. Click OK.

1-24 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 14. Now, update the iSeries Table view with the new column layout by clicking the down
arrow on the iSeries Table view title bar.

__ 15. Click Show columns > Customized in the pop-up menu.

Now you'll see the extra column that you've added. Note that the Last Modified
column appears between the Attribute and Text columns due to the movement you
performed in the order of the Selected columns list..

You can also sort the objects in the iSeries Table view by column.
__ 16. To sort the objects in ascending order by member type, click on the Type column
heading.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-25
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 17. If you click the heading a second time, it will sort it in descending order by member
type.
__ 18. In the Remote Systems view, select QCBLLESRC.
The table shows the members in QCBLLESRC.

Next, you will use the Remote Systems LPEX Editor to edit the member MSTDSP
found in QDDSSRC.
__ 19. 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 i5/OS-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.

1-26 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 20. Double-click the MSTDSP.DSPF tab to maximize the Editor window.
__ 21. Double-click the MSTDSP.DSPF tab again to return the view to its original size.
You have viewed and accessed objects in your library.

Part 2: Opening a second source member


Next, you will open a second member in the editor.
To open a second source member:
__ 1. In the Remote Systems view, double-click member PAYROLLC in the QCBLLESRC
source file.
This member will be loaded into the editor as well. Both source members are now
locked to your user profile on i5/OS so that no other user can edit the member while
you are editing it.
Your Editor window will look something like the following figure:

Notice the two tabs in the Editor window.


__ 2. Click on each tab to switch from one editing session to another editing session.
You have opened another member for editing.

Part 3: Displaying an outline of a source member

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-27
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

The Outline view acts as an excellent resource when you want to edit RPG, COBOL, and
DDS 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.
With WDSC 7.0, an Outline view for CL source is also supported. In this case, the outline
consists of CL labels and subroutines that you can jump to in the source.
To see an Outline view of your COBOL source:
__ 1. Click the PAYROLLC tab in the editor and click Refresh on the Outline view toolbar.
Note: If you have closed the Outline view, you can reset the perspective by selecting
Window > Reset perspective from the workbench menu or Show view > Other
then expand General and click Outline in the Show view dialog.
The Outline view contains index references to key areas of your source structure in
a tree view.

Next, explore more details of your source member.


__ 2. Expand ENVIRONMENT DIVISION.
__ 3. Expand the CONFIGURATION SECTION.
__ 4. Expand DATA DIVISION.
__ 5. Expand FILE SECTION.
__ 6. Double-click on any of the entries in the FILE SECTION of the Outline view.

1-28 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty This will position the source editor accordingly.

Part 4: Closing the source member edit sessions


We are done with both the source members for now, so let’s close them to release the lock
on the server that is being held for our edit session. We have not made any changes, so we
will not be prompted to save the source members when we close them.
__ 1. Right-click one of the editor tabs and select Close All to close all open source
members and release any held locks. You can also close individual source members

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-29
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

using the Close option, Close Others option (all except the one you right-clicked on)
or click the X on each respective source member’s edit tab to close the member.

Part 5: Exploring Remote System Explorer


Remote System Explorer allows you to:
• Simplify your work by giving you quick access to lists of i5/OS libraries, objects,
members, integrated file system files, UNIX files, and local files.
• Use the context-sensitive pop-up menus on these lists to perform actions such
as: start the Remote Systems LPEX Editor, Screen Designer, Integrated
Debugger or other common i5/OS actions.
• 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.
• Use the command support to increase your productivity by allowing you to enter
and repeat i5/OS or local commands without switching to an emulator session.

Part 6: Creating a library filter


In the Remote System Explorer perspective, you need to access the i5/OS objects you
want to work with.
In the previous exercises you have worked with the Library list. Now you will create your
own library filter. Library filters list a set of libraries from your i5/OS system in the Remote
Systems view.

1-30 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Filters allow you to easily organize elements within your system. You use the filter function
to list i5/OS native file system objects (such as libraries, objects, or members)

To create a library filter:


__ 1. In the Remote Systems view, expand the connection that connects to your iSeries
system (<i5/OS_system>), if it is 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, and it
creates the filter in the Remote Systems view.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-31
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

The Create a new iSeries library filter page opens:

Now you will create a filter to specify the libraries with which you want to work, so
they are displayed in the iSeries Objects list. In our case, we want to work with all
libraries that begin with “RSE” and the VARPG library. We will do this in two steps,
first requesting the generic RSE names.
__ 4. Type RSE* into the Library field, using the asterisk (*) wild card character.
__ 5. Click Next.
The Name the new filter page opens.

Note

You can choose between creating the filter for all connections or for this specific one only. If
you have similar libraries or objects on multiple connections, you may want this filter to
apply to all connections. The default is for the filter to be defined and accessible from all
connections (ones that are currently defined and also ones that may be created later).
If you create a filter for all connections, if you later delete the filter from one particular
connection, it will be deleted from all connections automatically.

1-32 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 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. Check the box “Only create filter in this connection”.

__ 8. Click Finish. If you would prefer to press Next, you will see a panel with a tip on
creating Filter Pools, and you can then click Finish on that panel.
Back in the Remote Systems view under iSeries Objects you will see the new filter
listing all RSE* libraries located below the Library list and User libraries filters.
Now you will add the VARPG libraries by changing your filter.

Changing the library filter


To change the library filter:

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-33
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 1. Expand and then right-click the filter All RSE and VARPG libraries and click
Change.

The Change Library Filter window opens.


__ 2. Select New filter string from the Filter strings list.

__ 3. Type VAR* in the Library field.


__ 4. Click Create.

1-34 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty The VAR* filter string is added to the list..

__ 5. Click OK.
You are now back in the Remote Systems view.

You will see the list expanded to include the VARPG library. Now you can work with
the libraries directly and can drill down to the object with which you want to work.
You have created a filter to show a specific i5/OS library and changed that filter to add more
i5/OS libraries.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-35
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Part 7: Creating an object filter


Now create an object filter. Object filters list a set of objects from your i5/OS 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.
__ 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 you will create a filter to show all your source files in your <team_lib> library.

1-36 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 3. In the Library field, type the name of <team_lib>.

__ 4. Click Browse beside the Object type field.


The Select Object Type window opens.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-37
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 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.

1-38 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 7. Click Browse beside the Object attribute field.

The Select Object Attribute window opens.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-39
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 8. Select PF-SRC under the Select an object attribute list.

__ 9. Click OK.
__ 10. Click Next.
The Name the new filter page opens.

1-40 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 11. In the Filter name field, type My source files


__ 12. .Check the Only create filter in this connection box.

__ 13. Click Finish. If you would prefer to press Next, you will see a panel with a tip on
creating Filter Pools, and you can then click Finish on that panel.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-41
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

The new object filter displays in the Remote Systems view under iSeries Objects.
Expand this filter to see your source files in your team 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-i5/OS 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.
For the next steps, assume you want to edit the member PAYROLLC in the source file
QCBLLESRC using this object filter.

Editing a member from your own object filter


To edit a member:
__ 1. Under the My source files filter, expand QCBLLESRC.
__ 2. Right-click member PAYROLLC.
__ 3. Click Open With > Remote Systems LPEX Editor on the pop-up menu. You could
also just double-click the member to open with the default editor (LPEX).
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.
You have created a filter to show all the source files in your library and accessed members
to edit from your filter.

1-42 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Part 8: Creating a user action


In PDM you can create user actions in addition to using the 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 i5/OS libraries, objects,
members and jobs as well as folders and files in any remote UNIX, Windows, Linux, Local,
or integrated file system.
To open the Work with User Actions wizard:
__ 1. Expand your i5/OS connection and expand iSeries Objects if not already
expanded.
__ 2. Expand the Library list filter if not already expanded.
__ 3. Right-click <team_lib>.
__ 4. Click User Actions > Work with User Actions on the pop-up menu.

The Work with User Actions window opens.


__ 5. In the left pane of the Work with User Actions window, expand New in the list, if it is
not expanded already, and 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.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-43
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 6. In the Action name: field, type Copy source file for the user action name.

__ 7. In the Comment field, type Copy source file with data.


__ 8. In the Command field, type CRTDUPOBJ for the command to execute.
__ 9. Click Prompt to open the command prompter for this command.
This is the command you will be running:
CRTDUPOBJ OBJ(&N) FROMLIB(&L) OBJTYPE(&T) NEWOBJ(QJUNKSRC) DATA(*YES)
We will use the command prompter to provide a form that you can fill out rather than
type a long string of parameters.

Specifying user action parameters


To specify user action parameters:

1-44 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 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.
The Duplicate data parameter is now shown on the prompt window.
__ 6. Select *YES from the Duplicate data parameter list drop-down arrow.
__ 7. Click OK.
You return to the Work with User Actions window and now the full command syntax
generated by the prompter appears in the Command: box.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-45
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Note

Clicking the Insert variable button displays a list of valid replacement variables with the
explanation of what they do.

__ 8. Select the Refresh after check box, so that the Remote Systems view gets
refreshed after the action has been run.
This Copy source file with data 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.

Specifying a restriction on a user action


To specify this restriction:
__ 1. Under the Defined Types list box, click FILE_SRC (for Source files).
__ 2. Click Add beside the Defined Types list box.
FILE_SRC is now listed under Selected types.
__ 3. Click Create. Your user action now shows up under the Object node in the left panel
of the Work With User Actions window.

1-46 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty

__ 4. Click Close.
When you right-click on a source file, this user action (Copy source file) appears on
the pop-up menu. For any other object type, it will not appear.
__ 5. Close the PAYROLLC source member in the LPEX editor if it is still open. The Copy
source file user action we will test in the next section will fail if the PAYROLLC
source member with file QCBLLESRC is still locked by the LPEX editor.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-47
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Hint

Click the X on the PAYROLLC edit tab to close the member.

Testing the user action


To test your user action:
__ 1. Locate your library filter All RSE and VARPG libraries.
__ 2. Expand the filter All RSE and VARPG libraries, if it is not already expanded.
__ 3. Expand your <team_lib> entry.
__ 4. Right-click the QCBLLESRC file.
__ 5. Click User Actions > Copy source file on the pop-up menu.

The file is copied, and the list is refreshed. Your new QJUNKSRC source file will
show in the list. You can check the messages of the CL commands you are running

1-48 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty in the RSE Communications server job by looking at the iSeries Commands log in
the right hand side bottom pane of the workbench.

__ 6. To delete the source file QJUNKSRC that you just created, right-click QJUNKSRC.
__ 7. Click Delete on the pop-up menu.
The Delete Confirmation dialog opens.
__ 8. Click Delete on the confirmation dialog.
You have created a user action that copies a source file with data to a new source file,
specified user action parameters, specified restrictions on the user action, and tested the
user action.

Note

We could have launched the user action from the object filter My source files - however,
an object filter does not refresh the list automatically like the library filter does - you have to
manually refresh the object filter list. For purposes of this lab, we chose the library filter with
the automatic refresh to reflect the results of the user action.

Part 9: Running commands from the Remote System Explorer


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. If you don't have it, in the Remote Systems view, right-click
the My source files filter and click Show in table on the pop-up menu.
As you have seen already you can now run commands on the i5/OS 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

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-49
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

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.
__ 3. Type an i5/OS command, for example ADDLIBLE, and click the Prompt button.

The Command Prompt window for the ADDLIBLE command opens.


__ 4. In the Library field, type <team_library_00> and click OK.

That will add this library to the library list of your Remote System Explorer job on the
i5/OS server.

1-50 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty The messages field will confirm the successful completion of this command. To get
to the command history (similar to F9 on a 5250 screen), select the appropriate
value from the Command list (click the down arrow beside the Messages field).

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.
You have run an i5/OS command from the iSeries Table view.

Important

You may skip over the RPG track pages, which perform the same types of steps as you just
performed in the COBOL track. Please go to the “Quiz” on page 1-82

End of exercise

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-51
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

1.4. RPG Track


Part 1: Viewing and accessing objects in the Remote System Explorer
perspective
Now you are ready to view and access objects in your library.
To view and access an object:
__ 1. Expand library <team_lib>.
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 the
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.

1-52 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty 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 work with these members, examine the iSeries Table view, which is similar to
the view in 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.

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, the iSeries

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-53
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Table view displays the members inside, their names, types, attributes, text
descriptions, and status.

The top of the iSeries Table view contains a lock icon that controls the correlation
between the Remote Systems view and the iSeries Table view.

If the lock is disabled, 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, when you click on various items in the Remote Systems
view, this view does not change the contents of the iSeries Table view. To enable or
disable the lock, you can click it once to change its state.
In the iSeries Table view, you can click on a column heading to sort the rows in the
table based on the data in the column.
__ 5. In the iSeries Table view toolbar, click the lock button to unlock the table view. (If the
button appears pressed into the toolbar, it is in the locked position.) Leave the
mouse pointer over the tool button for a second or two to display the fly-over 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 instead of using the pop-up
menu for an object in the Remote Systems view and selecting Show in Table.
You can also modify which specific columns you want to see in the iSeries Table
view.

1-54 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 6. To modify the iSeries Table properties, click Window > Preferences from the
workbench menu.
The Preferences Window opens.
__ 7. In the left pane of the Preferences window, expand Remote Systems.
__ 8. Expand iSeries under Remote Systems.
__ 9. Click Table View under iSeries.

__ 10. In the right pane of the Preferences window, select Last modified in the Available
columns list.
__ 11. Click the Add button.
__ 12. Now click on Last modified in the Selected columns list and click once on the
Move Up button to move Last modified ahead of the Text entry in the list.
__ 13. Click OK.
__ 14. Now, update the iSeries Table view with the new column layout by clicking the down
arrow on the iSeries Table view title bar.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-55
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 15. Click Show columns > Customized in the pop-up menu.

Now you'll see the extra column that you've added. Note that the Last Modified
column appears between the Attribute and Text columns due to the movement you
performed in the order of the Selected columns list..

You can also sort the objects in the iSeries Table view by column.
__ 16. To sort the objects in ascending order by member type, click on the Type column
heading.

__ 17. If you click the heading a second time, it will sort it in descending order by member
type.
__ 18. In the Remote Systems view, select QRPGLESRC.

1-56 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty The table shows the members in QRPGLESRC.

Next, you will use the Remote Systems LPEX Editor to edit the member MSTDSP
found in QDDSSRC.
__ 19. 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 i5/OS-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..

__ 20. Double-click the MSTDSP.DSPF tab to maximize the Editor window


__ 21. Double-click the MSTDSP.DSPF tab again to return the view to its original size.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-57
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

You have viewed and accessed objects in your library.

Part 2: Opening a second source member


Next, 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. Both source members are now
locked to your user profile on i5/OS so that no other user can edit the member while
you are editing it.
Your Editor window will look something like the following figure:

Notice the two tabs in the Editor window.


__ 2. Click on each tab to switch from one editing session to another editing session.
You have opened another member for editing.

Part 3: Displaying an outline of a source member


The Outline view acts as an excellent resource when you want to edit RPG, COBOL, and
DDS 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

1-58 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty 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.
With WDSC 7.0, an Outline view for CL source is also supported. In this case, the outline
consists of CL labels and subroutines that you can jump to in the source.
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.
Note: If you have closed the Outline view, you can reset the perspective by selecting
Window > Reset perspective from the workbench menu or Show view > Other
then expand General and click Outline in the Show view dialog.
The Outline view contains index references to key areas of your source structure in
a tree view.

Next, explore more details of your source member.


__ 2. Expand Files.
__ 3. Expand the MSTDSP workstation file.
__ 4. Expand the EMPSEL record format.
__ 5. Expand the EMPNO field.
__ 6. Double-click on any of the entries within the EMPNO record format Outline view.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-59
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

This will position the source editor accordingly.

Part 4: Closing the source member edit sessions


We are done with both the source members for now, so let’s close them to release the lock
on the server that is being held for our edit session. We have not made any changes, so we
will not be prompted to save the source members when we close them.
__ 1. Right-click one of the editor tabs and select Close All to close all open source
members and release any held locks. You can also close individual source members

1-60 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty using the Close option, Close Others option (all except the one you right-clicked on)
or click the X on each respective source member’s edit tab to close the member.

Part 5: Exploring Remote System Explorer


Remote System Explorer allows you to:
• Simplify your work by giving you quick access to lists of i5/OS libraries, objects,
members, integrated file system files, UNIX files, and local files.
• Use the context-sensitive pop-up menus on these lists to perform actions such
as: start the Remote Systems LPEX Editor, Screen Designer, Integrated
Debugger or other common i5/OS actions.
• 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.
• Use the command support to increase your productivity by allowing you to enter
and repeat i5/OS or local commands without switching to an emulator session.

Part 6: Creating a library filter


In the Remote System Explorer perspective, you need to access the i5/OS objects you
want to work with.
In the previous exercises you have worked with the Library list. Now you will create your
own library filter. Library filters list a set of libraries from your i5/OS system in the Remote
Systems view.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-61
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Filters allow you to easily organize elements within your system. You use the filter function
to list i5/OS native file system objects (such as libraries, objects, or members).

To create a library filter:


__ 1. In the Remote Systems view, expand the connection that connects to your iSeries
system (<i5/OS_system>), if it is 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, and it
creates the filter in the Remote Systems view.

1-62 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty The Create a new iSeries library filter page opens:

Now you will create a filter to specify the libraries with which you want to work, so
they are displayed in the iSeries Objects list. In our case, we want to work with all
libraries that begin with “RSE” and the VARPG library. We will do this in two steps,
first requesting the generic RSE names.
__ 4. Type RSE* into the Library field, using the asterisk (*) wild card character.
__ 5. Click Next.
The Name the new filter page opens.

Note

You can choose between creating the filter for all connections or for this specific one only. If
you have similar libraries or objects on multiple connections, you may want this filter to
apply to all connections. The default is for the filter to be defined and accessible from all
connections (ones that are currently defined and also ones that may be created later).
If you create a filter for all connections, if you later delete the filter from one particular
connection, it will be deleted from all connections automatically.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-63
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 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. Check the box “Only create filter in this connection”.

__ 8. Click Finish. If you would prefer to press Next, you will see a panel with a tip on
creating Filter Pools, and you can then click Finish on that panel.
Back in the Remote Systems view under iSeries Objects you will see the new filter
listing all RSE* libraries located below the Library list and User libraries filters.
Now you will add the VARPG libraries by changing your filter.

Changing the library filter


To change the library filter:

1-64 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 1. Expand and then right-click the filter All RSE and VARPG libraries and click
Change.

The Change Library Filter window opens.


__ 2. Select New filter string from the Filter strings list.

__ 3. Type VAR* in the Library field.


__ 4. Click Create.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-65
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

The VAR* filter string is added to the list..

__ 5. Click OK.
You are now back in the Remote Systems view.

You will see the list expanded to include the VARPG library. Now you can work with
the libraries directly and can drill down to the object with which you want to work.
You have created a filter to show a specific i5/OS library and changed that filter to add more
i5/OS libraries.

1-66 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Part 7: Creating an object filter


Now create an object filter. Object filters list a set of objects from your i5/OS 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.
__ 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 you will create a filter to show all your source files in your <team_lib> library.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-67
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 3. In the Library field, type the name of <team_lib>.

__ 4. Click Browse beside the Object type field.


The Select Object Type window opens.

1-68 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 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.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-69
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 7. Click Browse beside the Object attribute field.

The Select Object Attribute window opens.

1-70 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 8. Select PF-SRC under the Select an object attribute list.

__ 9. Click OK.
__ 10. Click Next.
The Name the new filter page opens.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-71
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 11. In the Filter name field, type My source files.

__ 12. Click Finish. If you would prefer to press Next, you will see a panel with a tip on
creating Filter Pools, and you can then click Finish on that panel.
The new object filter displays in the Remote Systems view under iSeries Objects:

1-72 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty 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-i5/OS 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.
For the next steps, assume you want to edit the member PAYROLL in the source file
QRPGLESRC using this object filter.

Editing a member from your own object filter


To edit a member:
__ 1. Under the My source files filter, expand QRPGLESRC.
__ 2. Right-click member PAYROLL.
__ 3. Click Open With > Remote Systems LPEX Editor on the pop-up menu. You could
also just double-click the member to open with the default editor (LPEX).
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.
You have created a filter to show all the source files in your library and accessed members
to edit from your filter.

Part 8: Creating a user action


In PDM you can create user actions in addition to using the 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 i5/OS libraries, objects,
members and jobs as well as folders and files in any remote UNIX, Windows, Linux, Local,
or integrated file system.
To open the Work with User Actions wizard:
__ 1. Expand your i5/OS connection and expand iSeries Objects if not already
expanded.
__ 2. Expand the Library list filter if not already expanded.
__ 3. Right-click <team_lib>.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-73
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 4. Click User Actions > Work with User Actions on the pop-up menu.

The Work with User Actions window opens.


__ 5. In the left pane of the Work with User Actions window, expand New in the list, if it is
not expanded already, and 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.
__ 6. In the Action name: field, type Copy source file for the user action name.

__ 7. In the Comment field, type Copy source file with data.

1-74 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 8. In the Command field, type CRTDUPOBJ for the command to execute.
__ 9. Click Prompt to open the command prompter for this command.
This is the command you will be running:
CRTDUPOBJ OBJ(&N) FROMLIB(&L) OBJTYPE(&T) NEWOBJ(QJUNKSRC) DATA(*YES)
We will use the command prompter to provide a form that you can fill out rather than
type a long string of parameters.

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.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-75
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

The Duplicate data parameter is now shown on the prompt window.


__ 6. Select *YES from the Duplicate data parameter list drop-down arrow.
__ 7. Click OK.
You return to the Work with User Actions window and now the full command syntax
generated by the prompter appears in the Command: box.

Note

Clicking the Insert variable button displays a list of valid replacement variables with the
explanation of what they do.

__ 8. Select the Refresh after check box, so that the Remote Systems view gets
refreshed after the action has been run.
This Copy source file with data 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.

Specifying a restriction on a user action


To specify this restriction:
__ 1. Under the Defined Types list box, click FILE_SRC (for Source files).
__ 2. Click Add beside the Defined Types list box.
FILE_SRC is now listed under Selected types.
__ 3. Click Create. Your user action now shows up under the Object node in the left panel
of the Work With User Actions window.

1-76 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty

__ 4. Click Close.
When you right-click on a source file, this user action (Copy source file) appears on
the pop-up menu. For any other object type, it will not appear.
__ 5. Close the PAYROLL source member in the LPEX editor if it is still open. The Copy
source file user action we will test in the next section will fail if the PAYROLL source
member with file QRPGLESRC is still locked by the LPEX editor.

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-77
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Hint

Click the X on the PAYROLL edit tab to close the member.

Testing the user action


To test your user action:
__ 1. Locate your library filter All RSE and VARPG libraries.
__ 2. Expand the filter All RSE and VARPG libraries, if it is not already expanded.
__ 3. Expand your <team_lib> entry.
__ 4. Right-click the QRPGLESRC file.
__ 5. Click User Actions > Copy source file on the pop-up menu.

The file is copied, and the list is refreshed. Your new QJUNKSRC source file will
show in the list. You can check the messages of the CL commands you are running

1-78 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty in the RSE Communications server job by looking at the iSeries Commands log in
the right hand side bottom pane of the workbench.

__ 6. To delete the source file QJUNKSRC that you just created, right-click QJUNKSRC.
__ 7. Click Delete on the pop-up menu.
The Delete Confirmation dialog opens.
__ 8. Click Delete on the confirmation dialog.
You have created a user action that copies a source file with data to a new source file,
specified user action parameters, specified restrictions on the user action, and tested the
user action.

Note

We could have launched the user action from the object filter My source files - however,
an object filter does not refresh the list automatically like the library filter does - you have to
manually refresh the object filter list. For purposes of this lab, we chose the library filter with
the automatic refresh to reflect the results of the user action.

Part 9: Running commands from the Remote System Explorer


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. If you don't have it, in the Remote Systems view, right-click
the My source files filter and click Show in table on the pop-up menu.
As you have seen already you can now run commands on the i5/OS 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

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-79
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

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.
__ 3. Type an i5/OS command, for example ADDLIBLE, and click the Prompt button.

The Command Prompt window for the ADDLIBLE command opens.


__ 4. In the Library field, type <team_library_00> and click OK.

That will add this library to the library list of your Remote System Explorer job on the
i5/OS server.

1-80 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty The messages field will confirm the successful completion of this command. To get
to the command history (similar to F9 on a 5250 screen), select the appropriate
value from the Command list (click the down arrow beside the Messages field).

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.
You have run an i5/OS command from the iSeries Table view.

End of exercise

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-81
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

1.5. Quiz
Now you are ready to review your knowledge of this module by taking the quiz. You can
also apply what you have learned in this module by completing the practice tasks detailed
in “Exercise Review/Wrap-up” on page 1-84.
__ 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. The lock icon controls the correlation between the Remote Systems view and the
iSeries Table view. (T, F)
__ 5. 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).
__ 6. You can create filters for all connections or for a specific connection. (T, F)

1-82 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 7. You give your filters a specific name because the Remote System Explorer saves
them for future use, unlike PDM, which does not save filters. (T, F)
__ 8. If you end up with too many filters, you can create filter pools. (T F)
__ 9. Filters can be specified for non iSeries servers and your local system. (T, F)
__ 10. You can specify a restriction on a user action. (T, F)

© Copyright IBM Corp. 2005, 2008 Exercise 1. Exploring and managing i5/OS objects and connections 1-83
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

1.6. Exercise Review/Wrap-up


In this exercise you have learned how to:
• Start the product
• Set the default workspace
• Access unique tools and views targeted towards i5/OS application development
tasks
• Create a connection to an i5/OS system
• Connect to an i5/OS system
• Add a library to your library list
• View libraries in your job's interactive library list from the Remote Systems view
• Find a source physical file in your library
• View members in a source physical file using the iSeries Table view
• Customize the columns in the iSeries Table view
• Open a member for edit from the iSeries Table view or the Remote Systems view
• Maximize the editor window
• Open another member for edit
• Switch from one edit session to another edit session
• Display a structural outline of items defined in a source member
• Create a filter to show specific i5/OS libraries
• Change the filter to add more i5/OS libraries
• Create a filter to show all the source files in a library
• Access members to edit from your filter
• Create a user action that copies a source file with data to a new source file in the
same library
• Specify user action parameters
• Specify a restriction on a user action
• Test the user action
• Run an i5/OS command from the iSeries Table view

1-84 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Exercise 2. Editing and compiling source code

What this exercise is about


This exercise teaches you how to edit, verify, and compile COBOL or
RPG in the Remote Systems LPEX Editor and learn about some of the
editor's language features.
When errors are found by either the verify or the compile step, the
iSeries Error List view 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 COBOL or RPG program that you have created.

What you should be able to do


At the end of the lab, you should be able to:
• Change the default settings of the LPEX Editor Parsers
• Change the color settings and font used by the editor
• Change the default behavior of the Enter key
• Use SEU commands to edit source
• Undo and redo source changes
• View language sensitive help for the operation codes
• View a list of all help contents
• Limit the search scope of help to specific documents
• Search the help
• Request a prompt for a specification line (RPG)
• Display context sensitive help for any field in the iSeries Source
Prompter
• Use the Find and Replace window to search for an item in your
source
• Filter or subset your source with LPEX filters
• Search through members in a source physical file
• Compare different versions of a program and identify the
differences
• Syntax check source by line
• View help on syntax errors

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

• Check for semantic errors on your workstation


• Start the Program Verifier tool
• Use the iSeries Error List view to locate each error in the source
• Change compile preferences
• Invoke the compile command
• Change the current library using the Command field in the iSeries
Table view
• Start an interactive connection and associate it to your WDSC
connection via STRRSESVR
• Invoke the payroll program

Introduction
Your program editing tasks are simplified with the Remote Systems LPEX Editor. The editor
can access source files on your workstation or your i5/OS 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
• Multiple simultaneously editable split-screen views of same source member
• Sequence numbers, which allow SEU-style commands in the prefix area
• Intelligent tabbing between columns for column-sensitive languages

2-2 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty • Automatic uppercasing for languages that expect uppercase


• Settings for column-sensitive languages that simplify text insertions and
deletions
• On-line language reference
In this lab you will be editing either the ILE COBOL source member PAYROLLC (in the
COBOL track) or the ILE RPG source member PAYROLL (in the RPG track).

Hint

You might want to maximize the Editor window (by double-clicking the tab) during this
module.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

2.1. Exercise instructions


This exercise contains separate tracks for two programming languages:
• For exercises about editing and compiling COBOL source, go to Exercise 2.2,
COBOL track, on page 2-5.
• For exercises about editing and compiling RPG source, go to Exercise 2.3, RPG
track, on page 2-53.

2-4 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty 2.2. COBOL track


Follow the instructions in this section to learn how to edit, verify, and compile COBOL
source in the Remote Systems LPEX editor. This exercise uses the ILE COBOL source
member PAYROLLC in source file QCBLLESRC. Start an edit session with PAYROLLC if
the member is not already in the LPEX Editor area.

Hint

Use your My Source files filter to locate file QCBLLESRC and then member
PAYROLLC.cblle - doubleclick PAYROLLC.cblle to open it in LPEX for editing.

Part 1: 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

Opening Preferences window


__ 1. Click on the Window drop-down menu, and then select Preferences... You will be
changing the default settings of LPEX Editor Parsers, Appearance, and User Key
Actions.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-5
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Changing the editor appearance


Other preference settings are located under LPEX Editor. Appearance allows you to
modify color settings and font used by the Editor.
__ 1. In the left pane of the Preferences window, expand LPEX Editor.

__ 2. Select Appearance under LPEX Editor.


__ 3. Select formatLine under the Styles list.
__ 4. Change the Foreground color to dark green by clicking the button and selecting the
color from the palette.
__ 5. Change Font size to 12 by clicking the Change button and selecting 12 in the Size
list.
__ 6. Change Background color to light green by clicking the color button and selecting
the color from the palette.

2-6 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Notice how your changes are reflected in the sample edit view.

__ 7. Select currentLine under the Styles list.


This option highlights the line that the cursor is on. The option applies to all source
files opened in the editor area.
__ 8. Change the Background color to light yellow.
__ 9. If you don't like the changes you made, you can click the Restore Defaults button to
return to the original settings for Appearance. Otherwise, you can leave these
settings by pressing the Apply button.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-7
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Modifying the default behavior of the Enter key


To modify the default behavior of the Enter key to split the current line in the source instead
of creating a new line:
__ 1. Expand LPEX Editor in the Preferences window (if not already expanded), and then
select User Key Actions.

__ 2. 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.
__ 3. Select splitLine from the dropdown box in the Action field (or optionally type
splitLine directly into the Action field).
__ 4. Click Set.

2-8 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 5. Click OK on the Preferences window.


__ 6. Return to the Editor window.
You have changed the default editor settings.

Seeing the results of splitLine


To see what splitLine does:
__ 1. Place the cursor somewhere on a line and press Enter.
The text to the right of the cursor is moved to the next line.
__ 2. Now, correct what you just did by using the Edit pulldown on the main workbench
menu, and then select Undo.

Part 2: 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.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-9
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

To enter SEU commands:


__ 1. Move the cursor into the gray sequence number area to the left of the edit area.
__ 2. Type dd over any sequence number, which automatically blanks out whatever
remains of the sequence number in the prefix area.
__ 3. Go down a few lines and type dd again and press Enter.

Notice that the lines have been deleted.


__ 4. Make sure the cursor is within the sequence number area.
__ 5. Type i5 and press Enter.
Five new blank lines are inserted.
You have learned how to use SEU commands in the editor.

Part 3: 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.

2-10 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty To undo and redo edit changes:


__ 1. Click Edit > Undo from the workbench menu.

Notice that the five new lines that you added in the previous section disappear and
the status line is decremented and only shows 1 change now.
__ 2. Press Ctrl+Z to undo the last change remaining.
Notice that the lines you previously deleted with the dd commands now reappear
and the status line does not show any changes remaining.

Note

Ctrl+Z is a keyboard shortcut that performs an Undo, just like Undo from the workbench
menu.

__ 3. Click Edit > Redo from the workbench menu.


Notice that the lines that just reappeared are gone. The previous undo of a delete is
reversed, thus the lines now deleted again.
At this point you will reload the source from the i5/OS to make sure that it is back in
its original form.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-11
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 4. Click File > Close on the workbench menu.


Tip: You can also click the X on the PAYROLLC tab.

A Save Resource dialog opens asking if you want to save the latest changes.

__ 5. Click No. This will not save any of the delete and insert practice changes you made.
__ 6. Go back to the workbench to the Remote Systems view and open the PAYROLLC
member in the QCBLLESRC file.
You have learned how to undo and redo changes that you made to a file.

Part 4: Invoking language-sensitive help


Inside the editor, cursor-sensitive language-reference help is available.
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.

Accessing language sensitive help


To access language sensitive help:
__ 1. Position the cursor over the word MOVE in line 231 of the ILE COBOL source.
__ 2. Press F1.
After a few moments, language-sensitive help for the MOVE operation code appears
in a Help window.

2-12 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Text marked in blue in the Help window contains links to more detailed information
about the topic.

__ 3. Click the link Format 1 - MOVE.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-13
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

The Help page for Format 1- Move is displayed.

__ 4. Minimize the Help window by clicking the first button in the upper right corner.
__ 5. Select Help > Help Contents on the workbench menu to see a list of all help that is
available in the product.

2-14 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 6. In the left pane of the Help window, click WebSphere Development Studio Client
for iSeries and then expand Reference.

__ 7. Expand Language Reference.


__ 8. Expand iSeries programming information.
__ 9. Expand High-level languages.
__ 10. Expand ILE COBOL.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-15
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 11. Expand Programmer’s Guide and select What’s New..

__ 12. In the right-hand pane of the help window, you will see a list of all the ILE COBOL
releases with links to the functional enhancements that were new in each release.
Click What’s New in V5R4? for an example.
__ 13. Explore the Help window to see what else is available in the ILE COBOL
Programmer’s Guide and Language Reference.
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.

2-16 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Limiting the search scope


To limit the search to specific documents in the help:
__ 1. Click Search scope.
The Select Search Scope dialog opens.
__ 2. Select the Search only the following topics radio button.

__ 3. Click New.
The New Search List dialog opens.
__ 4. In the List name field, type Programming Language Reference, for example.
__ 5. Expand WebSphere Development Studio Client for iSeries.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-17
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 6. Select the Reference check box.

__ 7. Click OK on the New Search List dialog.

2-18 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty The Select Search Scope dialog reopens again with Programming Language
Reference selected in the topic list.

__ 8. Click OK on the Select Search Scope dialog.


__ 9. In the What’s New list, you may have noticed a new intrinsic function called TRIML.
We will do a Search to see information about this new function. In the Search field,
type TRIML.

Note

Notice how the Search scope is set to the Programming Language Reference list name
that you created.

__ 10. Searching requires a help index, which is built the first time the search function is
used after a release of WDSC is installed on your PC. It takes approximately 5
minutes to create the index. However, once created, subsequent searches are very
fast. The lab setup should have already built the search index for you.
To complete the search query, click GO.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-19
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

The search results display. Select the second TRIML result as seen below..

__ 11. Close the help window


You have accessed language sensitive help.

Part 5: 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 PAYROLLC 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-20 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 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.
At the bottom of this window, you will notice that you have some options to select
from, for example, search only in certain columns, and so on. You want to find the
first occurrence of MSTDSP.
__ 3. In the Find field, enter MSTDSP to find the start of a file section.

__ 4. Make sure the Replace field is blank. You would use this field for text replacement.
The Editor automatically moves the active line to line 29, which contains the first
MSTDSP phrase in the file.
__ 5. Click Next to go to the next location of MSTDSP in the file. The Editor now is
positioned to MSTDSP in line 37.
__ 6. Click in the Editor window to close the Find/Replace window.
You have searched for an item in your source using the Find/Replace window.

Part 6: 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 WS-EMPNO on Line 142 in the Editor window

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-21
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 2. Select Edit > Selected > Filter Selection from the workbench menu..

Note

The source is filtered to only show lines referencing the WS-EMPNO variable.

__ 3. Move the cursor down to line 302.


__ 4. Expand line 302. This expands the section up to the next instance of WS-EMPNO.

Now we are going to show the entire source again.


__ 5. Click Edit > Show All from the workbench menu or press Ctrl+W.

2-22 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Your cursor is still positioned on the same line to which you moved the cursor (line
302), even though all source lines are now showing.
You have learned how to filter your source so that you see only lines containing a given
string.

Part 7: Filtering lines by type


To help you navigate quickly through your ILE COBOL source the editor allows you to filter
lines based on the line type. Imagine you want to see where all the divisions are defined in
your source.
To filter lines by type:
__ 1. Right-click in the Editor window with the PAYROLLC program.
__ 2. Click Filter view > Divisions on the pop-up menu.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-23
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

All source lines with divisions are displayed allowing you to move quickly and easily
to the desired subroutine in your file.

__ 3. Move your cursor to the line with the DATA DIVISION (line 64).
__ 4. Expand the declaration to show all lines in this division.
Now you could work with the source inside this division.
__ 5. Right-click in the Editor window and click Show all on the pop-up menu.
You have learned how to filter lines in your source by line type.

Part 8: Searching multiple files


If you would like to search through the members in a source physical file or through the files
in a local PC or IFS 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.
To search through multiple source members in a source physical file:
__ 1. Click Search > iSeries from the workbench menu.

The Search window opens.

2-24 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 2. In the Search string field, type ENHRS.


The Connection field should contain your connection name, <i5/OS_system>,
otherwise enter it there.

__ 3. Under Target in the Library field, type <team_lib>, if not already entered.
__ 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 *.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-25
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 6. Click Search.
The Multi-File Search window lists all the lines in all the files that reference ENHRS.

__ 7. Double-click the last line in the list for member REFMST.


The member REFMST is automatically loaded into the editor and the cursor is
placed on the correct line. The Outline view is also positioned appropriately.

__ 8. Click the X in the REFMST tab to close the REFMST file.


You have searched through members in a source physical file for a particular string.

2-26 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Part 9: Comparing file differences from the Remote Systems view
If your product undergoes many changes, you will find the Compare utility in the workbench
useful. It allows you to compare different versions of a program and find the differences.
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.

Important

Note: Make sure all lines show in the source before starting the Compare tool. You should
be currently showing all source from your Show All operation in previous steps to remove
source filters.

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.
__ 3. Click Compare under LPEX Editor.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-27
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

In the right pane of the Preferences window make sure that the three Ignore blanks
check boxes are selected.

__ 4. Click OK in the Preferences window.


__ 5. Back in the Editor window of the PAYROLLC member double-click the PAYROLLC
tab to maximize the editor view.

2-28 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 6. Click Edit > Compare to file... on the workbench menu.

The Compare File window opens.

Hint

On the above screenshot, notice how the Compare to file... menu entry has a symbol that
looks like a triangle. This same symbol is on your workbench toolbar, and is a fast-path into
launching the Compare to file... function.

__ 7. Expand your <i5/OS_system> connection in the Compare File window.


__ 8. Expand *LIBL.
__ 9. Expand <team_lib>.
__ 10. Expand QCBLLESRC.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-29
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 11. Select member PAYROLLC2.

__ 12. Click OK.


The editor now will show the differences between these two members PAYROLLC
and PAYROLLC2.

2-30 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Mismatches in PAYROLLC and PAYROLLC2 are highlighted in different colors so


that you know where the mismatched lines are in each member.
The first highlighted line is from the second member you are comparing to (in this
case PAYROLLC2). This line is read-only.
The second highlighted line is from the member you are currently editing
(PAYROLLC).
The color style for the first line is controlled by the deletedLines style in your LPEX
editor Appearance preferences.
The color style for the second line is controlled by the addedLines style in your
LPEX editor Appearance preferences.
.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-31
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

You can move from mismatch to mismatch by right-clicking in the PAYROLLC


source LPEX view and using the Compare menu and submenu.

__ 13. Use the Next Mismatch menu entry or click Ctrl+Shift+ N to find the next
mismatch.
Next, we will end the compare session.
__ 14. Right-click in the source edit view, and select Compare > Clear to remove the
miscompare lines from the second member you are comparing to.
__ 15. Double-click the PAYROLLC tab to return the Editor window to its original size.
You have compared different versions of the program and found the differences.

Part 10: Checking syntax


One of the powerful features that the LPEX Editor shares with SEU is its ability to check the
syntax of your source. Syntax checking can be done either as the cursor leaves each line
of source or all at once on either the currently selected source or on the entire source
member.

2-32 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty To syntax check the file:


__ 1. Click on the PAYROLLC Editor tab to bring make LPEX the active view.
__ 2. Press Ctrl-Home to position the source view at the top of the source member.
__ 3. Click Source and then click Syntax Check All on the workbench menu.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-33
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Error messages appear that draw attention to the errors. The first error should be
near Line 88. You could right-click and select Filter view > Errors to easily see the
Verify errors..

__ 4. Move the cursor onto the first pink error message.


__ 5. Press F1.

2-34 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty This opens a window with second-level help for the error.

__ 6. Minimize the Help window.


__ 7. Add the required left parenthesis to the erroneous source line to correct the error.

Hint

PIC X50) should be PIC X(50)

__ 8. Move the cursor off the line you just fixed.


The error message is automatically removed from the editor.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-35
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Information

You can toggle automatic syntax checking. Click Window > Preferences from the
workbench menu and then expand Remote Systems > Remote Systems LPEX Editor >
iSeries Parsers and select the language you want to change the settings for in the left
pane of the Preferences window. You can then toggle this via the Automatic syntax
checking check box.

Part 11: Verifying the source


Now you explore one of the most powerful and unique features of the Remote System
Explorer – the Program Verifier. Before you compile your code on i5/OS, 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 i5/OS. It is especially beneficial when you are writing code but you are disconnected
from i5/OS, but it also saves host cycles. You can do this because Remote System
Explorer contains the parsing and checking code from the i5/OS system compilers on 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.

2-36 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty To invoke the verifier:


__ 1. Open the COBOL source file named PAYROLLC2 in the LPEX editor.
__ 2. 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 – the source must be loaded in the editor for the button to appear.)

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

The error list shows you:


• The error message itself
• The severity
• The line number
• The source location
• The connection name

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-37
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Fixing errors
Next you will fix the errors in your PAYROLLC2 source.
To fix an error in your source go to the iSeries Error List view:
__ 1. Double-click the error with an ID of LNC1463.
You are automatically brought back into the Editor window to line 302 where the
error occurred. The error is caused by EMPNO not being uniquely defined. The
variable EMPNO should be EMPNO OF EMPSEL-I.
Make the change.
__ 2. Double-click LNC1326. PRCD should really be PRCDE. Make the appropriate change
on line 402.
__ 3. Double-click LNC1329. This error is caused because the array was declared with
four elements, not 14. On line 606, change the index of the array from 14 to 4.
__ 4. The next errors are LNC0407. You can ignore these as they are severity 20. All
severity 30 errors and above are now fixed. You can filter out different severities by
using the filter menu.
Click the arrow in the upper right corner of the iSeries Error List title bar.
__ 5. Click Show Severity on the pop-up menu.

__ 6. Clear the severities you don't want to see in the list by clicking on the menu entry
(Information and Warning and Error, in this case, leaving only Severe and
Terminating errors). Perform this multiple times to clear multiple severity types. After
clearing Error, you will see all LNC0407 messages disappear from the iSeries Error
List view.

2-38 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Saving the source member


Before you lose any of your changes, it's a good idea to save them. Make sure the member
is selected. You then verify the source again to make sure that all the errors are fixed.
__ 1. You can save the PAYROLLC2 member using one of these ways:
• Click File > Save from the workbench menu.
• Click the Save icon in the workbench toolbar.

• Press Ctrl+S.
Changes are uploaded to i5/OS.
__ 2. Use Source > Remove Messages to clear the verify messages from your source
view, so that you can re-run verify and not have previous verify messages
remaining.
__ 3. Verify your source again via Source > Verify.

You should not see any Severe or Terminating messages. You are ready to compile
the program.
You have verified your source and fixed any errors.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-39
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Part 12: 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 i5/OS. 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 i5/OS 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. In this
exercise you can run the compile interactively.

Changing compile preferences


To change the preferences to run the compile interactive:
__ 1. Click Window > Preferences from the workbench menu.
__ 2. In the left pane of the Preferences window, expand Remote Systems.
__ 3. Expand iSeries under Remote Systems.
__ 4. Click Command Execution under iSeries.

2-40 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 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.

Invoking the compile command


You will now use the prompt for the CRTBNDCBL command to specify your compile
parameters. All entry fields pertaining to names are already filled in with the correct
information.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-41
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

To compile source:
__ 1. Right-click the PAYROLLC2 member in QCBLLESRC.
__ 2. Click Compile (Prompt) > CRTBNDCBL on the pop-up menu.

The Create Bound COBOL Program (CRTBNDCBL) dialog opens.

2-42 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 3. In the Debug view list, select the *ALL parameter.

__ 4. Click OK when you are finished.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-43
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

The progress bar on the workbench (in the bottom status area) will indicate that the
compile is running. The iSeries Error List will be shown with no errors – if you still
have the message severity filter in effect. If you specify to see Error severity level
and below, you will see the following messages.

If you are not sure that the compile was successful, you can check the iSeries
Commands 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.
You have set compile preferences, invoked the compile command, and checked for a
successful compile.

2-44 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Part 13: Submitting i5/OS commands in the iSeries Table View
You can use the iSeries Table View inside the Remote System Explorer to submit
commands to i5/OS. You can run commands from the Command field beneath the iSeries
Table View, and you can view messages in the Messages field. After you populate the
table, you can enter a command and click either Prompt to specify parameters 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 be run in the RSE communication server job,
using your connection’s library list), Batch (uses SBMJOB command and settings from
your user profile), or Interactive (uses interactive job associated with connection via
STRRSESVR command).
To issue a command:
__ 1. From the Remote Systems view, right click on file QCBLLESRC in your My source
files filter, and select Show in Table.
__ 1. Click the iSeries Table View tab from the views at the bottom of the workbench.
__ 2. Now we will change the text description of an i5/OS library. In the Command field
type the command:
CHGLIB

__ 3. Click Prompt.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-45
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 4. The Change Library (CHGLIB) prompt window will now appear. Enter RSEWDSC
for the Library field and type over *SAME with WDSC RSE Classroom Library in
the Text ‘description’ field.

__ 5. Press OK.
The command will run on i5/OS and after completion you will see the completion
message on the bottom of the iSeries Table View.

You can also connect to systems other than i5/OS with the Remote System Explorer
and launch commands for these systems as well, for example, your local system, or
Linux.
You have submitted a command to change a library text description in the command line of
the iSeries Table View.

2-46 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Part 14: 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 the following ways:
• In the Remote System Explorer communications server job.
(This is the one you are using currently.)
• In a batch job.
• In an interactive job (to test 5250 applications).
• In a server job (for debug sessions).
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 the Start RSE
Server (STRRSESVR) command to associate the emulator with a particular connection in
the Remote System Explorer communications server. A multi-threaded debug session
creates a new server job and, in this way, keeps the RSE communications server job free
for other tasks.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-47
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Associating an interactive job with your connection


To associate an interactive 5250 session with your connection:
__ 1. Start a 5250-emulation session to <i5/OS_system> with the IBM Personal
Communications (PCOMM) or System i Access for Windows Pc5250 products.

Hint

Use the Start or Configure Session function of PCOMM or Pc5250 to define a connection
to <i5/OS_system>. Your classroom instructor may already have a shortcut to PCOMM or
Pc5250 on your Windows desktop for you.

__ 2. Signon to i5/OS with <i5/OS_userid> and <i5/OS_password>.

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

2-48 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 3. In the command line, type the following command (refer to your lab information
sheet for the connection name to use):
STRRSESVR <i5/OS_system>

__ 4. Press Enter.
The value of the STRRSESVR parameter (<i5/OS_system> from your lab
worksheet) is the name of the connection you defined in the Remote Systems view.
This associates the interactive job with the Remote System Explorer
communications server.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-49
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Now the interactive 5250 job will connect to WDSC on the client PC, and go into a
wait state, waiting for you to run a program from your WDSC workbench.

Note

Notice that a command to add your team library was run in the STRRSESVR interactive
job. This came from the initial library list specification you defined in an earlier lab for your
WDSC connection.

Running the payroll program


Now you are ready to run the program that you compiled earlier.
Return to the WDSC workbench.
To run the program:
__ 1. In the Remote Systems view, locate the PAYROLLC2 program that you created.

Hint

Find your team library <team_lib> in your Library list filter. You may need to refresh the
view in your library or filter within the Remote Systems View.

2-50 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 2. Right-click the PAYROLLC2 program (*pgm).


__ 3. Click Run As > Interactive on the pop-up menu.

__ 4. Find your 5250-emulation window on your Windows desktop and bring it to the
foreground by clicking on its title bar.
You will see a Time Reporting System payroll menu.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-51
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 5. Type X beside the Employee Master Maintenance menu item.

__ 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 your name for the Name field, leaving other fields blank.
__ 11. Press Enter.
__ 12. Press F3 to end the application and return to the STRRSESVR wait screen.
__ 13. To release control of the STRRSESVR interactive job, right-click iSeries Objects on
the WDSC Remote Systems view and click Release Interactive Job on the pop-up
menu. This will end the STRRSESVR job and return the 5250 emulation window to
an i5/OS command menu.
__ 14. In the WDSC workbench, close the PAYROLLC2 and PAYROLLC editor tabs. If
prompted to save PAYROLLC, specify to save it.
__ 15. Close the Help window that is minimized to the Windows task tray.
You have completed this exercise and are ready to take the quiz. See “Quiz” on
page 2-114.

End of exercise

2-52 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty 2.3. RPG track


Follow the instructions in this section to learn how to edit, verify, and compile RPG source
in the Remote Systems LPEX editor. This exercise uses the ILE RPG source member
PAYROLL in source file QRPGLESRC. Start an edit session with PAYROLL if the member
is not already in the LPEX Editor area.

Hint

Use your My Source files filter to locate file QRPGLESRC and then member
PAYROLL.rpgle - doubleclick PAYROLL.rpgle to open it in LPEX for editing.

Part 1: 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

Opening Preferences window


__ 1. Click on the Window drop-down menu, and then select Preferences... You will be
changing the default settings of LPEX Editor Parsers, Appearance, and User Key
Actions.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-53
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Setting column sensitive editing


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 via
the workbench preferences window..
__ 1. In the left pane of the Preferences window, expand Remote Systems.
__ 2. Select Remote Systems LPEX Editor.
The right pane allows you to set preferences for this feature.

2-54 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 3. 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.
__ 4. Click Apply.
The settings are saved and the Preferences window still is active for more changes
we need to make.

Changing the editor appearance


Other preference settings are located under LPEX Editor. Appearance allows you to
modify color settings and font used by the Editor.
__ 1. In the left pane of the Preferences window, expand LPEX Editor.

Hint

Scroll up in the Preferences window to find the LPEX Editor grouping. It is a different
grouping than Remote Systems LPEX Editor at the main sub-level.

__ 2. Select Appearance under LPEX Editor.


__ 3. Select formatLine under the Styles list.
__ 4. Change the Foreground color to dark green by clicking the button and selecting the
color from the palette.
__ 5. Change Font size to 12 by clicking the Change button and selecting 12 in the Size
list.
__ 6. Change Background color to light green by clicking the color button and selecting
the color from the palette.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-55
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Notice how your changes are reflected in the sample edit view.

__ 7. Select currentLine under the Styles list.


This option highlights the line that the cursor is on. The option applies to all source
files opened in the editor area.
__ 8. Change the Background color to light yellow.
__ 9. If you don't like the changes you made, you can click the Restore Defaults button to
return to the original settings for Appearance. Otherwise, you can retain these
settings by pressing the Apply button.

Modifying the default behavior of the Enter key


To modify the default behavior of the Enter key to split the current line in the source instead
of creating a new line:

2-56 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty
Note

This is really only useful for Free-Format RPG source lines and other free-format
languages like COBOL. For fixed-specification RPG source lines, you cannot split the text
to another line without causing syntax errors in your source.

__ 1. Expand LPEX Editor in the Preferences window (if not already expanded), and then
select User Key Actions.

__ 2. 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.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-57
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 3. Select splitLine from the dropdown box in the Action field (or optionally type
splitLine directly into the Action field).
__ 4. Click Set.
For ILE RPG, an additional step is needed. For the Enter key to use the new split
line action you need to change the default Remote System Explorer behavior for the
ILE RPG language.
__ 5. Expand Remote Systems, and then Remote Systems LPEX Editor, and finally
iSeries Parsers.
__ 6. Select ILE RPG.
__ 7. Clear the Repeat previous specification type check box.

2-58 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty
Note

If you are working with fixed column specification RPG source lines, you will probably
prefer to leave the Enter key behavior set to Repeat previous specification type.

__ 8. Click OK on the Preferences window.


__ 9. Return to the Editor window.
You have changed the default editor settings.

Seeing the results of column-sensitive editing


To see what column sensitive editing does:
__ 1. Move the cursor to line 27, column 10.

Notice that the line the cursor is on is now highlighted in the color you selected for it
in the preference setting for highlight current line.
__ 2. Make sure the editor is in Insert mode. If the status area shows Replace press the
Insert key to toggle from Replace to Insert mode. You can also go to the status area
and double-click on the word Replace to toggle it to Insert mode.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-59
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 3. Press the Spacebar three times.


Notice that only the file name is shifted but none of the other columns to the right are
affected.

__ 4. Press the Backspace key three times.


Once again the file name is shifted but no other columns are affected.

2-60 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Seeing the results of splitLine


To see what splitLine does:
__ 1. Place the cursor on line 469 (sequence number 046700) before the AND (Column
25) and press Enter.

The text to the right of the cursor in this Free-Form RPG section is moved to the next
line.

__ 2. Now, correct what you just did by using the Edit pulldown on the main workbench
menu, and then select Undo.

Part 2: 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:

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-61
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

• 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.
__ 2. Type dd over any sequence number, which automatically blanks out whatever
remains of the sequence number in the prefix area.
__ 3. Go down a few lines and type dd again and press Enter.

Notice that the lines have been deleted.


__ 4. Make sure the cursor is within the sequence number area.
__ 5. Type i5 and press Enter.
Five new blank lines are inserted.
You have learned how to use SEU commands in the editor.

Part 3: 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

2-62 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty 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 five new lines that you added in the previous section disappear and
the status line is decremented and only shows 1 change now.
__ 2. Press Ctrl+Z to undo the last change remaining.
Notice that the lines you previously deleted with the dd commands now reappear
and the status line does not show any changes remaining.

Note

Ctrl+Z is a keyboard shortcut that performs an Undo, just like Undo from the workbench
menu.

__ 3. Click Edit > Redo from the workbench menu.


Notice that the lines that just reappeared are gone. The previous undo of a delete is
reversed, thus the lines now deleted again.
At this point you will reload the source from the i5/OS to make sure that it is back in
its original form.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-63
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 4. Click File > Close on the workbench menu.


Tip: You can also click the X on the PAYROLL tab.

A Save Resource dialog opens asking if you want to save the latest changes.

__ 5. Click No. This will not save any of the delete and insert practice changes you made
__ 6. Go back to the workbench to the Remote Systems view and open the PAYROLL
member in the QRPGLESRC file.
You have learned how to undo and redo changes that you made to a file.

Part 4: Invoking language-sensitive help


Inside the editor, cursor-sensitive language-reference help is 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. The 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.

Accessing language sensitive help


To access language sensitive help:
__ 1. Position the cursor over the word MOVE in line 112 of the ILE RPG source.
__ 2. Press F1.
After a few moments, language-sensitive help for the MOVE operation code appears
in a Help window.

2-64 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Text marked in blue in the Help window contains links to more detailed information
about the topic.

__ 3. Click the link Date Data Type. (You may need to scroll down the page to see the
link.)

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-65
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

The Help page for Date Data Type is displayed.

__ 4. Minimize the Help window by clicking the first button in the upper right corner.
__ 5. Select Help > Help Contents on the workbench menu to see a list of all help that is
available in the product.

2-66 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 6. In the left pane of the Help window, click WebSphere Development Studio Client
for iSeries and then expand Reference.

__ 7. Expand Language Reference.


__ 8. Expand iSeries programming information.
__ 9. Expand High-level languages.
__ 10. Expand ILE RPG.
__ 11. Expand Programmer’s Guide.
__ 12. Expand About This Guide.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-67
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 13. Click What’s New .


.

__ 14. In the right-hand pane of the help window, you will see a list of all the ILE RPG
releases with links to the functional enhancements that were new in each release.
Click What’s New this Release? for an example.
__ 15. Explore the Help window to see what else is available in the ILE RPG Programmer’s
Guide and Language Reference.
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.

2-68 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Limiting the search scope


To limit the search to specific documents in the help:
__ 1. Click Search scope.
The Select Search Scope dialog opens.
__ 2. Select the Search only the following topics radio button.

__ 3. Click New.
The New Search List dialog opens.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-69
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 4. In the List name field, type Programming Language Reference, for example.
__ 5. Expand WebSphere Development Studio Client for iSeries.
__ 6. Select Reference.

__ 7. Click OK on the New Search List dialog.

2-70 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty The Select Search Scope dialog reopens again with Programming Language
Reference selected in the topic list.

__ 8. Click OK on the Select Search Scope dialog.


__ 9. In the What’s New this release information, you may have noticed a new operation
code called EVAL-CORR. We will do a Search to see information about this new
function. In the Search field, type EVAL-CORR.

Note

Notice how the Search scope is set to the Programming Language Reference list name
that you created.

__ 10. Searching requires a help index, which is built the first time the search function is
used after a release of WDSC is installed on your PC. It takes approximately 5
minutes to create the index. However, once created, subsequent searches are very
fast. The lab setup should have already built the search index for you.
To complete the search query, click GO.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-71
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

The search results display. Select the second EVAL-CORR result as seen below.

__ 11. Close the help window


You have accessed language-sensitive help.

2-72 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Part 5: 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.

Accessing language prompts


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 on 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.

On the iSeries Source Prompter view’s toolbar you can use the three buttons in the
upper right corner to: Disable source prompt view, Disable syntax checking, and
Change to insert mode (so that entries formed by the prompter are inserted as new
lines into the source).

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-73
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Displaying context sensitive help


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.

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 DIM(numeric_constant) to see specific help for that item.
__ 4. Minimize the Help window.
You have seen how to use prompts to enter code.

2-74 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Part 6: 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 anywhere in the LPEX source editor view for PAYROLL to bring focus to the
editor.
__ 2. Click Source > Show Indentation from the workbench menu.
The iSeries Indent view opens at the bottom of the workbench.

__ 3. You can display the iSeries Indent view as a full view. Double-click the iSeries
Indent tab.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-75
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 4. Scroll down to line 150. The Row shown on the status bar reflects 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.
__ 5. Double-click the tab for iSeries Indent view to return it to the non-maximized size.
__ 6. Click the X in the top right corner of the view to close the iSeries Indent view.
__ 7. This returns you to the Editor window with the PAYROLL program.
You have used the Indent view to see the beginning and ending of constructs.

Part 7: 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:

2-76 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 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.
At the bottom of this window, you will notice that you have some options to select
from, for example, search only in certain columns, and so on. 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 automatically 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. You will be positioned in
the editor to Line 110.
__ 6. Click in the Editor window source area to close the Find/Replace window.
You have searched for an item in your source using the Find/Replace window.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-77
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Part 8: 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. Position to line 56, and then double-click the variable EMPAPL in the Editor window.
__ 2. Select Edit > Selected > Filter Selection from the workbench menu.

Note

The source is filtered to only show lines referencing the EMPAPL variable.

__ 3. Move the cursor down to position it on line 79.

2-78 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 4. Expand line 79. This expands the section up to the next instance of EMPAPL.

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 to which you moved the cursor (line
79), even though all source lines are now showing.
You have filtered your source so that you see only lines containing a given string.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-79
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Part 9: 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.
To filter lines by type:
__ 1. Right-click in the Editor window containing the PAYROLL source.
__ 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.

2-80 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 3. Move your cursor to the line with the subroutine declaration CHGCDE (sequence
number 044400, line 446).

__ 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.
You have filtered lines in your source by line type.

Part 10: Searching multiple files


If you would like to search through the members in a source physical file or through the files
in a local PC or IFS 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.
To search through multiple source members in a source physical file:

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-81
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 1. Click Search > iSeries... from the workbench menu.

The Search window opens.


__ 2. In the Search string field, type ENHRS.
The Connection field should contain <i5/OS_system>, otherwise enter it there.

__ 3. Under Target in the Library field, type <team_lib>, if not already entered.
__ 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 *.

2-82 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 6. Click Search.


The Multi-File Search window lists all the lines in all the files that reference ENHRS.

__ 7. Double-click the last line in the list for member REFMST.


The member REFMST is automatically loaded into the editor and the cursor is
placed on the correct line. The Outline view is also positioned appropriately.

__ 8. Click the X in the REFMST tab to close the REFMST file.


You have searched through members in a source physical file for a particular string.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-83
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Part 11: Comparing file differences from the Remote Systems view
If your product undergoes many changes, you will find the Compare utility in the workbench
useful. It allows you to compare different versions of a program and find the differences.
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.

Important

Note: Make sure all lines show in the source before starting the Compare tool. You should
be currently showing all source from your Show All operation in previous steps to remove
source filters.

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.
__ 3. Click Compare under LPEX Editor.

2-84 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty In the right pane of the Preferences window make sure that the three 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
to maximize the editor view.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-85
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 6. Click Edit > Compare to file... on the workbench menu.

The Compare File window opens.

Hint

On the above screenshot, notice how the Compare to file... menu entry has a symbol that
looks like a triangle. This same symbol is on your workbench toolbar, and is a fast-path into
launching the Compare to file... function.

__ 7. Expand your <i5/OS_system> connection in the Compare File window.


__ 8. Expand *LIBL.
__ 9. Expand <team_lib>.
__ 10. Expand QRPGLESRC.

2-86 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 11. .Select member PAYROLLG.

__ 12. Click OK.


The editor now will show the differences between these two members PAYROLL
and PAYROLLG.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-87
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Mismatches in PAYROLL and PAYROLLG are highlighted in different colors so that


you know where the mismatched lines are in each member.
The first highlighted line is from the second member you are comparing to (in this
case PAYROLLG). This line is read-only.
The second highlighted line is from the member you are currently editing
(PAYROLL).
The color style for the first line is controlled by the deletedLines style in your LPEX
editor Appearance preferences.
The color style for the second line is controlled by the addedLines style in your
LPEX editor Appearance preferences.
.

2-88 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty You can move from mismatch to mismatch by right-clicking in the PAYROLL source
LPEX view and using the Compare menu and submenu.

__ 13. Use the Next Mismatch menu entry or click Ctrl+Shift+ N to find the next
mismatch.
Next, we will end the compare session.
__ 14. Right-click in the source edit view, and select Compare > Clear to remove the
miscompare lines from the second member you are comparing to.
__ 15. Double-click the PAYROLL tab to return the Editor window to its original size.
You have compared different versions of the program and found the differences.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-89
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Part 12: Checking syntax


One of the powerful features that the LPEX Editor shares with SEU is its ability to check the
syntax of your source. Syntax checking can be done either as 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 syntax checker prompt to correct it.
To syntax check the file:
__ 1. In the PAYROLL LPEX Editor view, move the cursor to line 211 which contains
EXSR ACDESR in the source line.

Note

You might already be on that source line, but if not, type the line number 211 over any
sequence number in left sequence number column, and press Enter, or scroll down to line
number 211.

2-90 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 2. Append an X to the EXSR opcode to make it EXSRX .


__ 3. Move the cursor off of line 211 to another line.
__ 4. An error message appears that draws attention to the error.
.

__ 5. Move the cursor onto the pink error message.


__ 6. Press F1.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-91
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

This opens a window with second-level help for the error.

__ 7. Minimize the Help window.


__ 8. Change EXSRX to EXSR to correct the error.

Hint

You could also use Edit > Undo from the workbench menu to correct this

__ 9. Move the cursor off the line you just fixed.


The error message is automatically removed from the editor.

2-92 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty
Information

You can toggle automatic syntax checking. Optionally, click Window > Preferences from
the workbench menu and then expand Remote Systems > Remote Systems LPEX
Editor > iSeries Parsers and select the language you want to change the settings for in
the left pane of the Preferences window. You can then toggle this via the Automatic
syntax checking check box.
You can syntax check the whole source member currently in the LPEX Editor view by
clicking Source > Syntax Check All on the workbench menu.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-93
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Part 13: Verifying the source


Now you explore one of the most powerful and unique features of the Remote System
Explorer – the Program Verifier. Before you compile your code on i5/OS, 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 i5/OS. It is especially beneficial when you are writing code but you are disconnected
from i5/OS, but it also saves host cycles. You can do this because Remote System
Explorer contains the parsing and checking code from the i5/OS system compilers on 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 – the source must be loaded in the editor for the button to appear.)

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

2-94 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty The error list shows you:


• The error message itself
• The severity
• The line number
• The source location
• The connection name

Fixing errors
Next you will fix the errors in your source.
To fix an error in your source go to the iSeries Error List view:
__ 1. Double-click the first error with an ID of 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 to use content assist.

Note

Note: The Outline view must be active and populated to use content assist.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-95
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 2. Select the misspelled variable and press Ctrl+spacebar.


The selection list presents potential existing variable names with similar spelling.

__ 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.

The next error in the iSeries Error List view is a RNF7030 as well.
__ 4. Double-click the second RNF7030 entry. RSNTAX should really be RSNTAG.
Make the appropriate change.

2-96 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 5. Go to error RNF5184 in the iSeries Error List view.

Note

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.

__ 6. Double-click RNF5184.
__ 7. Fix the error with Factor 2 by replacing the 2 with a 1.

Note

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.

Hint

You can use Source > Show Indentation or right-click and Filter View > Subroutines to
determine where the ENDSR is missing.

__ 8. Move to line 398 in the editor.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-97
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 9. Remove the asterisk (*) from the C-spec, which was making this source line an
erroneous comment line..

Hint

You can use the Tab key to quickly move to the appropriate column.

All the non-informational errors are now fixed.

2-98 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty You can filter out messages according to these severities by using the filter menu.
__ 10. Click the arrow in the upper right corner of the iSeries Error List title bar.
__ 11. Click Show Severity on the pop-up menu.

__ 12. Clear the severities you don't want to see in the list by clicking on the menu entry
(Information and Warning and Error, in this case, leaving only Severe and
Terminating errors). Perform this multiple times to clear multiple severity types. After
clearing Error, you will see all non-Severe and non-Terminating messages disappear
from the iSeries Error List view.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-99
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Saving the source member


Before you lose any of your changes, it's a good idea to save them. Make sure the member
is selected. You then verify the source again to make sure that all the errors are fixed.
__ 1. You can save the PAYROLL member using one of these ways:
• Click File > Save from the workbench menu.
• Click the Save icon in the workbench toolbar.

• Press Ctrl+S.
Changes are uploaded to the i5/OS.
__ 2. Use Source > Remove Messages to clear the verify messages from your source
view, so that you can re-run verify and not have previous verify messages
remaining.
__ 3. Verify your source again via Source > Verify.

You should not see any Severe or Terminating messages. You are ready to compile
the program.
You have verified your source and fixed any errors.

2-100 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Part 14: 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 i5/OS. 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 i5/OS 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. In this
exercise you can run the compile interactively.

Changing compile preferences


To change the preferences to run the compile interactive:
__ 1. Click Window > Preferences from the workbench menu.
__ 2. In the left pane of the Preferences window, expand Remote Systems.
__ 3. Expand iSeries under Remote Systems.
__ 4. Click Command Execution under iSeries.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-101
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 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.

Invoking the compile command


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.

2-102 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty To compile source:


__ 1. Right-click the PAYROLL member in QRPGLESRC.
__ 2. Click Compile (Prompt) > CRTBNDRPG on the pop-up menu.

The Create Bound RPG Program (CRTBNDRPG) dialog opens.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-103
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 3. In the Debugging views list, select the *ALL parameter.

__ 4. Click OK when you are finished.

2-104 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty The progress bar on the workbench (in the bottom status area) will indicate that the
compile is running. The iSeries Error List will be shown with no errors – if you still
have the message severity filter in effect. If you specify to see Error severity level
and below, you will see the following messages.

If you are not sure that the compile was successful, you can check the iSeries
Commands 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.
You have set compile preferences, invoked the compile command, and checked for a
successful compile.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-105
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Part 15: Submitting i5/OS commands in the iSeries Table View


You can use the iSeries Table View inside the Remote System Explorer to submit
commands to i5/OS. You can run commands from the Command field beneath the iSeries
Table View, and you can view messages in the Messages field. After you populate the
table, you can enter a command and click either Prompt to specify parameters 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 be run in the RSE communication server job,
using your connection’s library list), Batch (uses SBMJOB command and settings from
your user profile), or Interactive (uses interactive job associated with connection via
STRRSESVR command).
To issue a command:
__ 1. From the Remote Systems view, right click on file QRPGLESRC in your My source
files filter, and select Show in Table.
__ 1. Click the iSeries Table View tab from the views at the bottom of the workbench.
__ 2. Now we will change the text description of an i5/OS library. In the Command field
type the command:
CHGLIB

__ 3. Click Prompt.

2-106 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 4. The Change Library (CHGLIB) prompt window will now appear. Enter RSEWDSC
for the Library field and type over *SAME with WDSC RSE Classroom Library in
the Text ‘description’ field.

__ 5. Press OK.
The command will run on i5/OS and after completion you will see the completion
message on the bottom of the iSeries Table View.

You can also connect to systems other than i5/OS with the Remote System Explorer
and launch commands for these systems as well, for example, your local system, or
Linux.
You have submitted a command to change a library text description in the command line of
the iSeries Table View.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-107
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Part 16: 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 the following ways:
• In the Remote System Explorer communications server job.
(This is the one you are using currently.)
• In a batch job.
• In an interactive job (to test 5250 applications).
• In a server job (for debug sessions).
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 the Start RSE
Server (STRRSESVR) command to associate the emulator with a particular connection in
the Remote System Explorer communications server. A multi-threaded debug session
creates a new server job and, in this way, keeps the RSE communications server job free
for other tasks.

2-108 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Associating an interactive job with your connection


To associate an interactive 5250 session with your connection:
__ 1. Start a 5250-emulation session to <i5/OS_system> with the IBM Personal
Communications (PCOMM) or System i Access for Windows Pc5250 products.

Hint

Use the Start or Configure Session function of PCOMM or Pc5250 to define a connection
to <i5/OS_system>. Your classroom instructor may already have a shortcut to PCOMM or
Pc5250 on your Windows desktop for you.

__ 2. Signon to i5/OS with <i5/OS_userid> and <i5/OS_password>.

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

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-109
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 3. In the command line, type the following command (refer to your lab information
sheet for the connection name to use):
STRRSESVR <i5/OS_system>

__ 4. Press Enter.
The value of the STRRSESVR parameter (<i5/OS_system> from your lab
worksheet) is the name of the connection you defined in the Remote Systems view.
This associates the interactive job with the Remote System Explorer
communications server.

2-110 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Now the interactive 5250 job will connect to WDSC on the client PC, and go into a
wait state, waiting for you to run a program from your WDSC workbench.

Note

Notice that a command to add your team library was run in the STRRSESVR interactive
job. This came from the initial library list specification you defined in an earlier lab for your
WDSC connection.

Running the payroll program


Now you are ready to run the program that you compiled earlier.
Return to the WDSC workbench.
To run the program:
__ 1. In the Remote Systems view, locate the PAYROLL program that you created.

Hint

Find your team library <team_lib> in your Library list filter. You may need to refresh the
view in your library or filter within the Remote Systems View.

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-111
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 2. Right-click the PAYROLL program (*pgm).


__ 3. Click Run As > Interactive on the pop-up menu.

__ 4. Find your 5250-emulation window on your Windows desktop and bring it to the
foreground by clicking on its title bar.
You will see a Time Reporting System payroll menu.
__ 5. Type X beside the Employee Master Maintenance menu item.

2-112 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 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 your name for the Name field, leaving other fields blank.
__ 11. Press Enter.
__ 12. Press F3 to end the application and return to the STRRSESVR wait screen.
__ 13. To release control of the STRRSESVR interactive job, right-click iSeries Objects on
the WDSC Remote Systems view and click Release Interactive Job on the pop-up
menu. This will end the STRRSESVR job and return the 5250 emulation window to
an i5/OS command menu.
__ 14. In the WDSC workbench, close the PAYROLL editor tab. If prompted to save
PAYROLL, specify to save it.
__ 15. Close the Help window that is minimized to the Windows task tray.
You have completed this exercise and are ready to take the quiz. See “Quiz” on
page 2-114.

End of exercise

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-113
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

2.4. Quiz
Now you are ready to review your knowledge of this module by taking the quiz. You can
also apply what you have learned in this module by completing the practice tasks detailed
in “More practice” on page 2-116.
__ 1. You can configure the LPEX Editor to adopt the keyboard and command
personalities of many popular editors. (T, F)
__ 2. To receive language sensitive help, press the ____ key in an Editor window. Name
the key:
a. F2
b. F3
c. F1
d. F4
__ 3. 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
__ 4. 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
__ 5. 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. The ______ tool checks for semantic (compile) errors on your workstation so that
you can guarantee a clean compile on i5/OS.
a. Compile
b. LPEX Editor
c. Program Generator
d. Program Verifier

2-114 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 7. If you used the local program verifier, then your host compiles should be successful;
no wasted i5/OS cycles. (T, F)
__ 8. A compile command can be run on an i5/OS server from the Remote System
Explorer, and you can retrieve error feedback from the compile. (T, F)
__ 9. Interactive programs require a 5250 emulator, and you need to first run a Start RSE
Server (STRRSESVR) command to associate the emulator with a particular
connection in the Remote System Explorer. (T, F)

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-115
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

2.5. More practice


Given your experience using the Remote Systems LPEX Editor, try these new tasks:
• Check out how token highlighting works in your ILE COBOL or ILE RPG source.
• Display a format line and use it to enter your source.
• Filter source by comments.
• Set auto-uppercase on.
Use the product online help to assist you in these tasks.

2-116 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty 2.6. Exercise Review/wrap-up


In this exercise you have learned to:
• Check for semantic errors on your workstation
• Start the Program Verifier tool
• Use the iSeries Error list to locate each error in the source
• Use content-assist to fix an error
• Save your source
• Re-verify source
• Change compile preferences
• Invoke the compile command
• Change the current library using the Command field in the iSeries Table view
• Start an interactive connection
• Invoke the payroll program
• Change the default settings of the LPEX Editor Parsers
• Change the color settings and font used by the Editor
• Change the default behavior of the Enter key
• Use SEU commands to edit source
• Undo and redo source changes
• View language sensitive help for the MOVE operation code
• View a list of all help contents
• Limit the search scope of help to specific documents
• Search the help
• Request a prompt for a specification line (RPG)
• Display context sensitive help for any field in the iSeries Source Prompter
• Use the Find and Replace window to search for an item in your source
• Filter or subset your source with LPEX filters
• Search through members in a source physical file
• Compare different versions of a program and identify the differences
• Syntax check source by line
• View help on syntax errors
• Check for semantic errors on your workstation

© Copyright IBM Corp. 2005, 2008 Exercise 2. Editing and compiling source code 2-117
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

• Start the Program Verifier tool


• Use the iSeries Error List view to locate and fix each error in the source
• Change compile preferences
• Invoke the compile command
• Change the current library using the Command field in the iSeries Table view
• Start an interactive connection and associate it to the WDSC connection via
STRRSESVR
• Invoke the payroll program

2-118 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Exercise 3. Creating a screen with Screen


Designer

What this exercise is about


This module teaches you about the various aspects of Screen
Designer while modifying a display file to add a screen. You will step
through each part of the Screen Designer tool interface and update
some DDS as well.
You will also use the older CODE Designer product to work with printer
file DDS.
In the workbench’s Remote System Explorer perspective, you will use
the connection that you used in the module before.

What you should be able to do


At the end of the lab, you should be able to:
• Open a DDS member for editing with Screen Designer
• Explain the different functions within the Screen Designer and
Outline views
• Show file-level keywords and record keywords
• View the details of records, record-level keywords and field-level
keywords
• View the design of the payroll application main menu
• Create a group from an existing record format
• Create a new group and add a subfile record and a subfile control
record
• Add columns to the subfile record
• Add fields to the subfile control record
• Create a field via source reference
• Set indicators to handle field errors
• View and update record and field properties
• View keywords and the properties of a keyword
• Insert a keyword
• Check there are no semantic errors in the DDS source

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

• Save source changes


• Compile your source changes
• Open a DDS printer file source member in CODE Designer
• Add time and date fields to the printer record with formatting
• Verify and compile the DDS printer file source member

Introduction
Using an editor to create and maintain DDS source for your display
files can be a frustrating and difficult task. What would be great is a
graphical design tool that lets you design your screens visually and
then generate the DDS source for you. Well, that's exactly what
Screen Designer does for you.
Screen Designer helps the novice DDS programmer create screens
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.

3-2 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty 3.1. Exercise instructions


Part 1: Opening a DDS member in the Remote Systems view
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 <team_lib>.

__ 3. Right-click the MSTDSP member.


__ 4. Click Open With > Screen Designer on the pop-up menu.
The member MSTDSP will be downloaded to the workstation and loaded into
Screen Designer. Screen Designer is packaged within WDSC Advanced Edition.
You have opened the DDS source member MSTDSP in the Remote Systems view using
Screen Designer.

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Part 2: Viewing the DDS representation in Screen Designer


What you are looking at now is three views in your WDSC workbench. The main Screen
Designer view in the middle includes a screen image of your DDS with a tools palette of
record types, field types, constant types, and help types. The view also contains a
collapsible Controls section where you can see the defined screens and record formats.
The second view on the far right is the Outline view. This is a hierarchy representation of
your DDS records, fields, and keywords. 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 third view is a Properties view in lower left corner of your WDSC workbench (by
default, but shown below manually moved underneath the Outline view). It is a companion
view to the other DDS views, showing details on the DDS keyword/object selected in the
main Screen Designer view or in the Outline view.

3-4 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty To show file-level keywords and the record SELECT in the DDS tree:
__ 1. In the Outline view, expand the MSTDSP.DSPF folder.
__ 2. Expand the file-level keywords in the first folder under MSTDSP.DSPF, beginning
with DSPSIZ...
__ 3. Expand the SELECT record.
__ 4. Expand the EMESS field, and click to select the EMESS folder.

The Outline view DDS tree now shows you a summary of the file-level keywords and
of the record SELECT.
You have seen the file-level keywords and the record SELECT in the DDS tree.

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-5
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

In the main Screen Designer view, note how the SELECT record is highlighted in the
Controls section, and in the green screen design view, the EMESS field on Line 21 is
highlighted.

3-6 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty
Information

Experiment with the magnification and grid sliders and how they affect the 5250
green-screen window appearance.
The default magnification is 100%. The 100% button will take the magnification back to this
default if you want to return after using the slider to increase or decrease the view of the
green-screen window. Next to the 100% button is a two-sided arrow button that will
automatically scale the green-screen window to the current width of the Screen Designer
view in the workbench, so that the entire width of the green-screen application can be
seen.
The Grid slider adjusts the visible intensity of the row-column grid on the green-screen
application display so that you can line up rows and columns easier with your display fields.
The default grid intensity is 20%.

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-7
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Part 3: Selecting the DDS object


The Screen Designer view contains a collapsible Controls section where you can see the
defined screens and record formats. This is located at the top portion of the view.
When a record is selected in the Controls section, the Outline view is positioned to that
same record. There is a Properties view that will also be dynamically updated to reflect
information on the selected DDS record. In addition, the green-screen DDS view will
display the selected record format.
To work with the DDS record SELECT:
__ 1. In the DDS tree in the Outline view, click the SELECT record.
The Properties view is updated to show information on the SELECT record,
including the number of fields in the record..

3-8 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 2. In the Outline view, expand the SELECT record-level keyword folder.
__ 3. Expand the BLINK ALARM folder.
__ 4. Expand the ALARM keyword folder, and then click on Condition 60.
The Properties view shows the indicators set for the ALARM keyword (indicator 60
is the only only condition set). This interface can be used to AND, OR, and NOT
indicators.

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-9
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 5. Now, you will look at the DDS source line and properties for a selected object, you
are working with. In the Outline view for the SELECT record, click to select, and
then expand the EMESS field folder and subfolders..

3-10 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 6. Double-click on the Properties tab to maximize the view or drag the Properties tab to
the bottom middle view area in your workspace, or simply re-size the view to see
more details on the EMESS field.

__ 7. Click on the Attributes tab to see the high-intensity setting for this field, that is
conditioned by Indicator 60.

Note

Any changes made within this Properties panel is automatically reflected in the
green-screen design preview and in the DDS Source

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-11
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 8. In the main Screen Designer view, switch from the Design tab to the Source tab to
view the DDS source member. You may need to click on the Properties view tab to
restore it from maximized to normal size. The source is automatically positioned to
the EMESS field definition, because EMESS is the selected object in the Outline
view.
.

Even this relatively small and simple DDS source member demonstrates how much
easier it is to use the Screen 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.
You have seen the details of the record SELECT, the record-level keywords and the
field-level keywords.

3-12 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Part 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 page allows 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 a screen (for display files). It allows you to design your application's
screens 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.
You can create new records, fields, and constants directly on the Design page by using the
palette items to the right of the Design area. The Properties view for a selected DDS object
allows quick access to many of the editing features as well as information about the
currently selected object.
__ 1. Click the MAIN-MENU1 screen in the Screens list of the Controls section in the main
Screen Designer view.

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-13
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

In order to understand where MAIN_MENU1 came from, you need to understand the
concept of a screens group. A screens group is simply a collection of one or more DDS
records that represent how a screen would be assembled at runtime. It allows you at
development time to work with screens as they would appear when they get assembled by
your programs at runtime. To work with screen groups in Screen Designer you need to tell
Screen 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_MENU1 has been pre-created
for you by your instructor and Screen Designer has saved this information in the DDS
source in comment lines. Any screen groups that you create are persisted as comment
lines in the DDS so you can re-use these groups in subsequent Screen Designer sessions.
Any groups you create will appear in the Screens list in the Controls section of the main
Screen Designer view to allow quick access to each group of records.
You have seen the concept of a group, specifically the MAIN_MENU1 group.

Part 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 screen group:
__ 1. In the Controls section of the main Screen Designer view, press the New button to
the left of the Screens list.

3-14 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 2. Type over the default screen name of Untitled1, changing it to SCREEN1.

A blank Design page for the group SCREEN1 opens.


__ 3. Click the Records tab, click the EMPSEL record format in the list, and press the
Add 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.

You have finished creating a group. You could now work in the Design page with the
record formats contained in this group. Instead you'll create a new record format.

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-15
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

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. Subfiles are not difficult to create with
Screen Designer.
You have inserted a new screen group using the existing record EMPSEL.

Part 6: Creating new screens


To create a new record screen on the Design page you need to create a screen group that
will create an empty page you can work with.
To create a new screen group:
__ 1. In the Controls section of the main Screen Designer view, press the New button to
the left of the Screens list.
__ 2. Type over the default screen name of Untitled1, changing it to EMPL_LIST
A blank Design page for the group EMPL_LIST appears.

__ 3. You can create things on the Design page by selecting the appropriate tool from the
Palette on the right-hand side and then click on the Design page where you want it

3-16 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty to be created. Right now, most tool buttons are absent from the palette because
there is no record in which to create fields. The only two Records buttons available
are Standard Record and Subfile Record. If you leave the mouse over a button for
a second or two, fly-over help will appear describing the indicated button.
__ 4. Click the Subfile Record button and then click anywhere within the blank gray
design area.

The design area is still empty, but it turns black, and a subfile and a subfile control
record pair are created. You can see this via the Records tab, with SFL1 and CTL1
created for you..

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-17
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Additionally, you can see the newly created subfile and subfile control record pair in the
DDS outline and Properties views.

You have created a new screen group with a subfile record.

3-18 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Part 7: Adding fields to the subfile record


Now you will add some columns to the subfile using the Design page. You will position the
subfile 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. Make sure subfile record SFL1 is active in the design view, by clicking on it in the
Controls section.

__ 2. Click the Named field button (shown below) and then click somewhere on row 8.

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-19
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Six fields appear in a vertical column. This is because the subfile you created,
currently specified a SFLPAG (visible list size) of six, by default.

The Outline view confirms the size of the displayable subfile and the field placement
and length. You will move the field position in a later step, so it is OK if your field
position does not match the screenshot below.

3-20 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty The Properties view for Field1 shows the type of field, position, and length in an
editable details box. Changes in the Properties view will be automatically reflected in
the Design page and in the DDS source.

__ 3. In the Design page, click the top row in the six-row subfile, and hold the mouse
button down and drag it to Row 8, Column 5, releasing the mouse when the
hoverhelp indicator shows that the leftmost position of the field is on Row 8, Column
5.
All the rows in the subfile will move to the position on the Design page that you drag
the mouse to..

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-21
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 4. 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.

The Design area will now reflect a subfile with field length of 3, instead of 9.

3-22 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 5. Rename the field from FIELD1 to OPCODE by typing over the field name in the
Properties view, and pressing Enter. The Outline view will be automatically updated
with the change from FIELD1 to OPCODE, as will the DDS source.

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-23
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 6. In the Properties view for the OPCODE field, click the Color tab, select the Pink
button, and press the Add button to change the color from green to pink.

__ 7. Click the Basics tab in the Properties view for the OPCODE field, and change
Usage from Both to Input.

You will see the Design view reflect the new pink color, and the subfile record will be
filled with ‘I’ characters to represent Input, instead of the ‘B’ characters that
previously represented a usage of Both.
__ 8. Save your changes thus far via CTRL-s or clicking the Save toolbar button.
Now you will create an additional column in the subfile.

3-24 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Creating an additional output column


To create an additional output column:
__ 1. In the Design page Palette, click the Named Field button, and then move the cursor
to row 8, column 9 in the Design page, and click. You will see hoverhelp in the
Design page, which will assist you in locating the row and column for placement of
your new field.

__ 2. Drag the right edge of the new field out until the field has length 30.

Notice on the Outline view that you have created a new field, FIELD1, of length 30.

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-25
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 3. In the Properties view for FIELD1, click on the Basics tab, and rename the field
name to ENAME and change the Usage from Both to Output. ENAME will contain
the employee name.

3-26 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 4. In the Design page Palette, click the Named Field button, and then move the cursor
to row 8, column 41 in the Design page, and click. You will see hover help in the
Design page, which will assist you in locating the row and column for placement of
your new field.
Notice on the Outline view that you have created a new field, FIELD1, of length 9.
__ 5. In the Properties view for FIELD1, click on the Basics tab, and rename the field
name to SALARY, change the Usage from Both to Output, change Type from
Character to Zoned, and then change Shift to Y - Numeric only. On this same view,
now set the Length of the SALARY field to 8, and set Decimals to 2.

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-27
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 6. Now you will apply an Edit Code (EDTCDE) to the Salary field. In the Outline view,
click on the SALARY field under the SFL1 folder. In the main Screen Designer view,
click the Source tab. You should automatically be positioned to the DDS source line
with the SALARY field definition.

__ 7. Press the F4 function key to open an iSeries Source Prompter view for this DDS
source line. In the Functions field, type in EDTCDE(1 $) . Then press the Apply
button to enter your source file change.

Note

There is a blank space between the ‘1’ and the ‘$’.

__ 8. Press CTRL-s to save your work.


__ 9. Click the Design tab in the main Screen Designer view to return to the Design page.

3-28 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty
Important

The EDTCDE support in the DDS is correct. When called by your RPG or COBOL
program, it will format this output field in a format $666,666.66 using a currency symbol,
comma separators, and two decimal points. However, the Screen Designer Design page,
and Editing tab in Properties do not visualize Edit Codes properly. This is why you see
-66666666 with two trailing blanks in the Design page with WDSC 7.0. This should be
corrected in the next release of WDSC, and only affects viewing within Screen Designer.

__ 10. In the Properties view for the SALARY field, click the Color tab, select Yellow for the
color, and click the Add button.

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-29
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 11. The subfile seems compacted to the left. Please go into the Properties view for each
field and set the position column to:
• SALARY - Column 62
• ENAME - Column 22
• OPCODE - Column 10
This will space the fields out on the green-screen display a little nicer..

3-30 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 12. You will now change the maximum number of entries in the subfile that can be filled
in by the RPG or COBOL application. You will also specify how many of these
entries appear on the green-screen at one time before the end-user needs to scroll
the subfile.
In the Outline view, click the subfile control record CTL1. Then in the Properties
view, click the Subfile Control tab.
Set the Number of entries (SFLSIZ) to 100.
Set the Entries per displayed page (SFLPAG) to 9.

__ 13. Press CTRL-s to save your changes.

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-31
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 14. In the main Screen Designer view, make sure record SFL1 of screen EMPL_LIST is
selected for viewing via the Controls section. Now you can see that the subfile is
displaying 9 records at a time, before the end-user needs to press the scroll key to
see more.

You have added some rows to the new subfile record screen.

Part 8: Switching between multiple records


Next, fix up the Subfile control record. The screen group you created contains a subfile
record SFL1 and a subfile control record CTL1.
__ 1. Via the Controls section of the main Screen Designer view, click to select Screen
EMPL_LIST1 and then click on subfile control record CTL1 to make it the active
record in the Design page.
__ 2. You will see a blank Design page. Click the Draw records transparent icon so that
the fields in the subfile still appear at half-intensity so that column headings can be
lined up.

3-32 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty You will now see the subfile fields from record SFL1 superimposed in a
semi-transparent fashion on the Design page for subfile control record CTL1.

Hint

You can click the Display bright text button to make the semi-transparent fields easier to
see. This button is just to the left of the Draw records transparent button.

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-33
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 3. Now you will provide a 'Position to' entry in the subfile control header. From the
Palette in the Constants section, click on the Text Constant button and click again
in the Design page at Row 4, Column 9.

__ 4. Select the new constant field in the Design page, and type Position to: over the
default of “Text Constant”.

Now you need an employee name field.

3-34 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty You could create a named field with the right characteristics like you did in the
subfile, or use the Reference tab in the Properties view for the field to establish a
database or source reference. You will use a source reference to create this
employee name field from a definition in another record format within your source
member MSTDSP.

Creating the employee name field by source reference


To create the employee name field definition into the Design page:
__ 1. In the Design page for subfile control record CTL1, use the Named Field button in
the Palette to place a new field Row 4, Column 23.

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-35
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 2. In the Outline view, expand record EMPMNT and click on the ENAME field to select
it. This field is defined by reference to a database file field. When you click on it,
WDSC resolves the reference. Notice how length 30 is derived after you click on the
field.

__ 3. In the Outline view, expand subfile control record CTL1, and click on the new field
you added with the Named Field button, FIELD1.
__ 4. In the Properties view for FIELD1, click the Reference tab, and then select the
Source reference button.

3-36 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 5. You will define this field to reference a field you already have in your DDS for
employee name, so that you can make maintenance easier by changing a field
definition in one spot, and have that change reflected by reference elsewhere in
your DDS. Click the EMPMNT record, and then the ENAME field. Notice how the
reference field length of 30 and type of Character is derived for you.

__ 6. In the Design page, notice how the new field is now 30 characters long.

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-37
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 7. Now you will take a look at the generated DDS source to see the reference
information. In the Design page, click on the Source tab, and you should be
automatically positioned at the active DDS object, FIELD1, at the bottom of the
source member.
__ 8. Press F4 to bring up the iSeries Source Prompter view. Notice in the Functions field
the reference to record format EMPMNT and field ENAME within your DDS source
member.
__ 9. Now, via the iSeries Source Prompter view, change the field name from FIELD1 to
POS_TO and press the Apply button. You will notice the Outline view change from
FIELD1 to POS_TO automatically.

__ 10. Press Ctrl-s to save your source member.


You have fixed up the subfile records to add an employee name field with a position for
entry opposite this field.

Part 9: Adding field error handling


Add 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.
To set indicators:
__ 1. Select the POS_TO field and go to the Properties view.
__ 2. Click on the Color tab, select Red and press the Add button.

3-38 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 3. Now the Indicators... button will appear. Click that button.

__ 4. Type in indicator 60 and press OK.

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-39
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 5. Now use the Attributes tab to set Reverse image and Position cursor, with
indicator 60 as the condition.

__ 6. Examine the DDS generated in the Source tab of the main Screen Designer view...

Notice that all the new keywords were created with a condition of 60.
You have added error handling to the position to employee name field.

Part 10: Date field properties


The Properties notebook is mode-less. When you change an object's properties, the
selected object changes immediately.
__ 1. In the Outline view, expand the record SELECT and click to select the *DATE field.
As you select different items, the Properties notebook will continuously update itself
to show you the properties of the selected item

3-40 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 2. Change the year from 2 to 4 digits. Select the Length of year check box and select
4 digits from the list.

Notice how the sample is updated on the Properties view.


__ 3. To test the Design page, click the MAIN_MENU1 screen in the Controls section of
the main Screen Designer view and look at the upper right corner of the screen. The
year now has 4 digits.
You have used the Properties view for the record SELECT and changed the length of year
to 4 digits.

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-41
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Part 11: Adding new keywords


Screen 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 SELECT record in the Outline view.
__ 2. In the Properties view, click the Keywords tab..

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.
__ 3. In the Keywords tab, double-click the INDTXT keyword.
The keyword is created in your Outline viewfor the EMPAPL field.
__ 4. Double-click the INDTXT keyword again.
__ 5. Use the Source tab in the main Screen Designer view to see your DDS Source.

3-42 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 6. The INDTXT keyword requires two parameters. It is allowed to have multiple
INDTXT keywords with different parameters, however, you cannot have multiple
INDTXT keywords that have the same parameters; this is considered a semantic
error. In the source, add the following in the Functions field after INDTXT:
(02 ‘Hi’)

__ 7. Save your DDS Source via Ctrl-s .

Part 12: Verifying the source changes


You have just added a new record and some new fields to your DDS source. Everything
that the Screen 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 exercise by creating two INDTXT keywords describing the same field.
To verify your source:
__ 1. From the main WDSC workbench menu, click Source and then Verify. Or click the
verify button on the main WDSC workbench toolbar.

The DDS source is checked using the same verifier that the LPEX Editor uses. A
message appears on the status line at the bottom of the Designer stating that the
“Verify program action completed with errors”.
__ 2. If there are problems, they will show up in the iSeries Error List view. Click the
iSeries Error List tab. Make sure Warning level messages are showing via the
Show Severity filter.
__ 3. Double-click the warning DDS7861 in the Error list.

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-43
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

In the DDS Source view, the cursor is placed exactly where the error is in the
source. .

__ 4. Delete the source line in the EMPAPL field definition with the second INDTXT
keyword (should be line 32).

Note

You will see a red ‘X’ appear next to DDS7861 now in the iSeries Error List view, as an
indicator that the error situation has been corrected.

__ 5. Use Ctrl-s to save your source member.


__ 6. To clear the old error message from your source member, click on Source on the
main WDSC workbench menu, and then Remove Messages.
__ 7. Run the Verify again. Now you will see “Verify program action completed with no
errors” in the status message line, and you will not see any error messages in the
iSeries Error List view.
You have verified your DDS source and have identified and fixed an error in the source.

Part 13: Compiling your source changes and closing the Screen
Designer
Now you will compile the source on i5/OS just as you did in the Remote Systems LPEX
Editor and then close the Designer.
To compile your source:
__ 1. From the main WDSC workbench menu, click Compile(G) and then Compile, and
then CRTDSPF.
__ 2. Status messages will appear at the bottom of the WDSC workbench. The iSeries
Error List view will appear with no messages.

3-44 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 3. The iSeries Commands Log view will show the messages from the compile
command you issued to i5/OS.

__ 4. To close the Screen Designer, click the X on the Technical Preview: MSTDSP.DSPF
tab.

Part 14: Working with a DDS printer file


Up to this point, we have worked with a display file (DSPF). CODE Designer is useful for
editing and designing printer files (PRTF). In this section, you will open a DDS PRTF and
add a field to it.
__ 1. In the Remote Systems view of WebSphere Development Studio Client for iSeries,
locate member MSTPRT under QDDSSRC in your team library.

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-45
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 2. Right-click MSTPRT and select Open with > CODE Designer in the pop-up menu.

__ 3. After the file loads in CODE Designer, click the REPORT1 tab in the workspace.
You should now see the printer file loaded in the Design view.

3-46 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 4. Now, you will add a time field to the report. Click on the design window two spaces
after the MM/DD/YYYY field on Row 1, Column 12. (You can use the left arrow and
the right arrow to move the cursor.)

__ 5. In the palette on the left side of the design pane, click the Create time field button.
(Hold your mouse pointer over a button for a few moments to see the fly-over help
text.)

__ 6. Now, click the blinking cursor in the design pane to add the field.

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-47
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Notice that the field has the default format hh.mm.ss (hours.minutes.seconds). Next
you will change the field to use a colon (:) as a separator.
__ 7. Right-click the hh.mm.ss field you just added and select Properties. (Alternatively,
you can press F4.)

The properties notebook for the field opens.

3-48 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 8. In the Field properties notebook, select the Format checkbox and select *HMS from
the list.

__ 9. Next, select the Separator checkbox.


__ 10. In the Separator pull-down menu, select Colon(:).
__ 11. Close the Field properties notebook by clicking the X in the upper right corner.
Notice that the field you added now shows colon (:) characters separating the hours,
minutes, and seconds of the time.

Now you need to save, verify, and compile your source.


__ 12. Click File > Save from the Designer menu to save your source to i5/OS.

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-49
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 13. Click the Verify file button on the Designer toolbar.

At the bottom of the window, you should see a message stating that the verify
completed with no errors.

__ 14. Click Tools > Compile from the Designer menu and then click No prompt (or click
the Compile Source button on the CODE Designer toolbar).

__ 15. A message indicates when the compile is complete. Click OK in the Message
dialog.
__ 16. To close the Designer, click File > Exit from the Designer menu.

End of exercise

3-50 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty 3.2. Quiz


Now you are ready to review your knowledge of this module by taking the quiz.
__ 1. Grouping records together allows you to work on one record while still seeing the
related records in the background. (T, F)
__ 2. The Properties notebook is mode-less. When you change an object's properties, the
selected object changes immediately. (T, F)
__ 3. The DDS source is checked using the same verifier that the LPEX Editor uses. (T, F)
__ 4. You can compile DDS source on i5/OS via Screen Designer and CODE Designer
just as you can in the LPEX Editor. (T, F)

© Copyright IBM Corp. 2005, 2008 Exercise 3. Creating a screen with Screen Designer 3-51
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

3.3. Exercise Review/Wrap-up


You have learned about various aspects of the Screen Designer while modifying a display
file and CODE Designer while modifying a printer file, and now know more about the
product and how it is packaged. In particular, you have learned how to:
• Open a DDS member for editing with Screen Designer
• Explain the different functions within the Screen Designer and Outline views
• Show file-level keywords and record keywords
• View the details of records, record-level keywords and field-level keywords
• View the design of the payroll application main menu
• Create a group from an existing record format
• Create a new group and add a subfile record and a subfile control record
• Add columns to the subfile record
• Add fields to the subfile control record
• Create a field via source reference
• Set indicators to handle field errors
• View and update record and field properties
• View keywords and the properties of a keyword
• Insert a keyword
• Check there are no semantic errors in the DDS source
• Save source changes
• Compile your source changes
• Open a DDS printer file source member in CODE Designer
• Add time and date fields to the printer record with formatting
• Verify and compile the DDS printer file source member

3-52 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Exercise 4. Debugging source code

What this exercise is about


This module teaches you how to debug a CL program and an ILE RPG
or ILE COBOL program.
You will learn how to start the debugger, set breakpoints, monitor
variables, run and step into an interactive and a batch 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.

What you should be able to do


At the end of the lab, you should be able to:
• Define a service entry point
• Launch debugger via service entry point trigger
• Add a breakpoint
• Add a conditional breakpoint
• Edit a breakpoint
• Monitor a variable through the Monitors view
• Step into your payroll program
• List the call stack entries in the Debug view
• View topology of your program via the Application Diagram
function
• Remove a breakpoint
• Monitor memory
• Set a watch breakpoint
• Invoke the debugger from the Launch Configurations window
• Pass a parameter into the program to be debugged
• Debug a batch job in message-wait status

Introduction
The Integrated iSeries Debugger is a source-level debugger that
enables you to debug and test an application that is running on i5/OS.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

It provides a functionally rich interactive graphical interface that allows


you to:
• View source code or compiler listings, while the program is running
on i5/OS.
• 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 Modules/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 i5/OS - useful if you
don't want the source code on a production machine.
• Debug client/server and distributed applications.
• Step into a program that is currently suspended in message wait
status to view variables.
• Set service entry points for a particular program when invoked by a
particular userid, to gain debug control when program is launched
in either interactive or batch mode.
The Debugger supports RPG/400 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 COBOL program or a
CL and an ILE RPG program. You do not need in-depth knowledge of
COBOL or RPG.

4-2 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty 4.1. Exercise instructions


Separate tracks are provided for two different programming languages:
• For exercises about debugging COBOL source, see Exercise 4.2, Debugging
COBOL source, on page 4-4.
• For exercises about debugging RPG source, see Exercise 4.3, Debugging RPG
source, on page 4-49.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

4.2. Debugging COBOL source


Follow the instructions in this section if you prefer to debug an ILE COBOL program.

Part 1: Understanding your program code with the Application Diagram


function

Important

The Application Diagram function is only available in the Advanced Edition of WDSC.

Before you start debugging programs, let’s take a look at the Application Diagram function.
The Application Diagram function provides a graphical view of the different resources in an
i5/OS native application and their relationships to each other. There are two different
diagrams that you can look at in the Application Diagram view:
• Source Call Diagram
• Program Structure Diagram
The Source Call Diagram takes ILE COBOL source as input and displays a call graph
showing subroutine and procedure calls.
The Program Structure Diagram takes program and service program objects as input and
displays the binding relationships between them as well as the modules bound into each
program and service program.
To launch the Application Diagram function:
__ 1. In the Remote Systems view expand the Library list filter, if it isn't expanded
already.
__ 2. Expand library <team_lib>, if it isn't expanded already.
__ 3. Open the PAYROLLD.cblle source member in the QCBLLESRC source file via the
LPEX editor.

Hint

Double-click the source member within RSE to open it in the LPEX Editor view.

4-4 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 4. Click Source -> Visualize Application Diagram .

Hint

You can also use the Application Diagram icon on the main workbench toolbar to launch
the Application Diagram function.

The Application Diagram view opens for program PAYROLLD.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-5
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 5. Select the subroutine 0400-PRJMST-SELECT by clicking on it.

Notice that the box around 0400-PRJMST-SELECT is now highlighted and all
relationship arrows are highlighted. Arrows pointing away from the
0400-PRJMST-SELECT subroutine point to subroutines that
0400-PRJMST-SELECT calls. Arrows pointing to subroutine
0400-PRJMST-SELECT indicate calls to 0400-PRJMST-SELECT.

4-6 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 6. Right-click the subroutine 0400-PRJMST-SELECT and select Show Properties


View.

The Properties view opens, and displays information about the currently selected
subroutine 0400-PRJMST-SELECT.
__ 7. Select the Calls tab to view a list of the respective subroutines which
0400-PRJMST-SELECT calls and the source lines where the called subroutines
begin and end.

The list of subroutines can be used to quickly jump to the specified line in the
source. Likewise the Called by tab shows the list of subroutines which call
0400-PRJMST-SELECT.
__ 8. Within the Calls tab list, double-click the 0450-EXIT subroutine line.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-7
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

This takes you directly into the PAYROLLD source to the start of subroutine
0450-EXIT.

__ 9. Return to the Application Diagram view by selecting its PAYROLLD tab.

4-8 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 10. You can save the application diagram as a text or image file. Right-click in a blank
open area within the Application Diagram view and select File -> Save As Image
File..

__ 11. The Save As Image File dialog will appear. Press the Browse button, select the
Desktop for the Destination Folder, press OK.
__ 12. Back on the Save As Image File dialog, enter AppDiagramPAYROLLD.gif for the
File Name: field, and press OK.
Optional: Locate this .gif file on your Windows desktop and double-click it, to view
the application diagram that you saved.
__ 13. Experiment a little bit with the Palette on the right-hand side of the Application
Diagram view.
Click on the Zoom button in the Palette to obtain a zoom tool; clicking within the
Application Diagram view will zoom the view to focus in more on the area that you
click with the zoom tool. Right-click within a blank open area of the Application
Diagram view to see more zoom options.
Click on the Note button in the Palette to obtain a note tool; clicking with the
Application Diagram view will let you create a note with text of your choice, to help
you annotate the application diagram with your comments.
__ 14. Close the Application Diagram PAYROLLD tab. If prompted to save changes, select
No.
__ 15. Close the PAYROLLD.CBLLE source member tab. If prompted to save changes,
select No.
You have spent some time familiarizing yourself with the Application Diagram
function, which allows a graphical view of a program’s call structure.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-9
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Part 2: Starting the integrated debugger


You will be working with the ILE COBOL program PAYROLLD.
Note: PAYROLLD is the same COBOL program as PAYROLLC2 but without compile
errors.
You will use CL program CLC1 to call PAYROLLD and you will pass one parameter to
CLC1.
You will use a service entry point to start a debug session for your application. The service
entry point is a special kind of entry breakpoint that can be set directly from Remote
System Explorer. It is triggered when the first line of a specified procedure within a program
or module is executed. Service entry points allow you to gain control of your program at
that point. A new debug session gets started and execution is stopped at the entry location
into the procedure. The program/module/procedure can be running in either an interactive
job or a batch job.
To start the debugger:
__ 1. To use a service entry point to start a debug session for your application and to allow
updating of files in production libraries while debugging, the Update production
files setting must be checked in the preferences of iSeries Debug (Window ->
Preferences... and then expand Run/Debug and select iSeries Debug).

__ 2. In the Remote Systems view expand the Library list filter, if it isn't expanded
already.
__ 3. Expand library <team_lib>, if it isn't expanded already.

4-10 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 4. Right-click program CLC1 in library <team_lib>.


__ 5. On the resulting context menu, select Debug(Service Entry) and then Set Service
Entry Point to set a service entry point..

When a service entry point is created, a process for tracking service entries is
started on i5/OS (one process per i5/OS/userid combination). The i5/OS process
ends automatically when the WDSC workspace is closed, if the RSE connection is
disconnected, or if the user removes the service entry point.
__ 6. A message displays indicating the service entry point was successfully set. Press
OK.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-11
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Note

There is a possibility that you will get an error stating that you need to start the Debug
Server on i5/OS. Your instructor should have done STRSRVJOB on the i5/OS system for
you already, but in case you see this in your own work environment, here is how to correct
it:

The iSeries Service Entry Points view is automatically added to your workspace. It
lists all the defined service entry points. You can use this view to remove, enable,
disable, modify and refresh service entry points.

The default is to create a service entry point that will stop on entry into any module
(*ALL) or procedure (*ALL) within a program. The service entry point can be
modified after creation to stop at a particular procedure name or module name
within the program. Also, the program will only stop if the specified user ID is running
the program on i5/OS. The user ID can be changed via the modify operation.

4-12 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 7. Start a 5250-emulation session to <i5/OS_system> with the IBM Personal


Communications (PCOMM) or System i Access for Windows Pc5250 products.

Hint

Use the Start or Configure Session function of PCOMM or Pc5250 to define a connection
to <i5/OS_system>. Your classroom instructor may already have a shortcut to PCOMM or
Pc5250 on your Windows desktop for you. If you already have a 5250 session active, you
can use that session instead of starting and signing on to a new one.
If you have an existing 5250 session that is still associated to the RSE server job via
STRRSESVR, you need to release the interactive session. To do so, in the Remote
Systems view, right-click iSeries Objects and click Release Interactive Job on the pop-up
menu.

__ 8. Signon to i5/OS with <i5/OS_userid> and <i5/OS_password>.

Note

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

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-13
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 9. On the command line of the 5250 screen, enter ADDLIBLE <team_lib> where
<team_lib> is your team library from the lab information sheet. This will add your
team library to your interactive 5250 session’s library list.
__ 10. On the 5250 screen, enter CALL PGM(<team_lib>/CLC1) PARM(‘xx’) where ‘xx is
your team number. This will invoke your application program.

Note

For example, if your Team Number is 02, then type ‘02’ here. Do not forget the single
quotes around your Team Number. Make sure the PARM(‘02’) in the formed command
string looks OK before pressing Enter. If the PARM parameter is omitted, you will receive
an error when the CL program tries to call the payroll program.

As soon as the program enters the system, the service entry point is hit and a debug
session is started in WDSC and the Debug perspective appears with CLC1’s source
code in the editor. Your program is stopped at the first executable statement.

4-14 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 11. Click anywhere in the WDSC workbench to give the WDSC overall window
foreground focus.

You have started a debug session with a service entry point.


The Debug perspective gives you access to all available debugger features. Let’s
look at some of them.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-15
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Part 3: Setting breakpoints


You can only set breakpoints at executable lines. 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.
__ 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
sequence numbers.
Now you will add a conditional breakpoint to stop in the loop when it loops the 99th
time.

Adding a conditional breakpoint


To add a conditional breakpoint:

4-16 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 1. Position the cursor on line 8 and make sure that line is selected.
__ 2. Right-click on line 8.
__ 3. Click Add breakpoint on the pop-up menu.

__ 4. Click the Breakpoints tab in the upper right pane of the Debug perspective.
The Breakpoints view is displayed.
__ 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.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-17
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 7. Click Next.

__ 8. 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. Click Finish.

4-18 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty You have added a breakpoint including a conditional breakpoint to your source.

Part 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 to highlight and select it.
__ 2. Right-click &count.
__ 3. Click Monitor Expression on the pop-up menu.

The Monitors view opens.

The variable appears in the Monitors view. Its current value is zero.
Now that some breakpoints are set, you can start to run the application.
__ 4. Click the Resume icon from the Debug toolbar.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-19
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

The program starts running and stops at the breakpoint at line 8. (The Debugger has
to stop 98 times but because of the condition you set, it 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.
You have monitored the variable &count.

Part 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 PAYROLLD program that is being called by CLC1.
To step into a program:
__ 1. Click the Step into icon on the Debug toolbar.

The source of PAYROLLD is displayed. Depending on the Debug view option you
used to compile the program (*SOURCE, *LIST, or *ALL for ILE COBOL), this
window displays either the Source or Listing View. If Debug view *ALL was used,
you can switch back and forth from Source to Listing via right-clicking in the source
and selecting Switch View.
Your instructor has compiled PAYROLLD for you already with the *SOURCE Debug
view option.
You have stepped into PAYROLLD program.

4-20 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Part 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.
__ 1. In the Debug view, expand the stack entry of Thread1 if it is not expanded already.

The stack entry allows you to work with and switch between different programs
and/or ILE modules.
You have viewed the call stack entries of your program.

Part 7: Setting breakpoints in PAYROLLD


Now you add some breakpoints in PAYROLLD.
To add breakpoints:
__ 1. Select PAYROLLD in Thread1.
__ 2. In the source view (also called the iSeries default editor) scroll to line 201.
__ 3. Double-click the prefix area of line 201.
A breakpoint icon is added to the prefix area of this line to indicate that a breakpoint
is set.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-21
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 4. Repeat the above step for line 206.

__ 5. Repeat the above step for line 218.


To view all breakpoints, select the Breakpoints tab from the top left pane.

This view shows all breakpoints currently set in your Debug session. This is a
convenient place to work with breakpoints. You can remove, disable and 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.
You have added several breakpoints to PAYROLLD.

4-22 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Part 8: Removing a breakpoint in PAYROLLD


It is also easy to remove breakpoints from the Source view.
To remove a breakpoint:
__ 1. Right-click the prefix area of line 206.
__ 2. Click Remove Breakpoint on the pop-up menu.

The icon is removed from the prefix area indicating that no breakpoint is set on that
line. The breakpoint is also removed from the list in the Breakpoints view.

Note

You could also select and right-click anywhere in the source area of Line 206 (to the right of
sequence numbers) and select Remove Breakpoint from that context menu, to accomplish
the same thing.

Now you are ready to run the PAYROLLD program.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-23
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 3. Click the Resume icon from the Debug toolbar.

The program waits for input from the 5250-emulation session. Switch to your 5250
emulator session.

__ 4. Type an X beside the Project Master Maintenance option.


__ 5. Press Enter in the emulation session.
The program runs to the breakpoint at line 201.
You have removed a breakpoint from PAYROLLD, and resumed the program to stop at
another breakpoint.

Part 9: Monitoring variables in PAYROLLD


Next, monitor variables and change them in PAYROLLD.
To monitor variables:
__ 1. In the source view, double-click the variable EMPAPL on line 201.

4-24 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 2. Right-click the variable.


__ 3. Click Monitor Expression on the pop-up menu.

__ 4. Click the Monitors tab in the upper right pane.


The variable EMPAPL 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 206 and RSNAPL on line 244 to
the monitor.
Variable PRJAPL equals X because you selected the Project Master Maintenance
option.
__ 6. In the Monitors view, double-click the variable RSNAPL.
The value changes into an entry field.
__ 7. In the entry field, type in the new value X (uppercase) for the variable.

__ 8. Press Enter.
The variable is successfully changed. Notice how the icon for RSNAPL in the
Monitors view has changed to indicate the variable has been altered via debug.
You have monitored several variables in PAYROLLD.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-25
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Part 10: Adding a memory monitor


Adding a memory monitor for a variable allows you to view the memory starting with the
address where the variable is located. The memory can be displayed in hexadecimal and
text formats.
To add a memory monitor:
__ 1. In the Source view, double-click the variable IND-ERROR in line 219.
__ 2. Right-click and select Monitor Memory > 4 EBCDIC on the pop-up menu.

This will open the Memory view in the notebook at the bottom of the workbench
perspective. The tab within the view shows the name of the variable (IND-ERROR).
__ 3. Use the scroll bar on the right of the Memory view to scroll down.
You can see the current contents of the memory.
__ 4. Right-click in the view area within the memory contents table.

4-26 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 5. Click Reset to Base Address on the pop-up menu to return to the starting address.

__ 6. To get the hex content of the memory starting with the selected variable
IND-ERROR, right click on this variable in the source view again, and this time,
select Monitor Memory > 2 Hex . A new page with the hex values is added to the
Memory view. You will now have an EBCDIC and Hex memory sub-view for the
same IND-ERROR variable.

__ 7. Since you are only monitoring one variable’s memory storage, click the Toggle
Memory Monitors Pane button on the right-hand side of the Memory view to simplify
the information displayed by temporarily removing the Monitors column.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-27
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 8. Click on the EBCDIC sub-tab, and then click on the grey X to remove the memory
monitor rendering for EBCDIC, leaving just the Hex rendering.

__ 9. Click the Toggle Split Pane icon, select EBCDIC for a rendering and click the Add
Rendering(s) button. This will give you a Hex memory rendering and EBCDIC
rendering side-by-side within the same view.

__ 10. Use the Link Memory Rendering Panes icon to control the scrolling of the memory
renderings side-by-side views. You can have the renderings scroll independently of
each other, or in synchronization with each other. Explore the scroll bar action with
the Link Memory Rendering Panes icon depressed and reset.

__ 11. Click the Toggle Memory Monitors Pane icon to re-display the monitored variable
column.
__ 12. Click each gray X (Remove Rendering) button for the Hex and EBCDIC renderings,
to remove them both.

4-28 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 13. Click the XX (Remove All) icon to remove all variable memory monitors. When
prompted with the Remove All Memory Monitors message box, click the Yes button.

__ 14. Click the X on the Memory view tab, to close the Memory view.
You have added a memory monitor, and experimented with renderings for the variable
IND-ERROR.

Part 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:

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-29
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 1. Go to the Line number field at the bottom of the source area. In this field enter 118
and press Enter to go to that line.

__ 2. Double-click variable IND-TABLE to highlight it.


__ 3. Right-click and click Add Watch Breakpoint on the pop-up menu.

4-30 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty The Add a Watch Breakpoint window opens. The Expression field is pre-filled with
the highlighted variable IND-TABLE.

By default the Number of bytes to watch field is set to zero, which means the
variable will be watched in its defined length.
__ 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.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-31
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 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 IND-TABLE has
changed.

__ 8. Click OK.

4-32 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 9. In the Breakpoints view, right-click the Watch breakpoint and click Disable on the
pop-up menu. This will uncheck the breakpoint selection box.

You have added a watch breakpoint for the variable IND-TABLE and run the program to
see the notification that the variable has changed.

Part 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. A message “DELETE REQUESTED BUT
RECORD DOES NOT EXIST” may be at the bottom of the 5250 screen. If so, that is
a normal situation with the application, if this particular project code has already
been deleted.
__ 3. Press F3 to end the 5250 program.

Important

You may need to click the Resume icon again, if the 5250 application did not end. This will
depend on whether the project code has already been deleted indicator was turned on or
not.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-33
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 4. A message Program terminated appears:

Click OK.
__ 5. Close both the CLC1.CLLE and PAYROLLD.CBLLE LPEX editor sessions by
clicking the X on their tabs.
__ 6. Right-click the Debug perspective icon at the top right of the workbench. Click
Close on the pop-up menu to close the Debug perspective and return to the Remote
System Explorer perspective.

Part 13: Starting the Integrated Debugger using the Debug action
You will still be working with the COBOL program PAYROLLD.
Besides using service entry points to start a debug session, you can start the Debugger
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 does not 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.
CL program CLC1 requires a parameter.
To start the debugger:
__ 1. In the Remote Systems view expand the Library list filter, if it isn't expanded
already.
__ 2. Expand library <team_lib>, if it isn't expanded already.
__ 3. Right-click program CLC1 in library <team_lib>.

4-34 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 4. On the resulting context menu, select Debug(Service Entry) > Remove Service
Entry Point. This will remove the service entry point we set earlier - in this lab
section we are explicitly going to start the CLC1 program after running STRRSESVR
to tie the 5250 emulation session with WDSC’s debugger.
__ 5. Right-click on program CLC1 again, and select Debug (Prompt)(J) > Interactive...
from the pop-up menu.
__ 6. On the My iSeries program (Interactive) Modify attributes and launch panel, clear
the contents of the Name: field, and type CLC1 . This gives your debug
configuration a unique name so you can use it again when you debug this program.
__ 7. Click the How To Start tab.

By default, the page contains a call for the program and library for the object from
which RSE launched the debug wizard.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-35
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 8. Click Prompt.

The Call Program (CALL) window opens.


__ 9. In the Parameters: field, type ‘xx’ where ‘xx is your team number. Click Add .

4-36 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty The parameter value will appear in the lower list.

Note

For example, if your Team Number is 02, then type ‘02’ here. Do not forget the single
quotes around your Team Number. Make sure the PARM(‘02’) in the formed command
string looks OK before pressing OK. If the PARM parameter is omitted or is an incorrect
format, you will receive an error when the CL program tries to call the payroll program.

__ 10. Click OK.


The complete start command for the program now appears.

__ 11. Click Debug.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-37
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

The Debug perspective opens.


If not, you may see this error message:

The interactive connection is not currently active. Go to your 5250 emulation session
and start the interactive connection following the instructions in this message box.
You do not have to cancel the message box. 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 will be loaded
into the workbench.

Hint

Copy the CL command text from step 2 in the message box into the 5250 emulation
session’s command line, to save some time.

Now that the program is active on the i5/OS server and stopped at the first
executable statement, the debugger displays the source.

4-38 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty

You have started an interactive debug session.


__ 12. Remove all breakpoints from the previous debug session. In the Breakpoints view,
click the Remove All Breakpoints (double X) button in the toolbar or select
Remove All from the popup menu. When the Remove All Breakpoints confirmation
message box appears, respond by clicking the Yes button.
__ 13. Click the Resume button in the debugger perspective toolbar.
PAYROLLD is called and waits for input from the 5250 session.
Only Terminate and Suspend buttons are available on the Debug view toolbar.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-39
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 14. To get control back to the Debug session, click the Suspend icon.

You can now set breakpoints and use all the Debug features. You will also see the
source for PAYROLLD loaded into the Debug perspective.

Hint

Suspend is a valuable feature to debug a looping program, or a program that is waiting on


user input.

__ 15. Click the Terminate icon to end the Debug session.


The Debug session is terminated, but this does not end the program.
__ 16. Switch to the 5250 emulation session and press F3 to end the program. The 5250
emulation session is now back at the IBM RSE Communications Server wait screen.
__ 17. Click the arrow beside the Debug icon on the workbench toolbar, and select
Debug... from the list.

Hint

You can also edit, delete and create debug configurations by clicking on Run on the
workbench main menu bar, and select Debug...

The Debug Create, manage, and run configurations window opens.

4-40 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty

Here you can see the CLC1 debug configuration. This is your saved configuration to
debug CLC1 as an interactive application. You could now modify this configuration
to use a different parameter, copy this configuration, or create a new one. Notice the
list of debug configurations you can choose from.
__ 18. Press Close. The intent here is just to view the way to see previously saved
configurations.
__ 19. Close all source member editor views (CLC1 and PAYROLLD).
__ 20. Close the Debug perspective to return to the Remote System Explorer perspective.
__ 21. Right-click on the iSeries Objects subsystem in the Remote Systems view, and
select Release Interactive Job to end the STRRSESVR linkage to the RSE server.
You have started the debugger using a debug action and viewed a saved debug
configuration.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-41
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Part 14: Debugging a job


In addition to being able to debug a program, you can also debug a job running in
batch or interactive. You will submit a job to run in batch that will contain an error that
suspends the job in message wait status with a message to QSYSOPR message
queue. You will enter debug on the job to determine why the job is in error.
To debug a batch job:
__ 1. In the Remote Systems view, under your connection, <i5/OS_system> ,expand the
iSeries Objects subsystem, and then Library list, and then your <team_lib>.
__ 2. Right-click on program CLC1 and select Run(Prompt) > Batch...
__ 3. On the resulting Modify attributes and launch panel, press the Prompt button.

4-42 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 4. Add PARM(‘78’) in the Command to run: field.


This parameter represents a team number that is used to generate a team library
name. You are entering 78 which is a team number that does not exist. This will
cause an error in the CLC1 program when it tries to call PAYROLLD from a library
that does not exist.
Because you will submit this command in batch, a break message error due to the
bad library reference will be sent to the QSYSOPR message queue, and the CLC1
program will be suspended in Message-Wait status.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-43
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Note

Be sure to enter a blank space before the PARM parameter in the command string. Also,
you could press F4 in the Command to run: field to be prompted to add the parameter.

__ 5. Press OK to return to the Modify attributes and launch panel. You will now see your
parameter in the SBMJOB command string.

__ 6. Press the Run button to submit your command in batch.


__ 7. From your 5250 emulation window’s command line, type in WRKUSRJOB and
press Enter.
__ 8. Scroll until you find your BATCH job in MSGW (Message Wait) status.

4-44 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 9. For this job, enter option 7 for Display message.


__ 10. You will see an Inquiry message regarding error CPF0001 in CLC1 at statement
number 1100. The error was with a CALL command. Do not respond to this
message, and leave this Additional Message Information screen on your 5250
emulation display, and return to your WDSC workbench - you will answer this
message later after debugging the problem.

__ 11. Find your batch job in WDSC by expanding the iSeries Jobs subsystem, and then
right-click on My active jobs and select Refresh. Then expand My active jobs
folder, and then expand QBATCH.

__ 12. Your job will have <i5/OS_userid> for the job name and job user. Select and
right-click on this job, and select Debug As > iSeries Job

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-45
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

The Debug perspective will now open, and CLC1 source member will be loaded into
the view.
__ 13. In the Debug view, you can see that Thread:1 is stopped, and the active procedure
is a Function Check Exception Handler. Click on the CLC1 : CLC1 : CLC1
procedure under the Function Check Exception Handler line, and you will see the
CLC1 source view positioned to the instruction that caused the function check.

Note

Note that the source line with the failure is 1100 and the instruction is a CALL command.
This matches the information you saw on the Inquiry Message panel on the 5250 emulation
window.
You will need to look at the value of the &lib variable.

4-46 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 14. Double-click on &lib on line 1100 and then right-click and select Monitor
Expression.
__ 15. Click on the Monitors view tab, and you will see that &LIB is set to a library name
ending in 78. We do not have team numbers as high as 78, so this is not a valid
library name. You could confirm that using WRKLIB on 5250 or via a WDSC library
filter.

Now that you know what the problem is, you will terminate the debug session and
cancel the batch job.
__ 16. Click the Terminate icon on the Debug view toolbar.

__ 17. Close the CLC1 editor view, and then close the Debug perspective to return to the
Remote System Explorer perspective.
Your debug session is cancelled, but your job is still in Message Wait status on the
i5/OS server.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-47
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 18. Back on your 5250 emulation window, respond C on the Inquiry Message window to
cancel your batch job, and press Enter.

__ 19. Press Enter again on the 5250 emulation window.


__ 20. On the Work with User Jobs panel, press F5 to Refresh. You will see the status
MSGW disappear from the panel, indicating that the job has ended.
__ 21. Press F3 to end the Work with User Jobs function.
You have place a suspended batch job in debug, and analyzed what caused a
function check message.
After completing the exercise, you are ready to take the module quiz. See “Quiz” on
page 4-94.

End of exercise

4-48 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty 4.3. Debugging RPG source


Follow the instructions in this section if you prefer to debug an ILE RPG program.

Part 1: Understanding your program code with the Application Diagram


function

Important

The Application Diagram function is only available in the Advanced Edition of WDSC.

Before you start debugging programs, let’s take a look at the Application Diagram function.
The Application Diagram function provides a graphical view of the different resources in an
i5/OS native application and their relationships to each other. There are two different
diagrams that you can look at in the Application Diagram view:
• Source Call Diagram
• Program Structure Diagram
The Source Call Diagram takes ILE RPG source as input and displays a call graph showing
subroutine and procedure calls.
The Program Structure Diagram takes program and service program objects as input and
displays the binding relationships between them as well as the modules bound into each
program and service program.
To launch the Application Diagram function:
__ 1. In the Remote Systems view expand the Library list filter, if it isn't expanded
already.
__ 2. Expand library <team_lib>, if it isn't expanded already.
__ 3. Open the PAYROLLG.rpgle source member in the QRPGLESRC source file via the
LPEX editor.

Hint

Double-click the source member within RSE to open it in the LPEX Editor view.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-49
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 4. Click Source -> Visualize Application Diagram .

Hint

You can also use the Application Diagram icon on the main workbench toolbar to launch
the Application Diagram function.

The Application Diagram view opens for program PAYROLLG.

4-50 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 5. Select the subroutine ACDESR by clicking on it.

Notice that the box around ACDESR is now highlighted and all relationship arrows
are highlighted. Arrows pointing away from the ACDESR subroutine point to
subroutines that ACDESR calls. Arrows pointing to subroutine ACDESR indicate
calls to ACDESR.
__ 6. Right-click the subroutine ACDESR and select Show Properties View.

The Properties view opens, and displays information about the currently selected
subroutine ACDESR.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-51
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 7. Select the Calls tab to view a list of the respective subroutines which ACDESR calls
and the source lines where the called subroutines begin and end.

The list of subroutines can be used to quickly jump to the specified line in the
source. Likewise the Called by tab shows the list of subroutines which call
ACDESR.
__ 8. Within the Calls tab list, double-click the CHGCDE subroutine line.
This takes you directly into the PAYROLLG source to the start of subroutine
CHGCDE.

__ 9. Return to the Application Diagram view by selecting its PAYROLLG tab.

4-52 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 10. You can save the application diagram as a text or image file. Right-click in a blank
open area within the Application Diagram view and select File -> Save As Image
File...

__ 11. The Save As Image File dialog will appear. Press the Browse button, select the
Desktop for the Destination Folder, press OK.
__ 12. Back on the Save As Image File dialog, enter AppDiagramPAYROLLG.gif for the
File Name: field, and press OK.
Optional: Locate this .gif file on your Windows desktop and double-click it, to view
the application diagram that you saved.
__ 13. Experiment a little bit with the Palette on the right-hand side of the Application
Diagram view.
Click on the Zoom button in the Palette to obtain a zoom tool; clicking within the
Application Diagram view will zoom the view to focus in more on the area that you
click with the zoom tool. Right-click within a blank open area of the Application
Diagram view to see more zoom options.
Click on the Note button in the Palette to obtain a note tool; clicking with the
Application Diagram view will let you create a note with text of your choice, to help
you annotate the application diagram with your comments.
__ 14. Close the Application Diagram PAYROLLG tab. If prompted to save changes, select
No.
__ 15. Close the PAYROLLG.RPGLE source member tab. If prompted to save changes,
select No.
You have spent some time familiarizing yourself with the Application Diagram
function, which allows a graphical view of a program’s call structure.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-53
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Part 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 will use CL program CLR1 to call PAYROLLG and you will pass one parameter to
CLR1.
You will use a service entry point to start a debug session for your application. The service
entry point is a special kind of entry breakpoint that can be set directly from Remote
System Explorer. It is triggered when the first line of a specified procedure within a program
or module is executed. Service entry points allow you to gain control of your program at
that point. A new debug session gets started and execution is stopped at the entry location
into the procedure. The program/module/procedure can be running in either an interactive
job or a batch job.
To start the debugger:
__ 1. To use a service entry point to start a debug session for your application and to allow
updating of files in production libraries while debugging, the Update production
files setting must be checked in the preferences of iSeries Debug (Window ->
Preferences... and then expand Run/Debug and select iSeries Debug).

__ 2. In the Remote Systems view expand the Library list filter, if it isn't expanded
already.
__ 3. Expand library <team_lib>, if it isn't expanded already.

4-54 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 4. Right-click program CLR1 in library <team_lib>.


__ 5. On the resulting context menu, select Debug(Service Entry) and then Set Service
Entry Point to set a service entry point..

When a service entry point is created, a process for tracking service entries is
started on i5/OS (one process per i5/OS/userid combination). The i5/OS process
ends automatically when the WDSC workspace is closed, if the RSE connection is
disconnected, or if the user removes the service entry point.
__ 6. A message displays indicating the service entry point was successfully set. Press
OK.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-55
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Note

There is a possibility that you will get an error stating that you need to start the Debug
Server on i5/OS. Your instructor should have done STRSRVJOB on the i5/OS system for
you already, but in case you see this in your own work environment, here is how to correct
it:

The iSeries Service Entry Points view is automatically added to your workspace. It
lists all the defined service entry points. You can use this view to remove, enable,
disable, modify and refresh service entry points.

The default is to create a service entry point that will stop on entry into any module
(*ALL) or procedure (*ALL) within a program. The service entry point can be
modified after creation to stop at a particular procedure name or module name
within the program. Also, the program will only stop if the specified user ID is running
the program on i5/OS. The user ID can be changed via the modify operation.

4-56 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 7. Start a 5250-emulation session to <i5/OS_system> with the IBM Personal


Communications (PCOMM) or System i Access for Windows Pc5250 products.

Hint

Use the Start or Configure Session function of PCOMM or Pc5250 to define a connection
to <i5/OS_system>. Your classroom instructor may already have a shortcut to PCOMM or
Pc5250 on your Windows desktop for you. If you already have a 5250 session active, you
can use that session instead of starting and signing on to a new one.
If you have an existing 5250 session that is still associated to the RSE server job via
STRRSESVR, you need to release the interactive session. To do so, in the Remote
Systems view, right-click iSeries Objects and click Release Interactive Job on the pop-up
menu.

__ 8. Signon to i5/OS with <i5/OS_userid> and <i5/OS_password>.

Note

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

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-57
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 9. On the command line of the 5250 screen, enter ADDLIBLE <team_lib> where
<team_lib> is your team library from the lab information sheet. This will add your
team library to your interactive 5250 session’s library list.
__ 10. On the 5250 screen, enter CALL PGM(<team_lib>/CLR1) PARM(‘xx’) where ‘xx is
your team number. This will invoke your application program.

Note

For example, if your Team Number is 02, then type ‘02’ here. Do not forget the single
quotes around your Team Number. Make sure the PARM(‘02’) in the formed command
string looks OK before pressing Enter. If the PARM parameter is omitted, you will receive
an error when the CL program tries to call the payroll program.

As soon as the program enters the system, the service entry point is hit and a debug
session is started in WDSC and the Debug perspective appears with CLR1’s source
code in the editor. Your program is stopped at the first executable statement.

4-58 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 11. Click anywhere in the WDSC workbench to give the WDSC overall window
foreground focus.

You have started a debug session with a service entry point.


The Debug perspective gives you access to all available debugger features. Let’s
look at some of them.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-59
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Part 3: Setting breakpoints


You can only set breakpoints at executable lines. 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.
__ 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
sequence numbers.
Now you will add a conditional breakpoint to stop in the loop when it loops the 99th
time.

Adding a conditional breakpoint


To add a conditional breakpoint:

4-60 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 1. Position the cursor on line 8 and make sure that line is selected.
__ 2. Right-click on line 8.
__ 3. Click Add breakpoint on the pop-up menu.

__ 4. Click the Breakpoints tab in the upper right pane of the Debug perspective.
The Breakpoints view is displayed.
__ 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.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-61
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 7. Click Next.

__ 8. 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. Click Finish.

4-62 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty You have added a breakpoint including a conditional breakpoint to your source.

Part 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 to highlight and select it.
__ 2. Right-click &count.
__ 3. Click Monitor Expression on the pop-up menu.

The Monitors view opens.

The variable appears in the Monitors view. Its current value is zero.
Now that some breakpoints are set, you can start to run the application.
__ 4. Click the Resume icon from the Debug toolbar.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-63
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

The program starts running and stops at the breakpoint at line 8. (The Debugger has
to stop 98 times but because of the condition you set, it 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.
You have monitored the variable &count.

Part 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 that is being called by CLR1.
To step into a program:
__ 1. Click the Step into icon on the Debug toolbar.

The source of PAYROLLG is displayed. Depending on the Debug view option you
used to compile the program (*SOURCE, *LIST, or *ALL for ILE RPG), this window
displays either the Source or Listing View. If Debug view *ALL was used, you can
switch back and forth from Source to Listing via right-clicking in the source and
selecting Switch View.
Your instructor has compiled PAYROLLG for you already with the *SOURCE Debug
view option.
You have stepped into PAYROLLG program.

4-64 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Part 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.
__ 1. In the Debug view, expand the stack entry of Thread1 if it is not expanded already.

The stack entry allows you to work with and switch between different programs
and/or ILE modules.
You have viewed the call stack entries of your program.

Part 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 iSeries default 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.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-65
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 4. Repeat the above step for line 58.

__ 5. Click on line 87 (sequence number 000091) to select the source line, then right-click
and select Add Breakpoint.

Note

Because of sequencing with comment lines, line 87 corresponds to sequence number


000091. You can look at the top left of the editor view to see the actual line number.

4-66 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty To view all breakpoints, select the Breakpoints tab from the top left pane.

This view shows all breakpoints currently set in your Debug session. This is a
convenient place to work with breakpoints. You can remove, disable and 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.
You have added several breakpoints to PAYROLLG.

Part 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.

The icon is removed from the prefix area indicating that no breakpoint is set on that
line. The breakpoint is also removed from the list in the Breakpoints view.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-67
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Note

You could also select and right-click anywhere in the source area of Line 58 (to the right of
sequence numbers) and select Remove Breakpoint from that context menu, to accomplish
the same thing.

Now you are ready to run the PAYROLLG program.


__ 3. Click the Resume icon from the Debug toolbar.

The program starts running and runs to the breakpoint at line 57.
__ 4. Click the Resume icon again (or press F8, which is the keyboard shortcut).
The program waits for input from the 5250-emulation session. Switch to your 5250
emulator session.

__ 5. Type an X beside the Project Master Maintenance option.


__ 6. Press Enter in the emulation session.
The program runs to the breakpoint at line 87 (sequence number 000091).

4-68 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty You have removed a breakpoint from PAYROLLG, and resumed the program to stop at
another breakpoint.

Part 9: Monitoring variables in PAYROLLG


Next, monitor variables and change them in PAYROLLG.
To monitor variables:
__ 1. In the source view, double-click the variable EMPAPL on line 88 (sequence number
000092).
__ 2. Right-click the variable.
__ 3. Click Monitor Expression on the pop-up menu.

__ 4. Click the Monitors tab in the upper right pane.


The variable EMPAPL 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(sequence number 000097)
and RSCDE on line 113 (sequence number 000121) to the monitor.
Variable PRJAPL equals X because you selected the Project Master Maintenance
option.
__ 6. In the Monitors view, double-click the variable RSCDE.
The value changes into an entry field.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-69
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 7. In the entry field, type in the new value X (uppercase) for the variable.

__ 8. Press Enter.
The variable is successfully changed. Notice how the icon for RSCDE in the
Monitors view has changed to indicate the variable has been altered via debug.
You have monitored several variables in PAYROLLG.

4-70 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Part 10: Adding a memory monitor


Adding a memory monitor for a variable allows you to view the memory starting with the
address where the variable is located. The memory can be displayed in hexadecimal and
text formats.
To add a memory monitor:
__ 1. In the Source view, double-click the variable ERR in line 33.
__ 2. Right-click and select Monitor Memory > 4 EBCDIC on the pop-up menu.

This will open the Memory view in the notebook at the bottom of the workbench
perspective. The tab within the view shows the name of the variable (ERR).
__ 3. Use the scroll bar on the right of the Memory view to scroll down.
You can see the current contents of the memory.
__ 4. Right-click in the view area within the memory contents table.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-71
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 5. Click Reset to Base Address on the pop-up menu to return to the starting address.

__ 6. To get the hex content of the memory starting with the selected variable ERR, right
click on this variable in the source view again, and this time, select Monitor Memory
> 2 Hex . A new page with the hex values is added to the Memory view. You will now
have an EBCDIC and Hex memory sub-view for the same ERR variable.

__ 7. Since you are only monitoring one variable’s memory storage, click the Toggle
Memory Monitors Pane button on the right-hand side of the Memory view to simplify
the information displayed by temporarily removing the Monitors column.

__ 8. Click on the EBCDIC sub-tab, and then click on the grey X to remove the memory
monitor rendering for EBCDIC, leaving just the Hex rendering.

4-72 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 9. Click the Toggle Split Pane icon, select EBCDIC for a rendering and click the Add
Rendering(s) button. This will give you a Hex memory rendering and EBCDIC
rendering side-by-side within the same view.

__ 10. Use the Link Memory Rendering Panes icon to control the scrolling of the memory
renderings side-by-side views. You can have the renderings scroll independently of
each other, or in synchronization with each other. Explore the scroll bar action with
the Link Memory Rendering Panes icon depressed and reset.

__ 11. Click the Toggle Memory Monitors Pane icon to re-display the monitored variable
column.
__ 12. Click each gray X (Remove Rendering) button for the Hex and EBCDIC renderings,
to remove them both.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-73
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 13. Click the XX (Remove All) icon to remove all variable memory monitors. When
prompted with the Remove All Memory Monitors message box, click the Yes button.

__ 14. Click the X on the Memory view tab, to close the Memory view.
You have added a memory monitor, and experimented with renderings for the variable
ERR.

Part 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:

4-74 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 1. Go to the Line number field at the bottom of the source area. In this field enter 116
and press Enter to go to that line.

Note

Line 116 will position the active source line at sequence number 000124.

__ 2. Double-click variable *IN60 to highlight it.


__ 3. Right-click and click Add Watch Breakpoint on the pop-up menu.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-75
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

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.
__ 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.

4-76 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 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.

__ 8. Click OK. The program stops at line 465 (sequence number 000510). This line is
located immediately after the statement which caused the variable *IN60 to change.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-77
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 9. In the Breakpoints view, right-click the Watch breakpoint and click Disable on the
pop-up menu. This will uncheck the breakpoint selection box.

You have added a watch breakpoint for the variable *IN60 and run the program to see the
notification that the variable has changed.

Part 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. A message “DELETE REQUESTED BUT
RECORD DOES NOT EXIST” may be at the bottom of the 5250 screen. If so, that is
a normal situation with the application, if this particular project code has already
been deleted.
__ 3. Press F3 to end the 5250 program.

Important

You may need to click the Resume icon again, if the 5250 application did not end. This will
depend on whether the project code has already been deleted indicator was turned on or
not.

__ 4. A message Program terminated appears:

Click OK.

4-78 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 5. Close both the CLR1.CLLE and PAYROLLG.RPGLE LPEX editor sessions by
clicking the X on their tabs.
__ 6. Right-click the Debug perspective icon at the top right of the workbench. Click
Close on the pop-up menu to close the Debug perspective and return to the Remote
System Explorer perspective.

Part 13: Starting the Integrated Debugger using the Debug action
You will still be working with the RPG program PAYROLLG.
Besides using service entry points to start a debug session, you can start the Debugger
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 does not 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.
CL program CLR1 requires a parameter.
To start the debugger:
__ 1. In the Remote Systems view expand the Library list filter, if it isn't expanded
already.
__ 2. Expand library <team_lib>, if it isn't expanded already.
__ 3. Right-click program CLR1 in library <team_lib>.
__ 4. On the resulting context menu, select Debug(Service Entry) > Remove Service
Entry Point. This will remove the service entry point we set earlier - in this lab
section we are explicitly going to start the CLR1 program after running STRRSESVR
to tie the 5250 emulation session with WDSC’s debugger.
__ 5. Right-click on program CLR1 again, and select Debug (Prompt)(J) > Interactive...
from the pop-up menu.
__ 6. On the My iSeries program (Interactive) Modify attributes and launch panel, clear
the contents of the Name: field, and type CLR1 . This gives your debug
configuration a unique name so you can use it again when you debug this program.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-79
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 7. Click the How To Start tab.

By default, the page contains a call for the program and library for the object from
which RSE launched the debug wizard.

4-80 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 8. Click Prompt.

The Call Program (CALL) window opens.


__ 9. In the Parameters: field, type ‘xx’ where ‘xx is your team number. Click Add .

The parameter value will appear in the lower list.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-81
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Note

For example, if your Team Number is 02, then type ‘02’ here. Do not forget the single
quotes around your Team Number. Make sure the PARM(‘02’) in the formed command
string looks OK before pressing OK. If the PARM parameter is omitted or is an incorrect
format, you will receive an error when the CL program tries to call the payroll program.

__ 10. Click OK.


The complete start command for the program now appears.

__ 11. Click Debug.

4-82 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty The Debug perspective opens.


If not, you may see this error message:

The interactive connection is not currently active. Go to your 5250 emulation session
and start the interactive connection following the instructions in this message box.
You do not have to cancel the message box. 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 will be loaded
into the workbench.

Hint

Copy the CL command text from step 2 in the message box into the 5250 emulation
session’s command line, to save some time.

Now that the program is active on the i5/OS server and stopped at the first
executable statement, the debugger displays the source.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-83
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

You have started an interactive debug session.


__ 12. Remove all breakpoints from the previous debug session. In the Breakpoints view,
click the Remove All Breakpoints (double X) button in the toolbar or select
Remove All from the popup menu. When the Remove All Breakpoints confirmation
message box appears, respond by clicking the Yes button.
__ 13. Click the Resume button in the debugger perspective toolbar.
PAYROLLG is called and waits for input from the 5250 session.
Only Terminate and Suspend buttons are available on the Debug view toolbar.

4-84 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 14. To get control back to the Debug session, click the Suspend icon.

You can now set breakpoints and use all the Debug features. You will also see the
source for PAYROLLG loaded into the Debug perspective.

Hint

Suspend is a valuable feature to debug a looping program, or a program that is waiting on


user input.

__ 15. Click the Terminate icon to end the Debug session.


The Debug session is terminated, but this does not end the program.
__ 16. Switch to the 5250 emulation session and press F3 to end the program. The 5250
emulation session is now back at the IBM RSE Communications Server wait screen.
__ 17. Click the arrow beside the Debug icon on the workbench toolbar, and select
Debug... from the list.

Hint

You can also edit, delete and create debug configurations by clicking on Run on the
workbench main menu bar, and select Debug...

The Debug Create, manage, and run configurations window opens.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-85
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Here you can see the CLR1 debug configuration. This is your saved configuration to
debug CLR1 as an interactive application. You could now modify this configuration
to use a different parameter, copy this configuration, or create a new one. Notice the
list of debug configurations you can choose from.
__ 18. Press Close. The intent here is just to view the way to view previously saved
configurations.
__ 19. Close all source member editor views (CLR1 and PAYROLLG).
__ 20. Close the Debug perspective to return to the Remote System Explorer perspective.
__ 21. Right-click on the iSeries Objects subsystem in the Remote Systems view, and
select Release Interactive Job to end the STRRSESVR linkage to the RSE server.
You have started the debugger using a debug action and viewed a saved debug
configuration.

4-86 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty Part 14: Debugging a job


In addition to being able to debug a program, you can also debug a job running in
batch or interactive. You will submit a job to run in batch that will contain an error that
suspends the job in message wait status with a message to QSYSOPR message
queue. You will enter debug on the job to determine why the job is in error.
To debug a batch job:
__ 1. In the Remote Systems view, under your connection, <i5/OS_system> ,expand the
iSeries Objects subsystem, and then Library list, and then your <team_lib>.
__ 2. Right-click on program CLR1 and select Run(Prompt) > Batch...
__ 3. On the resulting Modify attributes and launch panel, press the Prompt button.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-87
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 4. Add PARM(‘78’) in the Command to run: field.


This parameter represents a team number that is used to generate a team library
name. You are entering 78 which is a team number that does not exist. This will
cause an error in the CLR1 program when it tries to call PAYROLLG from a library
that does not exist.
Because you will submit this command in batch, a break message error due to the
bad library reference will be sent to the QSYSOPR message queue, and the CLR1
program will be suspended in Message-Wait status.

4-88 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty
Note

Be sure to enter a blank space before the PARM parameter in the command string. Also,
you could press F4 in the Command to run: field to be prompted to add the parameter.

__ 5. Press OK to return to the Modify attributes and launch panel. You will now see your
parameter in the SBMJOB command string.

__ 6. Press the Run button to submit your command in batch.


__ 7. From your 5250 emulation window’s command line, type in WRKUSRJOB and
press Enter.
__ 8. Scroll until you find your BATCH job in MSGW (Message Wait) status.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-89
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 9. For this job, enter option 7 for Display message.


__ 10. You will see an Inquiry message regarding error CPF0001 in CLR1 at statement
number 1100. The error was with a CALL command. Do not respond to this
message, and leave this Additional Message Information screen on your 5250
emulation display, and return to your WDSC workbench - you will answer this
message later after debugging the problem.

__ 11. Find your batch job in WDSC by expanding the iSeries Jobs subsystem, and then
right-click on My active jobs and select Refresh. Then expand My active jobs
folder, and then expand QBATCH.

__ 12. Your job will have <i5/OS_userid> for the job name and job user. Select and
right-click on this job, and select Debug As > iSeries Job

4-90 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty The Debug perspective will now open, and CLR1 source member will be loaded into
the view.
__ 13. In the Debug view, you can see that Thread:1 is stopped, and the active procedure
is a Function Check Exception Handler. Click on the CLR1 : CLR1 : CLR1
procedure under the Function Check Exception Handler line, and you will see the
CLR1 source view positioned to the instruction that caused the function check.

Note

Note that the source line with the failure is 1100 and the instruction is a CALL command.
This matches the information you saw on the Inquiry Message panel on the 5250 emulation
window.
You will need to look at the value of the &lib variable.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-91
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 14. Double-click on &lib on line 1100 and then right-click and select Monitor
Expression.
__ 15. Click on the Monitors view tab, and you will see that &LIB is set to a library name
ending in 78. We do not have team numbers as high as 78, so this is not a valid
library name. You could confirm that using WRKLIB on 5250 or via a WDSC library
filter.

Now that you know what the problem is, you will terminate the debug session and
cancel the batch job.
__ 16. Click the Terminate icon on the Debug view toolbar.

__ 17. Close the CLR1 editor view, and then close the Debug perspective to return to the
Remote System Explorer perspective.
Your debug session is cancelled, but your job is still in Message Wait status on the
i5/OS server.

4-92 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty __ 18. Back on your 5250 emulation window, respond C on the Inquiry Message window to
cancel your batch job, and press Enter.

__ 19. Press Enter again on the 5250 emulation window.


__ 20. On the Work with User Jobs panel, press F5 to Refresh. You will see the status
MSGW disappear from the panel, indicating that the job has ended.
__ 21. Press F3 to end the Work with User Jobs function.
You have place a suspended batch job in debug, and analyzed what caused a function
check message.

End of exercise

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-93
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

4.4. Quiz
Now you are ready to review your knowledge of this module by taking the quiz. You can
also apply what you have learned in this module by completing the practice tasks detailed
in “More practice” on page 4-95.
__ 1. You can start the debugger:
a. From the Remote Systems view
b. Launch Configurations window
c. From a Service Entry Point
d. All of above
__ 2. You can only set breakpoints at executable lines. (T, F)
__ 3. The debugger allows you to:
a. Step over a program call
b. Step into a called program
c. Both
__ 4. The Debug view lists all call stack entries. It contains a tree view for each thread. (T,
F)
__ 5. Adding a storage monitor for a variable allows you to view the storage starting with
the address where the variable is located. (T, F).
__ 6. 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

4-94 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1
Student Exercises

EXempty 4.5. 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 product online help to assist you in these tasks.

© Copyright IBM Corp. 2005, 2008 Exercise 4. Debugging source code 4-95
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

4.6. Exercise Review/Wrap-up


In this exercise, you have learned how to:
• Define a service entry point
• Launch debugger via service entry point trigger
• Add a breakpoint
• Add a conditional breakpoint
• Edit a breakpoint
• Monitor a variable through the Monitors view
• Step into your payroll program
• List the call stack entries in the Debug view
• View topology of your program via the Application Diagram function
• Remove a breakpoint
• Monitor memory
• Set a watch breakpoint
• Invoke the debugger from the Launch Configurations window
• Pass a parameter into the program to be debugged
• Debug a batch job in message-wait status

4-96 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

5-40 System i Application Development Using WDSC 7.0 © Copyright IBM Corp. 2005, 2008
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V4.1

backpg
Back page
®

You might also like