remote ibm zos application development june14...

41
Remote IBM z/OS application development with IBM Rational Developer for System z © 2012 IBM Corporation 1 Remote IBM z/OS application development with IBM Rational Developer for System z Skill Level: Intermediate Reginaldo Barosa Executive IT Specialist – IBM Boston June, 2012

Upload: others

Post on 18-Aug-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 1

Remote IBM z/OS application development with IBM Rational Developer for System z

Skill Level: Intermediate Reginaldo Barosa Executive IT Specialist – IBM Boston

June, 2012

Page 2: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 2

Abstract This tutorial takes you through the steps of using the z/OS Application Development component of IBM® Rational® Developer for System z™ to work with remote systems. It will familiarize you with the IBM® z/OS® Application Development environment. If the connection to the mainframe is available, you will define a remote z/OS, set up a z/OS project, edit, compile, and execute a COBOL application. The process would be the same for a PL/I program. Before you start Learn what to expect from this tutorial and how to get the most out of it. Be sure that you have started the System z Sandbox and the IBM® Rational® Developer for System z is running under the Windows in the system z Sandbox. About this Series Walk through this scenario and others online as part of the Enterprise Modernization Sandbox for System z. About this tutorial To complete this tutorial, you will perform these six tasks:

1. Connect to a z/OS: This step has been done for you, as soon you start the system you will be connected to the z/OS system.

2. Allocate z/OS data sets: Allocate and load assets required for this tutorial.

3. Associate z/OS resources to properties: Configure the system data sets names, job names to be generated, and so forth.

4. Send the COBOL program to the z/OS: Copy a COBOL program from your workstation to the z/OS.

5. Create a z/OS project: Specify which data sets you will use in this tutorial, specify properties, and so on.

6. Work with z/OS remote assets: Edit, check syntax, submit, run, and see the output

Objectives You will learn how to

• Work with COBOL programs that are located on z/OS using Rational Developer for system z. • Create a z/OS project; use the COBOL Editor, Syntax checking, etc.. • Execute a program that will run on z/OS.

Page 3: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 3

Connecting to the z/OS remote system When you start this tutorial, you will be logging in on the z/OS, and you will be in the Enterprise Development perspective of Rational Developer for System z

1. If you successfully connect to the z/OS remote system, be sure that you have the Enterprise Development Perspective available and that you can see the Remote Systems view on the right.

Remote Systems view

The Remote Systems view shows all existing connections to remote systems. Connections are persisted, containing the information needed to access a particular remote host. The view contains a prompt to create new connections, and pop-up menu actions to rename, copy, delete, etc... Connections contain attributes, or data, that is saved between sessions of using the workbench. These attributes are the connection name, the remote system's host name and system type, an optional description, and a user ID that is used by default by each subordinate subsystem at connection time..

If you get an error message when connecting to z/OS… This tutorial assumes that Rational Developer for System z is started, the z/OS is ready, and you have logged in with a z/OS ID. Our system has periodical maintenance on Wednesday from 6:00PM to 8:00PM (Central US time) and Saturdays from 8:00AM to 4:00 PM and during this time you may experience problems. But if you get an error message outside of this period, it could be because the z/OS is down or Firewalls are blocking you. Please use Feedback to let us know about this problem.

2. Using the Remote Systems view, if necessary, expand the nodes left clicking on the plus (+) sign. You must expand dallas, MVS Files and My Data Sets nodes to see all files that you own. as Figure 1 shows. Notice that all the pictures in this tutorial will show EM4Z01 or EMPOTXX as High Level Qualifier (HLQ), but you probably will have other id, like EM4Z02, EM4Z03, EM4Z04, etc.. Keep this id in mind or write it down since you will need it later. Also notice that you do not have the same partitioned data sets (PDSs) that Figure 1 shows, because this is just an example. You will probably have other names or even more data sets, depending on your allocated userid.. In a real world users will need to connect proving a user id and password. To make this simpler we had already hard coded this into our system.

Figure 1. dallas, MVS Files and My Data Sets nodes expanded

Page 4: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 4

3. The example in Error! Reference source not found.2 shows EM4Z01. You will have other id, like EM4Z02, EM4Z03, etc..

Important: Make a note of this user ID, because you will need it in the next section. Figure 2. My Data Sets nodes expanded

Allocate z/OS data sets You are connected to a z/OS remote system. Now you will modify a provided JCL (job control language) and submit it to z/OS to allocate data sets that are required for this tutorial. Notice that the JCL provided is on your workstation, not in the z/OS. You will modify this JCL and submit it for execution in the z/OS remote system.

Modifying the JCL provided We provided a simple JCL that will allocate data sets with your assigned z/OS ID instead of the sample ID provided (EMPOTXX). Therefore, you will edit the provided JCL and change where you find EMPOTXX to your assigned ID.

1. Using the Remote Systems view, left-click the plus (+) sign of Local , Local Files, and Drives

and (see Figure 3), and look for this file: C:\RDz_7.6_POT\LAB2\LAB2ALOC.jcl Figure 3. Remote Systems view (second view after scrolling down)

and Caution! Be sure that you are selecting the correct file. This JCL file will be used to allocate all of the PDSs necessary and to copy some members to use in this tutorial. This file is under the three that Figure 4 shows. You might have other assets under this folder.

Page 5: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 5

Figure 4. JCL that will allocate the data sets

2. Double-click the LAB2ALOC.jcl file to invoke the LPEX editor.

Figure 5. Launch the LPEX editor

3. Now you will change EMPOTXX to your assigned z/OS user ID, like EM4Z02, EM4Z03, etc as you have noted in previous step when you connected to the z/OS.

a. Use CTRL + F to search for EMPOTXX. b. Type EMPOTXX in the Find field and your z/OS user ID in upper case in the Replace

field (You must use the user id that you annotate in previous section), and then click Replace all as shown in Figure 6.

Figure 6. Type your z/OS user ID and click Find and Replace all

Page 6: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 6

Important: The example in Figure 6 shows changing EMPOTXX to EM4Z01. Be sure that you are using your assigned user ID rather than EM4Z01 and that you are using UPPER CASE. Lower case names will cause JCL errors.

4. Double click in the blue title tab to maximize this view and be sure that you have changed everything correctly.

Figure 7. Double click to maximize

5. Browse the file to verify the changes. The idea is to modify the existing EMPOTXX High-Level Qualifier (HLQ) to your ID. In this example, it would be something similar to what you see in Figure 8. Your change will be different, because instead of EM4Z01, you must use EM4Z02, EM4Z03, EM4Z04, etc….

Figure 8. High-Level Qualifier changed to your ID (example only)

6. Save the changes by using Ctrl + S.

Notice that the asterisk (*) that is beside the title goes away (Figure 9). Figure 9. Lab title tab

7. Press the Esc key to show the command line again.

Page 7: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 7

Submitting a JCL for z/OS execution 1. Double-click again in the blue title tab (Figure 10) to resize the file windows back to original size.

Figure 10. Title tab

If you are still connected to the JES subsystem, you can submit this job to dallas for execution.

2. Type submit dallas, and press Enter.

Figure 11. Type "submit dallas"

You will see the JOB ID that was created for this execution (Figure 12). Figure 12. Job ID that was created previously is automatically added

3. Using the Remote Systems view, collapse the Local folder by left-clicking the hyphen (–), because you do not need that anymore.

Figure 13. Click to collapse the Local folder

4. Still using the Remote Systems view (Figure 14), scroll down and left-click the plus signs to expand the JES node, the My Jobs filter, and EM4Zxx1 The Figure shows a generic name.

Figure 14. Expand JES, My Jobs, and EM4Zxx1

Page 8: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 8

5. Double-click in the JES Job Log (JES2:JESMSGLG) to make sure that the job has successfully run and that the return code is 00, 00,and 00 as Figure 15 shows. or 04, 00 and 00 (It will be all zeros if you had data sets allocated already.)

The DELIST step may have return codes 4 or 0. If the data set was already allocated, they will be deleted and in this case, it will be 0 rather than 4. Figure 15. Verify that the job has run and shows the correct return codes

Alternative method to see the JES output

Another (better) way to see the JES output is by creating another view: 1. From the Remote Systems view, right-click My Jobs and select Show in Table (Figure 16). Figure 16. Remote Systems view path to Show in Table

2. When the Remote System Details view opens (Figure 17), notice the column that shows the Return Code. Double-click that column header to open the output listing. Figure 17. Remote Systems Details view

Page 9: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 9

7. Close all opened editors (LAB2ALOC.jcl and the JES2 JOB LOG) either by using CTRL + Shift + F4 or clicking the close-window icon:

8. You will now purge the output of the jobs listed. If RACF allows you to do that:

a. Go to the Remote System or Remote System Details view.

b. Right-click your Job and select Purge (see Figure 18). Figure 18. Using drop-down menu to Purge listings.

9. Using the Remote Systems view, expand My Data Sets by left-clicking the plus sign (+). You should now have allocated all of the data sets required for the next exercise (Figure 19). You may need to right click on My Data and use the Refresh option (or F5). Figure 19. Data sets allocated under My Data Sets

What you have done so far

You just submitted a JOB that was executed in the z/OS and allocated data sets that you will need for this tutorial. You saw the execution output in Figure 15. Important! Do not continue until this task has been successful.

Page 10: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 10

Associate z/OS resources to properties You have the data sets required on the z/OS, and you will define the settings required to work with the z/OS assets, such as specifying the correct COBOL libraries, CICS and DB2 settings, and so forth. Usually, this is done only once for each workspace.

PROPERTY GROUP

You can create a property group with property values that can be shared by z/OS projects, subprojects, and resources. A property group is a set of property values that you define for local or remote systems. Once defined, the values in a property group can be applied to the z/OS projects, subprojects, and remote resources that you create on that system. Property groups provide a way to manage resource properties, share them easily across systems, projects, resources, and users, and maintain consistency in your development and build environment. You can, for example, define a property group with values required for debugging in your environment and apply that property group to your resources when you need to debug the programs in your project or subproject. If you need to change a specific property value, for example, the JCL job card and data set, you can change this property once in the property group and the change is propagated to all resources associated with that property group. System programmers can create property groups and default property values and make them available to users. When a connection is made to a system, Rational Developer for System z searches the system for system property group and default value files. If these files are found, then those property groups or default values are loaded and can be used.. Rational Developer for System z assigns a set of default properties for the set of system properties. If you plan to develop COBOL applications in the workbench, you may wish to set properties on the Compiler Options tab of this page and override the JCL Procedures that would otherwise be used for compile, link, and execution requests. Note that the High Level Qualifier ( HLQ) is automatically replaced with your logon user id when you create a project from this system definition. Depending on your use of CICS, DB2, and IMS, you may need to set additional properties on the remaining tabs of this page.

Associate the property group to the MVS Files Because this is done once per installation, we have already created a property group on your workspace that reflect our z/OS system used in this exercise.:

1. Click on Property Group Manager tab to see this view, expand dallas and you will see the property LAB2_Remote_COBOL available to this connection as shown in Figure 20.

Figure 20. Property Group Manager view

Page 11: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 11

2. Using the Remote Systems view, expand dallas, select MVS Files, right-click and select Property Group > Associate Property Group.

Figure 21. Import the properties for the MVS files

3. Select LAB2_Remote_COBOL and click OK (Figure 22, which follows). Figure 22. Remote Systems view to select properties

You will see the properties associated to this resource in the next steps. Usually those properties are shared among developers and defined once.

Page 12: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 12

4. Using the Property Group Manager view, double click on LAB2Remote_COBOL to edit the properties as seen in the Figure 23.

Figure 23. Editing the Properties for MVS Files(1 of 3)

5. Using the Property Group Editor, click on COBOL tab and Procedures and Steps (left) as seen in the Figure 24.

Figure 24. Editing the Properties for MVS Files(1 of 3)

6. Double click on the blue title to maximize the editor

Page 13: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 13

7. Click the + signs at the left of ELAXFCOP, ELAXFCOT, and ELAXFCOC. 8. Select COBOL, as shown in Figure 25..

This is the default COBOL procedure when the COBOL syntax checking is used. Figure 25. Selecting and editing COBOL settings

Note: You could enable and disable the procedures that must be executed before the COBOL compilation if necessary. These are the default procedures supplied (but disabled):

ELAXFCOP. Invoke DB2 pre-compiler ELAXFCOT. Invoke CICS translator ELAXFCOC. Invoke COBOL compiler

The COBOL Compile Step Options dialog will be displayed. You could change these properties, such as Compile Options, data set names, and so on. For instance, when JCL is generated for Compile, it will use the options specified here. Later, the <HLQ> will be replaced with your logon user ID when JCL is generated or when you create a z/OS project, as we will discuss here later.

9. In this case, do not make any changes. Your screen must be exactly as shown in Figure 26, which follows.

Figure 26. COBOL Compile Step Options view

Page 14: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 14

10. To avoid future errors, you may at this point verify if the datasets specified here are allocated. Click the button Check Data Sets as seen in Figure 27. You should have a message that the Data set validations are complete. Click OK to dismiss this dialog.

Figure 27. Validating the data sets.

11. Click Run- tab, expand ELAXFGO and click Run. (Figure 28)

Figure 28 . Selecting Run-time Step Options view

12. No changes must be made, Your screen must be exactly as shown above.

Notice that Run in batch was specified. Due Firewalls you cannot run in debug mode.. Also notice the DDNAME POTVSAM in the additional JCL. This will be the DDNAME that will point to the VSAM data set in the z/OS and required for the batch execution. When the JCL is generated this DDNAME will be added

Page 15: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 15

13. Click Ctrl + Shift + F4 to close the property Group editor..

What you have done so far

You have connected to z/OS and have submitted a job to allocate and copy some of the members required to complete this tutorial. You also assigned the MVS resources to pre-defined properties. Now, if you ask for JCL generation, for instance, the data set names will be correct. Next, you will copy a COBOL program to z/OS and play with it.

Send the COBOL program to the z/OS You have the data sets and copy book members required for this tutorial, but you still need a COBOL program to play with. In this section, you will copy a COBOL program from the workstation and move it to your PDS member. Later, you will work with this program. You could do that with the JCL that you had submitted before, but we want to show you that one way to move data sets is to copy and paste files from your workstation to the z/OS. This capability will also work between different z/OS systems.

Copying the COBOL program to the z/OS system The data sets that you created submitting the JCL consist solely of the COBOL Copybooks and two COBOL subroutines. You will now copy the main COBOL program that is in your Microsoft® Windows® directory to the z/OS system.

1. Using the Remote Systems view (Figure 30), left-click in the plus sign (+) of the nodes Local > Local Files > Drives, and C:\, and look for this folder: C:\RDz_7.6_POT\LAB2

Figure 30. Folders and locations expanded in the Remote Systems view

and

Page 16: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 16

2. Right-click CUSVSAM.cbl (Figure 31), and select Copy.

Figure 31. Copy option in the drop-down menu after selecting CUSVSAM.cbl

3. Still using the Remote Systems view, scroll down, expand MVS Files and My Data Sets until you find the EM4Zxx.POT.COBOL data set (where EM4Zxx is your user ID).

4. Right-click EM4Zxx.POT.COBOL and select Paste, as Figure 32 shows. Notice that in the Figure we show EMPOT24 this is just one example. In your case would be EM4Z02, EM4Z03, or something like that. TIP: If you do not see the EM4Zxx.POT.COBOL, right click My Data Sets and click Refresh

Figure 32. Select Paste

Page 17: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 17

The programs will be moved from your workstation to the z/OS. A progress indicator will appear, as Figure 33 shows. Figure 33. Progress Information screen

5. If necessary, expand the data set EM4Zxx.POT.COBOL by clicking the plus sign (+) next to the folder. You will see the COBOL program loaded in the z/OS and also mapped to cbl (COBOL) as seen in Figure 34.

Notice that the other programs were already there they were copied to there when you submitted the JCL to allocate the datasets. All could be by this JCL, but the intention here is to show how easy is to move from the workstation to the z/OS and vice versa. Figure 34. The CUSVSAM COBOL member copied to the z/OS

6. Using the Remote Systems view, scroll back and collapse the Local folder by clicking the icon (Figure 35), because you don’t need it anymore.

Figure 35. Local folder icon

What you have done so far

You have connected to z/OS and have submitted a job to allocate and copy the members required to complete this tutorial. You also associated some properties to the MVS files that you will work with.. In this last section, you copied a COBOL program from your local workstation to a z/OS data set. You are ready to start working on this COBOL program now.

Page 18: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 18

Create a z/OS project and subproject After you define a z/OS-based system, you can define a z/OS project under that system, but you can define the z/OS project only when you are connected to the system.

Understanding how z/OS projects work After you define a z/OS-based system, you can define a z/OS project under that system. You can define the z/OS project, however, only when you are connected to the system. Rational Developer for System z assigns a set of default properties from the set of system properties. However, changes that you make to system properties do not affect the definition of an existing project. If you change your system properties to reference a new compiler release, for example, the reference affects only those projects that are defined subsequent to the change. This isolation of system data from existing projects is beneficial because it lets you develop your code without disruption. You can introduce changes to the project definition at a time of your choosing.

States of a z/OS project A z/OS project is in either of these two states:

Online. The project is connected to the system to which the project refers. You can directly change the data sets that are stored on that system.

Offline. The project can access only workstation-based files, which may be new or may be copies of mainframe resources.

When you disconnect from z/OS, you can specify the data sets and members to be transferred to the workstation. When you switch back to the online state, the specified files are automatically uploaded to the mainframe, with a confirmation message that keeps you from unintentionally overwriting resources. Before creating a new MVS subproject MVS subprojects contain the development resources that reside on an MVS system. You can create multiple subprojects in a z/OS project. Before you create an MVS subproject, you need to have completed these tasks:

Connecting to a remote system Creating a z/OS project

To make your job easier, you will group all of the assets that you will work with together. This is a new development concept for TSO users, because TSO does not have this capability. To accomplish this task, you will create a z/OS project, and then select which assets will be part of the project. Can I enforce a project from z/OS system?

A host-based project is one that has been defined on a z/OS system and can be downloaded to the workstation when you connect to the remote system. Host-based projects enable an installation to define and automatically propagate projects on client workspaces from a central location. When you disconnect from a remote system, the host-based projects are removed from your Enterprise projects view. Host-based projects are associated with specific user IDs and downloaded automatically when those user IDs connect to the z/OS system.

Page 19: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 19

Creating a new z/OS project The advantage of creating a z/OS Project is that we just focus on those data sets and members that are being constructed or updated, instead of having all of the dozens of mainframe data sets or members. At anytime if you need to see a data set not added to the project, just go to the z/OS Systems view and add it. Also, at any time, you can remove from your project the data sets no longer being used.

1. Using the Enterprise Projects view (on the left), right-click the blank area and select New > z/OS Project…

Figure 36. Creating a new z/OS project

2. For the Project name, type POTCOB, and then select Create an MVS subproject and click

Finish. Figure 37. Naming and creating the project

3. Type LAB2_COBOL as the Subproject Name, select LAB2_Remote_COBOL property group

and click Finish.

Figure 38. MVS Subproject Name and property group associated

Page 20: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 20

4. Click Cancel to Add Resources to Subproject dialog. You will do that in the next step. You should see a z/OS Project named POTCOB in your Enterprise Projects view..

5. Using the Enterprise Projects view, left click on the plus (+) sign to expand the project POTCOB, you'll see that is empty, but it was created. (Figure 39)

Figure 39. Project POTCOB is created but empty so far

Adding resources to the project To make the data sets available to your remote project named POTCOB, you will need to add them. For this tutorial, you need to add only two data sets, but you could add specific members or the whole data set.

1. Using the Remote Systems view on your right (Figure 40, which follows), expand MVS Files and My Data Sets under dallas until you see the data sets that you allocated before.

2. Select EM4Zxx.POT.COBOL and EM4Zxx.POT.COPYLIB (hold the Ctrl key down for multiple selections), right-click and select Add to Subproject. (Figure 40, shows one example using EM4Z01 as HLQ.)

Figure 40. Path to add subproject in Remote Systems view

3. In the Add Resources panel (Figure 41), select the z/OS POTCOB project from the drop-down

menu and LAB2_COBOL from the subproject drop-down menu.

4. Click Finish. Figure 41. Add Resources view

Page 21: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 21

5. Switch to the Enterprise Projects view and expand LAB2_COBOL. You will now see that EM4Zxx.POT.COBOL and EM4Zxx.POT.COPYLIB, are defined to the POTCOB project.

6. Expand EM4Zxx.POT.COBOL and EM4Zxx.POT.COPYLIB. The Enterprise Projects view should look like Figure 42.

Figure 42. Enterprise Projects view

Show Dependencies feature In this example we have added the COPYBOOKS in the project. This is not necessary. Rational Developer for System z has a nice feature named Show dependencies. You can automatically add the dependencies of a COBOL or PL/I program to your MVS subproject. If your program depends on a file that cannot be found, an error message is returned and the file is skipped. To ensure that files are not skipped, you may first run a local syntax check on your program; if the syntax check does not produce any errors, then all the dependencies can be located and no files will be skipped. The sequence would be like the shown below. DO NOT perform this on this lab since to save time. This will send a job to z/OS to be executed.. 1. Right-click the COBOL or PL/I program in the z/OS® Projects view. 2. Select Show Dependencies in the context menu. A job will be submitted to z/OS and if the system is able to execute your job a window opens, listing the dependencies for the selected program. This operation could take minutes depending on the z/OS availability. 3. Select the dependencies you wish to add to your subproject in the list box. 4. Check the Add selected to subproject check box. 5. Click Finish. The selected dependencies would be added to your MVS subproject.

What you have done so far

At this point you have connected to z/OS and have submitted a job that allocated and copied some members required to do this lab. You have associated to MVS files configuration properties. You copied the CUSVSAM COBOL program from your local workstation to a z/OS dataset. You also created a z/OS project and added three datasets to this project and you are ready to proceed. If you disconnect now and connect later, you can go the z/OS projects and the code that you are working on is all grouped there making your work easier since you don’t need to start looking for all your components.

Page 22: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 22

Work with z/OS remote assets You will work with a z/OS members using the editor with the assets located on the z/OS remote system. You have copied a COBOL program named CUSVSAM from your workstation to a PDS member. This is a batch program that reads a VSAM data set and displays it contents. Also, this program issues a dynamic call and a static call to two other COBOL programs, named REGI0B and REGI0C. Figure 43 shows this program architecture. Figure 43. CUSVSAM program architecture

Editing a remote COBOL program 1. Using the Enterprise Development perspective and the Enterprise Projects view, expand

EM4Zxx.POT.COBOL in the POTCOB project if not already expanded..

2. Double-click CUSVSAM.cbl to open the file by using the editor. You should see something similar to what Figure 44 shows.

3. Double click again to restore to the original size. Also notice that you are editing the file located in the z/OS system.

Figure 44. CUSVSAM.cbl file contents

3. Double click on the title bar to maximize the editor as seen in Figure 45,

Figure 45. Click the title tab to expand to full-screen view

Tip: Also, selecting Window > Reset Perspective restores the default (in that case, you may need to rearrange the Remote Systems and Team views on top of Enterprise Projects view again).

Page 23: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 23

4. Double click on the title bar again to make the editor back to its original size.

5. Click in the Outline tab to see the outline view.

6. Using the editor, browse the program, and notice that the contents of the Outline view are synchronized with the COBOL source code, and vice versa.

7. Click PROCEDURE DIVISION (Figure 45). Figure 45. Click an item on the left to see the code view for that item on the right

8. You will now make a small change in the DISPLAY statement: Locate line 44, and add two characters to the DISPLAY statement (Figure 46), which could be your initials. Notice that you must be inside the “ “ otherwise you will have errors and the editor will flag.

Figure 46. Changing the Display statement

9. Save the change by using Ctrl + S. The asterisk (*) beside the title will disappear, as Figure 47 shows.

10. Do not close the editor.

Figure 47. Asterisk no longer shows on the title tab

Note: When you are editing a PDS member, this resource is locked to prevent multiple updates.

Page 24: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 24

Modifying the COBOL Program About the CUSVSAM program

This is a batch program that reads all records from a VSAM KSDS file and prints them, using DISPLAY. Also, this program calls two other COBOL programs (REGI0B and REGI0C) by using dynamic and static calls. The subroutine that is called dynamically does a division by zero that will cause an abnormal end of task (abend) error with System Completion Code=0CB. By using the z/OS debug feature, you can intercept the abend error, modify the value to be other than zero, go back to the division statement, and rerun the division, thus avoiding the abend problem.

1. Using the Outline view, navigate to the first Procedure Division statement by clicking it (see Figure 48, which follows).

Figure 48. Navigate to the first Procedure Division statement

You are going to execute this code, but before submitting a job to the z/OS system to compile the COBOL source file, you can check the syntax to ensure a clean compilation. To see how this works, you will deliberately introduce an error that demonstrates the error feedback capability.

2. Using the Outline view on the left, find and click PROCEDURE DIVISION, and then go to line 44 of the CUSVSAM.cbl code display on the right (or, you could use CTRL + L and type 44).

3. Overtype DISPLAY with DSPLAY deleting the letter “I “(spelled incorrectly) to force an error. An yellow mark shows that something wrong. Move the mouse to the yellow mark to see what the error is.

Figure 49. Replace mode

Page 25: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 25

4. Still using the Outline view, click the paragraph 0200-LOGIC and go to line 75 (Figure 50). Figure 50. Line 75, 0200-LOGIC

5. Change from LAB2 to NODYNAM (Figure 51).

Figure 51. Change the IF statement in line 75

Using local syntax checking You will compile the COBOL program by using the local compiler, because this will save CPU resources in the z/OS system. But first, you need to save the changes. There is one option that performs both actions.

1. Right-click and select Save and Syntax Check > Local (Figure 51). Figure 51. Save changes and check syntax

2. Select Refreh dependencies and then perform a syntax check, and click OK,(Figure 52).

Page 26: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 26

Figure 52. Check syntax only; do not refresh dependencies

3. Click the Remote Error List tab (in the bottom pane, shown in Figure 53) to check syntax errors. Figure 53. Remote Error List tab

4. Double-click the error message (Figure 54). This should bring you to the editor, positioned at line 44.

Figure 54. Error message for line 44

Page 27: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 27

Using Replace with Local History You will fix that error by returning to the old version that had the correct Display statement. A nice feature of Rational Developer for System z is the ability to recover previous versions (even remote code) by using the local workstation. This is very useful when you delete and save components on the z/OS, where Undo is not possible after you have saved the changes.

1. Click CTRL + Shift + F4 to close any opened editor.

2. Right click CUSVSAM.cbl and select Replace With > Local History (Figure 55).

Figure 55. Select the CUSVSAM.cbl file, then Replace With and Local History

This operation can take a while, because it goes to the z/OS. It will show all of the previous versions (although you have just one).

3. Click on the white spot on the right (see the little hand in Figure 56) to see the next change.

Figure 56. Click on the white spot to see the next change

Page 28: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 28

4. As Figure 57 shows, you can see exactly where the difference between the versions. Figure 57. Side-by-side comparison

5. To return to the previous version (the original without changes), click Replace (Figure 58). The version without changes will return to the z/OS system.

Note: All operations are running at the z/OS level. Depending on your network, this could be slower if it is using the local copy. Figure 58. The Replace button

Page 29: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 29

6. Perform another Local Syntax Check: (Figure 59)

a. Right-click CUSVSAM.cbl and select Syntax Check > Local.

Figure 59. Syntax check run on local

b. Now you can select Syntax check only and click OK

7. Click in the Remote Error List view and note that we have a warning now in the Remote Error List. View. The error message from the last time is gone. Double click in the warning and you will be positioned at the location of the warning. Warnings are fine.. (Figure 60) Figure 60. Remote Error List view

8. Close all editors that are still open (CTRL + Shift + F4).

Page 30: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 30

Generate JCL to compile, link, and GO (no z/OS debugger) Now that you have a successful syntax check of your COBOL program, you can generate the JCL (Job Control Language) that will be used to create the executable file on your z/OS system.

1. Using the Enterprise Projects view, right-click the CUSVSAM.cbl file, and select Generate JCL > For Compile Link Go (Figure 61).

Figure 61. Generating JCL for Compile, Link and Go

2. Click OK for the Load Module Member Name

In the JCL Data Set and Member Name window, notice that JCL Data Set Name is set to the value that you specified for your project settings.

3. Notice the job name that will be created as EM4Z0X1 (EM4z011 in the Figure 62) and click OK.

Figure 62. JCL Data Set and Member Name view

You should see a similar message that Figure 63 shows.

Figure 63. JCL Generation Message notice

4. Click OK.

Page 31: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 31

5. Go to your Enterprise Projects view, and you will see that CUSVSAM.jcl was generated (Figure 64).

Figure 64. Member CUSVAM with the JCL generated

6. Double-click the JCL file to open in. Instead of EM4Z01 you should have your z/OS assigned user id. The first 14 lines should look something like the screen output in Figure 65. Figure 65. CUSVSAM member content

Notice that LPEX editor recognizes JCL, and you can navigate through your job in the Outline view.

7. Click the //GO step (line) in the left pane, and notice that the cursor will be at that location in the right pane. (Figure 66).

Figure 66. Using Outline view to find JCL steps.

Page 32: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 32

8. Add a JCL error. For example if you delete the comma in the end of the line 33 (after CUSVSAM) and press Enter will get the error shown in Figure 67, even this example is for another dataset.. Notice, also, that some keywords are recognized and displayed in blue text.

Figure 67. Error on line 28: Missing a comma

9. Fix the line 33 by adding a comma after CUSVSAM, and then pressing Enter.

Figure 68. Comma added at the end of line 29

10. Take a look in the JCL generated: Using the Outline view, click in the //GO step. Notice the DDNAME POTVSAM that is generated. This card was defined in the project properties previously.

The program CUSVSAM calls two other COBOL programs: REGI0B and REGI0C. For this tutorial, those programs were already compiled and are in the data sets EM4Zxx.POT.OBJ and EM4Zxx.POT.LOAD, because they need to be included by the linkage editor.

Figure 69. DDNAME POTVSAM generated

11. Save the changes (Ctrl + S), but do not close the editor.

Page 33: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 33

Submit the JCL to run Now you can submit the job to be run on the z/OS system. You can use the command editor or the context menu actions. Notice that the JES subsystem must be connected; otherwise, a message will indicate that submission was not accepted.

1. Using the command editor, type submit (or sub), and then press Enter as shown in Figure 70 Figure 70. "submit" typed in the editor command line

A message with your JOBID number will indicate that the job was accepted (Figure 71).

Figure 71. JOBID number added, which indicates that the job was accepted

2. Close the JCL editor by clicking the X .

Access the output listings You can check the job-generated output listings:

1. Using the Remote Systems view, locate the dallas node, and expand JES node.

2. Right-click My Jobs and select Refresh (Figure 72).

Figure 72. Refreshing MyJobs

Page 34: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 34

3. Expand MyJobs and you will see the job that you had submitted (Figure 84, which follows, shows an example).

Figure 73. Jobs submitted listed

4. Right-click My Jobs and select Show in Table. This is a good way to see the listing, because you get more details, such as the return code, the dates, and so forth (see Figure 74, which follows).

Figure 74. Show jobs in Table format

5. As expected, there is an abnormal end of task error (abend), as Figure 75 shows, and the return code is S0CB (division by zero)

Figure 75. Showing jobs in table format

Page 35: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 35

6. Using the Remote System Details view, double-click the job that you submitted (Figure 76).

Figure 76. Job tab

Because the abend was after the display of the VSAM records, you can see the records displayed.

7. Double-click the GO SYSOUT step to see the results of this step. Each record was read from the VSAM and displayed to the listing. You can also see the decimal-divide exception that caused the 0CB. (Figure 77).

Figure 77. Decimal-divide exception

8. Close all of the editors (CTRL +Shift + F4).

Page 36: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 36

9. Using Remote System Details view, select the jobs to be purged (use the CTRL key to select more than one), right-click, and select Purge. The job listings will be purged if you have authorization allowing you to do so.

Figure 78. Selecting the job to purge

Generating JCL for running the z/OS debug tool Change the project runtime for the JCL to be generated with the debug options.

1. Right-click CUSVSAM.cbl and select Property Group > Override Properties (Figure 79). Figure 79. Overriding CUSVAM.cbl properties

Page 37: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 37

2. Click on Run-tab, expand ELAXGO, select RUN and scroll down the editor Figure 80. Overriding Run-time options for CUSVAM.cbl program

3. Change the option to Run in batch with debugger and be sure that Program Parameters/Run-time Options is selected and save the changes using Ctrl + S.

4. Use Ctrl + Shift + F4 to close the editor: (Figure 81). Figure 81. Run-time Step Options view

Note: The reason that we specified Program Parameters/Runtime Options is that we want that the JCL generated in the form of PARM.RUN=('/TEST(,,,TCPIP&&xx.xx.xx.xx%8003:*)') to be used by the z/OS Debug. If you specify Run-time Options/Program Parameters, the JCL generated will be in the form of PARM.RUN=('TEST(,,,TCPIP&&xx.xx.xx.xx%8003:*)/'), and the COBOL z/OS debug will not work this way. But when doing PL/I this is the preferred way.

Page 38: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 38

5. Right-click CUSVSAM.cbl and select Generate JCL > For Compile Link Go. Figure 82. Generating JCL for Compile, Link and Go

6. Click OK to keep the Load Module Member Name as default

7. In the JCL Data Set and Member Name window, notice that the JCL Data Set Name is set to the value that you specified for your project settings.

8. Click OK.

Figure 83. JCL Data Set and Member Name view

9. This is the second time to generate the JCL; therefore, click Yes to replace the existing member.

Figure 84. Member Already Exists dialog

10. You should see the message shown in Figure 85. Click OK.

Figure 85. JCL Generation Message

Page 39: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 39

11. Open the JCL file double-clicking it.

12. Using the Outline view, click //GO, where you will see that a PARM.RUN parameter was generated.

Notice that the TCP/IP address of your machine is also generated (and will be something other than the one that Figure 98 shows, of course). Your workstation will be listening at the port 8001 (default). The debug tool running on the z/OS will communicate to you by using this IP address (that is the why this section of the tutorial will work only in networks that are known by the z/OS in Dallas). Figure 86. PARM.RUN card generated showing your IP address

13. Close the editor (Ctrl + F4). Disconnect from the z/OS. Using the Remote System view, right click on dallas and select Disconnect. (Figure 87) Figure 87. Disconnecting from z/OS

Important! Do not submit this job.

What you have done so far At this point, you are still connected to the z/OS. You edited a COBOL program located in our z/OS system in Texas, made small changes to it and. after the changes were committed on the z/OS, you returned to the previous version by using the local history. This Rational Developer for System z feature can be very helpful. You added an error in the program, checked the syntax, and corrected the errors. You generated the JCL necessary to run the batch program, and submitted it for execution. You have also seen how the z/OS debug tool would communicate back to your workstation by using the TCP/IP address automatically generated in the JCL card.

Page 40: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 40

Using the z/OS Remote Debug tool Attention! The z/OS Remote Debug tool will work only if the z/OS Dallas system is able to recognize your workstation IP address. This is not the case in this tutorial. When the COBOL program is running under z/OS Remote Debug, it must be able to communicate back using the TCP/IP address that is known in the z/OS network. If you are behind a router or without an external physical TCP/IP address, the debug tool will not work. Usually, this means that you must be inside the same network as the z/OS server. But at least you have been able to generate the JCL and understand how the debug will work. Also, you can watch the Flash movie that shows the z/OS debug tool in action.

Start the Microsoft® Internet Explorer® browser, and click Favorites to run the demo (see Figure 87). Figure 87. Debug tool Flash demo

In case you do not find this in the Favorites menu, use the Internet Explorer Browser execute the sequence: Click File > Open… > Browse… > and navigate to the HTML file: C:\RDZ7.6_POT\HTML\VIEWLETS\LAB2_DEBUG_with_Callouts\LAB2_DEBUG_with_Callouts.html Tip: Press F11 for more screen space. This movie will last a little longer than 5 minutes. You can play, pause, and stop the movie by using the icons (in that order) that the bar in Figure 88 shows. Figure 88. Flash movie control buttons

You have completed this tutorial.

Page 41: Remote IBM zOS application development june14 …public.dhe.ibm.com/software/dw/rational/emz/Remote_IBM...z/OS® Application Development environment. If the connection to the mainframe

Remote IBM z/OS application development with IBM Rational Developer for System z

© 2012 IBM Corporation 41

Trademarks IBM, the IBM logo, and Rational are trademarks of IBM Corporation in the United States, other countries, or both. Microsoft, Internet Explorer, Windows, Windows NT, and the Windows logo are trademarks of Microsoft Corporation in the United States, other countries, or both. Other company, product, or service names may be trademarks or service marks of others. Resources Learn

IBM Enterprise Modernization solutions Product overview: IBM Rational Developer for System z Demo: Rational Developer for System z Podcast: Building next generation mainframe applications with IBM Rational Developer for

System z and Rational Business Developer White paper: Unleash the power of mainframe assets into SOA See the Get products and technologies section that follows for a trial download

Visit the Rational software area on developerWorks for technical resources and best practices for Rational Software Delivery Platform products.

Subscribe to the developerWorks Rational zone newsletter. Keep up with developerWorks Rational content. Every other week, you'll receive updates on the latest technical resources and best practices for the Rational Software Delivery Platform.

Subscribe to the Rational Edge newsletter for articles on the concepts behind effective software development.

Subscribe to the IBM developerWorks newsletter, a weekly update on the best of developerWorks tutorials, articles, downloads, community activities, webcasts and events.

Browse the technology bookstore for books on these and other technical topics.

Get products and technologies

Get the trial download of Rational Developer for System z

Download trial versions of other IBM Rational software.

Download IBM product evaluation versions and get your hands on application development tools and middleware products from DB2®, Lotus®, Rational®, Tivoli®, and WebSphere®.

Discuss

Check out developerWorks blogs and get involved in the developerWorks community.

About the author

Reginaldo W. Barosa is an IBM Executive IT Specialist. He provides sales support, helping customers with enterprise modernization solutions and development tools, such as Rational Developer for System z. Before joining IBM U.S. twelve years ago, Reginaldo worked for IBM Brazil for 27 years. He has co-authored IBM Redbooks and has written two books, as well as other articles and tutorials for IBM developerWorks. He holds a degree in electrical engineering from Instituto Mauá de Tecnologia, São Paulo, Brazil.