Notes
Slide Show
Outline
1
RDz Workbench – Debugging z/OS COBOL Applications
  • Jon Sayles, IBM Software Group, Rational EcoSystems Team
2
IBM Trademarks and Copyrights
    • © Copyright IBM Corporation 2007,2008, 2009.  All rights reserved.


    • The information contained in these materials is provided for informational purposes only, and is provided AS IS without warranty of any kind, express or implied.  IBM shall not be responsible for any damages arising out of the use of, or otherwise related to, these materials.  Nothing contained in these materials is intended to, nor shall have the effect of, creating any warranties or representations from IBM or its suppliers or licensors, or altering the terms and conditions of the applicable license agreement  governing the use of IBM software. References in these materials to IBM products, programs, or services do not imply that they will be available in all countries in which IBM operates.


    • This information is based on current IBM product plans and strategy, which are subject to change by IBM without notice. Product release dates and/or capabilities referenced in these materials may change at any time at IBM’s sole discretion based on market opportunities or other factors, and are not intended to be a commitment to future product or feature availability in any way.


    • IBM, the IBM logo, the on-demand business logo, Rational, the Rational logo, and other IBM Rational products and services are trademarks or registered trademarks of the International Business Machines Corporation, in the United States, other countries or both. Other company, product, or service names may be trademarks or service marks of others.
3
Course Contributing Authors
  • Thanks to the following individuals, for assisting with this course:
    • Russ Courtney/IBM
    • Reginaldo Barosa/IBM
    • David Bean/IBM-Rational



4
Purpose of This Document
    • Course Name:  COBOL Foundation Training - with RDz


    • Course Description:  Learn the COBOL language, RDz and learn z/OS terms, concepts and development skills in this course.


    • Pre-requisites: Some experience in a 3rd or 4th Generation Language is expected.  SQL is also recommended.


    • Course Length: 10 days


    • Topics (Agenda)
      • Getting Started - installing and configuring RDz - and the course  materials, and using Eclipse to edit COBOL
      • COBOL General Language Rules
      • Basic COBOL Statements
      • Data records and table handling
      • Debugging Programs - Note: Deep dive on using RDz for common COBOL programming errors (001, 0C4, 0C7, infinite loops, fall-thru, etc.)
      • Input/Output and Report Writing Patterns
      • Sequential File Match/Merge Patterns
      • COBOL Subprograms and the Linkage Section
      • Structured Programming Concepts and Coding Patterns
      • Advanced Character Manipulation, COBOL Intrinsic Functions, Date and Time coding patterns, and Language Environment calls
      • OS/390 Concepts and JCL
      • Compile/Link & Run Procs on the mainframe
      • Indexed file Coding Patterns
      • Sort/Merge and Master File Update Coding Patterns
      • Accessing DB2 Data and Stored Procedures
      • COBOL in the Real World:
        • CICS - lecture only
        • IMS (DL/I and TM) - ditto
        • Batch processing - ditto
        • Java calling COBOL
        • COBOL and XML Statements
        • SOA and COBOL - creating and calling Web Services
        • Web 2.0 using Rich UI


5
Course Details
  • Audience
    • This course is designed for application developers who have learned or programmed in a 3rd or 4th generation language – and who need to build leading-edge applications using COBOL and Rational Developer for System z.

  • Prerequisites
    • This course assumes that the student has a basic understanding and knowledge of software computing technologies, and general data processing terms, concepts and vocabulary.
    • Knowledge of SQL (Structured Query Language) is assumed for database access is assumed as well.
    • Basic PC and mouse-driven development skills, terms and concepts are also assumed.
6
The RDz Workbench
7
Topic Considerations
8
Workshop Considerations
9
Topic Objectives
  • After completing this unit, you should be able to:
    • Using the Problem Determination Tools, Debug Option and RDz:
      • Debug a mainframe batch job
      • Compare and contrast mainframe debugging with local debugging (see unit titled:  RDz Workbench – Introduction)
      • Discuss the Debug Option setup and configuration requirements

10
Debugging Overview
  • Face facts: No one gets            it right the first time.
    • Not at the production       code level.

  • That's why IBM invented source-level application debuggers, so you can:
    • See program execution, line-by-line
    • Verify the value of a variable – during program execution
    • Stop and start program execution analysis, at the speed that our procedural understanding of the application's execution flow can handle
11
Enter Source-Level Debuggers
  • In a previous unit (RDz Workstation – Introduction) you learned about the RDz debugging capabilities:
    • Debug Perspective
    • Debug Views:
      • Variables
      • Monitors
      • Breakpoints
    • Etc.
  • But what you did in that unit, applied to debugging local-COBOL (Workstation-based) executables
  • Now it's time (as promised) to see how to debug mainframe-COBOL applications
12
Enter Source-Level Debuggers
  • Specifically: IBM Debug Tool
    • Green-screen (TSO-based) or RDz/Workstation-based interface to z/OS-based debugging engines
    • Debug:
      • Online (CICS, or IMS TM)
      • Batch
    • Seamless debugging of mixed-language applications
    • Interactive, source-level debugging in RDz with program running on z/OS
    • Display, monitor and alter program variables
    • Set standard types of breakpoints
    • View data in Hex (EBCDIC) or string values
    • Multiple configurable views
    • Ability to make adjustments to the program while debugging


  • Product web-site: http://www-01.ibm.com/software/awdtools/debugtool/
13
RDz Interfacing with Debug Tool
  • The RDz remote debugger
    • Client software that is installed with RDz on your workstation
    • Communicates with the Debug Tool engine on the mainframe
      • Note that Debug Tool must be installed on z/OS in order for you to do the labs in this unit
14
Debug Tool - Application Environments
  • One debugging engine, with support for many environments:
15
Steps for Batch Application Debug Session
  • ώ RDz is started on your workstation
  • Ensure that your compile proc has the necessary TEST parameter, and Compile/Link to create load module
  • Discover workstation TCP/IP parameters:
    • TCP/IP Address
    • Listener port#


  • Enter TCP/IP address of workstation in run JCL for Debug Tool DD statement, and Submit the JCL
  • Debug the application
16
1. Compile JCL Requirements for Using Debug Tool
  • Use the TEST compiler option to prepare your executable COBOL program for use with the debugger.
    • The TEST option is required for remote debugging.
    • The TEST option produces symbol and statement information that enables the debugger to perform symbolic source-level debugging.
  • The TEST option is set in the PROCs distributed with RDz (see screen capture)




  • If you are not using the            IBM/RDz PROCs for building                    your applications, be sure to              override the compiler option                 and add TEST - as shown θ
17
2. Discover TCP/IP address and RDz Port
  • Open the Debug Perspective
    • Click the small downward pointing triangle               next to the debug-daemon icon
    • Note the Port#
    • Select:  Get Workstation IP…
    • Copy the IP address
18
3. Paste in the TCP/IP Address and Submit the JCL
  • Configure your application to start Debug Tool by including a specific DD card in the run JCL – that includes your workstation's current Port# and TCP/IP address
    • This is an example of JCL to run a batch job
    • The CEEOPTS DD statement is the easiest way to start the Debug Tool for batch applications
    • Code as shown
19
Debug Tool - Prompts
  • Debug Tool will interface with RDz and throw the Confirm Perspective Switch prompt
    • Click Yes



  • Additionally, if (but only if) your mainframe source code is out sync with the Load Module you'll get an informational  prompt
20
4. Debug Tool Connects to RDz
  • Debug Perspective is launched in RDz
  • Same debugging features as Local COBOL Debug (from previous course unit)







  • Your source is copied down from z/OS to your RDz workstation


  • Execution is on z/OS
21
The Debug Perspective and Views – Review
  • Notes:
  •         - Same views, options and debugging features as Local COBOL Debugger
  •         - However, application execution happening on z/OS
  •         - Only interactive debug: view/browse activity occurs on the Workstation
22
Action Icons – Review
23
Run Menu
  • Shows same + additional debugging functionality as icons on toolbar
    • However, not all Run menu functionality enabled for COBOL/PL1

  • Also shows hot-keys
    • Your PC's function keys


  • Context-sensitive:
    • Options are grayed in current debug session if not applicable
24
Statement Breakpoints – Review
  • A statement breakpoint will stop the program when it reaches a statement
    • It stops before the statement runs
  • A breakpoint can optionally be made conditional
    • A simple condition may be specified such as:
      • VariableX > 999
      •           or
      • VariableY = 'Abc'
  • A breakpoint can be based on a frequency
    • Stop the Nth time a statement runs
25
Set a Statement Breakpoint – Review
26
Set/Edit Conditional Statement Breakpoints
27
Watch Monitor Breakpoints
  • Can have breakpoints occur conditionally, when:
    • The value in a field changes
    • Some portion (# of bytes) of a field changes
    • A simple condition tests true for the value in the field
  • Steps:
    • Select a variable
    • Right-click, and select: Add Watch Breakpoint…
    • Select Number of  bytes to watch – or add a simple condition
      • Specify Auto to test for all bytes


28
Run to a Statement Breakpoint
29
Breakpoint Options (from the Breakpoints View)
30
Variables View During Remote Debug – Additional Options
31
Variables View – EBCDIC (Hex) Data Representation
32
Monitors View – Options
33
Monitors – Detach the Eclipse View
34
Outline View – Code Sync Options
35
Outline View – Other Icon-Function Options
36
Handling program abends
  • Debug Tool can receive control back from the system after an abend occurs
    • The program will be stopped at the abending statement


  • You can:
    • Allow the application to abend and terminate
      • Capture abend info with a product such as Fault Analyzer
      • Terminate the application and prevent further processing
    • Or continue running the program

  • Usage note:
    • The LE  TRAP(ON)  option must be active
37
Terminating the application
  • There are several options for terminating your application:


    • Remain in the debugger, and RESUME until the program runs to completion
      • The program will terminate normally or with an abend
      • The return code is controlled by the program


    • Disconnect the debugger, and allow the program to run to completion
      • The program will terminate normally or with an abend
      • The return code is controlled by the program
38
Termination action buttons
39
Force an immediate termination with abend
40
Restart Your Debugging Session
  • For batch debugging
    • If your submitted JCL is still in the code (Content) area
      • No need to return to the z/OS Projects perspective
    • Right-click
    • Select: Submit


  • !Note that F11 (or Debug from the Run menu) does NOT work – as it did with Local COBOL debugging
41
Summary
  • Having completed this unit, you should now be able to:


    • Describe where the debug engines are located
    • Show how to set the workbench preferences for running and debugging
    • Show how to invoke the debugger for local programs
    • Describe the views of the Debug perspective
    • Demonstrate how to set breakpoints in COBOL code
    • Explain how to set up the COBOL compile options for remote debugging
    • Show how to debug a remote batch COBOL program
42
The RDz Workbench
43
Topic Objectives
  • After completing this unit, you should be able to:
    • Using the Problem Determination Tools, Debug Option and RDz:
      • Debug a mainframe online transaction
    • Describe the online transaction features for configuring your 3270 sessions with Debug Option
    • Debug a CICS 3270 Application


44
Online Debugging Overview
  • Guess what?         No one gets            it right the first time      coding online       programs either J



  • Lucky for you:
    • Debug tool handles:
      • CICS 3270 online transactions
      • IMS TM online transactions
    • Without any different debugging techniques
      • The only difference from batch is the debug setup procedure for the online environment
45
Steps for Online (CICS) Application Debug Session
  • ώ RDz is started on your workstation
  • Ensure that your compile proc has the necessary TEST parameter, and Compile/Link to create load module – and that your CICS application is setup for Debug Option testing
  • Discover workstation TCP/IP parameters:
    • TCP/IP Address
    • Listener port#
  • Access and login to your CICS region
  • Execute the DTCN transaction and specify:
    • Terminal ID
    • Programs – to put under Debug control
    • User-ID
    • TCP/IP parameters:
      • TCP/IP Address
      • Port#
    • Save the DTCN transaction specification
  • Debug your CICS application
46
1. Compile JCL Requirements for Using Debug Tool - Review
  • Use the TEST compiler option to prepare your executable COBOL program for use with the debugger.
    • The TEST option is required for remote debugging.
    • The TEST option produces symbol and statement information that enables the debugger to perform symbolic source-level debugging.
  • The TEST option is set in the PROCs distributed with RDz (see screen capture)




  • If you are not using the            IBM/RDz PROCs for building                    your applications, be sure to              override the compiler option                 and add TEST - as shown θ
47
2. Discover TCP/IP address and RDz Port - Review
  • Open the Debug Perspective
    • Click the small downward pointing triangle               next to the debug-daemon icon
    • Note the Port#
    • Select:  Get Workstation IP…
    • Copy the IP address
    • Either paste the IP address into Notepad, or write it down
48
3. Login to your CICS Region
  • From Remote Systems Explorer:
    • Right-click
    • Select: Host Connection Emulator
    • Select your CICS application
    • Enter your Userid and Password and sign in
49
3. Setup the Debug Option Parameters using DTCN – 1 of 2
  • From CICS (after signing in):
    • Clear the screen
    • Enter:  DTCN – and press  8 Enter
  • From the DTCN screen
    • Press F10 – this will fill in the Terminal Id for your workstation
50
3. Setup the Debug Option Parameters using DTCN – 2 of 2
  • DTCN transaction data entry screen
    • Enter the Tran-code
      • Transaction ID
    • Enter up to eight                   specific Program Id(s)          you wish to debug through …or…
    • Enter wildcard text            for the Program Id(s)
      • Ex. CD*
    • Enter your User-ID
    • Session Type: TCP
    • Port Number:             from your Debugger look-up
    • Display ID:                   Your TCP/IP address,             from your Debugger look-up (note that you can not paste into this 3270, screen)
  • Press F4 to save your debug profile
  • Press F3 to clear the screen
51
4. Start Debugging
  • From the CICS region
    • Enter the Tran-code
    • Press 8 Enter
    • Click: Yes at the Confirm Perspective Switch
52
4. Start Debugging
  • Debug as previously learned in the batch/remote and Local debug units.
53
What Happens for Calls and Screen-IO? – 1 of 2
54
What Happens for Calls and Screen-IO? – 2 of 2
  • If your current transaction ends, and a BMS or 3270 screen is sent:
  • You will be notified (prompted) by the debug engine
  • If a screen is sent, the 3270 will display in the content area


55
What About PF-Keys and Other Data Entry?
  • You can resize the screen portion of the debugger
  • And use the PF-Key emulation             options in the                 Host Connection
56
Same Debug Option Functionality!
57
Topic Objectives
  • After having completed this unit, you now should be able to:
    • Using the Problem Determination Tools, Debug Option and RDz:
      • Debug a mainframe online transaction
    • Describe the online transaction features for configuring your 3270 sessions with Debug Option
    • Debug a CICS 3270 Application