Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Rational Developer for System z For ISPF Developers

Similar presentations


Presentation on theme: "Introduction to Rational Developer for System z For ISPF Developers"— Presentation transcript:

1 Introduction to Rational Developer for System z For ISPF Developers
Jon Sayles RDz Technical Enablement Author Notes: This is the standard session track template for IBM Rational Software Conference 2009 Additional IBM presentation resource links available on W3: Rational Core Messaging Slides Rational Image Library PowerPoint Best Practices Presentation © 2010 IBM Corporation

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: Craig Branham, IBM / Rational Learning Development Zvi Weiss, Certified IT Specialist, Rational Software for System z Kevin McMillin, Dillards Vijay U Sankar, IBM

4 Table of Contents Learning from these slides Course assumptions
RDz Workbench and Graphical Development overview Editing and Syntax Checking Source Files Appendices

5  Using this PowerPoint
There are two types of slides in this PowerPoint: Workshop slides – which indicate that you are to "do something" using RDz (instructions will be on the slide) The  in the slide heading. 2. All the other slides contain conceptual learning material Some of the slides in this PowerPoint contain additional explanations and/or program code that you can use in workshops. To view a PowerPoint slide note: Move your mouse-pointer over the bottom of the slide border until the cursor becomes a north-south facing pointer Left-click and holding the left mouse-button down, drag the bottom border of the slide upwards until you see the text in the note This is a slide note. Some slide notes contain technical information – others contain program code

6 You know ISPF and have used it for at least two years You have:
Course Assumptions You know ISPF and have used it for at least two years You have: No experience with Eclipse or RDz Some experience with PC tools You have used MS-Windows applications for at least one year RDz installed and running on your workstation at version 7.6 or later Note that all ISPF discussion assumes IBM-installed ISPF product defaults

7 RDz for ISPF Developers
UNIT RDz for ISPF Developers Topics: The RDz Workbench – Terms and Concepts Editing COBOL Programs ISPF Prefix Area Commands Editing With Keystroke Shortcuts Find and Replace Dialog Creating New Programs From Scratch Miscellaneous Features – Hex edit, Content Assist Paragraph (control flow) and Data Flow Analysis Working with Copybooks and Property Files Appendix – ISPF / LPEX Editor Comparison

8 Topic objectives After completing this topic, you should be able to:
Describe the essential RDz terms and vocabulary – as they relate back to ISPF: View Perspective Menus Context menu Toolbar menus Work with Views: Define "view" Maximize/Minimize/Open/Close/resize different workbench views Work with Perspectives: Define "perspective" Switch perspectives Reset (to their installation defaults) Work with a graphical mouse Access the help system

9 Crossing the Chasm – From ISPF to RDz
On ISPF the development paradigm consists of: Typing  Familiarity with ISPF: Panels Commands

10 Crossing the Chasm – From ISPF to RDz
Using RDz the development paradigm changes to: Using a Graphical/Windowed IDE …with cutting-edge tools – that scale to the complexity of your z/OS development tasks An RDz Debug session with: - Monitored expressions - Dynamic data update - Breakpoints - Access to source tools - Program analysis - Flow diagram - Navigation - Real-time access to Edit and Browse: - DB2 table values - IMS Database values - VSAM files - QSAM files

11 Crossing the Chasm – From ISPF to RDz
To become productive using RDz you will need to: Get the hang of using a mouse for navigation  Understand the differences in development tool terms and concepts Familiarize yourself with the RDz workbench organization – Menus, "Views" and "Perspectives" Translate your existing development techniques to use RDz and learn some new ones It is not "rocket science" but it will take practice, and hands-on experience A short-list of RDz benefits include: Raised productivity – see IBM IDE Efficiency Benchmarks: Lowered development costs through development LPAR workload reduction Addition of new professional skills (Eclipse-based development platform) Improved job satisfaction

12 Launching Rational Developer for System z
When you launch RDz from your desktop it prompts you for a "workspace" A "workspace" is the highest-level folder on your workstation that contains: Files that are in local z/OS projects Meta-data ("data about data") – examples: Your development preferences and settings Your z/OS connection information  Datasets stored on your PC  ISPF Option 0 Workstation Hard-drive D:\RDZProjectNew

13 The RDz "Workbench" – Graphical IDE Elements – Menus and Views
Menus and toolbars RDz Workbench Scrollbars for navigation RDz uses as its Integrated Development Environment an open-source programming platform known as “eclipse” - Eclipse is a development platform that provides a graphical development environment that we'll be calling the RDz Workbench If you're a mainframe ISPF programmer, instead of exclusively typing in code and commands, you’ll type,  but also use your  mouse to: Drag & Drop files – from the mainframe to your workstation and back Do certain COBOL development activities – especially ones that pertain to program maintenance and analysis Manage (Open, Close, Create, Delete, Rename, Refactor, Move) files Kick off mainframe program compiles and batch jobs - and view the results “Paint” screens – develop CICS/BMS and IMS/MFS The Eclipse graphical software development idiom is a proven productivity enhancement over keyboard-only-development. Although, we will grant, that if you’re a dyed-in-the-wool ISPF-veteran, RDz will appear very different from green-screen technology. However, you will soon find that: For almost every development facility on the mainframe there is corresponding RDz functionality With a little practice you can become far more productive with RDz Consider – how often do you open a Windows DOS command prompt to type in commands that: create, copy, delete, organize and manage the files on your PC? Lots of tabbed Views

14  In ISPF you use menus to navigate from option to option, and
ISPF Menus Your initial impression of RDz might be that virtually everything is brand-spanking new But that's not the case. For example, in ISPF you use menus: - Primary Option Menu - Individual Panel Menus  In ISPF you use menus to navigate from option to option, and from panel to panel

15 RDz Menus And in RDz you use menus and toolbars  A Toolbar is simply a shortcut to menu functions enabled by Left-clicking on an icon Standard Menu  Toolbar 

16 RDz Menus – the Context Menu
RDz also makes use of Context Menus to simplify development tasks The context-menu is accessed by: 1. Selecting something 2. Pressing the right-mouse button Right-mouse "Context" menu  RDz's menus are used to access development functionality - individual tools within the workbench

17 RDz Views and Perspectives
The RDz Workbench is organized as tabbed and resize-able windows called “Views” Views display information or provide access to: - z/OS datasets - Local projects - Source editors - Syntax errors - Dataset editors - Analysis tools - Debug monitors - DB2 tables - SQL statement results COBOL Editor View z/OS Projects View Remote Systems View Views Outline View

18 RDz Views and Perspectives
Tabbed and resize-able Views COBOL Editor View z/OS Projects View Remote Systems View Outline View A Perspective is a "collection of Views related to/organized around common tasks" – such as z/OS development, Debugging, DB2/SQL/Stored Procedure development and testing, etc.

19 ISPF Panels as z/OS "Views and Perspectives"
Browse (=1) a "view" DSList (=3.4) In a sense, RDz's Views and Perspectives are simply a graphical way of organizing functionality you've been working with for years Think of an ISPF panel as a "View" Think of ISPF itself as a "Perspective"

20 Browsing a Dataset – ISPF
Let's see if this analogy holds… Fill in the ISPF Library member name: Press:  Enter

21 Browsing a Dataset – RDz
COBOL PDS  From Remote Systems (which you can think of as your new =3.4 DSLIST): Expand a PDS Right-click the PDS member Select Browse

22 Editing a Dataset – ISPF
Fill in the ISPF Library member name: Press:  Enter

23 Editing a Dataset – RDz From Remote Systems (aka 3.4): Expand your PDS
Double-click the PDS member – or Right-click, select Open Note that opening a dataset for Edit in RDz looks the same as Browse. But in fact, when you elect to Browse a file (previous slide), the keyboard is locked – so you cannot even make – much save source edits.

24 Dataset Management (Utility) Facilities – ISPF
Assortment of file management functions RDz equivalents exist as: Views Context menu options Toolbar menu options

25 ISPF Data Set Management Facilities – in RDz
All the essential Data Set Management Facilities are in RDz – and available without navigating =3.12 =3.3 =6 =3.1 =3.1 =3.14 =3.2

26 The Benefits of an Efficient IDE (Workbench)
Instead of maneuvering through panels to access functionality and working sequentially, in RDz the functionality you need is available in concurrent views Edit a program Access Datasets + Dataset Management File Compare Submit a Compile  File Search Dataset Statistics Access Jobs (Outlist facility)

27 Specifically – RDz and Equivalent ISPF Options
ISPF Edit or ISPF Browse (=2 or =1) ISPF Option 3 for local files ISPF Option 3 for remote files ISPF 3.2 Additional ISPF panels as Views

28 More RDz "Workbench" and Equivalent ISPF Panels
JCL Viewed ISPF 3.8  ISPF =6

29 Review – Terms and Vocabulary
On z/OS TSO or ISPF is equivalent to an RDz "Perspective" Each ISPF panel or ISPF option is equivalent to an RDz "View" You use menus and commands to navigate to and from ISPF panels/views Using RDz There are different Perspectives for different kinds of development work: Z/OS Project development work (browse/edit/compile) – z/OS Perspective Debugging – Debug Perspective DB2 and SQL work – Data Perspective Perspectives contain one-to-many "Views" Each View is specific to some development function: Edit Browse Analyze You can: Resize, open and close/Maximize and minimize views RDz menus are primarily used to access development tools and functions

30 Review – ISPF "Views" in RDz
Which ISPF options correlates to the RDz views shown here? ISPF = ____ ISPF = ____ ISPF = ____ ISPF = ____

31 Workshop – Becoming Familiar with the RDz Graphical Tools
This short workshop will start you down the road to RDz proficiency You will: Create a new example project (if you already haven't done so) Using your mouse: Manipulate tabs Navigate the workbench Explore menus Edit a program Compile a program Debug a program Recall that you will "do" workshops on all slides that have this symbol  in the slide header

32 Before We Begin… In this first introductory tutorial you will learn how to navigate the RDz Workbench, and edit source using programs and projects that reside on your local workstation As you move through these tutorials you will learn how to connect to z/OS and access PDS members, VSAM and sequential files and databases And possibly – depending on what's available in the learning environment, access source in Library Management Systems

33 Before Starting the Workshop – Keyboard vs. Mouse Development
You will use different development techniques with RDz:  Type statements using the Editor, and sometimes type other short snippets in dialog panels – like "find text string" operations, etc.  Navigate through wizards, through your source files, and do other development activities with your mouse. And sometimes you will mix mouse-operations with typing. If you’re new to mouse development consider the following: Left-mouse button Select some thing - Click – to set focus to or to select a field - Select a file in the Editor Scroll-bar manipulation Double-click a file to open it in the Editor Open a Workbench menu (at the top) Select (Left-mouse), hold, drag and drop a resource – used primarily for: - Opening Split-Screen views in the editor - Dragging and dropping files - CICS/BMS and IMS/MFS screen painting Right-mouse button Opens a “context menu” - From a program in the Editor Area - Open a Declaration or Copybook - Syntax Check - Rename/factor - Copy/Paste/Move/Delete code  Notes: Scrolling wheel Used to scroll up/down inside source files - Fast and convenient

34  Workshop – Launch RDz From your desktop or the Windows start menu launch RDz If you are prompted for a Workspace you can either customize/edit the Drive:\Directory name, or just click OK to accept the default Close the Welcome tab By clicking the X as shown here: RDz will open to what is called the: z/OS Projects perspective We'll explain these terms a bit later From now on, the product will open directly here (without the Welcome tab) Close the Welcome to z/OS Projects tab

35  Create a New Example Project
 Note – if you did this in some prior step of your education setup, please skip this slide Left-click the File menu, select: New > Example… In the Wizards: text box, type: cobol Select: COBOL Sample 1 Click: Next Name the project: chapter1 Click Finish Your z/OS Projects tab window will show your new project:

36 The RDz "Workbench" – Project Organization
You will work with a variety of COBOL resources: programs, copybooks, compile listings, executables, data files and so forth Using RDz you store, organize and manage the resources associated with your projects in Projects  RDz resources are organized into - Project(s) - Folders – and sub-folders - Files You can think of the RDz resource topology as similar to ISPF libraries: Note – that this analogy is not perfect, but close. Project Folders  Files   Notes:  RDz Workspace folder  Project sub-Folder  cobol Sub-folder – under the Project folder  File – organized inside the cobol folder, etc.

37  Navigate in the RDz Graphical Workbench
Double-click StartApp.cbl and using your mouse: 1. Move the slider bars: Up and down Right and left Get comfortable moving the slider bars to navigate in the source file 2. Left-click the up and down scrolling arrows: To scroll one line at a time through the source file The COBOL Editor Up-down slider bar Left-right slider bar These scrolling techniques are similar to pressing PF8/PF7/PF10/PF11 in ISPF

38  Resize a Window in the RDz Graphical Workbench
You might wish to see more program source at a glance in the Workbench. There are many ways to do this, but we'll start with: - Move your mouse-cursor over the right-hand border of the editor window It will turn into an East-West facing pointer  When this happens: - Left-click, and holding the left-mouse button down, drag to the right or left and resize the view You can also select the bottom window border. Left-click and hold + drag to make the window's height larger This window resizing technique is similar to setting your host emulator screen size (24X80, 32X80, etc.) As time permits, spend a few minutes working with mouse scrolling and window-sizing graphical development techniques

39 What have you done so far?
Workshop Review What have you done so far? Launched RDz and closed the Welcome tabs to access the z/OS Projects perspective Created a new project – populated with example COBOL programs Opened a program into the "COBOL editor" Navigated up & down, right & left using The scroll bars The single-line-at-a-time arrows Resized your editor window by dragging the window frame, making it: Wider (width) Deeper (height)

40  Workshop Review Practice makes perfect:
Close a view by clicking the Red X Practice makes perfect: Close the editor on StartApp.cbl If you made any changes to StartApp do NOT save them Open PrintApp.cbl in the editor Use the scroll bars to scroll up and down/right and left Use the up and down scrolling arrows Resize the editor window, make it: Wider Deeper (taller) Close the editor – and do NOT save changes to PrintApp

41 Manipulating Views – Part II
It can be very useful to maximize and restore views for various development tasks. This is very easy: To maximize a view: Double-click in the middle of the view tab Just don't click on the X  To restore a view back to its original size: Double-click (again) in the middle of the tab

42  Manipulating Views – Maximize and Restore
From your chapter1 project: Double-click StartApp.cbl and load it into the editor Double-click the editor tab to maximize the editor view Scroll up and down a few times in the editor Double-click the editor tab to restore the editor Close the editor don't save any source changes (if you happened to make any) Load PrintApp.cbl into the editor Maximize the editor view Scroll up and down a few times Restore the editor view Close the editor - by clicking the X in the tab

43  Resetting your Perspective
When you're first getting used to a new workbench, it's easy to do things inadvertently – like close views, or resize them so that they're virtually unusable  An easy fix is to restore your workbench is to access the Window menu and either: Reset your perspective to the RDz installation defaults …or… Open (Show) views you may have closed accidentally  Let's try it (do the following): Close a few of the views Resize the editor or some other view Now: Left-click the Window menu Click: Reset Perspective At the prompt, click OK  Note that from the Window menu you can also open other perspectives and open specific workbench views (the Show View option)

44  Do the following:  Open (Show) a View Reopen (Show) a view:
Up to now we've used just a few views, but RDz has lots of useful functionality accessed through views. And even though we're not ready to learn about every view and what it does, we should know how to open a view when we need to.  Do the following: Close the Remote Systems view Close the Properties view Reopen (Show) a view: Left-click the Window menu Click: Show View > Remote Systems Repeat the above steps to open the Properties view

45 Viewing More Than One Program at a Time
It's a common need when you're working with programs that inter-relate (CALL one another etc.) to want to view multiple sources simultaneously: In ISPF you press PF2 (Split-Screen) and Browse or Edit or files Using RDz it's actually simpler to produce independent program edit views

46  Workshop – Viewing More Than One Program at a Time
From z/OS Projects Double-click StartApp.cbl – to load it into the editor Double-click PrintApp.cbl – to load it into the editor 3. Double-click the PrintApp.cbl tab – to maximize the editing view With both programs open in maximized view: 4. Left-click and hold the left mouse button down over the PrintApp.cbl tab as you drag your mouse to the right 5. When your mouse moves over the blue scroll-bar it will turn into a bold-right-facing pointer. Release the mouse button

47  Workshop Working With More Than One Program at a Time
Congratulations – you are now in Split-screen edit, on two different programs To Restore the editing view to a single screen: Double-click over the tab  Notes 1. this may have seemed like a lot of individual steps, but once you've done it a few times, the motion will become quick and efficient 2. These are multiple "physical" windows – you have carte' blanche to work with your source: - Browse - Edit All of RDz's tools are available in either view  Practice makes perfect Please practice opening both StartApp and PrintApp Then create a split-screen view several times Also Restore the view to a single edit screen

48 Viewing a Program in Split-Screen
It's even more common to view the same program in split screen In ISPF you press PF2 and load the program into Browse or View mode (=1) In RDz it's much simpler to produce independent edit sessions……….. Edit session 1 Edit session 2

49  Workshop – Split-Screen Edit
From z/OS Projects: Double-click StartApp.cbl – to load it into the editor Press Ctrl+2 (Hold down the Ctrl key and press the 2 key on your PC) Double-click the tab to maximize the view of both source files Note that unlike ISPF (which only allows you to browse the same source in another split-screen session) you are in full source edit mode in both views To close the view, click the X in the right-hand corner of the split-screen  Practice makes perfect: Open StartApp.cbl and split-screen. Close the split-screen. Close StartApp. Repeat with PrintApp.cbl. Also pract. MaximizReand PrintApp.cbl a few times. Maximize the views, close the split-screen, etc.

50 Split-Screen Q&A Q. What about F9 …or… is there a a hot-key combination I can use to swap between split screens? A. Most of the time you'll just click your mouse into the "other" split screen to set focus, however you can press: Alt+Shift+Right-arrow key to swap from the left screen to the right – and Alt+Shift+Left-arrow key to swap from the right screen to the left Q. Remind me again – how do I close Split-Screens? A. If you're editing the same program, click the red-X in the top right hand corner If you're editing two different programs close the view tab Q. Can I split screens horizontally? A. Yes – here's how: Splitting one program's source horizontally: 1. Press Ctrl+2 to split the source view 2. Right-click inside the program and from the Context Menu select: Horizontal split

51 Horizontal Split of Two Different Programs
Horizontal Split of Two Different Programs 1. 1. Left-click on the view tab. Hold and drag downwards until the mouse-pointer becomes a south-facing arrow 2. Release the left-mouse button 1. 2.

52 What have you done so far?
Workshop Review What have you done so far? Launched RDz and closed the Welcome tabs to access the z/OS Projects perspective Created a new project – populated with example COBOL programs Opened a program into the "COBOL editor" Navigated up & down, right & left using The scroll bars The single-line-at-a-time arrows Resized your editor window by dragging the window frame, making it: Wider (width) Deeper (height) Maximized views and Restored them back to normal size in the Workbench Reset your z/OS Projects perspective to the RDz default Opened views that might have been closed accidentally Split-screen, and edited two programs at once Split-screen, and been in Edit on the same program

53  GUI-Editing Workshop – 1 of 2
Practice makes perfect: From this PowerPoint's Slide Notes: Select all (Ctrl+A) then Copy (Ctrl+C) all of the statements in the program If you don't remember how to access Slide Notes return to slide#5 in this PowerPoint From RDz Right-click over the cobol folder and select: New > File Name the file: TRMTRDZ.cbl Click your mouse-pointer into the new file in the top-left hand corner (column 1, row 1) and press Ctrl+V to paste the program statements you copied in step 1 Save the file (Ctrl+S) IDENTIFICATION DIVISION. PROGRAM-ID. TRMTRDZ. AUTHOR. IBM. INSTALLATION. COBOL DEV Center. DATE-WRITTEN. 01/23/88. DATE-COMPILED. 01/23/88. SECURITY. CONFIDENTIAL PATIENT DATA. ****************************************************************** *REMARKS. * * THIS PROGRAM EDITS A DAILY TREATMENT TRANSACTION FILE * PRODUCED BY DATA ENTRY OPERATORS FROM CICS SCREENS * IT CONTAINS EVERY TREATMENT FOR EVERY PATIENT IN THE * HOSPITAL. * THE PROGRAM EDITS EACH RECORD AGAINST A NUMBER OF * CRITERIA, BALANCES FINAL TOTALS AND WRITES GOOD * RECORDS TO AN OUTPUT FILE INPUT FILE DDS0001.TRMTDATA VSAM MASTER FILE DDS0001.PATMASTR INPUT ERROR FILE DDS0001.TRMTERR OUTPUT FILE PRODUCED DDS001.TRMTEDIT DUMP FILE SYSOUT ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. IBM-390. OBJECT-COMPUTER. IBM-390. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT SYSOUT ASSIGN TO UT-S-SYSOUT ORGANIZATION IS SEQUENTIAL. SELECT TRMTDATA ASSIGN TO UT-S-TRMTDATA ACCESS MODE IS SEQUENTIAL FILE STATUS IS OFCODE. SELECT TRMTEDIT ASSIGN TO UT-S-TRMTEDIT SELECT TRMTERR ASSIGN TO UT-S-TRMTERR SELECT PATMSTR ASSIGN to PATMSTR ORGANIZATION is INDEXED ACCESS MODE is RANDOM RECORD KEY is PATIENT-KEY FILE STATUS is PATMSTR-STATUS. DATA DIVISION. FILE SECTION. FD SYSOUT RECORDING MODE IS F LABEL RECORDS ARE STANDARD RECORD CONTAINS 130 CHARACTERS BLOCK CONTAINS 0 RECORDS DATA RECORD IS SYSOUT-Rec. 01 SYSOUT-REC PIC X(130). ****** THIS FILE IS PASSED IN FROM THE DATA COLLECTIONS SYSTEM ****** IT CONSISTS OF ALL PATIENT TREATMENTS ENTERED ****** THERE ARE TWO RECORD FORMATS - DETAIL AND TRAILER RECS ****** OUT OF BALANCE CONDITIONS SHOULD CAUSE THE JOB TO ABEND FD TRMTDATA RECORD CONTAINS 1101 CHARACTERS DATA RECORD IS INPATIENT-TREATMENT-REC-DATA. 01 INPATIENT-TREATMENT-REC-DATA PIC X(1101). ****** THIS FILE IS WRITTEN FOR ALL TREATMENT RECORDS THAT PASS ****** THE PROGRAM'S EDIT ROUTINES ****** THE TRAILER RECORD SHOULD ONLY CARRY THE NUMBER OF ****** RECORDS IN THE FILE ON TO THE NEXT JOB STEP FD TRMTEDIT DATA RECORD IS INPATIENT-TREATMENT-REC-EDIT. 01 INPATIENT-TREATMENT-REC-EDIT PIC X(1101). FD TRMTERR RECORD CONTAINS 1141 CHARACTERS DATA RECORD IS INPATIENT-TREATMENT-REC-ERR. 01 INPATIENT-TREATMENT-REC-ERR. 05 ERR-MSG PIC X(40). 05 REST-OF-REC PIC X(1101). FD PATMSTR RECORD CONTAINS 2964 CHARACTERS DATA RECORD IS PATIENT-MASTER-REC. 01 PATMSTR-REC. 05 PATIENT-KEY PIC X(06). 05 FILLER PIC X(2958). ** QSAM FILE WORKING-STORAGE SECTION. 01 FILLER PIC X(32) VALUE '* WORKING STORAGE BEGINS HERE *'. '****** DUMP MSG ****************'. ***************************************************************** * DUMP POINTER AREA * PARA POINTER- MOVE PARAGRAPH NUMBER TO THIS POINTER * * AS EACH PARAGRAPH IS ENTERED. DO NOT * * MOVE PARAGRAPH NUMBERS OF COMMON * PARAGRAPHS (USE COMM POINTER). * * * COMM POINTER - EACH COMMON PARAGRAPH SHOULD MOVE * * ITS PARAGRAPH NUMBER TO THIS POINTER * * AT IT INCEPTION. 01 DUMP-LOCATOR. 05 FILLER PIC X(32) VALUE '>>>>>>> WS DUMP POINTERS >>>>>>>'. 05 FILLER PIC X(16) VALUE 'Z PARA POINTER'. 05 PARA-POINTER PIC X(8) VALUE SPACES. 05 FILLER PIC X(8) VALUE ' Z'. 05 FILLER PIC X(16) VALUE 'Z COMM POINTER'. 05 COMM-POINTER PIC X(8) VALUE SPACES. VALUE '<<<<<<< WS DUMP POINTERS <<<<<<<'. 01 DUMP-DISPLAY. 05 DUMP-STATUS PIC X(3) VALUE SPACES. 05 DUMP-MESSAGE PIC X(61) VALUE 'NO MSG'. 01 FILE-STATUS-CODES. 05 PATMSTR-STATUS PIC X(2). 88 RECORD-FOUND VALUE "00". 88 PATMSTR-NOT-FOUND VALUE "23". 05 OFCODE PIC X(2). 88 CODE-WRITE VALUE SPACES. * COPY TREATMNT. ** DAILY PATIENT/TREATMENTS FILE 01 INPATIENT-TREATMENT-REC. 05 RECORD-TYPE PIC X(01). 88 TRAILER-REC VALUE "T". 05 PATIENT-ID PIC 9(6). 05 TREATMENT-DATE-TIME. 10 TREATMENT-DATE PIC X(08). 10 FILLER PIC X. 10 TREATMENT-TIME PIC X(08). 10 FILLER PIC X(09). 05 BED-IDENTITY PIC 9(4). 05 PRIMARY-DIAGNOSTIC-CODE PIC X(5). 05 MEDICATION-ID PIC X(8). 05 TREATMENT-MODE PIC X(03). 88 ORAL-ADMIN VALUE "0RA". 88 INTRAVENOUS-ADMIN VALUE "INV". 88 INJECTION VALUE "INJ". 88 MRI VALUE "MRI". 88 CAT VALUE "CAT". 88 CHEMO-THERAPY VALUE "CHM". 88 RADIATION-THERAPY VALUE "RAD". 88 SURGERY VALUE "SUR". 88 PHYSIO-THERAPY VALUE "PHY". 88 EQUIPMENT VALUE "EQP". 88 LAB-TESTS VALUE "LAB". 88 VENIPUNCTURE VALUE "VEN". 88 OTHER-TREATMENT VALUE "OTH". 88 VALID-TRTMNT-MODES VALUES ARE "ORA", "INV", "INJ", "MRI", "CAT" "SUR", "PHY", "EQP", "LAB", "VEN" "MRI", "CAT", "CHM", "RAD", "OTH". 05 BILLABLE-TREATMENT-IND PIC X(01). 88 NON-BILLABLE VALUE "N". 88 BILLABLE VALUE "B". 88 VALID-BILLABLE-TYPES VALUES ARE "N", "B". 05 MEDICATION-COST PIC 9(5)V99. 05 ATTENDING-PHYS-ID PIC X(08). 05 PRESCRIBING-PHYS-ID PIC X(08). 05 SUPERVISOR-NURSE-ID PIC X(08). 05 TREATMENT-NURSE-ID PIC X(08). 05 PHARMACY-COST PIC 9(3)V99. 05 ANCILLARY-CHARGE PIC 9(3)V99. 05 LAB-CHARGES OCCURS 12 TIMES. 10 LAB-TEST-ID PIC X(08). 10 TEST-CATEGORY PIC X(04). 88 PULMINARY VALUE "PULM". 88 BLOOD VALUE "BLOD". 88 SPINAL VALUE "SPNL". 88 H1N VALUE "H1N1". 88 GASTRO VALUE "GAST". 88 LUNG VALUE "LUNG". 88 NUCLEAR-MEDICINE VALUE "NUCL". 88 RENAL VALUE "RNAL". 88 MISCELLANEOUS VALUE "MISC". 88 VALID-CATEGORY VALUES ARE "PULM", "BLOD", "NUCL", "GAST", "SPNL", "LUNG", "RNAL", "H1N1", "MISC". ****** FOR PERFORMANCE, MOVE H1N1 TO THE TOP OF THE LIST 10 TEST-SHORT-DESC PIC X(25). 10 TEST-COST PIC 9(5)V99. 10 VENIPUNCTURE-COST PIC 9(3)V99. 10 PRESCRIBING-PHYS PIC X(08). 10 DIAG-CDE PIC X(05). 05 TREATMENT-COMMENTS PIC X(254). 01 WS-TRAILER-REC. 05 FILLER PIC X(1). 05 IN-RECORD-COUNT PIC 9(9). 05 IN-MEDICATION-CHARGES PIC S9(9)V99. 05 IN-PHARMACY-CHARGES PIC S9(7)V99. 05 IN-ANCILLARY-CHARGES PIC S9(5)V99. 01 WS-OUTPUT-REC. 05 PATIENT-NBR-O PIC 9(6). 05 FILLER PIC X(2) VALUE SPACES. 05 PATIENT-NAME-O PIC X(20). 05 PATIENT-PHONE-O PIC X(10). 05 PATIENT-TYPE-O PIC X(2). 05 BED-IDENTITY-O PIC ZZZ9. 05 CURR-DATE-O PIC X(6). 05 PATIENT-AMT-PER-DAY-O PIC $$,$$9.99. 05 INS-COVERAGE-PERC-O PIC 999. 05 INS-TYPE-O PIC X(4). 05 HOSPITAL-STAY-LTH-O PIC 999. 05 FILLER PIC X(7) VALUE SPACES. * COPY PTMSTR. ** VSAM FILE 01 PATIENT-MASTER-REC. 05 PATIENT-ID PIC X(6). 05 PATIENT-TYPE PIC X(1). 88 INPATIENT VALUE "I". 88 OUTPATIENT VALUE "0". 88 VALID-TYPE VALUES ARE "I", "O". 05 PREVIOUS-PATIENT-IND PIC X(01). 88 PREV-PATIENT VALUE "Y". 88 NOT-PREVE-PATIENT VALUE "N". 88 VALID-PREV-IND VALUES ARE "Y", "N". 05 PRIMARY-STAY-WARD-NBR PIC X(4). 88 INTENSIVE-CARE VALUE "0010". 88 OBSTETRICS VALUE "2010". 88 PEDIATRICS VALUE "1010". 88 ONCOLOGY VALUE "0011". 88 CARDIO-THORACIC VALUE "0110". 88 GENERAL VALUE "0000". 88 VALID-WARD VALUES ARE "0010", "2010", "1010", "0011", "0110", "0000". 05 BED-IDENTITY-PRIMARY PIC 9(4). 05 DATE-ADMIT PIC X(10). 05 DATE-DISCHARGE PIC X(10). 05 ATTENDING-PHYSICIAN PIC X(08). 05 DIAGNOSTIC-CODE-PRIMARY PIC X(05). 05 DIAGNOSTIC-CODE-SECONDARY PIC X(05). 05 DIAGNOSTIC-CODE-TERTIARY PIC X(05). 05 INS-TYPE PIC X(3). 88 VALID-INS-TYPE VALUES ARE "HMO", "PPO", "POS" "MAN". 88 Managed-Care value "MAN". 05 HOSPITAL-STAY-LTH PIC 999. 05 PATIENT-TOT-AMT PIC 9(7)V99. 05 PRIMARY-CARE-PHYSICIAN-ID PIC X(8). 05 IN-OUT-NETWORK PIC X(1). 88 IN-NETWORK VALUE "N". 88 OUT-OF-NETWORK VALUE "O". 05 COPAY PIC S9(3). 05 REMAINING-DEDUCTIBLE PIC S9(4). 05 HIPAA-FORM-SIGNED-IND PIC X(01). 88 HIPAA-SIGNED VALUE "Y". 88 HIPAA-UNSIGNED VALUE "N". 05 PATIENT-ADMIT-COMMENTS PIC X(254). 05 DAILY-LAB-CHARGES-SUMMARY OCCURS 20 TIMES. 10 LAB-TEST-S-ID PIC X(08). 10 LAB-TEST-DATE PIC X(08). 10 TEST-SHORT-S-DESC PIC X(25). 10 TEST-DIAG-CODE PIC X(5). 10 TEST-CHARGES PIC 9(7)V99. 10 PRESCRIBING-S-PHYS-ID PIC X(08). 05 EQUIPMENT-CHARGES-SUMMARY OCCURS 20 TIMES. 10 EQUIPMENT-S-ID PIC X(08). 10 EQUIPMENT-CHARGE-DATE PIC X(08). 10 EQUIP-DIAG-CODE PIC X(5). 10 EQUIPMENT-S-SHORT-DESC PIC X(30). 10 EQUIPMENT-CHARGES PIC 9(7)V99. 10 EQUIPMENT-PRES-PHYS-ID PIC X(08). 01 WS-SYSOUT-REC. 05 MSG PIC X(80). 77 WS-DATE PIC 9(6). 01 COUNTERS-AND-ACCUMULATORS. 05 RECORDS-WRITTEN PIC 9(7) COMP. 05 RECORDS-IN-ERROR PIC 9(7) COMP. 05 RECORDS-READ PIC 9(7) COMP. 05 WS-MEDICATION-CHARGES PIC S9(9)V99 COMP-3. 05 WS-PHARMACY-CHARGES PIC S9(7)V99 COMP-3. 05 WS-ANCILLARY-CHARGES PIC S9(5)V99 COMP-3. 01 MISC-WS-FLDS. 05 STR-LTH PIC 9(04) VALUE 0. 05 RETURN-CD PIC S9(04) VALUE 0. 05 ROW-SUB PIC 9(02). 05 ERROR-MSG-WS. 10 ERROR-MSG-FIRST PIC X(20). 10 ERROR-MSG-REST PIC X(60). 01 FLAGS-AND-SWITCHES. 05 MORE-DATA-SW PIC X(01) VALUE "Y". 88 NO-MORE-DATA VALUE "N". 05 ERROR-FOUND-SW PIC X(01) VALUE "N". 88 RECORD-ERROR-FOUND VALUE "Y". 88 VALID-RECORD VALUE "N". 05 MORE-TABLE-ROWS PIC X(01) VALUE "Y". 88 NO-MORE-TABLE-ROWS VALUE "N". * COPY ABENDREC. 01 ABEND-REC. 05 FILLER PIC X(3) VALUE "**". 05 FILLER PIC X(17) VALUE "ABEND PARAGRAPH: ". 05 PARA-NAME PIC X(40). 05 ABEND-REASON PIC X(40). 05 EXPECTED-VAL PIC 9(9). 05 ACTUAL-VAL PIC 9(9). 05 ONE-VAL PIC 9 VALUE 1. 05 ZERO-VAL PIC 9 VALUE 0. * COPY DIAGCODE. ***** DB2 TABLE DCLGENS 01 DCLDIAG-CODES. 10 DIAG-CODE PIC X(05). 10 INS-TYPE PIC X(03). 10 COPAY PIC S9(4) COMP. 10 DEDUCTIBLE PIC S9(4) COMP. 01 DCLWARD-CODES. 10 WARD-ID PIC X(04). 10 PRIMARY-PHYSICIAN-ID PIC X(08). 10 SUPERVISE-NURSE-ID PIC X(08). 10 LOCATION PIC X(08). 10 NUMBER-OF-BEDS PIC S9(4) COMP. 10 BASE-ROOM-CHARGE PIC S9(5)V99 COMP-3. 01 DCLHOSP-BED. 10 BED-ID PIC X(04). 10 ROOM-ID PIC X(08). 10 WARD-ID PIC X(08). 10 SPECIAL-CHARGES PIC S9(5)V99 COMP-3. 01 DCLMEDICATION. 10 MEDICATION-ID PIC X(08). 10 MED-NAME PIC X(08). 10 SHORT-DESCRIPTION PIC X(08). 10 COST PIC S9(5)V99 COMP-3. 10 PHARMACY-COST PIC S9(3)V99 COMP-3. * COPY SQLCA. 01 SQLCA. 03 SQLCAID PIC X(8). 03 SQLCABC PIC S9(9) COMP. 03 SQLCODE PIC S9(9) COMP. 03 SQLERRM. 49 SQLERRML PIC S9(4) COMP. 49 SQLERRMC PIC X(70). 03 SQLERRP PIC X(8). 03 SQLERRD OCCURS 6 PIC S9(9) COMP. 03 SQLWARN. 05 SQLWARN PIC X. 05 SQLWARN PIC X. 05 SQLWARN PIC X. 05 SQLWARN PIC X. 05 SQLWARN PIC X. 05 SQLWARN PIC X. 05 SQLWARN PIC X. 05 SQLWARN PIC X. 03 SQLEXT PIC X(8). PROCEDURE DIVISION. PERFORM 000-HOUSEKEEPING THRU 000-EXIT. PERFORM 100-MAINLINE THRU 100-EXIT UNTIL NO-MORE-DATA OR ******* Balancing logic put in by TGD 02/12/92 TRAILER-REC. PERFORM 999-CLEANUP THRU 999-EXIT. MOVE +0 TO RETURN-CODE. GOBACK. 000-HOUSEKEEPING. MOVE "000-HOUSEKEEPING" TO PARA-NAME. DISPLAY "HOUSEKEEPING". * Code your statement here to OPEN files ACCEPT WS-DATE FROM DATE. INITIALIZE COUNTERS-AND-ACCUMULATORS. PERFORM 800-OPEN-FILES THRU 800-EXIT. PERFORM 900-READ-TRMTDATA THRU 900-EXIT. IF NO-MORE-DATA MOVE "EMPTY INPUT FILE" TO ABEND-REASON GO TO 1000-ABEND-RTN. 000-EXIT. EXIT. 100-MAINLINE. MOVE "100-MAINLINE" TO PARA-NAME. * DISPLAY "100-MAINLINE". * Validate patient type and insurance coverage PERFORM 300-FIELD-EDITS THRU 300-EXIT. IF RECORD-ERROR-FOUND ADD +1 TO RECORDS-IN-ERROR PERFORM 710-WRITE-TRMTERR THRU 710-EXIT ELSE PERFORM 700-WRITE-TRMTEDIT THRU 700-EXIT. 100-EXIT. 300-FIELD-EDITS. MOVE "N" TO ERROR-FOUND-SW IN FLAGS-AND-SWITCHES. MOVE "300-FIELD-EDITS" TO PARA-NAME. ******** non-numeric fields IF NOT VALID-BILLABLE-TYPES IN BILLABLE-TREATMENT-IND MOVE "*** INVALID BILLABLE TYPE" TO ERR-MSG IN INPATIENT-TREATMENT-REC-ERR MOVE "Y" TO ERROR-FOUND-SW GO TO 300-EXIT. IF PRESCRIBING-PHYS-ID = SPACES MOVE "*** BLANK PRESCRIBING PHYSICIAN-ID" TO CALL 'DTEVAL' USING TREATMENT-DATE, RETURN-CD. IF RETURN-CD < 0 MOVE "*** BAD DATE PORTION OF DATE-TIME" TO MOVE "Y" TO MORE-TABLE-ROWS. PERFORM 350-CHECK-LAB-TABLE THRU 350-EXIT VARYING ROW-SUB FROM 1 BY 1 UNTIL NO-MORE-TABLE-ROWS OR ROW-SUB = 12. IF VALID-RECORD PERFORM 400-NUMERIC-RANGE-EDITS THRU 400-EXIT. ****** VERIFY TABLE (JUST TYPES AND LAB-TEST-ID) 300-EXIT. 350-CHECK-LAB-TABLE. IF LAB-TEST-ID(ROW-SUB) = SPACES MOVE "N" TO MORE-TABLE-ROWS GO TO 350-EXIT. IF NOT VALID-CATEGORY(ROW-SUB) MOVE "*** INVALID LAB-TEST CATEGORY" TO 350-EXIT. 400-NUMERIC-RANGE-EDITS. MOVE "400-NUMERIC-RANGE-EDITS" TO PARA-NAME. ******** Call to VSAM file to read record IF (MEDICATION-COST > 99000 OR MEDICATION-COST < 1.01) MOVE "*** INVALID MEDICATION COST" TO GO TO 400-EXIT. PERFORM 450-CROSS-FIELD-EDITS THRU 450-EXIT. 400-EXIT. 450-CROSS-FIELD-EDITS. MOVE "450-CROSS-FIELD-EDITS" TO PARA-NAME. ******** Specific requirements for certain procedures IF MRI OR CAT OR CHEMO-THERAPY OR RADIATION-THERAPY OR SURGERY OR LAB-TESTS IF MEDICATION-COST = ZERO OR ANCILLARY-CHARGE = ZERO MOVE "*** INVALID $$ AMOUNTS FOR PROCEDURES" TO GO TO 450-EXIT. IF CHEMO-THERAPY OR RADIATION-THERAPY OR SURGERY MOVE +0 TO STR-LTH CALL 'STRLTH' USING TREATMENT-COMMENTS, STR-LTH IF STR-LTH < 25 MOVE "*** INVALID TREATMENT COMMENT LENGTH" TO PERFORM 500-CROSS-FILE-EDITS THRU 500-EXIT. 450-EXIT. 500-CROSS-FILE-EDITS. MOVE "500-CROSS-FILE-EDITS" TO PARA-NAME. MOVE PATIENT-ID IN INPATIENT-TREATMENT-REC TO PATIENT-KEY. READ PATMSTR INTO PATIENT-MASTER-REC. IF NOT RECORD-FOUND MOVE "*** PATIENT NOT-FOUND ON MASTER FILE" TO GO TO 500-EXIT. PERFORM 600-DB2-TABLE-EDITS THRU 600-EXIT. 500-EXIT. 600-DB2-TABLE-EDITS. MOVE "600-DB2-TABLE-EDITS" TO PARA-NAME. ******** EXEC SQL to get info from DB2 MOVE DIAGNOSTIC-CODE-PRIMARY IN PATIENT-MASTER-REC TO DIAG-CODE IN DCLDIAG-CODES. ****** CHECK FOR VALID DIAGNOSTIC CODE EXEC SQL SELECT DIAG_CODE INTO :DIAG-CODE FROM DDS0001.DIAG_CODES WHERE DIAG_CODE = :DIAG-CODE END-EXEC. IF SQLCODE = -811 OR 0 NEXT SENTENCE IF SQLCODE = +100 MOVE "*** DIAGNOSTIC CODE NOT-FOUND IN DIAG_CODES" TO move sqlcode to PATIENT-ID IN INPATIENT-TREATMENT-REC MOVE DIAG-CODE IN DCLDIAG-CODES TO PRIMARY-DIAGNOSTIC-CODE move sqlcode to EXPECTED-VAL move PATIENT-ID IN INPATIENT-TREATMENT-REC to ACTUAL-VAL WRITE SYSOUT-REC FROM ABEND-REC GO TO 600-EXIT IF SQLCODE < 0 MOVE "*** FATAL DB2 ERROR" TO GO TO 1000-DB2-ERROR-RTN. ****** CHECK FOR VALID BED IDENTITY MOVE BED-IDENTITY TO BED-ID. SELECT BED_ID INTO :BED-ID FROM DDS0001.HOSP_BED WHERE BED_ID = :BED-ID MOVE "*** BED IDENT NOT-FOUND IN HOSP_BED" TO ****** CHECK FOR VALID PHYSICIAN-ID MOVE ATTENDING-PHYS-ID TO PRIMARY-PHYSICIAN-ID. SELECT PRIMARY_PHYSICIAN_ID INTO :PRIMARY-PHYSICIAN-ID FROM DDS0001.WARD_DATA WHERE PRIMARY_PHYSICIAN_ID = :PRIMARY-PHYSICIAN-ID MOVE "*** ATTENDING PHYSICIAN NOT FOUND IN TABLE" TO ****** CHECK FOR VALID MEDICATION-ID MOVE MEDICATION-ID IN INPATIENT-TREATMENT-REC TO MEDICATION-ID IN DCLMEDICATION. SELECT MEDICATION_ID INTO :DCLMEDICATION.MEDICATION-ID FROM DDS0001.MEDICATION WHERE MEDICATION_ID = :DCLMEDICATION.MEDICATION-ID MOVE "*** MEDICATION-ID NOT FOUND IN TABLE" TO ****** CHECK FOR VALID SUPERVISOR NURSE-ID MOVE SUPERVISOR-NURSE-ID TO SUPERVISE-NURSE-ID. SELECT SUPERVISE_NURSE_ID INTO :SUPERVISE-NURSE-ID WHERE SUPERVISE_NURSE_ID = :SUPERVISE-NURSE-ID MOVE "*** SUPERVISOR NURSE NOT FOUND" TO MOVE "*** FATAL DB2 ERROR" TO 600-EXIT. 700-WRITE-TRMTEDIT. MOVE "700-WRITE-TRMTEDIT" TO PARA-NAME. WRITE INPATIENT-TREATMENT-REC-EDIT FROM INPATIENT-TREATMENT-REC. ADD MEDICATION-COST TO WS-MEDICATION-CHARGES. ADD ANCILLARY-CHARGE TO WS-ANCILLARY-CHARGES. ADD PHARMACY-COST IN INPATIENT-TREATMENT-REC TO WS-PHARMACY-CHARGES. ADD +1 TO RECORDS-WRITTEN. 700-EXIT. 710-WRITE-TRMTERR. MOVE INPATIENT-TREATMENT-REC TO REST-OF-REC. WRITE INPATIENT-TREATMENT-REC-ERR. ADD +1 TO RECORDS-IN-ERROR. 710-EXIT. 800-OPEN-FILES. MOVE "800-OPEN-FILES" TO PARA-NAME. OPEN INPUT TRMTDATA. OPEN OUTPUT TRMTEDIT, SYSOUT, TRMTERR. OPEN I-O PATMSTR. 800-EXIT. 850-CLOSE-FILES. MOVE "850-CLOSE-FILES" TO PARA-NAME. CLOSE TRMTDATA, TRMTEDIT, SYSOUT, TRMTERR, PATMSTR. 850-EXIT. 900-READ-TRMTDATA. * Code your statements here to read the input file * Remember to move "NO" to IFCODE if the input file is AT END READ TRMTDATA INTO INPATIENT-TREATMENT-REC AT END MOVE "N" TO MORE-DATA-SW GO TO 900-EXIT END-READ MOVE "N" TO ERROR-FOUND-SW. ADD +1 TO RECORDS-READ. 900-EXIT. 999-CLEANUP. MOVE "999-CLEANUP" TO PARA-NAME. * Final file-handling edits and trailer record handling IF NOT TRAILER-REC MOVE "** INVALID FILE - NO TRAILER REC" TO ABEND-REASON MOVE INPATIENT-TREATMENT-REC-DATA TO WS-TRAILER-REC. IF RECORDS-READ NOT EQUAL TO IN-RECORD-COUNT MOVE "** INVALID FILE - # RECORDS OUT OF BALANCE" TO ABEND-REASON IF WS-ANCILLARY-CHARGES NOT EQUAL TO IN-ANCILLARY-CHARGES MOVE "** ANCILLARY CHARGES OUT OF BALANCE" MOVE WS-ANCILLARY-CHARGES TO EXPECTED-VAL MOVE IN-ANCILLARY-CHARGES TO ACTUAL-VAL DISPLAY "** ANCILLARY CHARGES IN **" DISPLAY WS-ANCILLARY-CHARGES DISPLAY "** ANCILLARY CHARGES EXPECTED **" DISPLAY IN-ANCILLARY-CHARGES. IF WS-MEDICATION-CHARGES NOT EQUAL TO IN-MEDICATION-CHARGES MOVE "** MEDICATION CHARGES OUT OF BALANCE" DISPLAY "** MEDICATION CHARGES IN **" DISPLAY WS-MEDICATION-CHARGES DISPLAY "** MEDICATION CHARGES EXPECTED **" DISPLAY IN-MEDICATION-CHARGES. IF WS-PHARMACY-CHARGES NOT EQUAL TO IN-PHARMACY-CHARGES MOVE "** PHARMACY CHARGES OUT OF BALANCE" DISPLAY "** PHARMACY CHARGES IN **" DISPLAY WS-PHARMACY-CHARGES DISPLAY "** PHARMACY CHARGES EXPECTED **" DISPLAY IN-PHARMACY-CHARGES. MOVE "T" TO RECORD-TYPE. MOVE RECORDS-WRITTEN TO IN-RECORD-COUNT. MOVE WS-ANCILLARY-CHARGES TO IN-ANCILLARY-CHARGES. MOVE WS-MEDICATION-CHARGES TO IN-MEDICATION-CHARGES. MOVE WS-PHARMACY-CHARGES TO IN-PHARMACY-CHARGES. WRITE INPATIENT-TREATMENT-REC-EDIT FROM WS-TRAILER-REC. * Code the statement to close all files PERFORM 850-CLOSE-FILES THRU 850-EXIT. DISPLAY "** RECORDS READ **". DISPLAY RECORDS-READ. DISPLAY "** RECORD-IN EXPECTED **". DISPLAY IN-RECORD-COUNT. DISPLAY "** RECORDS WRITTEN **". DISPLAY RECORDS-WRITTEN. DISPLAY "** ERROR RECORDS FOUND **". DISPLAY RECORDS-IN-ERROR. * Code the statement to Display a successful end-of-job msg DISPLAY "******** NORMAL END OF JOB TRTMNT ********". 999-EXIT. 1000-ABEND-RTN. WRITE SYSOUT-REC FROM ABEND-REC. DISPLAY "*** ABNORMAL END OF JOB - TRTMNT ***" UPON CONSOLE. DIVIDE ZERO-VAL INTO ONE-VAL. 1000-DB2-ERROR-RTN. ************************************************************ * ERROR TRAPPING ROUTINE FOR INVALID SQLCODES * DISPLAY '**** DB2 ACCESS PROBLEM *****'. DISPLAY '999-ERROR-TRAP-RTN '. MOVE "*** DB2 PROBLEM ***" TO ERROR-MSG-FIRST. MOVE SQLCA TO ERROR-MSG-REST. MULTIPLY SQLCODE BY -1 GIVING SQLCODE. DISPLAY 'SQLCODE ==> ' SQLCODE. DISPLAY SQLCA. DISPLAY SQLERRM. EXEC SQL WHENEVER SQLERROR CONTINUE END-EXEC. EXEC SQL ROLLBACK WORK END-EXEC.

54  GUI-Editing Workshop – 2 of 2
 Steps: Use the scroll bars to slide up and down, right and left Maximize the view of TRMTRDZ Press Ctrl+2 – to open a split-screen view the program Scroll up and down in either side of the split-screen view Close the split-screen view Double-click to Restore the normal RDz views  Hey… Let's try a few new things! Anywhere in the Procedure Division hover your mouse-pointer over a variable Find the Outline View, and using it to navigate, click: PROCEDURE DIVISION DATA DIVISION Expand the DATA DIVISION and click WORKING STORAGE Expand the PROCEDURE DIVISION and click several paragraphs From within WORKING STORAGE, expand and click a few variables Using the Outline view, find the following FILE CONTROL 1000 ABEND ROUTINE FD TRMTERR In the COBOL editor, scroll to the bottom of the file and click: 1000-DB2-ERROR-RTN What happened in the Outline view?

55 What have you done so far?
Section Review What have you done so far? Learned a few of RDz's Workbench terms and concepts – and how they contrast and compare with ISPF: Workspace Perspective View Menu Editor Understood the central role of your mouse (both left or "selection" button, and the right or "context-menu" button in doing RDz development Launched RDz and closed the Welcome tabs to access the z/OS Projects perspective Created a new project – populated with example COBOL programs Opened a program into the "COBOL editor" Navigated up & down, right & left using Scroll bars Resized your editor window Maximized views and Restored them back to normal size Reset your z/OS Projects perspective to the RDz default Opened views that might have been closed accidentally Worked in Split-screen mode

56 Part II – Editing Your Program Source
Author Notes: This is the standard session track template for IBM Rational Software Conference 2009 Additional IBM presentation resource links available on W3: Rational Core Messaging Slides Rational Image Library PowerPoint Best Practices Presentation © 2009 IBM Corporation

57 Editing – Agenda Selecting an Edit Profile Program source Navigation
Editing programs ala' ISPF PF Keys ISPF Line Commands ISPF Prefix Commands Common program editing techniques Data Flow analysis Procedural logic (Paragraph Flow) analysis Other common ISPF techniques Find (exclude/not exclude) Creating new programs scratch Working with programs that contain EBCDIC (binary) data embedded in the source file Working with RDz Property Files

58 Selecting an Edit Profile
The RDz workbench tools provide a number of different edit profiles you can use for development An editor profile is basically an emulation of an editor you use or may have used with different software packages. Examples: ispf, xedit, vi, etc. For the purposes of this course consider that you will learn: lpex The installation default editor profile A powerful PC-style editor Language-sensitive tools and features Extensible ispf An emulation of the z/OS TSO/ISPF editor Close to 85-90% (depending on your shop's ISPF customization) of the same features But in a GUI editing workbench – so initially, things will seem quite from the mainframe

59  Changing You Editor Profile
From Window Preferences Click: LPEX Editor And in the Editor profile list Select: ispf Click: OK  Set ispf as your editor profile

60  Other Preferences to Customize
1. Set tab stops: From Window, Preferences LPEX Editor Tabs  Press OK 2. Enable vertical lines in the editor: System z LPEX Editor COBOL Parser  Check all three options  Set the above two preferences, then: Open TRMTRDZ.cbl in the editor Note the new (cool) vertical lines. Try out the tab stops

61 (Optional Customized Preferences) Changing Colors to Green Screen
You might also wish to customize your editor view colors – to closely match those you use on ISPF. This is easy to do, and the steps are shown on the next slide. Note that the screen captures throughout the rest of this course are RDz default, not customized

62  (Optional Workshop) Changing Editor Colors
First – open any file in the editor (StartApp.cbl will do) Next, from: Window > Preferences LPEX Editor Appearance Set customized attributes. After each operation, click: Apply and look at your editor view Palette: Black Current Line – click: Foreground, and from the Color Palette, select aqua (or green), then click: OK on the Color Palette prefixArea – click: Foreground, and from the Color Palette, select aqua (or green), selection – click: Foreground, and from the Color Palette, select Black. Click Background and from the Color Palette select: Gray then click OK on the Color Palette

63  (Optional Workshop) Changing Editor Colors
Next, from: LPEX Editor Parsers Parser Style Set some more customized attributes. After each operation, click: Apply and look at your editor view Ensure that Document parser is set to: cobolZosSqlCics Set the following Style attributes (Foreground) to aqua (or green) User defined word Reserved word Function Picture string Non-numeric literal Comment Numeric literal Sequence number Click OK  If you don't like your changes, there's a "Restore Defaults" button you can click that returns the editor to the install colors Under: Preferences, LPEX Editor, Parsers, Parser Style and LPEX Editor, Appearance Note also that, if you would like to customize the above COBOL program elements to different colors (instead of all aqua or green) feel free to return to the Parser Style attributes, and experiment with different Foreground colors for User defined word (variables and paragraph names), etc.

64 The RDz Editor – Using the ISPF Profile
The RDz editor view changes, when you use the ISPF profile: New function keys are enabled, the "prefix area" appears, etc. Note – same: Scrollbars Status line – showing: Current line Columns Command line Colorized source New: Prefix area - for ISPF prefix commands PF-key assignment The command line now works with some ISPF commands  Note: ISPF command line commands are NOT case sensitive Status line Vertical Scroll Bar Prefix Area Command line

65  ISPF PF-Keys and Navigation Options Top, Bottom ISPF commands
F1 – Help F5 – Repeat Find F6 – Repeat Change F7 – Page Up F8 – Page Down  With TRMTRDz.cbl loaded into the editor, do the following: Press F1 – Note that this opens RDz Help in a separate view, and the first time you do this it will take a few seconds Press F8 – several times to page down in the source file Press F7 – several times to page back up in the file Double-click on the Editor tab – to maximize the size of the Editor window Press F8 and F7 again Note that the # of lines scrolled has changed, according to your window size Press and hold the F8 key down – to zoom downwards in the source file On the command line, type the ISPF command shown. Press <Enter> after each command: Top Bottom  Note: There is no Max/PF8 or Max/PF7 option. Instead, use: Top, Bottom – or as you learned in the previous section: PgUp, PgDn and the Scrollbars

66  "No L" Locate – More Navigation Options
Using ISPF you locate a given line by typing Locate, Loc or: L <Line#> Using RDz (from the command line): Type (only) the line number Press <Enter>  Locate the following lines in TRMTRDZ.cbl 22 333 444 999 – Note that the program is only 949 lines long 143 1

67 Summary – Options for Navigating Through Your Program Source
Top of file: Top Bottom of file: Bottom Page down: F8 Page up: F7 Page down: PgDn key Page up: PgUp key Click inside the scrolling area – on either side of the scroll bar to Page up or Page down Locate any line of source by typing the Line# in the command area Scroll up/down right/left using the: Scroll bars Line-at-a-time up/down – click the arrow Your mouse scroll-wheel  Fast and convenient for positioning/centering code on-screen

68  Open-ended Review and Workshop – Navigation Options
Progress your RDz navigation skills by trying out the various scrolling and navigation techniques – and make up your own workshop.  Maximize the editor view of TRMTRDZ.cbl and practice the following: Commands: Top Bottom <Line#> Hint – Set your mouse cursor focus in the Command line and press the up arrow key on your keypad to "retrieve" the previous line command This is exactly like PF12 or the ISPF Retrieve command Practice the ISPF and RDz paging and scrolling techniques: F8 / F7 PgDn key / PgUp key Click inside the Scroll bar on either side of the indicator Practice centering paragraphs, long statements, records Drag Scroll bars up and down (left-mouse button) One line at-a-time up/down scrolling: Click the up/down arrows Click (set focus) inside your source file and use your mouse's scroll-wheel  One line up Dragging  scroll bar

69  More ISPF Commands – Find/Repeat Find
You can do the essential ISPF find commands and its variations Let's try out a few familiar commands and options:  With TRMTRDz.cbl loaded into the editor, do the following: - On the command line, type an ISPF command Press <Enter> after each command: top F WS-T Press F5 several times Bottom F WS-T first F WS-T last Top F WS-T 12 20 F WS-T first 12 20 F WS-T first F WS-T last F WS-T Prev Top ; F WS-T all x all ; f ws-t all RES To reset your source view Hint: Don't forget that – with mouse focus in the Command line, you can press the Up arrow key to retrieve the previous command Note – Because ISPF command-line commands are not case sensitive both of these examples work Note – You can "stack' ISPF line commands by separating with a semi-colon. But – you also need to type a space (a blank) between the operands and the semi-colon.

70  More ISPF Commands – Change and Repeat Change
You can do the essential ISPF change commands and its variations  With TRMTRDz.cbl loaded into the editor, do the following: - On the command line, type an ISPF command Press <Enter> after each command: top C row-sub row-idx undo C row-sub row-idx all undo 12 C all row-sub row-idx C row-sub row-idx first C row-sub row-idx last top ; c row-sub row-idx 12 40 Press F5 then Press F6 Continue pressing F5 and F6 for "discretionary find/change" bottom Try a few more Find / Change command combinations: F "Y" all F '"Y"' all Press F5 F '01' all 8 12 X all; f '01' all RES X all; f '01' all 8 12 X all ; f row-sub all c * row-idx Press F6 a few times Bounds 20 40 Then try a few Find/Change commands again Take another 5-10 minutes and use F with the following Find operands: char, suffix, prefix, word, char, RFIND F sql prefix F

71 ISPF Commands continued – COBOL Source Numbering
RDz's statement numbering is slightly different than ISPF The default source mode is without COBOL numbers You can display your code with the following options: Num on – like ISPF – turns the Prefix area into 6 digit sequential line numbers, incremented by 100 Num cobol – turns columns into COBOL line numbers Num off – returns the Prefix area to line numbers incremented by 1 Unnum – turns off the line numbers in columns 73-80  Note that for both Num off and Unnum you must be in Num On mode (like ISPF) Cols COBOL Line Numbers

72  Workshop – ISPF Commands – COBOL Source Numbering
Let's work with the COBOL number commands a little – do the following – and note the effect of the source numbering commands: Load StartApp.cbl into the editor Type this series of commands on the command line (press <Enter> after each command): num on num off num cobol unnum Close StartApp.cbl – and do NOT save your changes Again Load StartApp.cbl into the editor – and type this series of commands on the command line (press <Enter> after each command): Num on Num off Close StartApp.cbl – and SAVE your changes Again Load StartApp.cbl into the editor – and note: The COBOL sequence numbers were saved The initial message displayed reveals this

73 Preference to Save Sequence Numbers
Note that, if you have enabled sequence numbers, then any COBOL numbering will be saved from session to session in your source file. Enabling sequence numbers is done from: Window Preferences LPEX Editor System z LPEX Editor Sequence Numbers 

74 RDz for ISPF Developers
UNIT RDz for ISPF Developers Topics: The RDz Workbench – Terms and Concepts Editing COBOL Programs ISPF Prefix Area Commands Editing With Keystroke Shortcuts Find and Replace Dialog Creating New Programs From Scratch Miscellaneous Features – Hex edit, Content Assist Paragraph (control flow) and Data Flow Analysis Working with Copybooks and Property Files Appendix – ISPF / LPEX Editor Comparison

75 ISPF Prefix Commands Most of the ISPF prefix area edit commands are supported with same functionality For a complete list of supported prefix commands: Place your cursor in the prefix area Press F1 ISPF Prefix area commands

76  Prefix Area Commands Workshop – New Program File
Steps: From this PowerPoint's Slide Notes: Select all (Ctrl+A) then Copy (Ctrl+C) all of the statements in the program If you don't remember how to access Slide Notes return to slide#5 in this PowerPoint From z/OS Projects Right-click over the cobol folder and select: New > File Name the file: SANDBOX.cbl Click your mouse-pointer into the new file in the top-left hand corner (column 1, row 1) and press Ctrl+V to paste the program statements you copied in step 1 Save the file (Ctrl+S) IDENTIFICATION DIVISION. PROGRAM-ID. SANDBOX. AUTHOR. IBM. INSTALLATION. COBOL DEV Center. DATE-WRITTEN. 01/23/88. DATE-COMPILED. 01/23/88. SECURITY. NON-CONFIDENTIAL. ****************************************************************** *REMARKS. * * THE PROGRAM'S PROCEDURE INCLUDES * A DAILY CONTROL BREAK REPORT AND FILE UPDATES * FOR THE AVAILABLE HOSPITAL BEDS/ROOMS/WARDS * IT BASES IT'S PROCESSING ON THE DAILY PATIENT FILE * WHICH IS SORTED ON WARD/ROOM/BED - FOR CORRECT * CONTROL-BREAK REPORTING INPUT FILE DDS0001.PATSRCH VSAM MASTER FILES - DDS0001.PATMASTR & DDS0001.PATPERSN INPUT ERROR FILE DDS0001.PATERR OUTPUT FILE PRODUCED - DDS001.WARDPRT DUMP FILE SYSOUT ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. IBM-390. OBJECT-COMPUTER. IBM-390. SPECIAL-NAMES. C01 IS NEXT-PAGE. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT SYSOUT ASSIGN TO UT-S-SYSOUT ORGANIZATION IS SEQUENTIAL. SELECT TRMTDATA ASSIGN TO UT-S-TRMTDATA ACCESS MODE IS SEQUENTIAL FILE STATUS IS OFCODE. SELECT PATSRCH ASSIGN TO UT-S-PATSRCH SELECT WARDFILE ASSIGN TO UT-S-WARDRPT SELECT PATERR ASSIGN TO UT-S-PATERR SELECT TRMTERR ASSIGN TO UT-S-TRMTERR SELECT PATMSTR ASSIGN to PATMSTR ORGANIZATION is INDEXED ACCESS MODE is RANDOM RECORD KEY is PATMSTR-KEY FILE STATUS is PATMSTR-STATUS. SELECT PATPERSN ASSIGN to PATPERSN RECORD KEY is PATPERSN-KEY FILE STATUS is PATPERSN-STATUS. DATA DIVISION. FILE SECTION. FD SYSOUT RECORDING MODE IS F LABEL RECORDS ARE STANDARD RECORD CONTAINS 130 CHARACTERS BLOCK CONTAINS 0 RECORDS DATA RECORD IS SYSOUT-Rec. 01 SYSOUT-REC PIC X(130). FD TRMTERR RECORD CONTAINS 1141 CHARACTERS DATA RECORD IS INPATIENT-TREATMENT-REC-ERR. 01 INPATIENT-TREATMENT-REC-ERR. 05 ERR-MSG PIC X(40). 05 REST-OF-REC PIC X(1101). ****** THIS FILE IS PASSED IN FROM THE DATA COLLECTIONS SYSTEM ****** IT CONSISTS OF ALL PATIENT TREATMENTS ENTERED ****** THERE ARE TWO RECORD FORMATS - DETAIL AND TRAILER RECS ****** OUT OF BALANCE CONDITIONS SHOULD CAUSE THE JOB TO ABEND FD TRMTDATA RECORD CONTAINS 1101 CHARACTERS DATA RECORD IS INPATIENT-TREATMENT-REC-DATA. 01 INPATIENT-TREATMENT-REC-DATA PIC X(1101). FD WARDFILE RECORD CONTAINS 132 CHARACTERS 01 RPT-REC PIC X(132). ****** IT CONSISTS OF ALL PATIENT RECORDS ENTERED FD PATSRCH RECORD CONTAINS 993 CHARACTERS DATA RECORD IS INPATIENT-DAILY-REC-SRCH. 01 INPATIENT-DAILY-REC-SRCH PIC X(993). FD PATERR RECORD CONTAINS 1133 CHARACTERS DATA RECORD IS INPATIENT-DAILY-REC-ERR. 01 INPATIENT-DAILY-REC-ERR. 05 ERR-MSG PIC X(40). 05 REST-OF-PAT-REC PIC X(993). FD PATMSTR RECORD CONTAINS 2964 CHARACTERS DATA RECORD IS PATMSTR-REC. 01 PATMSTR-REC. 05 PATMSTR-KEY PIC X(06). 05 FILLER PIC X(2958). FD PATPERSN RECORD CONTAINS 800 CHARACTERS DATA RECORD IS PATPERSN-REC. 01 PATPERSN-REC. 05 PATPERSN-KEY PIC X(06). 05 FILLER PIC X(794). WORKING-STORAGE SECTION. 01 FILE-STATUS-CODES. 05 PATMSTR-STATUS PIC X(2). 88 PATMSTR-FOUND VALUE "00". 05 PATPERSN-STATUS PIC X(2). 88 PATPERSN-FOUND VALUE "00". 05 OFCODE PIC X(2). 88 CODE-WRITE VALUE SPACES. 05 MORE-DATA-SW PIC X(1) VALUE SPACE. 05 WS-INFILE-RECORD-READ-CTR PIC 9(7) COMP VALUE 0. 01 FLAGS-AND-SWITCHES. 05 MORE-DATA-SWITCH PIC X(01) VALUE "Y". 88 NO-MORE-DATA VALUE "N". 05 ERR-FOUND-SWITCH PIC X(01) VALUE "N". 05 ERROR-FOUND-SW PIC X(01) VALUE "N". 88 RECORD-ERROR-FOUND VALUE "Y". 88 VALID-RECORD VALUE "N". 05 MORE-TABLE-ROWS PIC X(01) VALUE "Y". 88 NO-MORE-TABLE-ROWS VALUE "N". ** DAILY PATIENT/TREATMENTS FILE 01 INPATIENT-TREATMENT-REC. 05 RECORD-TYPE PIC X(01). 88 TRAILER-REC VALUE "T". 05 PATIENT-ID PIC 9(6). 05 TREATMENT-DATE-TIME. 10 TREATMENT-DATE PIC X(08). 10 FILLER PIC X. 10 TREATMENT-TIME PIC X(08). 10 FILLER PIC X(09). 05 BED-IDENTITY PIC 9(4). 05 PRIMARY-DIAGNOSTIC-CODE PIC X(5). 05 MEDICATION-ID PIC X(8). 05 TREATMENT-MODE PIC X(03). 88 ORAL-ADMIN VALUE "0RA". 88 INTRAVENOUS-ADMIN VALUE "INV". 88 INJECTION VALUE "INJ". 88 MRI VALUE "MRI". 88 CAT VALUE "CAT". 88 CHEMO-THERAPY VALUE "CHM". 88 RADIATION-THERAPY VALUE "RAD". 88 SURGERY VALUE "SUR". 88 PHYSIO-THERAPY VALUE "PHY". 88 EQUIPMENT VALUE "EQP". 88 LAB-TESTS VALUE "LAB". 88 VENIPUNCTURE VALUE "VEN". 88 OTHER-TREATMENT VALUE "OTH". 88 VALID-TRTMNT-MODES VALUES ARE "ORA", "INV", "INJ", "MRI", "CAT" "SUR", "PHY", "EQP", "LAB", "VEN" "MRI", "CAT", "CHM", "RAD", "OTH". 05 BILLABLE-TREATMENT-IND PIC X(01). 88 NON-BILLABLE VALUE "N". 88 BILLABLE VALUE "B". 88 VALID-BILLABLE-TYPES VALUES ARE "N", "B". 05 MEDICATION-COST PIC 9(5)V99. 05 ATTENDING-PHYS-ID PIC X(08). 05 PRESCRIBING-PHYS-ID PIC X(08). 05 SUPERVISOR-NURSE-ID PIC X(08). 05 TREATMENT-NURSE-ID PIC X(08). 05 PHARMACY-COST PIC 9(3)V99. 05 ANCILLARY-CHARGE PIC 9(3)V99. 05 LAB-CHARGES OCCURS 12 TIMES. 10 LAB-TEST-ID PIC X(08). 10 TEST-CATEGORY PIC X(04). 88 PULMINARY VALUE "PULM". 88 BLOOD VALUE "BLOD". 88 SPINAL VALUE "SPNL". 88 H1N VALUE "H1N1". 88 GASTRO VALUE "GAST". 88 LUNG VALUE "LUNG". 88 NUCLEAR-MEDICINE VALUE "NUCL". 88 RENAL VALUE "RNAL". 88 MISCELLANEOUS VALUE "MISC". 88 VALID-CATEGORY VALUES ARE "PULM", "BLOD", "NUCL", "GAST", "SPNL", "LUNG", "RNAL", "H1N1", "MISC". ****** FOR PERFORMANCE, MOVE H1N1 TO THE TOP OF THE LIST 10 TEST-SHORT-DESC PIC X(25). 10 TEST-COST PIC 9(5)V99. 10 VENIPUNCTURE-COST PIC 9(3)V99. 10 PRESCRIBING-PHYS PIC X(08). 10 DIAG-CDE PIC X(05). 05 TREATMENT-COMMENTS PIC X(254). ** QSAM FILE 01 INPATIENT-DAILY-REC. 05 PATIENT-RECORD-TYPE PIC X(01). 88 TRAILER-REC-D VALUE "T". 05 CURR-DTE PIC X(08). 05 BED-IDENTITY-W PIC 9(4). 05 ROOM-IDENTITY PIC 9(4). 05 TOTAL-ROOM-CHARGE PIC 9(7)V99. 05 BASE-ROOM-CHARGE PIC 9(7)V99. 05 ROOM-DATE-FROM PIC X(08). 05 ROOM-DATE-TO PIC X(08). 05 PRIMARY-DIAGNOSTIC-CODE-W PIC X(5). 05 WARD-NBR PIC X(4). 88 INTENSIVE-CARE VALUE "0010". 88 OBSTETRICS VALUE "2010". 88 PEDIATRICS VALUE "1010". 88 ONCOLOGY VALUE "0011". 88 CARDIO-THORACIC VALUE "0110". 88 GENERAL VALUE "0000". 88 VALID-WARD VALUES ARE "0010", "2010", "1010", "0011", "0110", "0000". 05 ADDITIONAL-EQUIP-CHARGES OCCURS 12 TIMES. 10 EQUIPMENT-ID PIC X(08). 10 EQUIPMENT-CATEGORY PIC X(04). 88 HEATING-PAD VALUE "HEAT". 88 AUTOCLAVE VALUE "AUTO". 88 SCOPE VALUE "SCOP". 88 DRIP VALUE "DRIP". 88 MONITOR VALUE "MON ". 88 SHUNT VALUE "SHNT". 88 MISCELLANEOUS VALUE "MISC". 88 VALID-CATEGORY VALUES ARE "HEAT", "AUTO", "SCOP", "DRIP", "MON ", "SHNT", "MISC". 10 EQUIPMENT-SHORT-DESC PIC X(30). 10 EQUIPMENT-COST PIC 9(5)V99. 10 EQUIPMENT-PRES-PHYS PIC X(08). 10 EQUIPMENT-REASON-CDE PIC X(04). 05 DAILY-CHARGES-COMMENTS PIC X(255). 01 WS-HDR-REC. 05 FILLER PIC X(1) VALUE " ". 05 HDR-DATE. 10 HDR-YY PIC 9(4). 10 DASH PIC X(1) VALUE "-". 10 HDR-MM PIC 9(2). 10 DASH PIC X(1) VALUE "-". 10 HDR-DD PIC 9(2). 05 FILLER PIC X(20) VALUE SPACE. 05 FILLER PIC X(65) VALUE "HOSPITAL WARDS / ROOMS / BEDS AVAILABILITY REPORT". 05 FILLER PIC X(14) VALUE "Page Number:" Justified Right. 05 PAGE-NBR-O PIC ZZ9. 01 WS-TRAILER-REC. 05 FILLER PIC X(1). 05 IN-RECORD-COUNT PIC 9(9). 05 IN-TOTAL-ROOM-CHARGE PIC S9(9)V99. 05 IN-BASE-ROOM-CHARGE PIC S9(9)V99. 05 IN-EQUIPMENT-CHARGES PIC S9(9)V99. 01 WS-BLANK-LINE. 05 FILLER PIC X(130) VALUE SPACES. 01 WS-WARD-RPT-REC. 05 FILLER PIC X(1) VALUE SPACES. 05 FILLER PIC X(09) VALUE "WARD-ID:". 05 WARD-O PIC X(8). 05 FILLER PIC X(19) VALUE "PRIMARY PHYSICIAN:". 05 PHYS-O PIC X(12). 05 FILLER PIC X(18) VALUE "NURSE SUPERVISOR:". 05 NURSE-O PIC X(12). 05 FILLER PIC X(16) VALUE "NUMBER OF BEDS:". 05 BEDS-O PIC ZZZ9. 05 FILLER PIC X(22) VALUE " BASE ROOM CHARGE:". 05 ROOM-CHARGE-O PIC $,$$9.99. 05 FILLER PIC X(50) VALUE SPACES. 01 WS-ROOM-RPT-REC. 05 FILLER PIC X(2) VALUE SPACES. 05 FILLER PIC X(10) VALUE "ROOM-NBR:". 05 ROOM-O PIC X(6). 05 FILLER PIC X(12) VALUE " ROOM TYPE:". 05 ROOM-TYPE PIC X(14). 05 FILLER PIC X(17) VALUE " NUMBER OF BEDS:". 05 BEDS-O PIC Z99. 05 FILLER PIC X(23) VALUE " SPECIAL EQUIPMENT:". 05 SPECIAL-EQUIP-O PIC X(60). 01 WS-BED-PATIENT-DETAIL. 05 FILLER PIC X(4) VALUE SPACES. 05 FILLER PIC X(14) VALUE "PATIENT NAME:". 05 PAT-NAME. 15 LAST-NAME-O PIC X(10). 15 FILLER PIC X(1) VALUE SPACES. 15 MIDINIT-O PIC X(1). 15 FIRST-NAME-O PIC X(10). 05 FILLER PIC X(11) VALUE " BED-NBR:". 05 BED-O PIC X(4). 05 FILLER PIC X(14) VALUE " ADMIT DATE:". 05 ADMIT-DATE-O PIC X(10). 05 FILLER PIC X(13) VALUE " DIAGNOSIS:". 05 DIAGNOSIS-O PIC X(7). 05 FILLER PIC X(11) VALUE "COMMENTS:". 05 DAILY-COMMENTS-O PIC X(50). 01 COUNTERS-AND-ACCUMULATORS. 05 WS-RECORDS-IN-ERROR PIC 9(7) COMP. 05 WS-MEDICATION-CHARGES PIC S9(9)V99 COMP-3. 05 WS-PHARMACY-CHARGES PIC S9(7)V99 COMP-3. 05 WS-ANCILLARY-CHARGES PIC S9(5)V99 COMP-3. * CREATE TABLE WARD_DATA ( *WARD*ID CHAR(4) WITH DEFAULT NULL, *PRIM*RY_PHYSICIAN_ID CHAR(8) WITH DEFAULT NULL, *SUPE*VISE_NURSE_ID CHAR(8) WITH DEFAULT NULL, *LOCA*ION CHAR(8) WITH DEFAULT NULL, *NUMB*R_OF_BEDS SMALLINT WITH DEFAULT NULL, * BASE*ROOM_CHARGE DECIMAL(7 , 2) WITH DEFAULT NULL * COPY PTMSTR. ** VSAM FILE 01 PATIENT-MASTER-REC. 05 PATIENT-ID PIC X(6). 05 PATIENT-TYPE PIC X(1). 88 INPATIENT VALUE "I". 88 OUTPATIENT VALUE "0". 88 VALID-TYPE VALUES ARE "I", "O". 05 PREVIOUS-PATIENT-IND PIC X(01). 88 PREV-PATIENT VALUE "Y". 88 NOT-PREVE-PATIENT VALUE "N". 88 VALID-PREV-IND VALUES ARE "Y", "N". 05 PRIMARY-STAY-WARD-NBR PIC X(4). 05 BED-IDENTITY-PRIMARY PIC 9(4). 05 DATE-ADMIT PIC X(10). 05 DATE-DISCHARGE PIC X(10). 05 ATTENDING-PHYSICIAN PIC X(08). 05 DIAGNOSTIC-CODE-PRIMARY PIC X(05). 05 DIAGNOSTIC-CODE-SECONDARY PIC X(05). 05 DIAGNOSTIC-CODE-TERTIARY PIC X(05). 05 INS-TYPE PIC X(3). 88 VALID-INS-TYPE VALUES ARE "HMO", "PPO", "POS" "MAN". 88 Managed-Care value "MAN". 05 HOSPITAL-STAY-LTH PIC 999. 05 PATIENT-TOT-AMT PIC 9(7)V99. 05 PRIMARY-CARE-PHYSICIAN-ID PIC X(8). 05 IN-OUT-NETWORK PIC X(1). 88 IN-NETWORK VALUE "N". 88 OUT-OF-NETWORK VALUE "O". 05 COPAY PIC S9(3). 05 REMAINING-DEDUCTIBLE PIC S9(4). 05 HIPAA-FORM-SIGNED-IND PIC X(01). 88 HIPAA-SIGNED VALUE "Y". 88 HIPAA-UNSIGNED VALUE "N". 05 PATIENT-ADMIT-COMMENTS PIC X(254). 05 DAILY-LAB-CHARGES-SUMMARY OCCURS 20 TIMES. 10 LAB-TEST-S-ID PIC X(08). 10 LAB-TEST-DATE PIC X(08). 10 TEST-SHORT-S-DESC PIC X(25). 10 TEST-DIAG-CODE PIC X(5). 10 TEST-CHARGES PIC 9(7)V99. 10 PRESCRIBING-S-PHYS-ID PIC X(08). 05 EQUIPMENT-CHARGES-SUMMARY OCCURS 20 TIMES. 10 EQUIPMENT-S-ID PIC X(08). 10 EQUIPMENT-CHARGE-DATE PIC X(08). 10 EQUIP-DIAG-CODE PIC X(5). 10 EQUIPMENT-S-SHORT-DESC PIC X(30). 10 EQUIPMENT-CHARGES PIC 9(7)V99. 10 EQUIPMENT-PRES-PHYS-ID PIC X(08). 01 WS-SYSOUT-REC. 05 MSG PIC X(80). 01 WS-CURRENT-DATE-FIELDS. 05 WS-CURRENT-DATE. 10 WS-CURRENT-YEAR PIC 9(4). 10 WS-CURRENT-MONTH PIC 9(2). 10 WS-CURRENT-DAY PIC 9(2). 05 WS-CURRENT-TIME. 10 WS-CURRENT-HOUR PIC 9(2). 10 WS-CURRENT-MINUTE PIC 9(2). 10 WS-CURRENT-SECOND PIC 9(2). 10 WS-CURRENT-MS PIC 9(2). 05 WS-DIFF-FROM-GMT PIC S9(4). 01 COUNTERS-IDXS-AND-ACCUMULATORS. 05 RECORDS-WRITTEN PIC 9(7) COMP. 05 PAT-WS-RECORDS-IN-ERROR PIC 9(7) COMP. 05 PAT-WS-INFILE-RECORD-READ-CTR PIC 9(9) COMP. 05 WS-BASE-ROOM-CHARGE PIC S9(9)V99 COMP-3. 05 WS-TOTAL-ROOM-CHARGE PIC S9(9)V99 COMP-3. 05 WS-EQUIPMENT-COST PIC S9(7)V99 COMP-3. 05 HOLD-WARD-ID PIC 9(4) VALUE 0. 05 HOLD-ROOM-NBR PIC 9(4) VALUE 0. 05 ROW-SUB PIC 9(2) VALUE 0. 05 WS-LINES PIC 9(03) VALUE 0. 05 WS-PAGES PIC 9(03) VALUE 1. 05 TRLR-REC-SW PIC 9(01) VALUE 0. 88 TRLR-REC-FOUND VALUE 1. 01 MISC-WS-FLDS. 05 STR-LTH PIC 9(04) VALUE 0. 05 RETURN-CD PIC S9(04) VALUE 0. 05 TABLE-SIZE PIC 9(02) VALUE 12. 05 MORE-TABLE-ROWS PIC X(01). 88 MORE-TABLE-ROWS VALUE "Y". 88 NO-MORE-TABLE-ROWS VALUE "N". 05 MORE-WARD-DATA-SW PIC X(01) VALUE "Y". 88 NO-MORE-PATIENTS VALUE "N". 88 MORE-PATIENTS VALUE "Y". 05 ERROR-FOUND-SWT PIC X(01) VALUE "Y". 05 WS-ERROR-FOUND-SWITCH PIC X(01) VALUE "Y". 05 FIRST-TIME-IN-SW PIC X(01) VALUE "Y". 88 FIRST-TREATMENT-READ VALUE "Y". 88 NOT-FIRST-TIME VALUE "N". 05 WARD-SW PIC X(01) VALUE "N". 88 NEW-WARD VALUE "Y". 05 ROOM-SW PIC X(01) VALUE "N". 88 NEW-ROOM VALUE "Y". 01 PATIENT-PERSONAL-MASTER-REC. 05 PATIENT-NBR-MR PIC X(6). 05 SSNBR PIC X(10). 05 AGE PIC 9(03). 05 DRIVERS-LICENSE-NO PIC X(10). 05 ISSUING-STATE PIC X(02). 05 OCCUPATION PIC X(20). 05 EMPLOYER. 10 EMP-NAME PIC X(30). 10 EMP-ADDR PIC X(30). 10 EMP-CITY PIC X(30). 10 EMP-STATE PIC X(02). 10 EMP-ZIP PIC X(09). 05 MARITAL-STATUS PIC X(01). 88 MARRIED VALUE "M". 88 SINGLE VALUE "S". 88 DIVORCED VALUE "D". 88 WIDOWED VALUE "W". 88 VALID-STATUS VALUES ARE "M", "S", "W", "D". 05 PATIENT-NAME. 10 LAST-NAME PIC X(15). 10 MIDINIT PIC X(01). 10 FIRST-NAME PIC X(20). 05 PHONE-HOME PIC X(10). 05 PHONE-WORK PIC X(10). 05 PHONE-MOBILE PIC X(10). 05 HEIGHT PIC 9(02). 05 WEIGHT PIC 9(03). 05 GENDER PIC X(01). 88 FEMALE VALUE "F". 88 MALE VALUE "M". 88 NOT-PROVIDED VALUE "N". 88 VALID-GENDER VALUES ARE "F", "M", "N". 05 DOB PIC 9(05). 05 FAMILY-CONTACT-PRIMARY PIC X(30). 05 FCON-RELATIONSHIP PIC X(02). 88 SPOUSE VALUE "SP". 88 SIBLING VALUE "SI". 88 CHILD VALUE "CH". 88 FRIEND VALUE "FR". 88 VALID-RELS VALUES ARE "SP", "SI", "CH", "FR". 05 MINOR-INDICATOR PIC X(01) VALUE SPACES. 05 RESPONSIBLE-PARTY. 10 SSN PIC X(10). 10 OCCUPATION PIC X(30). 10 EMPLOYER PIC X(30). 10 CITY PIC X(20). 10 ST PIC X(02). 10 ZIP PIC X(09). 05 FCON-PHONE-H PIC 9(10). 05 FCON-PHONE-C PIC X(10) VALUE SPACE. 05 PAYMENT-METHOD-TYPE PIC X(02). 88 CREDIT-CARD VALUE "CC". 88 CHECK VALUE "CH". 88 CASH VALUE "CA". 88 VALID-PAYMENT-METHOD VALUES ARE "CC", "CH", "CA". 05 CREDIT-CARD-EXP-DATE. 10 EXP-MONTH PIC 9(02). 10 EXP-YEAR PIC 9(04). 05 HOME-ADDRESS. 10 APARTMENT-NBR PIC X(05). 10 STREET PIC X(30). 10 CITY PIC X(20). 10 STATE PIC X(02). 10 POSTAL-CODE PIC X(09). 10 COUNTRY PIC X(20). 05 OCCUPATION PIC X(30). 05 EMPLOYER PIC X(30). 05 PATIENT-COMMENTS PIC X(255). 01 ABEND-REC. 05 FILLER PIC X(3) VALUE "**". 05 FILLER PIC X(17) VALUE "ABEND PARAGRAPH: ". 05 PARA-NAME PIC X(40). 05 ABEND-REASON PIC X(40). 05 EXPECTED-VAL PIC 9(9). 05 ACTUAL-VAL PIC 9(9). 05 ONE-VAL PIC 9 VALUE 1. 05 ZERO-VAL PIC 9 VALUE 0. 01 SQLCA. 03 SQLCAID PIC X(8). 03 SQLCABC PIC S9(9) COMP. 03 SQLCODE PIC S9(9) COMP. 03 SQLERRM. 49 SQLERRML PIC S9(4) COMP. 49 SQLERRMC PIC X(70). 03 SQLERRP PIC X(8). 03 SQLERRD OCCURS 6 PIC S9(9) COMP. 03 SQLWARN. 05 SQLWARN PIC X. 05 SQLWARN PIC X. 05 SQLWARN PIC X. 05 SQLWARN PIC X. 05 SQLWARN PIC X. 05 SQLWARN PIC X. 05 SQLWARN PIC X. 05 SQLWARN PIC X. 03 SQLEXT PIC X(8). * COBOL DECLARATION FOR TABLE DDS0001.DIAG_CODES * 01 DCLDIAG-CODES. 10 DIAG-CODE PIC X(5). 10 INS-TYPE PIC X(3). 10 COPAY PIC S9(4) USAGE COMP. 10 DEDUCTIBLE PIC S9(4) USAGE COMP. * THE NUMBER OF COLUMNS DESCRIBED BY THIS DECLARATION IS * * COBOL DECLARATION FOR TABLE DDS0001.MEDICATION * 01 DCLMEDICATION. 10 MEDICATION-ID PIC X(8). 10 MED-NAME PIC X(40). 10 SHORT-DESCRIPTION PIC X(100). 10 COST PIC S9(5)V9(2) USAGE COMP-3. 10 PHARMACY-COST PIC S9(3)V9(2) USAGE COMP-3. * THE NUMBER OF COLUMNS DESCRIBED BY THIS DECLARATION IS * * COPY DIAGCODE. ***** DB2 TABLE DCLGENS 01 DCLWARD-CODES. 10 WARD-ID PIC X(04). 10 PRIMARY-PHYSICIAN-ID PIC X(08). 10 SUPERVISE-NURSE-ID PIC X(08). 10 LOCATION PIC X(08). 10 NUMBER-OF-BEDS PIC S9(4) COMP. 10 BASE-ROOM-CHARGE PIC S9(5)V99 COMP-3. 01 DCLHOSP-BED. 10 BED-ID PIC X(04). 10 ROOM-ID PIC X(08). 10 WARD-ID PIC X(08). 10 SPECIAL-CHARGES PIC S9(5)V99 COMP-3. 01 DCLROOM-DATA. 10 PRIVATE PIC S9(4) COMP. 10 SEMI-PRIVATE PIC S9(4) COMP. 10 SPECIAL-EQUIPMENT PIC X(254). PROCEDURE DIVISION. PERFORM 000-HOUSEKEEPING THRU 000-EXIT. PERFORM 100-MAINLINE THRU 100-EXIT UNTIL NO-MORE-PATIENTS OR ******* Balancing logic put in by TGD 02/12/92 TRAILER-REC. PERFORM 999-CLEANUP THRU 999-EXIT. MOVE +0 TO RETURN-CODE. GOBACK. 000-HOUSEKEEPING. MOVE "000-HOUSEKEEPING" TO PARA-NAME. DISPLAY "HOUSEKEEPING". * DATE VALUES MOVE FUNCTION CURRENT-DATE TO WS-CURRENT-DATE-FIELDS. MOVE WS-CURRENT-YEAR TO HDR-YY. MOVE WS-CURRENT-MONTH TO HDR-MM. MOVE WS-CURRENT-DAY TO HDR-DD. INITIALIZE COUNTERS-IDXS-AND-ACCUMULATORS, WS-TRAILER-REC, INPATIENT-TREATMENT-REC-DATA. MOVE +1 TO WS-LINES, WS-PAGES. PERFORM 800-OPEN-FILES THRU 800-EXIT. PERFORM 900-READ-WARD-DATA THRU 900-EXIT. IF NO-MORE-PATIENTS MOVE "EMPTY PATIENT INPUT FILE" TO ABEND-REASON GO TO 1000-ABEND-RTN. **** PUT IN TO HANDLE NEW SORT REQUIREMENTS IF TRAILER-REC MOVE 1 TO TRLR-REC-SW PERFORM 900-READ-WARD-DATA THRU 900-EXIT 000-EXIT. EXIT. 100-MAINLINE. MOVE "100-MAINLINE" TO PARA-NAME. IF WARD-NBR IN INPATIENT-DAILY-REC NOT = HOLD-WARD-ID PERFORM 200-NEW-WARD THRU 200-EXIT PERFORM 300-NEW-ROOM THRU 300-EXIT PERFORM 400-NEW-PATIENT THRU 400-EXIT MOVE WARD-NBR IN INPATIENT-DAILY-REC TO HOLD-WARD-ID MOVE ROOM-IDENTITY IN INPATIENT-DAILY-REC TO HOLD-ROOM-NBR ELSE IF ROOM-IDENTITY IN INPATIENT-DAILY-REC NOT = HOLD-ROOM-NBR PERFORM 400-NEW-PATIENT THRU 400-EXIT. 100-EXIT. 200-NEW-WARD. MOVE "200-NEW-WARD" TO PARA-NAME. MOVE "N" TO ERR-FOUND-SWITCH IN FLAGS-AND-SWITCHES. MOVE WARD-NBR IN INPATIENT-DAILY-REC TO WARD-ID IN DCLWARD-CODES, WARD-ID IN DCLROOM-DATA. *** WARD-ID IN DCLHOSP-BED. ?? PERFORM 250-PROCESS-WARD-TABLE-DATA THRU 250-EXIT. *** SET UP PAGE HEADERS PERFORM 700-WRITE-PAGE-HDR THRU 700-EXIT. PERFORM 720-WRITE-WARD-RPT THRU 720-EXIT. ***PROCESS PATIENT TREATMENTS PERFORM 700-WRITE-TRMTEDIT THRU 700-EXIT. 200-EXIT. 250-PROCESS-WARD-TABLE-DATA. * MOVE SUPERVISOR-NURSE-ID TO SUPERVISE-NURSE-ID. EXEC SQL SELECT PRIMARY_PHYSICIAN_ID, SUPERVISE_NURSE_ID, LOCATION, NUMBER_OF_BEDS, BASE_ROOM_CHARGE INTO :PRIMARY-PHYSICIAN-ID, :SUPERVISE-NURSE-ID, :LOCATION, :DCLWARD-CODES.NUMBER-OF-BEDS, :DCLWARD-CODES.BASE-ROOM-CHARGE FROM DDS0001.WARD_DATA WHERE WARD_ID = :DCLWARD-CODES.WARD-ID END-EXEC. IF SQLCODE = -811 OR 0 NEXT SENTENCE IF SQLCODE = +100 MOVE "*** PATIENT WARD DATA IN ERROR" TO ERR-MSG IN INPATIENT-DAILY-REC-ERR IN PATERR MOVE "Y" TO ERR-FOUND-SWITCH move sqlcode to EXPECTED-VAL move PATIENT-ID IN INPATIENT-DAILY-REC to ACTUAL-VAL WRITE SYSOUT-REC FROM ABEND-REC GO TO 250-EXIT IF SQLCODE < 0 MOVE "*** FATAL DB2 ERROR" TO GO TO 1000-DB2-ERROR-RTN. MOVE WARD-ID IN DCLWARD-CODES TO WARD-O. MOVE PRIMARY-PHYSICIAN-ID IN DCLWARD-CODES TO PHYS-O. MOVE SUPERVISE-NURSE-ID TO NURSE-O. MOVE NUMBER-OF-BEDS IN DCLWARD-CODES TO BEDS-O IN WS-WARD-RPT-REC. MOVE BASE-ROOM-CHARGE IN DCLWARD-CODES TO ROOM-CHARGE-O. PERFORM 400-NUMERIC-RANGE-EDITS THRU 400-N-EXIT. 250-EXIT. 300-NEW-ROOM. MOVE "300-NEW-ROOM" TO PARA-NAME. MOVE ROOM-IDENTITY IN INPATIENT-DAILY-REC TO ROOM-ID IN DCLHOSP-BED, ROOM-ID IN DCLROOM-DATA. PERFORM 350-PROCESS-ROOM-TABLE-DATA THRU 350-EXIT. PERFORM 740-WRITE-ROOM-RPT THRU 740-EXIT. 300-EXIT. 350-PROCESS-ROOM-TABLE-DATA. MOVE "*** PATIENT ROOM DATA IN ERROR" TO MOVE "Y" TO ERROR-FOUND-SW GO TO 350-EXIT MOVE ROOM-ID IN DCLROOM-DATA TO ROOM-O. IF PRIVATE IN DCLROOM-DATA = 1 MOVE "PRIVATE" TO ROOM-TYPE IF SEMI-PRIVATE = 1 MOVE "SEMI-PRIVATE" TO ROOM-TYPE MOVE "SPECIAL-NEEDS" TO ROOM-TYPE. MOVE WARD-ID IN DCLWARD-CODES TO PHYS-O. TO BEDS-O IN WS-ROOM-RPT-REC. MOVE SPECIAL-EQUIPMENT IN DCLROOM-DATA TO SPECIAL-EQUIP-O. 350-EXIT. 400-NUMERIC-RANGE-EDITS. MOVE "400-NUMERIC-RANGE-EDITS" TO PARA-NAME. ******** Call to VSAM file to read record IF (MEDICATION-COST > 99000 OR MEDICATION-COST < 1.01) MOVE "*** INVALID MEDICATION COST" TO ERR-MSG IN INPATIENT-TREATMENT-REC-ERR GO TO 400-N-EXIT. IF (PHARMACY-COST IN INPATIENT-TREATMENT-REC > 990 OR PHARMACY-COST IN INPATIENT-TREATMENT-REC < .99) MOVE "*** INVALID PHARMACY COSTS" TO IF (ANCILLARY-CHARGE > 900 OR ANCILLARY-CHARGE < 1.01) MOVE "*** INVALID ANCILLARY CHARGES" TO 400-N-EXIT. 400-NEW-PATIENT. MOVE "400-NEW-PATIENT" TO PARA-NAME. MOVE "N" TO ERROR-FOUND-SW IN FLAGS-AND-SWITCHES. MOVE PATIENT-ID IN INPATIENT-DAILY-REC TO PATMSTR-KEY, PATPERSN-KEY. PERFORM 450-GET-PATIENT-DATA THRU 450-EXIT. PERFORM 760-WRITE-PATIENT-RPT THRU 760-EXIT. 400-EXIT. 450-GET-PATIENT-DATA. MOVE DAILY-CHARGES-COMMENTS TO DAILY-COMMENTS-O. READ PATMSTR. READ PATPERSN. IF PATPERSN-FOUND MOVE PATPERSN-REC TO PATIENT-PERSONAL-MASTER-REC MOVE LAST-NAME TO LAST-NAME-O MOVE MIDINIT TO MIDINIT-O MOVE DIAG-CDE TO DIAGNOSIS-O MOVE FIRST-NAME TO FIRST-NAME-O MOVE "PATIENT NOT FOUND IN PATPERSN" TO ABEND-REASON MOVE "500-GET-PATIENT-DATA" TO PARA-NAME MOVE PATIENT-ID IN INPATIENT-DAILY-REC TO EXPECTED-VAL 450-EXIT. 600-DB2-TABLE-EDITS. MOVE "600-DB2-TABLE-EDITS" TO PARA-NAME. ******** EXEC SQL to get info from DB2 MOVE DIAG-CDE IN LAB-CHARGES to DIAG-CODE IN DCLDIAG-CODES. ****** CHECK FOR VALID DIAGNOSTIC CODE SELECT DIAG_CODE INTO :DIAG-CODE FROM DDS0001.DIAG_CODES WHERE DIAG_CODE = :DIAG-CODE MOVE "*** DIAGNOSTIC CODE NOT-FOUND IN DIAG_CODES" TO move sqlcode to PATIENT-ID IN INPATIENT-TREATMENT-REC MOVE DIAG-CODE IN DCLDIAG-CODES TO PRIMARY-DIAGNOSTIC-CODE move PATIENT-ID IN INPATIENT-TREATMENT-REC GO TO 600-EXIT MOVE "*** FATAL DB2 ERROR" TO ****** CHECK FOR VALID BED IDENTITY MOVE BED-IDENTITY-W TO BED-ID IN DCLHOSP-BED. SELECT BED_ID INTO :DCLHOSP-BED.BED-ID FROM DDS0001.HOSP_BED WHERE BED_ID = :DCLHOSP-BED.BED-ID MOVE "*** BED IDENT NOT-FOUND IN HOSP_BED" TO ****** CHECK FOR VALID PHYSICIAN-ID MOVE ATTENDING-PHYS-ID TO PRIMARY-PHYSICIAN-ID. SELECT PRIMARY_PHYSICIAN_ID INTO :PRIMARY-PHYSICIAN-ID WHERE PRIMARY_PHYSICIAN_ID = :PRIMARY-PHYSICIAN-ID MOVE "*** ATTENDING PHYSICIAN NOT FOUND IN TABLE" TO ****** CHECK FOR VALID MEDICATION-ID MOVE MEDICATION-ID IN INPATIENT-TREATMENT-REC TO MEDICATION-ID IN DCLMEDICATION. SELECT MEDICATION_ID INTO :DCLMEDICATION.MEDICATION-ID FROM DDS0001.MEDICATION WHERE MEDICATION_ID = :DCLMEDICATION.MEDICATION-ID MOVE "*** MEDICATION-ID NOT FOUND IN TABLE" TO ****** CHECK FOR VALID SUPERVISOR NURSE-ID MOVE SUPERVISOR-NURSE-ID TO SUPERVISE-NURSE-ID. SELECT SUPERVISE_NURSE_ID INTO :SUPERVISE-NURSE-ID WHERE SUPERVISE_NURSE_ID = :SUPERVISE-NURSE-ID MOVE "*** SUPERVISOR NURSE NOT FOUND" TO 600-EXIT. 700-WRITE-TRMTEDIT. MOVE "700-WRITE-TRMTEDIT" TO PARA-NAME. WRITE INPATIENT-TREATMENT-REC-DATA FROM INPATIENT-TREATMENT-REC. ADD MEDICATION-COST TO WS-MEDICATION-CHARGES. ADD ANCILLARY-CHARGE TO WS-ANCILLARY-CHARGES. ADD PHARMACY-COST IN INPATIENT-TREATMENT-REC TO WS-PHARMACY-CHARGES. ADD +1 TO RECORDS-WRITTEN. 700-T-EXIT. 700-WRITE-PAGE-HDR. MOVE "700-WRITE-PAGE-HDR" TO PARA-NAME. MOVE WS-PAGES TO PAGE-NBR-O. WRITE RPT-REC FROM WS-HDR-REC AFTER ADVANCING NEXT-PAGE. WRITE RPT-REC FROM WS-BLANK-LINE. ADD +1 TO WS-PAGES. MOVE +2 TO WS-LINES. 700-EXIT. 710-WRITE-TRMTERR. MOVE INPATIENT-TREATMENT-REC TO REST-OF-REC. WRITE INPATIENT-TREATMENT-REC-ERR. ADD +1 TO WS-RECORDS-IN-ERROR. 710-EXIT. 720-WRITE-WARD-RPT. MOVE "720-WRITE-WARD-RPT" TO PARA-NAME. WRITE RPT-REC FROM WS-WARD-RPT-REC AFTER ADVANCING 2. ADD +3 TO WS-LINES. 720-EXIT. 740-WRITE-ROOM-RPT. MOVE "740-WRITE-ROOM-RPT" TO PARA-NAME. PERFORM 790-CHECK-PAGINATION THRU 790-EXIT. WRITE RPT-REC FROM WS-ROOM-RPT-REC AFTER ADVANCING 1. ADD +2 TO WS-LINES. 740-EXIT. 760-WRITE-PATIENT-RPT. MOVE "760-WRITE-PATIENT-RPT" TO PARA-NAME. WRITE RPT-REC FROM WS-BED-PATIENT-DETAIL ADD +1 TO WS-LINES. 760-EXIT. 790-CHECK-PAGINATION. MOVE "790-CHECK-PAGINATION" TO PARA-NAME. IF WS-LINES > 50 WRITE RPT-REC FROM WS-BLANK-LINE PERFORM 700-WRITE-PAGE-HDR THRU 700-EXIT. 790-EXIT. 795-WRITE-PATERR. MOVE "795-WRITE-PATERR" TO PARA-NAME. MOVE INPATIENT-DAILY-REC TO REST-OF-PAT-REC. WRITE INPATIENT-DAILY-REC-ERR. ADD +1 TO PAT-WS-RECORDS-IN-ERROR. 795-EXIT. 800-OPEN-FILES. MOVE "800-OPEN-FILES" TO PARA-NAME. OPEN INPUT PATSRCH, PATPERSN, PATMSTR. OPEN OUTPUT WARDFILE, PATERR, SYSOUT. DISPLAY PATMSTR-STATUS, PATPERSN-STATUS. * GOBACK. 800-EXIT. 850-CLOSE-FILES. MOVE "850-CLOSE-FILES" TO PARA-NAME. CLOSE PATSRCH, WARDFILE, SYSOUT, PATPERSN, PATMSTR. 850-EXIT. 900-READ-TRMTDATA. * Code your statements here to read the input file * Remember to move "NO" to IFCODE if the input file is AT END INITIALIZE INPATIENT-TREATMENT-REC-DATA . READ TRMTDATA AT END MOVE "N" TO MORE-DATA-SW GO TO 900-T-EXIT END-READ MOVE "N" TO ERROR-FOUND-SW. ADD +1 TO WS-INFILE-RECORD-READ-CTR. 900-T-EXIT. 900-READ-WARD-DATA. * READ SORTED PATIENT TRANS FILE READ PATSRCH INTO INPATIENT-DAILY-REC AT END MOVE "N" TO MORE-WARD-DATA-SW GO TO 900-EXIT END-READ. ADD +1 TO PAT-WS-INFILE-RECORD-READ-CTR. 900-EXIT. 999-CLEANUP. MOVE "999-CLEANUP" TO PARA-NAME. * Final file-handling edits and trailer record handling IF TRLR-REC-FOUND IF NOT TRAILER-REC MOVE "** INVALID FILE - NO TRAILER REC" TO ABEND-REASON MOVE INPATIENT-DAILY-REC TO WS-TRAILER-REC. * IF WS-INFILE-RECORD-READ-CTR NOT EQUAL TO IN-RECORD-COUNT * MOVE "** INVALID FILE - # RECORDS OUT OF BALANCE" * TO ABEND-REASON * MOVE WS-INFILE-RECORD-READ-CTR TO ACTUAL-VAL * MOVE IN-RECORD-COUNT TO EXPECTED-VAL * GO TO 1000-ABEND-RTN. * MOVE "T" TO PATIENT-RECORD-TYPE. * MOVE RECORDS-WRITTEN TO IN-RECORD-COUNT. * MOVE WS-BASE-ROOM-CHARGE TO IN-BASE-ROOM-CHARGE. * MOVE WS-TOTAL-ROOM-CHARGE TO IN-TOTAL-ROOM-CHARGE. * MOVE WS-EQUIPMENT-COST TO IN-EQUIPMENT-CHARGES. * WRITE INPATIENT-DAILY-REC FROM WS-TRAILER-REC. * Code the statement to close all files PERFORM 850-CLOSE-FILES THRU 850-EXIT. * Code the statement to Display a successful end-of-job msg DISPLAY "NORMAL END OF JOB". 999-EXIT. 1000-ABEND-RTN. WRITE SYSOUT-REC FROM ABEND-REC. DISPLAY "*** ABNORMAL END OF JOB- DALYEDIT ***" UPON CONSOLE. DIVIDE ZERO-VAL INTO ONE-VAL. 1000-DB2-ERROR-RTN. ************************************************************ * ERROR TRAPPING ROUTINE FOR INVALID SQLCODES * DISPLAY '**** WE HAVE A SERIOUS PROBLEM HERE *****'. DISPLAY '999-ERROR-TRAP-RTN '. MULTIPLY SQLCODE BY -1 GIVING SQLCODE. DISPLAY 'SQLCODE ==> ' SQLCODE. DISPLAY SQLCA. DISPLAY SQLERRM. EXEC SQL WHENEVER SQLERROR CONTINUE END-EXEC. EXEC SQL ROLLBACK WORK END-EXEC.

77  Prefix Area Commands Workshop
Using your ISPF skills, issue the following ISPF commands by entering values in the Prefix area and pressing <Enter> after each edit operation  Note: The editor line numbers will change and update as you finish each workshop step. Keep in mind that you're practicing ISPF Prefix Area commands in RDz – not programming  With the SANDBOX.cbl program loaded in the editor: Repeat lines 9 and 21 Block repeat lines 9  23 Block delete lines 23  25 Copy line 11 after line 19 Block copy lines 23  36 after line 48 Delete lines 50 and 56  58 Block move lines 37  38 after line 46 Block shift lines 101  105 left 4 Block shift lines 160  164 right 6 Scroll to the bottom of the file (Ctrl+End). Block repeat the 1000-ABEND-RTN paragraph, and rename the paragraph: 1001-ABEND-RTN Insert 20 new lines at the end of the file ISPF Prefix area commands

78  Prefix Area Commands Workshop - continued
 Continue editing SANDBOX.cbl Reminder: do not to worry if your line #s are not exactly in synch with these workshop tasks. Just do the ISPF functions described Scroll to the top-of-file, and Insert a new blank line after line 13 Block exclude lines 30  35 Click the collapse/expand icon From the command line, type: RES On line 1, exclude 9999 lines  In one operation, perform the ISPF prefix commands shown here  Please spend another 5 minutes practicing with ISPF prefix area commands and combinations that you're familiar with from the mainframe Close your edit session and do NOT save your changes to SANDBOX.cbl Block Exclude

79 ISPF Prefix Area Commands – Example with Excludes/Expand up or Down
A common ISPF Prefix command technique is to: Exclude a number of lines (Xn (where n – is a number), or XX….XX) Show a number of the excluded lines – with an "F" or "L" prefix command With RDz you might use this less, as you get expand/collapse functionality (plus signs). But if you need this technique, it's supported:  Optional Workshop To show n excluded lines within an excluded block: Excludes lines, then position your cursor on the excluded marker Type: F n … or… L n - in the prefix area Where n is a number of lines to show F – shows the first n excluded lines L – shows the last n excluded lines (OPTIONAL) Try: LC and UC (lower-case/uppper-case prefix area commands) – in any COBOL program

80 RDz for ISPF Developers
UNIT RDz for ISPF Developers Topics: The RDz Workbench – Terms and Concepts Editing COBOL Programs ISPF Prefix Area Commands Editing With Keystroke Shortcuts Find and Replace Dialog Creating New Programs From Scratch Miscellaneous Features – Hex edit, Content Assist Paragraph (control flow) and Data Flow Analysis Working with Copybooks and Property Files Appendix – ISPF / LPEX Editor Comparison

81 Keyboard Editing versus Mouse-based
You're probably getting the picture that there are two distinct editing "modes" using a graphical workbench like RDz: Using your mouse for: Navigation Highlighting Selection Accessing RDz tools  and your keyboard for content editing Using the keyboard for: Accessing RDz tools Content editing Most developers feel as though it's worth going through the skills-transition, to master mouse-oriented development – as this pays dividends for z/OS and modern-development workflow (Services, contemporary U.I. work, etc.) But, on the next few slides we present Hot-Key combinations available in the RDz editor for those that are ISPF power-typists, who want to ease into things gradually

82 Common ISPF Key Editing Techniques
Split and Join lines: 1. Split lines: Position Cursor Press Alt+S …or… Press: Ctrl+Enter 2. Join lines: Press Alt/J Leading blanks can cause line joining to shift to the right (sometimes past column 80). A better solution for joining lines is to Select and cut the text to join  Paste the text

83 Common ISPF Key Editing Techniques - continued
You're probably used to the Erase (EOF) key. Using RDz you substitute Ctrl+Delete Other useful PC-key combos 1. Select to the end-of-line Shift+End 2. Move your cursor to the end and beginning of a statement Position your cursor inside a statement  Press End Home Ctrl+Delete

84  Workshop - Common ISPF Key Editing Techniques
From z/OS Projects Open the SANDBOX.cbl program in the editor Using the Outline view, find the beginning of the PROCEDURE DIVISION Find the MOVE "000-HOUSEKEEPING" TO PARA-NAME. Statement Using Ctrl+Enter, split the line before the TO Using the mouse Cut & Paste technique, rejoin the lines Under the * DATE VALUES comment line, split the next four MOVE statements after the TO operand Scroll to the top of file and using Ctrl+Delete erase to end of line five of the comments Using the Outline view, return to the 000-HOUSEKEEPING paragraph, and re-join two of the MOVE statement lines you split in the above steps (again use the Cut & Paste technique) Using the command line, Find the first occurrence of : INPATIENT-TREATMENT-REC-DATA in the source Place your cursor on that line at column 22 Press the Home and End keys a few times Press Shift+Home and Shift+End Scroll down to the PROCEDURE DIVISION and practice/experiment using: Ctrl+Enter, Joining Lines, Ctrl+Delete, Shift+End, Home and End for five minutes Close the editor and do NOT save your changes

85  Hot-Key Combinations
The ISPF editor actually supports an extensive collection of Hot-Key combinations: You can see the complete list of Hot-Keys at any time during your edit session by pressing: Ctrl+Shift+L  Black entries are activated Gray entries are unavailable in the current editing context Hot-Keys are case-IN-sensitive Alt+C  Alt+c We will cover the essential Hot-Keys starting on the next slide: Navigation Select Text Copy/Paste Text Line Options Miscellaneous Ctrl + Shift + L

86  Hot-Key Combinations – Source Navigation + Miscellaneous Keys
RDz Hot Keys Description ISPF Equivalent Ctrl+Home Top of file Max PF7 Ctrl+End Bottom of file Max PF8 Ctrl+2 Open same program in split-screen view PF2 - then open the source member Ctrl+0 (zero) Close edit session PF3 (or CAN on the command line) Ctrl+S Save edit session Save Ctrl+P Print current file N/A Ctrl+T Make current line top line in the editor PF7/PF8 with CSR as your paging option PgUp Page up one physical page of source at a time PF7 PgDn Page down one page of source at a time PF8 PF7/PF8 Page up/down one page of source at a time Up/Down – Right/Left Arrows Scroll one character at a time through your source: Up/Down – Right/Left Up/Down/Right/Left Arrows Ctrl+PgDn Page Right PF11 Ctrl+PgUp Page Left PF10 Ctrl+L Open Line Number feature Ctrl+G Filters out all COBOL code except the four divisions Prefix area exclude Ctrl+W Show all filtered lines RES Shift+F10 Show the Context (popup) menu Ctrl+Shift+L Show the list of all Hot-Key Combinations Escape Cursor jumps to the command line

87 Workshop – Source File Navigation and Hot-Key Combinations
Load TRMTRDZ.cbl into the editor. Press the following Hot-Key combinations. (Optional) Type or write down what happens after you press the Hot-Key combination Ctrl+L - Type: 77 and Press: Enter ________________________________________ Ctrl+T ________________________________________ Ctrl+2 ________________________________________ Ctrl+0 ________________________________________ Ctrl+End ________________________________________ Ctrl+Home ________________________________________ Ctrl+Shift+L ________________________________________ PF8 ________________________________________ PF7 ________________________________________ PgDn ________________________________________ PgUp ________________________________________ Ctrl+PgUp ________________________________________ Ctrl+PgDn ________________________________________ Ctrl+G ________________________________________ Ctrl+W ________________________________________ Ctrl+F10 ________________________________________ Ctrl+P- You can decide if you want to print the file ________________________ Down Arrow - Continually press the down arrow ______________________ Up Arrow - Continually press the up arrow ___________________________

88  Hot-Key Combinations – Line and Statement Editing Options
RDz Hot Keys Description ISPF Equivalent Ctrl+F Opens Find/Replace Dialog Find/Change ISPF Commands Ctrl+Z Undo last change UNDO (if Recovery On) Ctrl+Y Redo last change N/A Shift+Down Arrow Select text from the current cursor position downward in the source file Prefix Area Command: CC … CC PF7 Shift+Up Arrow Select text from the current cursor position upward in the source file Ctrl+Shift+Right Arrow Open same program in split-screen view PF2 + navigate to source member Shift+End Select text from cursor position to end of line Shift+Home Select text from cursor position to beginning of line Ctrl+A Select all text in the source file Prefix Area Command: C99999 Alt+U Unselect selected text Ctrl+C Copy currently selected source lines Prefix Area Command: C or CC Ctrl+X Cut currently selected source lines Prefix Area Command: M or MM Ctrl+V Paste currently copied source lines Prefix Area Command: A or B Ctrl+J Find previous edit change Ctrl+Right Locates cursor at the beginning of the next COBOL word Ctrl+Backspace Delete Current line Prefix Area Command: D Ctrl+D Repeat Current line Prefix Area Command: R Ctrl+/ or Ctrl+\ Comment or Uncomment current line Ctrl+Enter Insert new line Prefix Area Command: TS or I Ctrl+Delete Delete (Truncate) to end of line Erase (EOF) key F5 and F6 Find and Repeat Find, Change and Repeat Change PF5 / PF6 F2 Delete COBOL word to the right of the cursor position

89 Workshop – Line and Statement Editing Hot-Key Combinations
Load TRMTRDZ.cbl into the editor. Press the following Hot-Key combinations (Optional) Type or write down what happens after you press the Hot-Key combination Ctrl+A ________________________________________ Alt+U ________________________________________ Ctrl+Backspace ________________________________________ Ctrl+Z ________________________________________ Ctrl+Y ________________________________________ Ctrl+D ________________________________________ Shift+Right arrow ________________________________________ (Repeat with Shift+Left Arrow) Shift+Down arrow ________________________________________ (Repeat with Shift+Up Arrow) (With your mouse cursor at the beginning of a line) Shift+End _______________________________ (With your mouse cursor at the END of a line) Shift+Home _______________________________ Ctrl+X ________________________________________ Ctrl+Home ________________________________________ Ctrl+V ________________________________________ Ctrl+End ________________________________________ Ctrl+J ________________________________________ (With your mouse cursor in the middle of a line) Ctrl+Delete _______________________________ (Multiple times) Ctrl+Shift+Right arrow _______________________________ (Holding these keys down) Ctrl+Right arrow _______________________________ (Holding these keys down) Ctrl+Left arrow _______________________________ If time permits, spend some time working with the combination of the Navigation and Line and Statement Editing Hot-Keys

90 RDz for ISPF Developers
UNIT RDz for ISPF Developers Topics: The RDz Workbench – Terms and Concepts Editing COBOL Programs ISPF Prefix Area Commands Editing With Keystroke Shortcuts Find and Replace Dialog Creating New Programs From Scratch Miscellaneous Features – Hex edit, Content Assist Paragraph (control flow) and Data Flow Analysis Working with Copybooks and Property Files Appendix – ISPF / LPEX Editor Comparison

91 Find/Replace Dialog – 1 of 2
Besides the ISPF Find/Change command, there are other ways to search and replace text Standard find: From anywhere inside your source, press: Ctrl+F …or… Ctrl+f Brings up the following dialog with find options  1. Enter Find and/or Replace value 2. Check one or more search refinement options  3. Press a Find button (covered on the next slide) Find option checkboxes: Case sensitive – case sensitive search Whole word – finds your text delimited by spaces or dashes Regular expression – powerful search meta-language – for complex search Wrap – if starting mid-way through source, continue find from the top Select found text – shows and selects found element Peek: Shows specified number of lines of source after the found element Restrict search to columns – search between start and end columns only If you are used to using a regular expression editor, then most normal regular expressions are supported. If you are not used to using regular expressions and want to find out more about what regular expressions are supported with the LPEX editor, then: - Click on the regular expression selection box - Press F1 - Select “regular expressions” from the listed help topics. See Notes

92 Find/Replace Dialog – 2 of 2
Find option buttons: Next Find forward in the source Does not find text inside copy or include files Ctrl+n – finds next Previous Find upwards (back) in the source from your current cursor position All Finds all lines within the source Acts to exclude or filter source Press Ctrl+W to "show all" excluded lines …and/or to close the find dialog box Clicking anywhere in the main body of your source file also closes the Find dialog Click the pluses in the left-hand border as well – show filtered source Replace Adheres to COBOL columns If replace would push text past column 73 you will receive a warning Replace all Changes "found" to replacement values throughout the file

93  Workshop Find/Replace Dialog
Load SANDBOX.cbl into the editor Do a Ctrl+F Search for All 01 Note that this found a bunch of comment lines. Why? Restrict the column search to between 8 and 20 Find All: (again) Expand some of the plus-signs and un-filter the code Press: Ctrl+W … What does that do? Customizing Search From Window, Preferences Scroll down and select: - LPEX Editor - Find Text Check:  Select found text  Incremental find dialog Click OK Re-run the above Searches

94  Workshop Find/Replace Dialog – continued
Experiment with the Find/Replace options and option buttons covered on the previous Find/Replace Dialog slides. After each search press Ctrl/W. Here are some suggestions… Find All date Check  Case sensitive – and rerun this search 811 perform Check  Whole word – and rerun this search Try experimenting with your own searches, using these Find/Replace options: Case sensitive Whole word Select found text Replace Replace All Previous Next Next (combined with) (This is like PF5/PF6) When you are finished, close your editor session and do not save changes

95 Find All (Exclude) Search Within File
Common ISPF editing technique: - Exclude various source lines - find (within) excluded lines - Used extensively on giant production source files Command ====> F (or C) 'xxx' X To perform this using RDz use the same command line syntax format: 1. Exclude lines 2. Then type: F <xxxx> ALL X This will limit the scope of the search to only the excluded source lines Note that ALL operand is not required

96 Find All (Not Exclude) Search
Another common ISPF technique - Exclude various source lines - Find within (not) excluded lines Command ====> F (or C) 'xxx' NX To perform this using RDz use the same command line syntax format: 1. Exclude lines 2. Then type: F <xxxx> ALL NX This will limit the scope of the search to only the NOT excluded source lines Note that the ALL operand is not required

97  Workshop – Find Exclude/Not Exclude
From z/OS Projects Open the SANDBOX.cbl program in the editor Using the Outline view, find the beginning of the PROCEDURE DIVISION Find the MOVE "000-HOUSEKEEPING" TO PARA-NAME. Statement Using Ctrl+Enter, split the line before the TO Using the mouse Cut & Paste technique, rejoin the lines Under the * DATE VALUES comment line, split the next four MOVE statements after the TO operand Scroll to the top of file and using Ctrl+Delete erase to end of line five of the comments Using the Outline view, return to the 000-HOUSEKEEPING paragraph, and re-join two of the MOVE statement lines you split in the above steps (again use the Cut & Paste technique) Using the Outline view, go to the: DATA DIVISION, FILE SECTION, TRMTDATA, and INPATIENT-TREATMENT-REC-DATA line in the source Place your cursor on that line at column 22 Press the Home and End keys a few times Scroll down to the PROCEDURE DIVISION and practice/experiment using: Ctrl+Enter, Joining Lines, Ctrl+Delete, Home and End for five minutes Close the editor and do NOT save your changes

98 RDz for ISPF Developers
UNIT RDz for ISPF Developers Topics: The RDz Workbench – Terms and Concepts Editing COBOL Programs ISPF Prefix Area Commands Editing With Keystroke Shortcuts Find and Replace Dialog Creating New Programs From Scratch Miscellaneous Features – Hex edit, Content Assist Paragraph (control flow) and Data Flow Analysis Working with Copybooks and Property Files Appendix – ISPF / LPEX Editor Comparison

99  Creating New Programs Using Templates
To create new programs from scratch, you've been creating a new file and saving it with a .cbl suffix This works, but the "Best Practice" method is to use COBOL program templates  From File, New > Other… …in the Wizards panel, - Type: cobol - Select COBOL Program - Click Next > …in the COBOL Program panel, - Name the Program Finally you specify which folder to create the program in Select the cobol folder Click Next >

100  Creating New Programs From Templates – continued
You can add CICS or DB2 template sample code to your new program: Check the features you'd like Click Finish A few things happen: Your new program is created  The Snippets View is opened We will discuss Snippets soon  Note that you can customize the templates used to create new programs From Window, Preferences, select: COBOL Code Templates Features

101 Creating New Programs Using Copy/Paste
Instead of using pre-defined templates, you may be used to "cannibalizing" pre-existing programs, by creating a new PDS member from an existing program, then editing OUT the code you don't need for your new development work. + Pluses: + Fast – Minuses: - Must clean-up PDS member fragments - More difficult with SCM (instead of PDS) - Most useful if copying either the entire program or one long contiguous block of code There are two development patterns that you will want to employ to do this with RDz Create a new empty file – saved as <newFileName>.cbl Open a second (existing) COBOL program and Copy all of the existing program into the new file.cbl …or… Copy/Paste only specific portions of the existing program into the new file.cbl Both have their uses, so let's have a look at how to proceed with them

102  Creating New Programs Using Copy/Paste – Copy Entire Program
This you've done already, using code embedded in the slide notes: 1. Open an existing program source in the editor: StartApp.cbl - Select all (Ctrl+A) then Copy (Ctrl+C) all of the statements in the program 2. Right-click over the cobol folder in z/OS Projects and select: New > File Name your new file: Start2.cbl 3. Click your mouse-pointer into the new file in the top-left hand corner (column 1, row 1) and press Ctrl+V to paste the program statements you copied in step 1 4. Save the file (Ctrl+S) 5. Close both programs  Repeat the above process: - PrintApp.cbl – copy the entire program to: Print2.cbl - TRMTRDZ.cbl – copy the entire program to: TRMT2.cbl

103 Creating New Programs Using Copy/Paste Code Blocks
Often it's easier to create new programs from non-contiguous blocks of code, cannibalized from an existing program. Example – grab specific SELECT/ASSIGNS, Useful WORKING-STORAGE fields not part of COPY or INCLUDE, a (couple of) paragraphs or a lengthy computation, etc. This is easily done combining mouse-based copy/paste with the previous new program technique or (even better) starting from a Template: 1. Open an existing to-be-copied program in the editor (we'll call this: From-Program) 2. Start from a program template, or create a new empty program as before (we'll call this: To-Program) 3. Maximize your Editors 4. Find and Select copy source within: From-Program 5. Paste the copied source into the appropriate area of: To-Program 6. Scroll down and find the next piece of code to copy in From-Program – repeat steps 5 & 6

104  New Program File for Workshops
Steps: From this PowerPoint's Slide Notes: Select all (Ctrl+A) then Copy (Ctrl+C) all of the statements in the program If you don't remember how to access Slide Notes return to slide#5 in this PowerPoint From z/OS Projects Right-click over the cobol folder and select: New > File Name the file: DFLOWRDZ.cbl Click your mouse-pointer into the new file in the top-left hand corner (column 1, row 1) and press Ctrl+V to paste the program statements you copied in step 1 Save the file (Ctrl+S) IDENTIFICATION DIVISION. PROGRAM-ID. DFLOWRDZ. AUTHOR. IBM. INSTALLATION. COBOL DEV Center. DATE-WRITTEN. 01/23/88. DATE-COMPILED. 01/23/88. SECURITY. CONFIDENTIAL PATIENT DATA. ****************************************************************** *REMARKS. * * THIS PROGRAM EDITS A DAILY TREATMENT TRANSACTION FILE * PRODUCED BY DATA ENTRY OPERATORS FROM CICS SCREENS * IT CONTAINS EVERY TREATMENT FOR EVERY PATIENT IN THE * HOSPITAL. * THE PROGRAM EDITS EACH RECORD AGAINST A NUMBER OF * CRITERIA, BALANCES FINAL TOTALS AND WRITES GOOD * RECORDS TO AN OUTPUT FILE INPUT FILE DDS0001.TRMTDATA VSAM MASTER FILE DDS0001.PATMASTR INPUT ERROR FILE DDS0001.TRMTERR OUTPUT FILE PRODUCED DDS001.TRMTEDIT DUMP FILE SYSOUT ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. IBM-390. OBJECT-COMPUTER. IBM-390. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT SYSOUT ASSIGN TO UT-S-SYSOUT ORGANIZATION IS SEQUENTIAL. SELECT TRMTDATA ASSIGN TO UT-S-TRMTDATA ACCESS MODE IS SEQUENTIAL FILE STATUS IS OFCODE. SELECT TRMTEDIT ASSIGN TO UT-S-TRMTEDIT SELECT TRMTERR ASSIGN TO UT-S-TRMTERR SELECT PATMSTR ASSIGN to PATMSTR ORGANIZATION is INDEXED ACCESS MODE is RANDOM RECORD KEY is PATIENT-KEY FILE STATUS is PATMSTR-STATUS. DATA DIVISION. FILE SECTION. FD SYSOUT RECORDING MODE IS F LABEL RECORDS ARE STANDARD RECORD CONTAINS 130 CHARACTERS BLOCK CONTAINS 0 RECORDS DATA RECORD IS SYSOUT-Rec. 01 SYSOUT-REC PIC X(130). ****** THIS FILE IS PASSED IN FROM THE DATA COLLECTIONS SYSTEM ****** IT CONSISTS OF ALL PATIENT TREATMENTS ENTERED ****** THERE ARE TWO RECORD FORMATS - DETAIL AND TRAILER RECS ****** OUT OF BALANCE CONDITIONS SHOULD CAUSE THE JOB TO ABEND FD TRMTDATA RECORD CONTAINS 1101 CHARACTERS DATA RECORD IS INPATIENT-TREATMENT-REC-DATA. 01 INPATIENT-TREATMENT-REC-DATA PIC X(1101). ****** THIS FILE IS WRITTEN FOR ALL TREATMENT RECORDS THAT PASS ****** THE PROGRAM'S EDIT ROUTINES ****** THE TRAILER RECORD SHOULD ONLY CARRY THE NUMBER OF ****** RECORDS IN THE FILE ON TO THE NEXT JOB STEP FD TRMTEDIT DATA RECORD IS INPATIENT-TREATMENT-EDIT. 01 INPATIENT-TREATMENT-EDIT PIC X(1101). FD TRMTERR RECORD CONTAINS 1141 CHARACTERS DATA RECORD IS INPATIENT-TREATMENT-ERR. 01 INPATIENT-TREATMENT-ERR. 05 ERR-MSG PIC X(40). 05 REST-OF-REC PIC X(1101). FD PATMSTR RECORD CONTAINS 2964 CHARACTERS DATA RECORD IS PATIENT-MASTER-REC. 01 PATMSTR-REC. 05 PATIENT-KEY PIC X(06). 05 FILLER PIC X(2958). ** QSAM FILE WORKING-STORAGE SECTION. 01 FILLER PIC X(32) VALUE '* WORKING STORAGE BEGINS HERE *'. '****** DUMP MSG ****************'. ***************************************************************** * DUMP POINTER AREA * PARA POINTER- MOVE PARAGRAPH NUMBER TO THIS POINTER * * AS EACH PARAGRAPH IS ENTERED. DO NOT * * MOVE PARAGRAPH NUMBERS OF COMMON * PARAGRAPHS (USE COMM POINTER). * * * COMM POINTER - EACH COMMON PARAGRAPH SHOULD MOVE * * ITS PARAGRAPH NUMBER TO THIS POINTER * * AT IT INCEPTION. 01 DUMP-LOCATOR. 05 FILLER PIC X(32) VALUE '>>>>>>> WS DUMP POINTERS >>>>>>>'. 05 FILLER PIC X(16) VALUE 'Z PARA POINTER'. 05 PARA-POINTER PIC X(8) VALUE SPACES. 05 FILLER PIC X(8) VALUE ' Z'. 05 FILLER PIC X(16) VALUE 'Z COMM POINTER'. 05 COMM-POINTER PIC X(8) VALUE SPACES. VALUE '<<<<<<< WS DUMP POINTERS <<<<<<<'. 01 DUMP-DISPLAY. 05 DUMP-STATUS PIC X(3) VALUE SPACES. 05 DUMP-MESSAGE PIC X(61) VALUE 'NO MSG'. 01 FILE-STATUS-CODES. 05 PATMSTR-STATUS PIC X(2). 88 RECORD-FOUND VALUE "00". 88 PATMSTR-NOT-FOUND VALUE "23". 05 OFCODE PIC X(2). 88 CODE-WRITE VALUE SPACES. * COPY BNCHTRMT. ** DAILY PATIENT/TREATMENTS FILE 01 INPATIENT-TREATMENT-REC. 05 RECORD-TYPE PIC X(01). 88 TRAILER-REC VALUE "T". 05 PATIENT-ID PIC 9(6). 05 TREATMENT-DATE-TIME. 10 TREATMENT-DATE PIC X(08). 10 FILLER PIC X. 10 TREATMENT-TIME PIC X(08). 10 FILLER PIC X(09). 05 BED-IDENTITY PIC X(4). 05 PRIMARY-DIAGNOSTIC-CODE PIC X(5). 05 MEDICATION-ID PIC X(8). 05 TREATMENT-MODE PIC X(03). 88 ORAL-ADMIN VALUE "0RA". 88 INTRAVENOUS-ADMIN VALUE "INV". 88 INJECTION VALUE "INJ". 88 MRI VALUE "MRI". 88 CAT VALUE "CAT". 88 CHEMO-THERAPY VALUE "CHM". 88 RADIATION-THERAPY VALUE "RAD". 88 SURGERY VALUE "SUR". 88 PHYSIO-THERAPY VALUE "PHY". 88 EQUIPMENT VALUE "EQP". 88 LAB-TESTS VALUE "LAB". 88 VENIPUNCTURE VALUE "VEN" MN 88 OTHER-TREATMENT VALUE "OTH". 88 VALID-TRTMNT-MODES VALUES ARE "ORA", "INV", "INJ", "MRI", "CAT" "SUR", "PHY", "EQP", "LAB", "VEN" "MRI", "CAT", "CHM", "RAD", "OTH". 05 BILLABLE-TREATMENT-IND PIC X(01). 88 NON-BILLABLE VALUE "N". 88 BILLABLE VALUE "B". 88 VALID-BILLABLE-TYPES VALUES ARE "N", "B". 05 MEDICATION-COST PIC 9(5)V99. 05 ATTENDING-PHYS-ID PIC X(08). 05 PRESCRIBING-PHYS-ID PIC X(08). 05 SUPERVISOR-NURSE-ID PIC X(08). 05 TREATMENT-NURSE-ID PIC X(08). 05 PHARMACY-CST PIC 9(3)V99. 05 ANCILLARY-CHARGE PIC 9(3)V99. 05 LAB-CHARGES OCCURS 12 TIMES. 10 LAB-TEST-ID PIC X(08). 10 TEST-CATEGORY PIC X(04). 88 PULMINARY VALUE "PULM". 88 BLOOD VALUE "BLOD". 88 SPINAL VALUE "SPNL". 88 H1N VALUE "H1N1". 88 GASTRO VALUE "GAST". 88 LUNG VALUE "LUNG". 88 NUCLEAR-MEDICINE VALUE "NUCL". 88 RENAL VALUE "RNAL". 88 MISCELLANEOUS VALUE "MISC". 88 VALID-CATEGORY VALUES ARE "PULM", "BLOD", "NUCL", "GAST", "SPNL", "LUNG", "RNAL", "H1N1", "MISC". ****** FOR PERFORMANCE, MOVE H1N1 TO THE TOP OF THE LIST 10 TEST-SHORT-DESC PIC X(25). 10 TEST-COST PIC 9(5)V99. 10 VENIPUNCTURE-COST PIC 9(3)V99. 10 PRESCRIBING-PHYS PIC X(08). 10 DIAG-CDE PIC X(05). 05 TREATMENT-COMMENTS PIC X(254). * COPY TRAILER. 01 WS-OUTPUT-REC. 05 PATIENT-NBR-O PIC 9(6). 05 FILLER PIC X(2) VALUE SPACES. 05 PATIENT-NAME-O PIC X(20). 05 PATIENT-PHONE-O PIC X(10). 05 PATIENT-TYPE-O PIC X(2). 05 BED-IDENTITY-O PIC ZZZ9. 05 CURR-DATE-O PIC X(6). 05 PATIENT-PHRM-PER-DAY-O PIC $$,$$9.99. 05 INS-COVERAGE-PERC-O PIC 999. 05 INS-TYPE-O PIC X(4). 05 HOSPITAL-STAY-LTH-O PIC 999. 05 FILLER PIC X(7) VALUE SPACES. 01 WS-TRAILER-REC. 05 FILLER PIC X(1). 05 IN-RECORD-COUNT PIC 9(9). 05 IN-MEDICATION-CHARGES PIC S9(9)V99. 05 IN-PHARMACY-CHARGES PIC S9(7)V99. 05 IN-ANCILLARY-CHARGES PIC S9(5)V99. * COPY PATMSTR. ** VSAM FILE * COPY PTMSTR. 01 PATIENT-MASTER-REC. 05 PATIENT-ID PIC X(6). 05 PATIENT-TYPE PIC X(1). 88 INPATIENT VALUE "I". 88 OUTPATIENT VALUE "0". 88 VALID-TYPE VALUES ARE "I", "O". 05 PREVIOUS-PATIENT-IND PIC X(01). 88 PREV-PATIENT VALUE "Y". 88 NOT-PREVE-PATIENT VALUE "N". 88 VALID-PREV-IND VALUES ARE "Y", "N". 05 PRIMARY-STAY-WARD-NBR PIC X(4). 88 INTENSIVE-CARE VALUE "0010". 88 OBSTETRICS VALUE "2010". 88 PEDIATRICS VALUE "1010". 88 ONCOLOGY VALUE "0011". 88 CARDIO-THORACIC VALUE "0110". 88 GENERAL VALUE "0000". 88 VALID-WARD VALUES ARE "0010", "2010", "1010", "0011", "0110", "0000". 05 BED-IDENTITY-PRIMARY PIC 9(4). 05 DATE-ADMIT PIC X(10). 05 DATE-DISCHARGE PIC X(10). 05 ATTENDING-PHYSICIAN PIC X(08). 05 DIAGNOSTIC-CODE-PRIMARY PIC X(05). 05 DIAGNOSTIC-CODE-SECONDARY PIC X(05). 05 DIAGNOSTIC-CODE-TERTIARY PIC X(05). 05 INS-TYPE PIC X(3). 88 VALID-INS-TYPE VALUES ARE "HMO", "PPO", "POS" "MAN". 88 Managed-Care value "MAN". 05 HOSPITAL-STAY-LTH PIC 999. 05 PATIENT-TOT-AMT PIC 9(7)V99. 05 PRIMARY-CARE-PHYSICIAN-ID PIC X(8). 05 IN-OUT-NETWORK PIC X(1). 88 IN-NETWORK VALUE "N". 88 OUT-OF-NETWORK VALUE "O". 05 COPAY PIC S9(3). 05 REMAINING-DEDUCTIBLE PIC S9(4). 05 HIPAA-FORM-SIGNED-IND PIC X(01). 88 HIPAA-SIGNED VALUE "Y". 88 HIPAA-UNSIGNED VALUE "N". 05 PATIENT-ADMIT-COMMENTS PIC X(254). 05 DAILY-LAB-CHARGES-SUMMARY OCCURS 20 TIMES. 10 LAB-TEST-S-ID PIC X(08). 10 LAB-TEST-DATE PIC X(08). 10 TEST-SHORT-S-DESC PIC X(25). 10 TEST-DIAG-CODE PIC X(5). 10 TEST-CHARGES PIC 9(7)V99. 10 PRESCRIBING-S-PHYS-ID PIC X(08). 05 EQUIPMENT-CHARGES-SUMMARY OCCURS 20 TIMES. 10 EQUIPMENT-S-ID PIC X(08). 10 EQUIPMENT-CHARGE-DATE PIC X(08). 10 EQUIP-DIAG-CODE PIC X(5). 10 EQUIPMENT-S-SHORT-DESC PIC X(30). 10 EQUIPMENT-CHARGES PIC 9(7)V99. 10 EQUIPMENT-PRES-PHYS-ID PIC X(08). 01 WS-SYSOUT-REC. 05 MSG PIC X(80). 77 WS-DATE PIC 9(6). * COPY WSACCUMS. 01 COUNTERS-AND-ACCUMULATORS. 05 RECORDS-WRITTEN PIC 9(7) COMP. 05 RECORDS-IN-ERROR PIC 9(7) COMP. 05 RECORDS-READ PIC 9(7) COMP. 05 WS-MEDICATION-CHARGES PIC S9(9)V99 COMP-3. 05 WS-ANCILLARY-CHARGES PIC S9(5)V99 COMP-3. 05 IN-PHARMACY-CHARGE-TMP PIC S9(5)V99 COMP-3. 05 TOTAL-CHARGES PIC S9(5)V99 COMP-3. 05 PHARM-MEDICATION PIC S9(5)V99 COMP-3. 01 MISC-WS-FLDS. 05 STR-LTH PIC 9(04) VALUE 0. 05 WS-PHARMACY-CHARGES PIC S9(7)V99 COMP-3. 05 RETURN-CD PIC S9(04) VALUE 0. 05 ROW-SUB PIC 9(02). 05 ERROR-MSG-WS. 10 ERROR-MSG-FIRST PIC X(20). 10 ERROR-MSG-REST PIC X(60). 01 FLAGS-AND-SWITCHES. 05 MORE-DATA-SW PIC X(01) VALUE "Y". 88 NO-MORE-DATA VALUE "N". 05 ERROR-FOUND-SW PIC X(01) VALUE "N". 88 RECORD-ERROR-FOUND VALUE "Y". 88 VALID-RECORD VALUE "N". 05 MORE-TABLE-ROWS PIC X(01) VALUE "Y". 88 NO-MORE-TABLE-ROWS VALUE "N". * COPY ABENDREC. 01 ABEND-REC. 05 FILLER PIC X(12) VALUE "ABEND PARA: ". 05 PARA-NAME PIC X(20). 05 ABEND-REASON PIC X(40). 05 FILLER PIC X(10) VALUE " EXPECTED:". 05 EXPECTED-VAL PIC 9(6). 05 FILLER PIC X(8) VALUE " ACTUAL:". 05 ACTUAL-VAL PIC 9(6). 05 FILLER PIC X(9) VALUE " VALUE-3:". 05 VALUE PIC 9(6). 05 FILLER PIC X(9) VALUE "S0CB VALS". 05 ONE-VAL PIC 9 VALUE 1. 05 ZERO-VAL PIC 9 VALUE 0. * VSAM FILES * COPY PATINS. 01 PATIENT-INSURANCE. 05 INS-COMPANY-PRIMARY. 10 PATIENT-ID PIC X(6). 10 INS-COMPANY-PRIMARY-ID PIC X(8). 10 CARRIER-NAME PIC X(30). 10 CARRIER-PHONE PIC X(10). 10 CARRIER-FAX PIC X(10). 10 INSURED-NAME PIC X(30). 10 INSURED-GENDER PIC X(01). 88 FEMALE VALUE "F". 88 MALE VALUE "M". 88 NOT-PROVIDED VALUE "N". 88 VALID-GENDER VALUES ARE "F", "M", "N". 10 PATIENT-RELATIONSHIP PIC X(02). 88 SPOUSE VALUE "SP". 88 SELF-REL VALUE "SE". 88 CHILD VALUE "CH". 88 OTHER-REL VALUE "OT". 88 VALID-RELS VALUES ARE "SP", "SE", "SP", "OT". 10 INS-IDENT-NBR PIC X(20). 10 GROUP-NBR PIC X(10). 10 ADDRESS-CLAIMS. 15 STREET PIC X(30). 15 CITY PIC X(20). 15 STATE PIC X(02). 15 ZIP PIC X(9). 10 RETIRED-IND PIC X(01). 88 RETIRED VALUE "Y". 88 NOT-RETIRED VALUE "N". 88 VALID-RET-IND VALUES ARE "Y", "N". 05 INS-COMPANY-SECONDARY. 10 CARRIER-ID PIC X(8). 10 INSUREDS-NAME PIC X(30). 05 BENEFIT-ASSIGNMENT-DETAILS. 10 MEDICARE-BENEFICIARY PIC X(30). 10 MEDICARE-CLAIM-NBR PIC X(15). 10 COMMERCIAL-BENEFICIARY PIC X(30). 10 COMMERCIAL-CLAIM-NBR PIC X(15). 05 PAT-INSURANCE-COMMENTS PIC X(100). 05 FILLER PIC X(142). * COPY PATPERSN. 01 PATIENT-PERSONAL-MASTER-REC. 05 PATIENT-NBR-MR PIC X(6). 05 SSNBR PIC X(10). 05 AGE PIC 9(03). 05 DRIVERS-LICENSE-NO PIC X(10). 05 ISSUING-STATE PIC X(02). 05 OCCUPATION PIC X(20). 05 EMPLOYER. 10 EMP-NAME PIC X(30). 10 EMP-ADDR PIC X(30). 10 EMP-CITY PIC X(30). 10 EMP-STATE PIC X(02). 10 EMP-ZIP PIC X(09). 05 MARITAL-STATUS PIC X(01). 88 MARRIED VALUE "M". 88 SINGLE VALUE "S". 88 DIVORCED VALUE "D". 88 WIDOWED VALUE "W". 88 VALID-STATUS VALUES ARE "M", "S", "W", "D". 05 PATIENT-NAME. 10 LAST-NAME PIC X(15). 10 MIDINIT PIC X(01). 10 FIRST-NAME PIC X(20). 05 PHONE-HOME PIC X(10). 05 PHONE-WORK PIC X(10). 05 PHONE-MOBILE PIC X(10). 05 HEIGHT PIC 9(02). 05 WEIGHT PIC 9(03). 05 GENDER PIC X(01). 05 DOB PIC 9(05). 05 FAMILY-CONTACT-PRIMARY PIC X(30). 05 FCON-RELATIONSHIP PIC X(02). 88 SPOUSE VALUE "SP". 88 SIBLING VALUE "SI". 88 CHILD VALUE "CH". 88 FRIEND VALUE "FR". VALUES ARE "SP", "SI", "CH", "FR". 05 MINOR-INDICATOR PIC X(01) VALUE SPACES. 05 RESPONSIBLE-PARTY. 10 SSN PIC X(10). 10 OCCUPATION PIC X(30). 10 EMPLOYER PIC X(30). 10 CITY PIC X(20). 10 ST PIC X(02). 10 ZIP PIC X(09). 05 FCON-PHONE-H PIC 9(10). 05 FCON-PHONE-C PIC X(10) VALUE SPACE. 05 PAYMENT-METHOD-TYPE PIC X(02). 88 CREDIT-CARD VALUE "CC". 88 CHECK VALUE "CH". 88 CASH VALUE "CA". 88 VALID-PAYMENT-METHOD VALUES ARE "CC", "CH", "CA". 05 CREDIT-CARD-EXP-DATE. 10 EXP-MONTH PIC 9(02). 10 EXP-YEAR PIC 9(04). 05 HOME-ADDRESS. 10 APARTMENT-NBR PIC X(05). 10 STREET PIC X(30). 10 CITY PIC X(20). 10 STATE PIC X(02). 10 POSTAL-CODE PIC X(09). 10 COUNTRY PIC X(20). 05 OCCUPATION PIC X(30). 05 EMPLOYER PIC X(30). 05 PATIENT-COMMENTS PIC X(255). * COPY DIAGCODE. ***** DB2 TABLE DCLGENS * EXEC SQL INCLUDE WARDDATA END-EXEC. * EXEC SQL INCLUDE MEDICATN END-EXEC. * EXEC SQL INCLUDE HOSPBED END-EXEC. * EXEC SQL INCLUDE DIAGCODE END-EXEC. * DCLGEN TABLE(DDS0001.DIAG_CODES) * * LIBRARY(DDS0001.TEST.COPYLIB(DIAGCODE)) * * ACTION(REPLACE) * * LANGUAGE(COBOL) * * QUOTE * * DBCSDELIM(NO) * * ... IS THE DCLGEN COMMAND THAT MADE THE FOLLOWING STATEMENTS * EXEC SQL DECLARE DDS0001.DIAG_CODES TABLE ( DIAG_CODE CHAR(5) NOT NULL, INS_TYPE CHAR(3) NOT NULL, COPAY SMALLINT NOT NULL, DEDUCTIBLE SMALLINT NOT NULL ) END-EXEC. * COBOL DECLARATION FOR TABLE DDS0001.DIAG_CODES * 01 DCLDIAG-CODES. 10 DIAG-CODE PIC X(5). 10 INS-TYPE PIC X(3). 10 COPAY PIC S9(4) USAGE COMP. 10 DEDUCTIBLE PIC S9(4) USAGE COMP. * THE NUMBER OF COLUMNS DESCRIBED BY THIS DECLARATION IS * * DCLGEN TABLE(DDS0001.HOSP_BED) * * LIBRARY(DDS0001.TEST.COPYLIB(HOSPBED)) * EXEC SQL DECLARE DDS0001.HOSP_BED TABLE ( BED_ID CHAR(4), ROOM_ID CHAR(4), WARD_ID CHAR(4), SPECIAL_CHARGES DECIMAL(7, 2) * COBOL DECLARATION FOR TABLE DDS0001.HOSP_BED * 01 DCLHOSP-BED. 10 BED-ID PIC X(4). 10 ROOM-ID PIC X(4). 10 WARD-ID PIC X(4). 10 SPECIAL-CHARGES PIC S9(5)V9(2) USAGE COMP-3. * DCLGEN TABLE(DDS0001.MEDICATION) * * LIBRARY(DDS0001.TEST.COPYLIB(MEDICATN)) * EXEC SQL DECLARE DDS0001.MEDICATION TABLE ( MEDICATION_ID CHAR(8), MED_NAME CHAR(40), SHORT_DESCRIPTION CHAR(100), COST DECIMAL(7, 2), PHARMACY_COST DECIMAL(5, 2) * COBOL DECLARATION FOR TABLE DDS0001.MEDICATION * 01 DCLMEDICATION. 10 MEDICATION-ID PIC X(8). 10 MED-NAME PIC X(40). 10 SHORT-DESCRIPTION PIC X(100). 10 COST PIC S9(5)V9(2) USAGE COMP-3. 10 PHARMACY-COST PIC S9(3)V9(2) USAGE COMP-3. * THE NUMBER OF COLUMNS DESCRIBED BY THIS DECLARATION IS * * DCLGEN TABLE(DDS0001.WARD_DATA) * * LIBRARY(DDS0001.TEST.COPYLIB(WARDDATA)) * EXEC SQL DECLARE DDS0001.WARD_DATA TABLE ( WARD_ID CHAR(4), PRIMARY_PHYSICIAN_ID CHAR(8), SUPERVISE_NURSE_ID CHAR(8), LOCATION CHAR(8), NUMBER_OF_BEDS SMALLINT, BASE_ROOM_CHARGE DECIMAL(7, 2) * COBOL DECLARATION FOR TABLE DDS0001.WARD_DATA * 01 DCLWARD-DATA. 10 PRIMARY-PHYSICIAN-ID PIC X(8). 10 SUPERVISE-NURSE-ID PIC X(8). 10 LOCATION PIC X(8). 10 NUMBER-OF-BEDS PIC S9(4) USAGE COMP. 10 BASE-ROOM-CHARGE PIC S9(5)V9(2) USAGE COMP-3. * THE NUMBER OF COLUMNS DESCRIBED BY THIS DECLARATION IS * * COPY SQLCA. 01 SQLCA. 03 SQLCAID PIC X(8). 03 SQLCABC PIC S9(9) COMP. 03 SQLCODE PIC S9(9) COMP. 03 SQLERRM. 49 SQLERRML PIC S9(4) COMP. 49 SQLERRMC PIC X(70). 03 SQLERRP PIC X(8). 03 SQLERRD OCCURS 6 PIC S9(9) COMP. 03 SQLWARN. 05 SQLWARN PIC X. 05 SQLWARN PIC X. 05 SQLWARN PIC X. 05 SQLWARN PIC X. 05 SQLWARN PIC X. 05 SQLWARN PIC X. 05 SQLWARN PIC X. 05 SQLWARN PIC X. 03 SQLEXT PIC X(8). PROCEDURE DIVISION. PERFORM 000-HOUSEKEEPING THRU 000-EXIT. PERFORM 100-MAINLINE THRU 100-EXIT UNTIL NO-MORE-DATA OR ******* Balancing logic put in by TGD 02/12/92 TRAILER-REC. PERFORM 999-CLEANUP THRU 999-EXIT. MOVE +0 TO RETURN-CODE. GOBACK. 000-HOUSEKEEPING. MOVE "000-HOUSEKEEPING" TO PARA-NAME. DISPLAY "HOUSEKEEPING". * Code your statement here to OPEN files ACCEPT WS-DATE FROM DATE. INITIALIZE COUNTERS-AND-ACCUMULATORS. PERFORM 800-OPEN-FILES THRU 800-EXIT. PERFORM 900-READ-TRMTDATA THRU 900-EXIT. IF NO-MORE-DATA MOVE "EMPTY INPUT FILE" TO ABEND-REASON GO TO 1000-ABEND-RTN. 000-EXIT. EXIT. 100-MAINLINE. MOVE "100-MAINLINE" TO PARA-NAME. * DISPLAY "100-MAINLINE". * Validate patient type and insurance coverage PERFORM 300-FIELD-EDITS THRU 300-EXIT. IF RECORD-ERROR-FOUND ADD +1 TO RECORDS-IN-ERROR PERFORM 710-WRITE-TRMTERR THRU 710-EXIT ELSE PERFORM 700-WRITE-TRMTEDIT THRU 700-EXIT. 100-EXIT. 300-FIELD-EDITS. MOVE "N" TO ERROR-FOUND-SW IN FLAGS-AND-SWITCHES. MOVE "300-FIELD-EDITS" TO PARA-NAME. ******** non-numeric fields IF NOT VALID-BILLABLE-TYPES IN BILLABLE-TREATMENT-IND MOVE "*** INVALID BILLABLE TYPE" TO ERR-MSG IN INPATIENT-TREATMENT-ERR MOVE "Y" TO ERROR-FOUND-SW GO TO 300-EXIT. IF NOT VALID-TRTMNT-MODES IN TREATMENT-MODE MOVE "*** INVALID TREATMENT MODE" TO IF PATIENT-ID IN INPATIENT-TREATMENT-REC NOT NUMERIC MOVE "*** NON-NUMERIC PATIENT-ID" TO IF PATIENT-ID IN INPATIENT-TREATMENT-REC = ZERO MOVE "*** INVALID (000000) PATIENT-ID" TO IF BED-IDENTITY IN INPATIENT-TREATMENT-REC NOT NUMERIC MOVE "*** NON-NUMERIC BED-IDENTITY" TO IF MEDICATION-COST IN INPATIENT-TREATMENT-REC NOT NUMERIC MOVE "*** NON-NUMERIC MEDICATION-COST" TO IF PHARMACY-CST IN INPATIENT-TREATMENT-REC NOT NUMERIC MOVE "*** NON-NUMERIC PHARMACY COSTS" TO IF ANCILLARY-CHARGE IN INPATIENT-TREATMENT-REC NOT NUMERIC MOVE "*** NON-NUMERIC ANCILLARY-CHARGES" TO IF ATTENDING-PHYS-ID = SPACES MOVE "*** BLANK ATTENDING PHYSICIAN-ID" TO IF GROUP-NBR in INS-COMPANY-PRIMARY = SPACES MOVE "*** BLANK INS GROUP NBR" TO IF PRESCRIBING-PHYS-ID = SPACES MOVE "*** BLANK PRESCRIBING PHYSICIAN-ID" TO CALL 'DTEVAL' USING TREATMENT-DATE, RETURN-CD. IF RETURN-CD < 0 MOVE "*** BAD DATE PORTION OF DATE-TIME" TO MOVE "Y" TO MORE-TABLE-ROWS. PERFORM 350-CHECK-LAB-TABLE THRU 350-EXIT VARYING ROW-SUB FROM 1 BY 1 UNTIL NO-MORE-TABLE-ROWS OR ROW-SUB = 12. IF VALID-RECORD PERFORM 400-NUMERIC-RANGE-EDITS THRU 400-EXIT. ****** VERIFY TABLE (JUST TYPES AND LAB-TEST-ID) 300-EXIT. 350-CHECK-LAB-TABLE. IF LAB-TEST-ID(ROW-SUB) = SPACES MOVE "N" TO MORE-TABLE-ROWS GO TO 350-EXIT. IF NOT VALID-CATEGORY(ROW-SUB) MOVE "*** INVALID LAB-TEST CATEGORY" TO 350-EXIT. 400-NUMERIC-RANGE-EDITS. MOVE "400-NUMERIC-RANGE-EDITS" TO PARA-NAME. ******** Call to VSAM file to read record IF (MEDICATION-COST > 99000 OR MEDICATION-COST < 1.01) MOVE "*** INVALID MEDICATION COST" TO GO TO 400-EXIT. IF (PHARMACY-CST IN INPATIENT-TREATMENT-REC > 990 OR PHARMACY-CST IN INPATIENT-TREATMENT-REC < .99) MOVE "*** INVALID PHARMACY COSTS" TO IF (ANCILLARY-CHARGE > 900 OR ANCILLARY-CHARGE < 1.01) MOVE "*** INVALID ANCILLARY CHARGES" TO IF (SSN IN RESPONSIBLE-PARTY > " " OR SSN IN RESPONSIBLE-PARTY < " ") MOVE "*** INVALID SOCIAL SECURITY #" TO IF (HOSPITAL-STAY-LTH > 365 OR HOSPITAL-STAY-LTH < 1) MOVE "*** INVALID HOSPITAL STAY LTH" TO IF (EQUIPMENT-CHARGES(ROW-SUB) > OR EQUIPMENT-CHARGES(ROW-SUB) < 99.99) MOVE "*** INVALID EQUIPMENT CHARGES" TO IF (EXP-MONTH > 12 OR EXP-MONTH < 1) MOVE "*** INVALID CREDIT-CARD EXP. DATE" TO PERFORM 450-CROSS-FIELD-EDITS THRU 450-EXIT. PERFORM 500-CROSS-FILE-EDITS THRU 500-EXIT. 400-EXIT. 450-CROSS-FIELD-EDITS. MOVE "450-CROSS-FIELD-EDITS" TO PARA-NAME. ******** Specific requirements for certain procedures IF MRI OR CAT OR CHEMO-THERAPY OR RADIATION-THERAPY OR SURGERY OR LAB-TESTS IF MEDICATION-COST = ZERO OR ANCILLARY-CHARGE = ZERO MOVE "*** INVALID $$ AMOUNTS FOR PROCEDURES" TO GO TO 450-EXIT. IF ORAL-ADMIN OR INTRAVENOUS-ADMIN OR INJECTION IF PHARMACY-CST IN INPATIENT-TREATMENT-REC = ZERO OR IF NOT OTHER-TREATMENT IF TREATMENT-NURSE-ID = SPACES OR SUPERVISOR-NURSE-ID = SPACES MOVE "*** INVALID NURSING ENTRIES" TO IF NOT (OTHER-TREATMENT AND LAB-TESTS) IF TREATMENT-COMMENTS = SPACES MOVE "*** INVALID TREATMENT COMMENTS" TO IF CHEMO-THERAPY OR RADIATION-THERAPY OR SURGERY MOVE +0 TO STR-LTH CALL 'STRLTH' USING TREATMENT-COMMENTS, STR-LTH IF STR-LTH < 25 MOVE "*** INVALID TREATMENT COMMENT LENGTH" TO 450-EXIT. 500-CROSS-FILE-EDITS. MOVE "500-CROSS-FILE-EDITS" TO PARA-NAME. MOVE PATIENT-ID IN INPATIENT-TREATMENT-REC TO PATIENT-KEY. READ PATMSTR INTO PATIENT-MASTER-REC. IF NOT RECORD-FOUND MOVE "*** PATIENT NOT-FOUND ON MASTER FILE" TO GO TO 500-EXIT. PERFORM 600-DB2-TABLE-EDITS THRU 600-EXIT. 500-EXIT. 600-DB2-TABLE-EDITS. MOVE "600-DB2-TABLE-EDITS" TO PARA-NAME. ******** EXEC SQL to get info from DB2 MOVE ZERO TO ANCILLARY-CHARGE. MOVE DIAGNOSTIC-CODE-PRIMARY IN PATIENT-MASTER-REC TO DIAG-CODE IN DCLDIAG-CODES. ****** CHECK FOR VALID DIAGNOSTIC CODE EXEC SQL SELECT DIAG_CODE INTO :DIAG-CODE FROM DDS0001.DIAG_CODES WHERE DIAG_CODE = :DIAG-CODE END-EXEC. IF SQLCODE = -811 OR 0 NEXT SENTENCE IF SQLCODE = +100 MOVE "*** DIAGNOSTIC CODE NOT-FOUND IN DIAG_CODES" TO move SQLCODE to PATIENT-ID IN INPATIENT-TREATMENT-REC MOVE DIAG-CODE IN DCLDIAG-CODES TO PRIMARY-DIAGNOSTIC-CODE move sqlcode to EXPECTED-VAL move PATIENT-ID IN INPATIENT-TREATMENT-REC to ACTUAL-VAL WRITE SYSOUT-REC FROM ABEND-REC GO TO 600-EXIT IF SQLCODE < 0 MOVE "*** FATAL DB2 ERROR" TO move sqlcode to PATIENT-ID IN INPATIENT-TREATMENT-REC GO TO 1000-DB2-ERROR-RTN. ****** CHECK FOR VALID BED IDENTITY MOVE BED-IDENTITY TO BED-ID. SELECT BED_ID INTO :BED-ID FROM DDS0001.HOSP_BED WHERE BED_ID = :BED-ID MOVE "*** BED IDENT NOT-FOUND IN HOSP_BED" TO ****** CHECK FOR VALID PHYSICIAN-ID MOVE ATTENDING-PHYS-ID TO PRIMARY-PHYSICIAN-ID. SELECT PRIMARY_PHYSICIAN_ID INTO :PRIMARY-PHYSICIAN-ID FROM DDS0001.WARD_DATA WHERE PRIMARY_PHYSICIAN_ID = :PRIMARY-PHYSICIAN-ID MOVE "*** ATTENDING PHYSICIAN NOT FOUND IN TABLE" TO ****** CHECK FOR VALID MEDICATION-ID MOVE MEDICATION-ID IN INPATIENT-TREATMENT-REC TO MEDICATION-ID IN DCLMEDICATION. SELECT MEDICATION_ID INTO :DCLMEDICATION.MEDICATION-ID FROM DDS0001.MEDICATION WHERE MEDICATION_ID = :DCLMEDICATION.MEDICATION-ID MOVE "*** MEDICATION-ID NOT FOUND IN TABLE" TO ****** CHECK FOR VALID SUPERVISOR NURSE-ID MOVE SUPERVISOR-NURSE-ID TO SUPERVISE-NURSE-ID. SELECT SUPERVISE_NURSE_ID INTO :SUPERVISE-NURSE-ID WHERE SUPERVISE_NURSE_ID = :SUPERVISE-NURSE-ID MOVE "*** SUPERVISOR NURSE NOT FOUND" TO MOVE "*** FATAL DB2 ERROR" TO MOVE IN-PHARMACY-CHARGES TO PHARMACY-COST IN DCLMEDICATION. WHERE PHARMACY_COST >= :DCLMEDICATION.PHARMACY-COST MOVE "*** PHARMACY COST" TO 600-EXIT. 700-WRITE-TRMTEDIT. MOVE "700-WRITE-TRMTEDIT" TO PARA-NAME. COMPUTE PATIENT-PHRM-PER-DAY-O = WS-PHARMACY-CHARGES * 1.15. WRITE INPATIENT-TREATMENT-EDIT. ADD MEDICATION-COST TO WS-MEDICATION-CHARGES. ADD ANCILLARY-CHARGE TO WS-ANCILLARY-CHARGES. ADD +1 TO RECORDS-WRITTEN. ADD IN-PHARMACY-CHARGE-TMP TO TOTAL-CHARGES. 700-EXIT. 710-WRITE-TRMTERR. WRITE INPATIENT-TREATMENT-ERR. ADD +1 TO RECORDS-IN-ERROR. 710-EXIT. 800-OPEN-FILES. MOVE "800-OPEN-FILES" TO PARA-NAME. OPEN INPUT TRMTDATA. OPEN OUTPUT TRMTEDIT, SYSOUT, TRMTERR. OPEN I-O PATMSTR. 800-EXIT. 850-CLOSE-FILES. MOVE "850-CLOSE-FILES" TO PARA-NAME. CLOSE TRMTDATA, TRMTEDIT, SYSOUT, TRMTERR, PATMSTR. 850-EXIT. 900-READ-TRMTDATA. * Code your statements here to read the input file * Remember to move "NO" to IFCODE if the input file is AT END READ TRMTDATA INTO INPATIENT-TREATMENT-REC AT END MOVE "N" TO MORE-DATA-SW GO TO 900-EXIT END-READ MOVE "N" TO ERROR-FOUND-SW. ADD +1 TO RECORDS-READ. 900-EXIT. 999-CLEANUP. MOVE "999-CLEANUP" TO PARA-NAME. * Final file-handling edits and trailer record handling IF NOT TRAILER-REC MOVE "** INVALID FILE - NO TRAILER REC" TO ABEND-REASON IF RECORDS-READ NOT EQUAL TO IN-RECORD-COUNT MOVE "** INVALID FILE - # RECORDS OUT OF BALANCE" TO ABEND-REASON IF WS-ANCILLARY-CHARGES NOT EQUAL TO IN-ANCILLARY-CHARGES MOVE "** ANCILLARY CHARGES OUT OF BALANCE" MOVE WS-ANCILLARY-CHARGES TO EXPECTED-VAL MOVE IN-ANCILLARY-CHARGES TO ACTUAL-VAL DISPLAY "** ANCILLARY CHARGES IN **" DISPLAY WS-ANCILLARY-CHARGES DISPLAY "** ANCILLARY CHARGES EXPECTED **" DISPLAY IN-ANCILLARY-CHARGES. IF WS-MEDICATION-CHARGES NOT EQUAL TO IN-MEDICATION-CHARGES MOVE "** MEDICATION CHARGES OUT OF BALANCE" DISPLAY "** MEDICATION CHARGES IN **" DISPLAY WS-MEDICATION-CHARGES DISPLAY "** MEDICATION CHARGES EXPECTED **" DISPLAY IN-MEDICATION-CHARGES. IF WS-PHARMACY-CHARGES NOT EQUAL TO IN-PHARMACY-CHARGES MOVE "** PHARMACY CHARGES OUT OF BALANCE" DISPLAY "** PHARMACY CHARGES IN **" DISPLAY WS-PHARMACY-CHARGES DISPLAY "** PHARMACY CHARGES EXPECTED **" DISPLAY IN-PHARMACY-CHARGES. MOVE "T" TO RECORD-TYPE. MOVE RECORDS-WRITTEN TO IN-RECORD-COUNT. MOVE WS-ANCILLARY-CHARGES TO IN-ANCILLARY-CHARGES. MOVE WS-MEDICATION-CHARGES TO IN-MEDICATION-CHARGES. MOVE WS-PHARMACY-CHARGES TO IN-PHARMACY-CHARGE-TMP. WRITE INPATIENT-TREATMENT-EDIT FROM WS-TRAILER-REC. * Code the statement to close all files PERFORM 850-CLOSE-FILES THRU 850-EXIT. DISPLAY "** RECORDS READ **". DISPLAY RECORDS-READ. DISPLAY "** RECORD-IN EXPECTED **". DISPLAY IN-RECORD-COUNT. DISPLAY "** RECORDS WRITTEN **". DISPLAY RECORDS-WRITTEN. DISPLAY "** ERROR RECORDS FOUND **". DISPLAY RECORDS-IN-ERROR. * Code the statement to Display a successful end-of-job msg DISPLAY "******** NORMAL END OF JOB TRTMNT ********". 999-EXIT. 1000-ABEND-RTN. WRITE SYSOUT-REC FROM ABEND-REC. DISPLAY "*** ABNORMAL END OF JOB - TRTMNT ***" UPON CONSOLE. DIVIDE ZERO-VAL INTO ONE-VAL. 1000-DB2-ERROR-RTN. ************************************************************ * ERROR TRAPPING ROUTINE FOR INVALID SQLCODES * DISPLAY '**** DB2 ACCESS PROBLEM *****'. DISPLAY '999-ERROR-TRAP-RTN '. MOVE "*** DB2 PROBLEM ***" TO ERROR-MSG-FIRST. MOVE SQLCA TO ERROR-MSG-REST. MULTIPLY SQLCODE BY -1 GIVING SQLCODE. DISPLAY 'SQLCODE ==> ' SQLCODE. DISPLAY SQLCA. DISPLAY SQLERRM. EXEC SQL WHENEVER SQLERROR CONTINUE END-EXEC. EXEC SQL ROLLBACK WORK END-EXEC.

105  Workshop - Creating New Programs using Copy/Paste Code
With DFLOWRDZ.cbl open in the editor 1. Right-click over the cobol folder in z/OS Projects and select: New > File Name your new file: DFLOW2.cbl 2. Maximize your Editors (Double-click the tab) 3. (Using your mouse you will do the following): 3a. Select and (Right-click to) copy source from DFLOWRDZ 3b. (Right-click to) Paste the copied source into DFLOW2 3c. Scroll down in DFLOWRDZ and find the next piece of code to copy. Repeat 3a, 3b and 3c - to copy from DFLOWRDZ to DFLOW2 as follows: - The TRMTDATA and PATMSTR: SELECT/ASSIGN FDs and WORKING-STORAGE structures: - INPATIENT-TREATMENT-REC, PATIENT-MASTER-REC READ INTO Paragraphs (Paragraphs 900-READ-TRMTDATA and 500-CROSS-FILE-EDITS) - Two or more non-adjacent: WORKING-STORAGE 01 structures Paragraphs – including the READ Save DFLOW2.cbl when finished If time permits, repeat this workshop using sections of SANDBOX to create another new program

106 RDz for ISPF Developers
UNIT RDz for ISPF Developers Topics: The RDz Workbench – Terms and Concepts Editing COBOL Programs ISPF Prefix Area Commands Editing With Keystroke Shortcuts Find and Replace Dialog Creating New Programs From Scratch Miscellaneous Features – Hex edit, Content Assist Paragraph (control flow) and Data Flow Analysis Working with Copybooks and Property Files Appendix – ISPF / LPEX Editor Comparison

107 Working With Source Code Containing Hexadecimal Values
Many mainframe application programs, especially online IMS and CICS programs that interact with screens contain EBCDIC binary or Hex values embedded in the source Most often in copybooks Although not limited to copybooks. Example: MOVE '.' TO WS-OUT-FIELD-NO-TRANS-IND. On the mainframe – the character-set is EBCDIC – ergo, no issue On workstations – because RDz's ISPF and LPEX editors expect ASCII source the file transfer technology must translate EBCDIC to ASCII – which most of the time is no problem except for in the case of source containing Hexadecimal values What's the solution? RDz "wraps" or encloses the EBCDIC hex characters on the way down from z/OS – and displays them as empty squares in the editor Current state: RDz version 7.6 and above – supports all hex values except : X'0D' X'0A' If your file contains X'0D' or '0A' the file will be opened in read-only mode (which is common for copybook use) – and the 0D/0A gets temporarily converted to '3F' in ASCII Embedded HEX characters do not affect any fields surrounding them in source files You can edit hex values by entering Hex edit mode (next slide)

108 Working With Source Code Containing Hex Values – continued
To view source lines that contain embedded Hex characters: Select the source line Right-click and select: Source > Hex edit line This Hex line view shows the text, and different source encodings (essentially, ASCII vs. EBCDIC character set) The bottom line (Source encoding Cp037) shows EBCDIC values  To edit an EBCDIC hex value (like the 3F shown in the screen capture): Make your change in HEX (overtype the value) Press <Enter> before clicking your mouse out of the Hex line editor

109 Hover (mouse-over) Variable and Paragraph Name
To see the declaration of a variable, paragraph or section name: Move your mouse-pointer over the identifier – and just hover Notes: You can hover anywhere (not just on the "current line") Hover works even if the declarations are contained in a copybook (although you have to configure the SYSLIB property in your project) Workshop: - Open TRMTRDZ.cbl in the editor - Scroll down in the source and hover over variables, file names and fields within a record

110 Real-Time Syntax Validation
Validation Markers When the COBOL Validator does not understand what you've coded, a yellow warning triangle appears in the prefix column on the far left of the editor If you mouse over the column you can get context-specific language coding "hints" You can enable/disable Validation from the Preferences menu Windows > Preferences > LPEX Editor > System z LPEX Editor > COBOL LPEX Editor The Syntax Validation process actually uses model COBOL or PL/I statements to work its magic – and includes CICS and SQL. Language elements you type - including variables - are compared against model (keyword) syntax Most (but not 100% of all) discrepancies are discovered. Syntax Validation of course can't be of much help as you are typing in statements that reference undeclared variables or paragraphs. This feature is like the Java editor in RAD. See Slide Notes

111  Open-Ended Workshop From the Slide Notes copy the code for test1
Use: Ctrl+A to select all lines, then press: Ctrl+C From RDz – Create a new file in the chapter1 \cobol\ folder - named: test1.cbl Paste the source you copied into the new file: Ctrl+V From the Outline View – do the following: Click on several of the COBOL Divisions Click on: FD STUDENT-FILE Expand: PROCEDURE DIVISION Click on: 200-PROCESS-RECORDS Click on and Expand the WORKING-STORAGE SECTION Click on several lines in test1.cbl code within the editor and note the effect on the Outline View 5. Experiment with several of the ISPF editing options: PF7/PF8 Prefix area Find / Change commands 6. Experiment with hover 7. Experiment with validations (by editing in some COBOL syntax errors) Press Ctrl+Z to undo the errors 8. Experiment with several of the RDz Hot-Key combinations 9. Press Ctrl+F and use the Find/Replace Dialog 10. From inside the source file: - Scroll to the find the 200-PROCESS-RECORDS paragraph - Click your mouse inside the paragraph - Right-click and select: Open Perform Hierarchy - Expand the entries – and consider how the Perform Hierarchy is different from the Outline View 11. Practice with any other techniques you've learned so far, then close the editor IDENTIFICATION DIVISION. PROGRAM-ID. test1. 003200* 000300* *************************************************** 000400* *** test1.cbl 000500* *** 001000* *** The program produces a report that shows 001100* *** the number of courses and credits that 001200* *** a student has taken. The input file has 001300* *** two types of records, a student record showing 001400* *** information about a student, followed by 001500* *** a number of course records for that student. 001600* *** Each course record shows the information 001700* *** for a course taken by the student. 003000* *** 003100* *************************************************** * ************************************************** INSTALLATION. IBM. DATE-WRITTEN DATE-COMPILED SECURITY. NONE. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. IBM. OBJECT-COMPUTER. IBM. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT STUDENT-FILE ASSIGN TO UT-S-STDNTFL ORGANIZATION IS SEQUENTIAL. SELECT CREDITS-REPORT ASSIGN TO UT-S-REPORTFL DATA DIVISION. FILE SECTION. FD STUDENT-FILE LABEL RECORDS ARE STANDARD. STUDENT-RECORD. SR-NAME PIC X(19). FILLER PIC X(5). SR-ADDRESS PIC X(20). FILLER PIC XXXXX. SR-PHONE PIC X(7). FILLER PIC XXX. SR-BIRTH-DATE PIC X(6). FILLER PIC XXXX. SR-RECORD-TYPE PIC X. FILLER PIC XX. COURSE-RECORD. CR-NAME PIC X(19). FILLER PIC X(5). CR-COURSE-NUMBER PIC X(5). FILLER PIC X(5). CR-CREDITS PIC 9. FILLER PIC X(34). FILLER PIC XXX. FD CREDITS-REPORT LABEL RECORDS ARE STANDARD. REPORT-LINE-OUT PIC X(60). WORKING-STORAGE SECTION. SWITCHES-IN-PROGRAM. SW-END-OF-DATA PIC X VALUE 'N'. END-OF-DATA VALUE 'Y'. ACCUMS-AND-COUNTERS. ACCUM-CREDITS PIC 999 VALUE 0. CTR-COURSES PIC 999 VALUE 0. CTR-STUDENTS PIC 9(5) VALUE 0. CTR-LINES PIC 99 VALUE 0. SAVE-AREAS. SAVE-NAME PIC X(19). GRAND-TOTAL-LINE. FILLER PIC X(30) VALUE ' TOTAL STUDENTS PROCESSED IS: '. GTL-STUDENT-COUNT PIC ZZZZZ. DETAIL-LINE. FILLER PIC X(5) VALUE SPACE. DL-NAME PIC X(19). FILLER PIC X(8) VALUE SPACE. DL-COURSES PIC ZZZ. FILLER PIC X(10) VALUE SPACE. DL-CREDITS PIC ZZZZ. HEADING-1. FILLER PIC X(10) VALUE SPACE. FILLER PIC X(80) VALUE 'S T U D E N T C R E D I T S R E P O R T'. HEADING-2. FILLER PIC X(5) VALUE SPACE. FILLER PIC X(25) VALUE 'STUDENT NAME'. FILLER PIC X(15) VALUE 'COURSES'. FILLER PIC X(7) VALUE 'CREDITS'. * PROCEDURE DIVISION. TOP-LEVEL. PERFORM 100-INITIALIZATION. PERFORM 200-PROCESS-RECORDS UNTIL END-OF-DATA. PERFORM 300-WRAP-UP. STOP RUN. INITIALIZATION. OPEN INPUT STUDENT-FILE. OPEN OUTPUT CREDITS-REPORT. PERFORM 211-PAGE-CHANGE-RTN. PERFORM 230-READ-A-RECORD. MOVE SR-NAME TO SAVE-NAME. ADD 1 TO CTR-STUDENTS. PROCESS-RECORDS. IF SR-RECORD-TYPE IS EQUAL TO '1' THEN DISPLAY STUDENT-RECORD PERFORM 210-PROCESS-1-RECORDS MOVE SR-NAME TO SAVE-NAME ADD 1 TO CTR-STUDENTS ELSE PERFORM 220-PROCESS-2-RECORDS. PERFORM 230-READ-A-RECORD. PROCESS-1-RECORDS. IF CTR-LINES IS GREATER THAN 30 THEN PERFORM 211-PAGE-CHANGE-RTN. PERFORM 212-BUILD-DETAIL-LINE. WRITE REPORT-LINE-OUT FROM DETAIL-LINE AFTER ADVANCING 1. MOVE ZERO TO CTR-COURSES. PAGE-CHANGE-RTN. WRITE REPORT-LINE-OUT FROM HEADING-1 AFTER ADVANCING PAGE. WRITE REPORT-LINE-OUT FROM HEADING-2 AFTER ADVANCING 2. MOVE ZERO TO CTR-LINES. BUILD-DETAIL-LINE. MOVE SAVE-NAME TO DL-NAME. MOVE CTR-COURSES TO DL-COURSES. MOVE ACCUM-CREDITS TO DL-CREDITS. PROCESS-2-RECORDS. ADD CR-CREDITS TO ACCUM-CREDITS. ADD 1 TO CTR-COURSES. READ-A-RECORD. READ STUDENT-FILE AT END MOVE 'Y' TO SW-END-OF-DATA. WRAP-UP. MOVE CTR-STUDENTS TO GTL-STUDENT-COUNT. WRITE REPORT-LINE-OUT FROM GRAND-TOTAL-LINE AFTER ADVANCING 2. CLOSE CREDITS-REPORT STUDENT-FILE. 310-File-Close.

112 Workshop – Syntax Validation
Optional workshop: With StartApp.cbl open in the editor Scroll to line 53 Change: until to unti Move the cursor to see the yellow syntax validation triangle Move your cursor directly over the validation triangle to view the validation message text Then correct unti back to: until Note that the validation triangle disappears If time permits find out what else validation works for: Misspell variable name references inside the Procedure Division (in test1.cbl) misspell paragraph names in PERFORM statements Do not save your changes Optional workshop: With “StartApp” open in the editor Change other keywords But DON'T save changes … you'll need a working copy of StartApp throughout this module

113 Content Assist (Ctrl+Spacebar)
Different Content Assist options Content Assist (Ctrl+Spacebar) Content Assist allows you to code statements by selecting values from a list after typing partial text and pressing: Ctrl+Spacebar The process: Partially type a: COBOL keyword Variable (including 88-level) Paragraph name Move your cursor immediately at the end of the text you wish to use Content Assist to complete "immediately" = the very next byte after the text Press Ctrl + Spacebar Select the completion identifier from the list – which is sorted alphabetically within type Benefits: Improves productivity Reduces typos and syntax errors Particularly helpful with lengthy COBOL identifiers

114 Workshop – Content Assist
Refactor the 300-WRAP-UP paragraph in test1.cbl using Content Assist – and move the file close statement into a new Performed paragraph. Type in a new Paragraph name at the end of the program Enter a new blank line below the paragraph name Type: cl and press Ctrl+Spacebar Select CLOSE Use content assist to select both file names (one at a time) Add a period at the end of the CLOSE statement Enter a blank line in place of the current CLOSE statement in 300-WRAP-UP Use Content Assist to select: 7a. PERFORM 7b. Your new paragraph name When finished: Save your changes and using the Context Menu do a Local Syntax Check. Remove any syntax errors 3. 4. 7a. 7b.

115 RDz for ISPF Developers
UNIT RDz for ISPF Developers Topics: The RDz Workbench – Terms and Concepts Editing COBOL Programs ISPF Prefix Area Commands Editing With Keystroke Shortcuts Find and Replace Dialog Creating New Programs From Scratch Miscellaneous Features – Hex edit, Content Assist Paragraph (control flow) and Data Flow Analysis Working with Copybooks and Property Files Appendix – ISPF / LPEX Editor Comparison

116 Paragraph Control Flow Analysis
1. Often you will need to discover a program's control flow by tracing through a PERFORM chain or following some GO TO statements This is a straightforward process with RDz Select (double-click) your starting paragraph name Right-click and select: Open Perform Hierarchy 2. Perform Hierarchy Paragraph Name List  Paragraph relationships (nested PERFORM chain) shown through indentation

117 Paragraph Control Flow Analysis – continued
If you wish to navigate to the paragraphs declaration in the source: 1. Double-click (to select) the paragraph in editor 2. Press F3 – or use the Context menu to Open Declaration You can return to your original source position in the paragraph control flow analysis by: Clicking a paragraph in the Perform Hierarchy …or… Pressing: Alt+Left arrow Perform Hierarchy Paragraph Name List Expand the Hierarchy Name List - to see the nesting of the PERFORM chain paragraph relationships (GO TO as well) Click a Paragraph name in the Perform Hierarchy view - to navigate to that line within the source (Editor View)

118  Workshop – Paragraph Flow Analysis
Open TRMTRDZ.cbl in the editor From the Outline view, click on the 100-MAINLINE paragraph Double-click on the 100-MAINLINE paragraph name in the editor Right-click and select: Perform Hierarchy Expand all paragraphs displayed in the Perform Hierarchy Scroll up to the top of the Perform Hierarchy Paragraph Names List Double-click five or six of the paragraph names in the Perform Hierarchy – and note how the editor window code synchronizes with the paragraph name reference in the Perform Hierarchy view To view the source-level declaration for one of your selected paragraphs from the Perform Hierarchy In the source editor: Double-click (to select) a paragraph name Press F3 – or use the Context menu and Open Declaration To return to your place in the Perform Hierarchy and analyze more of the program's procedural flow, double-click another paragraph name entry in the Perform Hierarchy Paragraph Name list Alternatively, you can trace backwards/forwards through your code by pressing: Alt-Left - to go back up through previously selected source lines Alt-Right – to go forward through selected lines

119 Data Flow Analysis – Technique
Data Flow analysis is an iterative complex process, that involves expanding the scope of searching, as new variables in the data flow are discovered On the mainframe, you either: Utilize listing files/SX-REF entries – or – Using ISPF you access option 3.4, or =3.14 and issue a series of manual text FIND operations – saving or writing down interim results. This is: Typing-intensive Error-prone With lots of time spent loading programs into the editor in split-screen, etc. Using RDz you: Find your starting Search variable Pin the Search View and double-click each found-reference Not typing-intensive Less error-prone With RDz, all Search results are: Fixed Hyperlinked

120 Data Flow Analysis – RDz
Using RDz you will do the following: From your starting variable: Select the field and search (using a menu) for all occurrences "Pin" the search results Double-click each result line – which co-locates the line in the editor Analyze the statements operation If another variable is indicated as being part of the Data Flow, return to Step 1 and search on the next variable We'll do a workshop on this, using a new program…

121  Workshop – Data Analysis
Open DFLOWRDZ.cbl in the editor From the command line, type: F WS-PHARM and press <Enter> In the Editor source, Double-click (to select) WS-PHARMACY-CHARGES From the Search menu, select, Text > File This will launch a search for WS-PHARMACY-CHARGES throughout your program, and save the search results in a new persistent view From the Search View, click: Pin the Search View – This keeps the view intact, when you launch additional searches

122  Workshop – Data Analysis – continued
Double-click each line in the Search View – the source code will synchronize in the Editor Analyze each COBOL statement. If the operation would alter the value of some other variable (through a MOVE or COMPUTE statement) return to Step 1 on the previous slide, and search on the next variable in data flow Double-click to select another variable - in this example, double-click: PATIENT-PHRM-PER-DAY-O Pull down the Search Menu, and select, Text > File From the (new) Search results click: Pin the Search View

123  Workshop – Data Analysis – continued
Again analyze each COBOL statement in the pinned Search view. If the operation would alter the value of some other variable (through a MOVE or COMPUTE statement) return to Step 1 and search on the next variable in data flow Double-click to select another variable From the Search Menu select, Text > File From the (new) Search results click: Pin the Search View Analyze the next variable's usage and continue If the operations for a COBOL variable do not modify the contents of storage, return to a previously pinned view, and double-click the next line Additional pinned Search Views for other variables

124 Data Flow Analysis – Review
Data Flow analysis is an iterative complex process, that involves expanding the scope of searching, as new variables in the data flow are discovered On the mainframe, you either: Utilize listing files/SX-REF entries – or Using ISPF you access option 3.4, or =3.14 and issue a series of manual text FIND operations – saving or writing down interim results. This is: Typing-intensive and error-prone With lots of time spent loading programs into the editor in split-screen, etc. Using RDz you: Find your starting Search variable Pin the Search View and double-click each reference  There are static analysis tools from IBM that are dedicated to providing this information, through ultra-quick and simple techniques (ask about Rational Asset Analyzer)

125 RDz for ISPF Developers
UNIT RDz for ISPF Developers Topics: The RDz Workbench – Terms and Concepts Editing COBOL Programs ISPF Prefix Area Commands Editing With Keystroke Shortcuts Find and Replace Dialog Creating New Programs From Scratch Miscellaneous Features – Hex edit, Content Assist Paragraph (control flow) and Data Flow Analysis Working with Copybooks and Property Files Appendix – ISPF / LPEX Editor Comparison

126 Working With Copybooks - 1 of 2
Your programs most likely contain copybook or Include files. To open them using RDz: Set your mouse-focus inside the variable Right-Click Select: Open Copy Member

127 Other Copybook Development Facilities – Show Dependencies - 2 of 2
Besides opening copybook/include files, it can be useful to understand the "build dependencies" necessary for your COBOL program to compile successfully From z/OS Project Right-Click over the file you want to run the report against Select: Show Dependencies…

128 Enabling Your Project for Copybooks
Copybook and Include files are found by RDz searching in a SYSLIB property – a project attribute set by doing the following: From the Window menu: Show View > z/OS Project Views > Property Group Manager From the Property Group Manager View Expand LOCAL Right-click COBOL Sample Property Group, select: Edit…  In the SYSLIB setting, enter the fully-qualified directory structure of where you will store your project's copybooks The SYSLIB directory must be within your project The SYSLIB setting is case-sensitive to directory and folder names In this example: d: - drive RDZProjectNew – my workspace folder chapter1 – my project folder in the workspace copy – a folder inside of the chapter1 project

129  Workshop – Enabling Your Project for Copybooks (Part 1 of 2)
From the z/OS Projects explorer, create a new folder named copy, in the chapter1 project Following the five steps (on this and the previous slide) enable your chapter1 project for copybooks by setting the SYSLIB property to your copy folder, under chapter1 (remember, that SYSLIB is case-sensitive) Create the copybook source file in your SYSLIB directory Select and copy (Ctrl+C) all of the COBOL 01-record statement declaration code in the Slide Notes Right-click over your new copy folder in your chapter1 project, and select: New > File Name your new file: cobtable.cpy Paste (Ctrl+V) the copied source code into your new file Save (Ctrl+S) the file CUSTOMER-TABLE. CUSTOMER-DATA. FILLER PIC X(22) VALUE ' USAIR '. FILLER PIC X(22) VALUE ' AMERICAN '. FILLER PIC X(22) VALUE ' EASTERN '. FILLER PIC X(22) VALUE ' SABENA '. FILLER PIC X(22) VALUE ' BRANIFF '. FILLER PIC X(22) VALUE ' TWA '. FILLER PIC X(22) VALUE ' PEOPLES '. FILLER PIC X(22) VALUE ' DELTA '. FILLER PIC X(22) VALUE ' UNITED '. FILLER PIC X(22) VALUE ' PIEDMONT '. CUSTOMER-INFO REDEFINES CUSTOMER-DATA. CUSTOMER-REC OCCURS 10 TIMES INDEXED BY CUST-INDEX. CUSTOMER-CODE PIC 99. CUSTOMER-ACCOUNT PIC 9(5). CUSTOMER-NAME PIC X(15). Slide Notes

130  Workshop – Enabling Your Project for Copybooks (Part 2 of 2)
3. From the slide notes – select all (Ctrl+A) then copy (Ctrl+C) the large COBOL program source file 4. From Project Explorer – Create a new file under the \cobol\ folder, named: cntrlbrk.cbl 5. Paste the copied source code into this new file – starting at line1/position 1 6. Save (Ctrl+S) your new COBOL program 7. Experiment with all of the Copybook development techniques discussed – starting from five slides prior in this unit: With cntrlbrk.cbl loaded into the editor: find the copy statement in the program source Press: Ctrl+F Type copy in the find area and press <Enter> Double-click (to select) cobtable Right-click and from the Context Menu, select the options to: Browse Copy Member Open Copy Member Close the copybook Find a copybook variable in the Procedure Division: Ctrl+F Type CUSTOMER-NAME in the find area and press <Enter> Double-click to select CUSTOMER-NAME Right-click and from the Context Menu select: Open Declaration From z/OS Project Explorer: Right-click over cntrlbrk.cbl Select: Show Dependencies… IDENTIFICATION DIVISION. PROGRAM-ID. CNTRLBRK. AUTHOR IBM DATE-WRITTEN 000500 000600****************************************************************** 000700* PROGRAM USED TO CREATE CONTROL BREAK REPORT: CNTRLBRK SELECTS * 000800* NON-PAID INVOICES FROM THE INVOICE FILE, PERFORMS INPUT DATA * 000900* VALIDATION, SORTS THE RECORDS IN CUSTOMER NAME AND INVOICE * 001000* NUMBER ORDER, THEN CREATES A NEW SORTED OUTPUT FILE OF NON- * 001100* PAID INVOICES AND A PRINTED OUTPUT REPORT. ALL ERROR CON- * 001200* CONDITIONS ARE DISPLAYED TO SYSOUT * 001300****************************************************************** 001400 ENVIRONMENT DIVISION. 001600 CONFIGURATION SECTION. SOURCE-COMPUTER. IBM-390. OBJECT-COMPUTER. IBM-390. 002000 INPUT-OUTPUT SECTION. FILE-CONTROL. 002300 SELECT MI-INPUT-FILE ASSIGN TO UT-S-ACT2DATA. SELECT SW-MI-SORT-FILE ASSIGN TO UT-S-SORTFILE. SELECT MI-OUTPUT-SRT-FILE ASSIGN TO UT-S-SORT2FIL. SELECT MATB-OUTPUT-RPT ASSIGN TO UT-S-REPORT. 002800 002900 DATA DIVISION. 003100 FILE SECTION. 003300 FD MI-INPUT-FILE RECORDING MODE IS F LABEL RECORDS ARE STANDARD RECORD CONTAINS 80 CHARACTERS BLOCK CONTAINS 0 RECORDS DATA RECORD IS MI-INPUT-RECORD. 004000 MI-INPUT-RECORD PIC X(80). 004200 FD MI-OUTPUT-SRT-FILE RECORDING MODE IS F LABEL RECORDS ARE STANDARD RECORD CONTAINS 80 CHARACTERS BLOCK CONTAINS 0 RECORDS DATA RECORD IS MI-OUTPUT-SRT-RECORD. 004900 MI-OUTPUT-SRT-RECORD PIC X(80). 005100 FD MATB-OUTPUT-RPT RECORDING MODE IS F LABEL RECORDS ARE STANDARD RECORD CONTAINS 133 CHARACTERS BLOCK CONTAINS 0 RECORDS DATA RECORD IS MATB-OUTPUT-REP-LINE. 005800 MATB-OUTPUT-REP-LINE PIC X(133). 006000 006100 SD SW-MI-SORT-FILE RECORD CONTAINS 80 CHARACTERS DATA RECORD IS SW-MI-SORT-WORK. 006500 SW-MI-SORT-WORK. CUST-NO-SRT-WK PIC 99. CUST-NAME-SRT-WK PIC X(15). INV-NO-SRT-WK PIC X(5). AGED-CODE-SRT-WK PIC 9. INV-AMT-SRT-WK PIC S9(7)V99. PAID-DATE-SRT-WK PIC X(6). FILLER PIC X(42). 007400 WORKING-STORAGE SECTION. 007600 01 PROGRAM-INDICATOR-SWITCHES. 05 WS-EOF-INPUT-SW PIC X(3) VALUE 'NO '. 88 EOF-INPUT VALUE 'YES'. 05 WS-EOF-SRT-OUTPUT-SW PIC X(3) VALUE 'NO '. 88 EOF-SRT-OUTPUT VALUE 'YES'. 05 WS-INPUT-OK-SW PIC X(3) VALUE 'NO '. 88 INPUT-OK VALUE 'YES'. 05 WS-NAME-FOUND-SW PIC X(3) VALUE SPACES. 88 NAME-FOUND VALUE 'YES'. 88 NAME-NOT-FOUND VALUE 'NO '. 05 WS-PAID-SW PIC X(3) VALUE SPACES. 88 UNPAID VALUE 'NO '. 88 PAID VALUE 'YES'. 009100 WS-REPORT-CONTROLS. WS-PAGE-COUNT PIC S9(3) VALUE ZERO. WS-LINES-PER-PAGE PIC S9(2) VALUE +50. WS-LINES-USED PIC S9(2) VALUE +51. WS-LINE-SPACING PIC S9(1) VALUE ZERO. 009700 WS-BREAK-CONTROLS. WS-PREVIOUS-CUST-NO PIC 9(2). 010000 copy cobtable. 012000 WS-ACCUMULATORS. 012200* FOR PROGRAM RECORD TRACKING WS-READ-CTR PIC 9(4) VALUE ZERO. WS-REL-CTR PIC 9(4) VALUE ZERO. WS-RETR-CTR PIC 9(4) VALUE ZERO. WS-WRTN-CTR PIC 9(4) VALUE ZERO. WS-PAID-CTR PIC 9(4) VALUE ZERO. WS-UNPD-CTR PIC 9(4) VALUE ZERO. 012900 013000 013100* FOR CUSTOMER TOTALS WS-CURRENT-TL PIC 9(7)V99 VALUE ZERO. WS-OVER-30-TL PIC 9(7)V99 VALUE ZERO. WS-OVER-60-TL PIC 9(7)V99 VALUE ZERO. WS-OVER-90-TL PIC 9(7)V99 VALUE ZERO. WS-CUST-TOTAL-TL PIC 9(7)V99 VALUE ZERO. 013700 013800* FOR REPORT GRAND TOTALS WS-CURRENT-GTL PIC 9(7)V99 VALUE ZERO. WS-OVER-30-GTL PIC 9(7)V99 VALUE ZERO. WS-OVER-60-GTL PIC 9(7)V99 VALUE ZERO. WS-OVER-90-GTL PIC 9(7)V99 VALUE ZERO. 014300 014400 014500* PROGRAM FILES DEFINED: 014600 014700 MI-INPUT-REC. CUST-NO-IN PIC 99. INV-NO-IN PIC X(5). INV-NO-IN-NUM REDEFINES INV-NO-IN PIC 9(5). AGED-CODE-IN PIC 9. INV-AMT-IN PIC S9(7)V99. PAID-DATE-IN PIC X(6). PAID-DATE-IN-NUM REDEFINES PAID-DATE-IN PIC 9(6). FILLER PIC X(57). 015700 MI-OUTPUT-SRT-REC. CUST-NO-SRT PIC 99. CUST-NAME-SRT PIC X(15). INV-NO-SRT PIC X(5). AGED-CODE-SRT PIC 9. INV-AMT-SRT PIC S9(7)V99. PAID-DATE-SRT PIC X(6). FILLER PIC X(42). 016600 016700 016800* PROGRAM REPORT LINES. 016900 HL-HEADER-1. FILLER PIC X(1) VALUE SPACES. FILLER PIC X(15) VALUE 'REPORT NO 12345'. FILLER PIC X(34) VALUE SPACES. FILLER PIC X(25) VALUE 'AGED TRIAL BALANCE AS OF '. RPT-DATE PIC X(8). FILLER PIC X(29) VALUE SPACES. FILLER PIC X(5) VALUE 'PAGE '. RPT-PAGE-NO PIC ZZZ. FILLER PIC X(12) VALUE SPACES. 018100 HL-HEADER-2. FILLER PIC X(3) VALUE SPACES. FILLER PIC X(10) VALUE 'CUST NO '. FILLER PIC X(9) VALUE 'CUST NAME'. FILLER PIC X(8) VALUE SPACES. FILLER PIC X(7) VALUE 'INVOICE'. FILLER PIC X(8) VALUE SPACES. FILLER PIC X(7) VALUE 'CURRENT'. FILLER PIC X(7) VALUE SPACES. FILLER PIC X(7) VALUE 'OVER 30'. FILLER PIC X(7) VALUE SPACES. FILLER PIC X(7) VALUE 'OVER 60'. FILLER PIC X(7) VALUE SPACES. FILLER PIC X(7) VALUE 'OVER 90'. FILLER PIC X(9) VALUE SPACES. FILLER PIC X(5) VALUE 'TOTAL'. FILLER PIC X(25) VALUE SPACES. 019900 020000 DL-DETAIL. FILLER PIC X(5) VALUE SPACES. CUST-NO-DL PIC X(2). FILLER PIC X(6) VALUE SPACES. CUST-NAME-DL PIC X(15). FILLER PIC X(3) VALUE SPACES. CUST-INV-DL PIC X(5). FILLER PIC X(4) VALUE SPACES. CURRENT-DL PIC Z,ZZZ,ZZ9.99-. FILLER PIC X(1) VALUE SPACES. OVER-30-DL PIC Z,ZZZ,ZZ9.99-. FILLER PIC X(1) VALUE SPACES. OVER-60-DL PIC Z,ZZZ,ZZ9.99-. FILLER PIC X(1) VALUE SPACES. OVER-90-DL PIC Z,ZZZ,ZZ9.99-. FILLER PIC X(38) VALUE SPACES. 021700 021800 TL-CUST-TOTAL. FILLER PIC X(5) VALUE SPACES. FILLER PIC X(19) VALUE 'TOTALS FOR CUST NO '. CUST-NO-TL PIC X(2). FILLER PIC X(14) VALUE SPACES. CURRENT-TL PIC Z,ZZZ,ZZ9.99-. FILLER PIC X(1) VALUE SPACES. OVER-30-TL PIC Z,ZZZ,ZZ9.99-. FILLER PIC X(1) VALUE SPACES. OVER-60-TL PIC Z,ZZZ,ZZ9.99-. FILLER PIC X(1) VALUE SPACES. OVER-90-TL PIC Z,ZZZ,ZZ9.99-. FILLER PIC X(1) VALUE SPACES. CUST-TOTAL-TL PIC Z,ZZZ,ZZ9.99-. FILLER PIC X(24) VALUE SPACES. 023500 023600 GTL-REPORT-TOTALS. FILLER PIC X(5) VALUE SPACES. FILLER PIC X(21) VALUE 'GRAND TOTALS '. FILLER PIC X(14) VALUE SPACES. CURRENT-GTL PIC Z,ZZZ,ZZ9.99-. FILLER PIC X(1) VALUE SPACES. OVER-30-GTL PIC Z,ZZZ,ZZ9.99-. FILLER PIC X(1) VALUE SPACES. OVER-60-GTL PIC Z,ZZZ,ZZ9.99-. FILLER PIC X(1) VALUE SPACES. OVER-90-GTL PIC Z,ZZZ,ZZ9.99-. FILLER PIC X(38) VALUE SPACES. 025000 025100 ERROR-MESSAGE-EL PIC X(133). 025300 ERROR-RECORD-EL. CUST-NO-EL PIC 99. FILLER PIC X(4) VALUE SPACES. INV-NO-EL PIC 9(5). FILLER PIC X(4) VALUE SPACES. AGED-CODE-EL PIC 9. FILLER PIC X(4) VALUE SPACES. INV-AMT-EL PIC Z,ZZZ,ZZ9.99-. FILLER PIC X(4) VALUE SPACES. PAID-DATE-EL PIC 9(6). FILLER PIC X(57). 026500 DISPLAY-LINE. DISP-MESSAGE PIC X(45). DISP-VALUE PIC ZZZ9. 026900 027000 PROCEDURE DIVISION. 027200 MAINLINE SECTION. 027400 OPEN INPUT MI-INPUT-FILE OUTPUT MI-OUTPUT-SRT-FILE OUTPUT MATB-OUTPUT-RPT. SORT SW-MI-SORT-FILE ON ASCENDING KEY CUST-NAME-SRT-WK INV-NO-SRT-WK INPUT PROCEDURE 200-SRT-INPUT-PROCD THRU 200-EXIT OUTPUT PROCEDURE 300-SRT-OUTPUT-PROCD THRU 300-EXIT. PERFORM 550-DISPLAY-PROG-DIAG THRU 550-DISPLAY-PROG-DIAG-EXIT CLOSE MI-INPUT-FILE MI-OUTPUT-SRT-FILE MATB-OUTPUT-RPT. MOVE ZERO TO RETURN-CODE. GOBACK. 028900 029000 SRT-INPUT-PROCD SECTION. 029200 MOVE 'NO ' TO WS-EOF-INPUT-SW. PERFORM 800-READ-INPUT-FILE THRU 800-READ-INPUT-FILE-EXIT. IF EOF-INPUT DISPLAY 'ERROR!! INPUT FILE EMPTY!' GO TO 200-EXIT. PERFORM 210-PRSS-INPUT-RECORDS THRU PRSS-INPUT-RECORDS-EXIT UNTIL EOF-INPUT. 030100 EXIT. EXIT. 030400 030500 PRSS-INPUT-RECORDS. 030700 PERFORM 214-CK-INPUT-DATA THRU 214-CK-INPUT-DATA-EXIT. IF INPUT-OK AND UNPAID PERFORM 218-SEARCH-FOR-CUST-NAME THRU SEARCH-FOR-CUST-NAME-EXIT IF NAME-FOUND PERFORM 850-FORMAT-RELEASE THRU 850-FORMAT-RELEASE-EXIT ELSE NEXT SENTENCE ELSE NEXT SENTENCE. PERFORM 800-READ-INPUT-FILE THRU 800-READ-INPUT-FILE-EXIT. 031900 032000 PRSS-INPUT-RECORDS-EXIT. EXIT. 032300 032400 CK-INPUT-DATA. 032600 MOVE 'YES' TO WS-INPUT-OK-SW. IF PAID-DATE-IN-NUM IS NUMERIC 032900 IF PAID-DATE-IN-NUM IS ZERO ADD 1 TO WS-UNPD-CTR MOVE 'NO ' TO WS-PAID-SW 033300 IF AGED-CODE-IN IS > ZERO AND < 5 033500 IF CUST-NO-IN IS NUMERIC 033700 IF INV-NO-IN-NUM IS NUMERIC 033900 IF INV-AMT-IN IS NUMERIC MOVE 'YES' TO WS-INPUT-OK-SW ELSE MOVE '** ERROR ** INVOICE AMOUNT NOT NUMERIC ' TO ERROR-MESSAGE-EL PERFORM 700-ERROR-DISPLAY THRU ERROR-DISPLAY-EXIT 034800 ELSE MOVE '** ERROR ** INVOICE NUMBER NOT NUMERIC ' TO ERROR-MESSAGE-EL PERFORM 700-ERROR-DISPLAY THRU ERROR-DISPLAY-EXIT 035500 ELSE MOVE '** ERROR ** CUSTOMER NUMBER NOT NUMERIC ' TO ERROR-MESSAGE-EL PERFORM 700-ERROR-DISPLAY THRU ERROR-DISPLAY-EXIT 036200 ELSE MOVE '** ERROR ** INVALID AGED CODE ' TO ERROR-MESSAGE-EL PERFORM 700-ERROR-DISPLAY THRU ERROR-DISPLAY-EXIT 036900 ELSE ADD 1 TO WS-PAID-CTR MOVE 'YES' TO WS-PAID-SW 037300 ELSE MOVE '** ERROR ** PAID DATE NOT NUMERIC' TO ERROR-MESSAGE-EL PERFORM 700-ERROR-DISPLAY THRU ERROR-DISPLAY-EXIT. 038000 038100 038200 CK-INPUT-DATA-EXIT. EXIT. 038500 038600 038700 SEARCH-FOR-CUST-NAME. 038900 MOVE SPACES TO WS-NAME-FOUND-SW. SET CUST-INDEX TO 1. SEARCH CUSTOMER-REC AT END MOVE 'NO ' TO WS-NAME-FOUND-SW MOVE '** ERROR ** CUSTOMER NAME NOT FOUND' TO ERROR-MESSAGE-EL PERFORM 700-ERROR-DISPLAY THRU ERROR-DISPLAY-EXIT WHEN CUSTOMER-CODE (CUST-INDEX) IS EQUAL TO CUST-NO-IN MOVE 'YES' TO WS-NAME-FOUND-SW MOVE CUSTOMER-NAME (CUST-INDEX) TO CUST-NAME-SRT-WK. 040500 040600 SEARCH-FOR-CUST-NAME-EXIT. EXIT. 040900 041000 041100 SRT-OUTPUT-PROCD. 041300 PERFORM 320-INITIALIZE-OUTPUT THRU INITIALIZE-OUTPUT-EXIT. PERFORM 900-RETURN-SRTD-REC THRU 900-RETURN-SRTD-REC-EXIT. IF EOF-SRT-OUTPUT DISPLAY 'SORTED RECORDS NOT AVAILIBLE' GO TO 300-EXIT. MOVE CUST-NO-SRT-WK TO WS-PREVIOUS-CUST-NO. MOVE CUST-NAME-SRT-WK TO CUST-NAME-DL. PERFORM 340-PRSS-SORTED-OUTPUT THRU PRSS-SORTED-OUTPUT-EXIT UNTIL EOF-SRT-OUTPUT. PERFORM 400-PRSS-CUST-BREAK THRU 400-PRSS-CUST-BREAK-EXIT. PERFORM 500-PRSS-GRAND-TOTALS THRU PRSS-GRAND-TOTALS-EXIT. 042800 042900 EXIT. EXIT. 043200 043300 043400 INITIALIZE-OUTPUT. 043600 MOVE ZEROS TO WS-PAGE-COUNT, WS-LINE-SPACING, WS-CURRENT-TL, WS-OVER-30-TL, WS-OVER-60-TL, WS-OVER-90-TL, WS-CUST-TOTAL-TL, WS-CURRENT-GTL, WS-OVER-30-GTL, WS-OVER-60-GTL, WS-OVER-90-GTL. MOVE 'NO ' TO WS-EOF-SRT-OUTPUT-SW. MOVE SPACES TO DL-DETAIL. MOVE ' ' TO RPT-DATE. 045100 045200 INITIALIZE-OUTPUT-EXIT. EXIT. 045500 045600 PRSS-SORTED-OUTPUT. 045800 IF CUST-NO-SRT-WK IS NOT EQUAL TO WS-PREVIOUS-CUST-NO PERFORM 400-PRSS-CUST-BREAK THRU PRSS-CUST-BREAK-EXIT. PERFORM 343-DETAIL-LINE-PRSS THRU DETAIL-LINE-PRSS-EXIT. PERFORM 950-WRITE-OUTPUT-REC THRU WRITE-OUTPUT-REC-EXIT. PERFORM 900-RETURN-SRTD-REC THRU RETURN-SRTD-REC-EXIT. 046800 046900 047000 PRSS-SORTED-OUTPUT-EXIT. EXIT. 047300 047400 DETAIL-LINE-PRSS. 047600 IF WS-LINES-USED IS GREATER THAN WS-LINES-PER-PAGE OR WS-LINES-USED IS EQUAL TO WS-LINES-PER-PAGE PERFORM 955-HEADINGS THRU 955-HEADINGS-EXIT. MOVE CUST-NO-SRT-WK TO CUST-NO-DL. MOVE INV-NO-SRT-WK TO CUST-INV-DL. IF AGED-CODE-SRT-WK IS EQUAL TO 1 MOVE INV-AMT-SRT-WK TO CURRENT-DL ADD INV-AMT-SRT-WK TO WS-CURRENT-TL ELSE IF AGED-CODE-SRT-WK IS EQUAL TO 2 MOVE INV-AMT-SRT-WK TO OVER-30-DL ADD INV-AMT-SRT-WK TO WS-OVER-30-TL ELSE IF AGED-CODE-SRT-WK IS EQUAL TO 3 MOVE INV-AMT-SRT-WK TO OVER-60-DL ADD INV-AMT-SRT-WK TO WS-OVER-60-TL ELSE MOVE INV-AMT-SRT-WK TO OVER-90-DL ADD INV-AMT-SRT-WK TO WS-OVER-90-TL. 049600 WRITE MATB-OUTPUT-REP-LINE FROM DL-DETAIL AFTER ADVANCING WS-LINE-SPACING. ADD WS-LINE-SPACING TO WS-LINES-USED. MOVE 1 TO WS-LINE-SPACING. MOVE SPACES TO DL-DETAIL. 050200 050300 DETAIL-LINE-PRSS-EXIT. EXIT. 050600 050700 PRSS-CUST-BREAK. 050900 COMPUTE WS-CUST-TOTAL-TL = WS-CURRENT-TL + WS-OVER-30-TL + WS-OVER-60-TL + WS-OVER-90-TL . MOVE 2 TO WS-LINE-SPACING. MOVE WS-PREVIOUS-CUST-NO TO CUST-NO-TL. MOVE WS-CURRENT-TL TO CURRENT-TL. MOVE WS-OVER-30-TL TO OVER-30-TL. MOVE WS-OVER-60-TL TO OVER-60-TL. MOVE WS-OVER-90-TL TO OVER-90-TL. MOVE WS-CUST-TOTAL-TL TO CUST-TOTAL-TL. WRITE MATB-OUTPUT-REP-LINE FROM TL-CUST-TOTAL AFTER ADVANCING WS-LINE-SPACING. ADD WS-LINE-SPACING TO WS-LINES-USED. ADD WS-CURRENT-TL TO WS-CURRENT-GTL. ADD WS-OVER-30-TL TO WS-OVER-30-GTL. ADD WS-OVER-60-TL TO WS-OVER-60-GTL. ADD WS-OVER-90-TL TO WS-OVER-90-GTL. IF NOT EOF-SRT-OUTPUT MOVE ZEROS TO WS-CURRENT-TL, WS-OVER-30-TL, WS-OVER-60-TL, WS-OVER-90-TL, WS-CUST-TOTAL-TL MOVE CUST-NO-SRT-WK TO WS-PREVIOUS-CUST-NO MOVE CUST-NAME-SRT-WK TO CUST-NAME-DL IF WS-LINES-USED IS GREATER THAN WS-LINES-PER-PAGE OR WS-LINES-USED IS EQUAL TO WS-LINES-PER-PAGE PERFORM 955-HEADINGS THRU 955-HEADINGS-EXIT ELSE MOVE 2 TO WS-LINE-SPACING. 054100 054200 PRSS-CUST-BREAK-EXIT. EXIT. 054500 054600 PRSS-GRAND-TOTALS. 054800 MOVE 2 TO WS-LINE-SPACING. MOVE WS-CURRENT-GTL TO CURRENT-GTL. MOVE WS-OVER-30-GTL TO OVER-30-GTL. MOVE WS-OVER-60-GTL TO OVER-60-GTL. MOVE WS-OVER-90-GTL TO OVER-90-GTL. WRITE MATB-OUTPUT-REP-LINE FROM GTL-REPORT-TOTALS AFTER ADVANCING WS-LINE-SPACING. 055600 055700 PRSS-GRAND-TOTALS-EXIT. EXIT. 056000 056100 056200 056300 DISPLAY-PROG-DIAG. 056500 DISPLAY '**** B999BLK2 RUNNING ****'. DISPLAY ' '. MOVE 'MONTHLY INVOICE RECORDS READ ' TO DISP-MESSAGE. MOVE WS-READ-CTR TO DISP-VALUE. DISPLAY DISPLAY-LINE. DISPLAY ' '. MOVE 'MONTHLY INVOICE RECORDS RELEASED TO SORT ' TO DISP-MESSAGE. MOVE WS-REL-CTR TO DISP-VALUE. DISPLAY DISPLAY-LINE. MOVE 'MONTHLY INVOICE RECORDS RETURNED FROM SORT ' TO DISP-MESSAGE. MOVE WS-RETR-CTR TO DISP-VALUE. DISPLAY DISPLAY-LINE. DISPLAY ' '. MOVE 'MONTHLY INVOICE RECORDS WRITTEN TO MRA ' TO DISP-MESSAGE. MOVE WS-WRTN-CTR TO DISP-VALUE. DISPLAY DISPLAY-LINE. DISPLAY ' '. MOVE 'MONTHLY INVOICE PAID ' TO DISP-MESSAGE. MOVE WS-PAID-CTR TO DISP-VALUE. DISPLAY DISPLAY-LINE. MOVE 'MONTHLY INVOICE UNPAID ' TO DISP-MESSAGE. MOVE WS-UNPD-CTR TO DISP-VALUE. DISPLAY DISPLAY-LINE. DISPLAY ' '. DISPLAY '**** B999BLK2 EOJ ****'. 059700 059800 059900 DISPLAY-PROG-DIAG-EXIT. EXIT. 060200 060300 ERROR-DISPLAY. 060500 MOVE 'NO ' TO WS-INPUT-OK-SW. DISPLAY ERROR-MESSAGE-EL. MOVE CUST-NO-IN TO CUST-NO-EL. MOVE INV-NO-IN-NUM TO INV-NO-EL. MOVE AGED-CODE-IN TO AGED-CODE-EL. MOVE INV-AMT-IN TO INV-AMT-EL. MOVE PAID-DATE-IN-NUM TO PAID-DATE-EL. DISPLAY ERROR-RECORD-EL. 061400 ERROR-DISPLAY-EXIT. EXIT. 061700 061800 READ-INPUT-FILE. 062000 READ MI-INPUT-FILE INTO MI-INPUT-REC AT END MOVE 'YES' TO WS-EOF-INPUT-SW, GO TO 800-READ-INPUT-FILE-EXIT. ADD 1 TO WS-READ-CTR. 062500 READ-INPUT-FILE-EXIT. EXIT. 062800 062900 FORMAT-RELEASE. 063100 MOVE CUST-NO-IN TO CUST-NO-SRT-WK. MOVE INV-NO-IN TO INV-NO-SRT-WK. MOVE AGED-CODE-IN TO AGED-CODE-SRT-WK. MOVE INV-AMT-IN TO INV-AMT-SRT-WK. MOVE PAID-DATE-IN TO PAID-DATE-SRT-WK. RELEASE SW-MI-SORT-WORK. ADD 1 TO WS-REL-CTR. 063900 064000 FORMAT-RELEASE-EXIT. EXIT. 064300 064400 064500 064600 RETURN-SRTD-REC. 064800 RETURN SW-MI-SORT-FILE AT END MOVE 'YES' TO WS-EOF-SRT-OUTPUT-SW, GO TO 900-RETURN-SRTD-REC-EXIT. ADD 1 TO WS-RETR-CTR. 065300 RETURN-SRTD-REC-EXIT. EXIT. 065600 065700 WRITE-OUTPUT-REC. 065900 WRITE MI-OUTPUT-SRT-RECORD FROM SW-MI-SORT-WORK. ADD 1 TO WS-WRTN-CTR. 066200 WRITE-OUTPUT-REC-EXIT. EXIT. 066500 066600 HEADINGS. 066800 ADD 1 TO WS-PAGE-COUNT. MOVE WS-PAGE-COUNT TO RPT-PAGE-NO. WRITE MATB-OUTPUT-REP-LINE FROM HL-HEADER-1 AFTER ADVANCING PAGE. MOVE 1 TO WS-LINES-USED. MOVE 2 TO WS-LINE-SPACING. WRITE MATB-OUTPUT-REP-LINE FROM HL-HEADER-2 AFTER ADVANCING WS-LINE-SPACING. ADD WS-LINE-SPACING TO WS-LINES-USED. 067800 067900 HEADINGS-EXIT. EXIT. Program Code in Slide Notes

131 Review – Benefits of Windowed Workbench Development
Productivity Parallel work (Far) better use of screen "real estate" (Far) less manual typing For navigation For development tasks This is primarily due to RDz "tooling" Consistent quick, responsive PC performance CPU Resources Most of what you do everyday can be done locally Conserves MIPS on development LPAR

132 Part III – Local Projects and Local Debug
Author Notes: This is the standard session track template for IBM Rational Software Conference 2009 Additional IBM presentation resource links available on W3: Rational Core Messaging Slides Rational Image Library PowerPoint Best Practices Presentation © 2009 IBM Corporation

133 The RDz Workbench – Local Projects
A Workspace with a number of local z/OS Projects Note – all local files reside on your PC or on a network server Drive\:Workspace

134 The RDz "Workbench" – Workspace and Project Organization
You will work with a variety of COBOL resources: programs, copybooks, compile listings, executables, data files and so forth Using RDz you store, organize and manage the resources associated with your projects in a Workspace. After you launch RDz and select a Workspace (3 slides back), you have access to all the files and folders inside the Workspace – typically organized in one or more projects.  Workspace resources are organized into - Project(s) - Folders - Files Projects  Notes: Workspace Folders  Files  Mainframe note. Think of a Workspace as the equivalent of your TSO account (without any accounting charge-backs)

135 What is a Project (and what's in a Project?)
Workspace projects organize and manage related application resources. And projects within a workspace can be organized by: Batch application .. vs.. Online applications Lines of business/departmental applications: Accounts Payable, Inventory, Claims, Manufacturing Part Assembly, etc. Common – or shared projects, which might consist of data and record definitions that are used across multiple projects There are also a number of specific RDz project types that we will learn about as we go through the course, such as z/OS Local Projects, MVS Subprojects, etc. Projects also contain and are governed by build configuration files, known as property files** which specify generation options for your project components Projects may be further divided into folders z/OS COBOL Projects typically contain the following high-level folders: BuildOutput, cobol, copy Compile Results files COBOL Copybook Source  Note that you can name the cobol and copy folders anything you’d like (and they're case-INsensitive.  Distributed dev-note. Think of a build file as the equivalent of the build XML in a Java “ant” file. .NET developers – this is like your “build” file and build process  Mainframe note. Think of a build file as the equivalent z/OS JCL or your SCM, in that entries and property settings within a build file are used by the compiler to customize the resultant executables

136 What is in the \cobol\ folder?
\cobol\ is the default folder that is the highest level folder within a given project in your workspace, under which COBOL program resources are organized. These COBOL resources include: Sub-Folders – in case you'd like to further refine and break-down the organization of large projects cobol batch program1.cbl program2.cbl online program3.cbl Or in our case, just all COBOL files:  By default, COBOL files should end with one of the following file-name extensions: .cbl, .cob, .cobol  Note: The folder name \cobol\ is not required nor enforced Notes: RDz supports “.cpy” as a default extension for COBOL copy-books? If you have used “do it” up to know for “chapter1” you can mention that they will see - PrintApp.cbl - StartApp.cbl Under the \cobol\ folder See Notes

137 What is in \BuildOutput\ ?
\BuildOutput\ is the default folder that is the highest level folder under which all of your compiled COBOL resources are stored inside a project. These resources include: .OBJ – object modules .exe – COBOL executables – suitable for running or debugging .adt – an internal-system file used by RDz when you do source-level debugging produced by a Compiler Directive) .lst – listing file  - Shows highest error condition - Sorted XRef of COBOL variables - Other program info If you are familiar with Enterprise COBOL - listings on the mainframe, you can look at this listing and see that it looks almost the same as those you are already familiar with. If you are new to IBM COBOL compilers, you can look at the listing (printpaps – actually has not compiler error” and see things like which compiler options are used and, at the end, what the highest message level was. To see the Sorted XRef <Xref?>, look at the end of the listing for information after “Cross-reference of data names “” See Notes

138 Paper/Pencil Review Questions
Where (under what folder and/or sub-folder) in your project would you look for the following files? StartApp.OBJ _______________ StartApp.cbl _______________ StartApp.exe _______________ myCopy.cpy _______________ StartApp.lst _______________ True/False – all COBOL source files (each and every one) will: a. End with an extension of .COBOL b. Be organized and exist under the \COBOL\ folder – or a sub-folder under the \cobol\ folder in your project  Note – if you do not know what these file types are, do not worry, we will be covering them and their use a bit later in the course. Answers: .OBJ, .lst and .exe files will be under the \BuildOptions\ folder .cbl under the \cobol\ folder .cpy can be under \cobol\ or under a separate folder for copylibs and include files See Notes

139 The RDz Workbench UNIT Topics: The RDz Workbench – Terms and Concepts
Editing COBOL Programs Debugging COBOL Programs Appendices - ISPF / LPEX Comparison

140 Topic objectives After completing this topic, you should be able to: Describe the configuration model for running and/or debugging local COBOL applications Create a Launch Configuration – for running and/or debugging local COBOL application Define COBOL ENVIRONMENT DIVISION entries compatible with Windows PC COBOL work Run local COBOL applications – that respond to ACCEPT/DISPLAY UI Debug local COBOL applications and use the majority of the RDz COBOL source debugging features successfully  Workshops – As mentioned previously, note that for most (at least where marked on the slide with the:  symbol ) of the slides in this topic, you should experiment with the editing technique shown. The COBOL source in the Slide Notes might not always match the screen capture, but should be usable for the technique.

141 Local COBOL Application Executable Resource Model
You can run and/or debug your COBOL applications as standalone Windows executables. To do this, you will need the following: Clean compile of your entire project (Note – not just the COBOL program you wish to run or debug, there can be no syntax errors above warning-level in the project) A Launch Configuration – which defines parameters, and other settings needed to debug or run your application as an executable, on Windows Your source available Your input files and output files specified in PC-COBOL SELECT/ASSIGN syntax UDB Local DB2 Database Parms Sequential Input/Output Files Launch Configuration + COBOL .exe Running – or Debugged Output Reports

142 A Tale of Two Perspectives – z/OS Projects Perspective and the Debug Perspective
 "Perspectives" - Recall that a "Perspective" is a convenient grouping for a collection of views organized around a given role or task So far in this unit you've used the z/OS Projects Perspective – to learn: About RDz Understand the use of Projects, Views and other eclipse facilities How the editor works – features, typical development workflow, etc. In this section we will introduce you to the Debug Perspective – which allows you to do source-code (line-by-line) testing of your COBOL logic We will start by showing you how to debug local (Workstation-based) COBOL programs In subsequent units we'll learn how to debug mainframe applications (batch and online) Both local and mainframe debug facilities are almost 100% identical Learning how to do local debugging will set you up for learning the mainframe debugging features

143 Steps in Debugging Local Workstation Projects
You will need the following: A project – that compiles clean One or more COBOL programs to debug A Debug Configuration Let's start by creating a new project. But – in order to save time and focus on debugging per se' – we'll use one of the example projects that ships with RDz UDB Local DB2 Database Debug Configuration Sequential Input/Output Files RDz Debug Perspective COBOL.exe + Called modules Output Reports

144 Create a new Workstation COBOL Project
Open the File menu and select: New > Example… Expand Workstation COBOL Select COBOL Sample 1 and click: Next From Example Project Name your project, and click: Finish

145 Load a COBOL Program into the Editor Area (Editor)
From z/OS Projects, Double-click StartApp.cbl (to load the source into the editor) Browse (scroll) in the file and view some of the code – note that this is not a mainframe application. It is a PC-COBOL program to be debugged on your Workstation Double-click: PrintApp.cbl and have a look at some of the statements Note: Please don't change any of the code in the programs, yet

146 Prepare Your Application for Debug – Rebuild
From z/OS Projects, Expand the BuildOutput folder Note that this example project comes already-compiled. How can we tell? Because there is a: BuildOutput folder  Executable (in this case, StartApp.exe) in BuildOutput Sadly, your custom projects will not come ready-made like this, so we'll have to learn how to create executables Note also that icon to the left of StartApp.cbl has a purple background This denotes that StartApp is the "entry point" into the application. Basically StartApp's PROCEDURE DIVISION is where the operating system begins execution If you're an ex-Java or C/C++ developer think of StartApp as "main" Build a project (optional but a Best Practice) – Select (Right-Click) and delete the entire BuildOutput folder … really - it's okay - go ahead  At the warning-confirmation prompt, click: Delete Note – the reason for doing this, is that you will easily be able to tell if your project build is successful (if there are compile errors, BuildOutput is not created by the Rebuild step) Right-Click again over your project, and from the Context Menu, select Rebuild Project (note that it is at the bottom of the Context Menu options list) This should re-create the BuildOutput folder including StartApp.exe

147 Create your Debug Configuration
Recall that you will need to define a configuration file for debugging This is a one-time-per-project step, and is very simple: Right-Click over your Project From the Context-Menu select: Debug As > Debug Configurations… From the Debug Configurations dialog: Double-Click: Compiled Application This will create a new configuration, named (appropriately enough): New_configuration You can think of a Debug Configuration as "run JCL for Debugging Windows executables" See Notes

148 Specify the Configuration Properties
1. 1. Name your configuration Select the Program name: 2. click the Browse… button (as shown) and from the Open dialog: -Expand BuildOutput -Double-Click StartApp 3. The Open dialog will close, and from the Configuration Properties dialog, click: Debug 2. Note that if your StartApp shows as: StartApp.exe – that's the one you want

149 Debug – Initial Prompts
Two small prompts will popup: Click Yes to Confirm Perspective Switch To enter the Debug Perspective, and use better views for your work A DOS window appears (briefly) and becomes a Windows background task. This DOS window is still available from your PC's toolbar, and in fact represents the operator's console (all COBOL ACCEPT/DISPLAY statements pipe their input/output to this window)

150 The Debug Perspective – Views and Facilities
Debugger Breakpoints View Toolbar  Program Variables View  Your code Program Outline View

151 The Debug Perspective – Debug Toolbar Icons
There are a few different ways of stepping through your code One of the simplest is to use the icons on the Debug view toolbar Resume – Run from break-point to breakpoint in your code, or until your program ends Suspend – Stop running your code (the Debugger will wait for you to do something) Terminate – Stop your debug session Animated step – Debug through your code line-by-line. Stop at breakpoints Step into – Execute the current instruction (one COBOL statement at a time) Step over – Execute the current instruction. If the current instruction is a CALL or PERFORM, resume (run through) all of the statements in the procedure being called and stop: On the next sequential instruction On a break point inside the CALL or PERFORM procedure If the debug session (or your application Entry Point program) ends Step return – (used within a called module or performed paragraph) – resume (run) through the rest of the statements and stop (debug) on the next sequential instruction after the CALL or PERFORM statement Use Step filters – Filters out Assembly-language instructions - Be sure this icon is clicked on as shown. If not (if filtering is not clicked on) you will see assembly language code Enable/Disable Step by step debug Debug daemon – Displays status and properties of the debug listener

152 Debug – Simple Stepping
From the Debug toolbar: Click the Step into icon (shown below), or press F5 Your program will debug line by line Note that as variable values change the Variables view display turns bright yellow for the fields that have been modified by the statement

153 Debug – Console IO When your code reaches an Accept or Display statement: From the toolbar, click the Windows DOS box and answer the prompt For Accept – type in a value and press  Enter For Display – you can see what the statement IO does in the DOS box In either case, your Debug session goes into a "wait state" until you respond to the prompt

154 Debug – Variable Values
Can be seen from the: Variables view Monitor List view Right-click inside view Select Add variable to Monitor List Hover-help (mouse-over) in the Source code view

155 Change Variable Values Dynamically (on the fly) During Debug
From the Variables view Select a variable value Over-type the value Press Enter To see the variable value in Hex Select the variable Right-click From the context-menu, select  1 Hexadecimal

156 Additional Features from the Variables (Right-Click) Context Menu
From the Variables view Select a variable value Right-Click and try: Find Also Right-Click Copy Variables Paste to Notepad Filter Find by keying in text Very useful for large programs

157 Debug – Passing Execution from Program to Program
When a call is made to another program in your application The called program is dynamically loaded into the debugger

158 Debug – Passing Execution from Program to Program
When the called program's GOBACK instruction is executed: The called program is flushed from the Debugger Control returns to the calling program Please finish debugging this application (Note: you will have to enter Q to quit/end)

159 Ending a Debug Session and Starting Over
When your "main" program's GOBACK or STOP RUN is executed (or if there's a program execution failure) your debug session will terminate Click OK and: Return to the z/OS Projects perspective – to continue analyze/edit/compile (top right-hand corner of your workbench) …or… Start another Debug session: Press F11 …or… Click the green bug on the toolbar

160 To Set and Debug with Unconditional Breakpoints
From within a Debug Session Scroll to the line you wish to stop at Double-click in the left-hand margin of the source code area Double-click again to unset a previously-set Breakpoint Press F8 or click the Resume icon to run to your Breakpoint

161 What Other Kinds of Breakpoints Exist
All of the major types of Breakpoints are available Try experimenting with: Entry Breakpoint Zoom through StartApp Debug through PrintApp

162 What Other Debug Options are Available?
Actually, quite a few During Debug, Right-click over the left-hand margin Add Breakpoint Jump to location – Causes immediate unconditional branch to the line your mouse is pointing to Like a GOTO – and does not alter program storage (variable values) Run to location – Executes all code between the current line, and the line your mouse is pointing to Like a PERFORM – and could alter program storage Add Bookmark… Add Task… Animated Debug Using default speed Altered animation speed 

163 Iterate Over Complex Code (Debug Option)
While in PrintApp.cbl Debug to the GOBACK Change the value of IN-NAME Right-click over the margin Jump to line 46 Debug (step) through code again

164 Absolutely Through Debugging?
Best Practice to remove Debugger modules from storage Right-click over <terminated> Select Remove All Terminated Return to z/OS Projects

165  Workshop Debugging – 1 of 6
From the File menu, select: New > Example… Expand Workstation COBOL Select COBOL Sample 1 Click Next > Name the project: DebugLab Click Finish Case Sensitivity: COBOL is not case-sensitive (at least, not IBM's Enterprise COBOL) – so: field1 – FIELD1 = fiELD1 COBOL program names and project names are not either But we will establish a naming convention with project names in lower-case See Notes

166  Workshop Debugging – 2 of 6
From z/OS Projects Right-click over the project and select: Rebuild Project Expand BuildOutput Right-click over StartApp.exe, and select: Debug As > Debug Configurations From Debug Configurations Select Compiled Application Click the New launch configuration icon Name the Debug Configuration Instructions continue on the next slide…

167  Workshop Debugging – 3 of 6
In the Program name: area: Click Browse… Use the Windows dialog to find and select the directory for your Workspace\Project\ BuildOutput folder and StartApp.exe file Note that the icon might not show the file suffix – select the run icon as shown Click Open From the Debug Configuration window click: Apply Debug Click "Yes" at the Confirm Perspective Switch prompt

168  Workshop Debugging – 4 of 6
Apply the Debugging techniques you learned in this section: Breakpoints: Entry to PRINTAPP  On specific lines Remove breakpoints (you've added) Step into the code Use the various step options Run to your breakpoints If you run past the breakpoints and would like to start again, use the toolbar to restart your Debug session: If you'd like to just stop, hit the Terminate sign, on the toolbar: The Windows.exe created by doing a Project Rebuild is actually a native machine-language version of your application (your code is generated to C/C++ or Java then compiled – the compiler builds machine code out of your COBOL) This you will notice, if for no other reason than by the speed (REALLY FAST) of StartApp.exe's response when you Run it

169  Workshop Debugging – 5 of 6
From the Variables and Monitors tabs: Modify values on the fly Monitor variables Detach the Monitored variable list The Windows.exe created by doing a Project Rebuild is actually a native machine-language version of your application (your code is generated to C/C++ or Java then compiled – the compiler builds machine code out of your COBOL) This you will notice, if for no other reason than by the speed (REALLY FAST) of StartApp.exe's response when you Run it

170  Workshop Debugging – 6 of 6
Other techniques: Mouse-over hover value Jump to/Run to Location Add Tasks and Bookmarks Use the Context Menu Terminate and remove all terminated debug sessions when done Return to the z/OS Perspective The Windows.exe created by doing a Project Rebuild is actually a native machine-language version of your application (your code is generated to C/C++ or Java then compiled – the compiler builds machine code out of your COBOL) This you will notice, if for no other reason than by the speed (REALLY FAST) of StartApp.exe's response when you Run it

171 Final Workshop – Optional
Enterprise Modernization for IBM System z: Local IBM z/OS application development with IBM Rational Developer for System z In order to pull together all of the edit, compile and debug techniques described in this section, if time permits at work: Please go to the Enterprise Modernization Sandbox Select and print out the following PDS Follow the Sandbox Slides to: Register Download and install the Citrix client (first-time only) Use the Sandbox And follow the detailed Instructions in the IBM Proof of Technology lab

172 Topic Summary After having completed this topic, you should now be able to: Describe the configuration model for running and/or debugging local COBOL applications Create a Launch Configuration – for running and/or debugging local COBOL application Define COBOL ENVIRONMENT DIVISION entries compatible with Windows PC COBOL work Run local COBOL applications – that respond to ACCEPT/DISPLAY UI Debug local COBOL applications and use the majority of the RDz COBOL source debugging features successfully

173 Rational Developer for System z – Introduction Appendices

174 RDz Introduction UNIT Topics: The RDz Workbench – Terms and Concepts
Editing COBOL Programs Debugging COBOL Programs Appendix – Additional RDz Knowledge Transfer Creating a new Workstation Project Appendix – ISPF/LPEX Editor Comparison

175 The IBM Education Assistant
The Education Assistant has a number of detailed and useful Camtasias that show use cases for both RDz (standalone) and RDz integrated with other tools (such as Rational Team Concert)

176 The RDz Café IBM's RDz and COBOL Cafés contain white papers, links to additional learning resources and Q&A forums. The forums are reviewed by the RDz development team – who send out responses first-hand to technical questions.

177 RDz Introduction UNIT Topics: The RDz Workbench – Terms and Concepts
Editing COBOL Programs Debugging COBOL Programs Appendix – Creating a New Workstation Project Appendix – ISPF/LPEX Editor Comparison

178  Installation Verification Procedure – 1 of 5
From the File menu, select: New > Example… Expand Workstation COBOL Select COBOL Sample 1 Click Next > Name the project: chapter1 Click Finish Case Sensitivity: COBOL is not case-sensitive (at least, not IBM's Enterprise COBOL) – so: field1 – FIELD1 = fiELD1 COBOL program names and project names are not either But we will establish a naming convention with project names in lower-case See Notes

179  Installation Verification Procedure – 2 of 5
From z/OS Projects Double-click StartApp.cbl This will load the program source into the COBOL editor Scroll around in the source file – and have your first look at a COBOL program (not so scary… ) Don't change any of the source (yet) But you can size the editor window to see more source  Note that in the next course unit ("RDz Workbench") – we will cover the tools and development facilities you're looking at.

180  Installation Verification Procedure – 3 of 5
From z/OS Projects Expand BuildOutput Right-click over StartApp.exe, and select: Run As > Run Configurations Note that if you do not see a BuildOutput folder: Right-click over the chapter1 project From the context menu select: Rebuild Project From Run Configurations Select Compiled Application Click the New launch configuration icon Instructions continue on the next slide…

181  Installation Verification Procedure – 4 of 5
In the Project area, type: chapter1 In the Program name: area: Click Browse… Use the Windows dialog to find and select the directory for your Workspace\Project\ BuildOutput folder and StartApp.exe file Note that the icon might not show the file suffix – select the run icon as shown Click Open From the Run Configuration window click: Apply Run

182  Installation Verification Procedure – 5 of 5
This will launch a DOS application that prompts you for either a name, or a Q (upper or lower-case) to quit Enter a few names – after each name, press the Enter key Enter: Q to quit  Optional: Browse through the StartApp and PrintApp program source. If you're an experienced COBOL programmer taking this course to learn RDz, note the differences between these two programs and the COBOL datasets you typically work with

183 Appendix 2 DLI Model Utility Plug-in
Author Notes: This is the standard session track template for IBM Rational Software Conference 2009 Additional IBM presentation resource links available on W3: Rational Core Messaging Slides Rational Image Library PowerPoint Best Practices Presentation © 2009 IBM Corporation

184 Visualize your IMS Data - The DLIModel Utility
An RDz "plug-in" that offers a visual representation of IMS PSB and DBDs and simplifies IMS metadata generation Available as a free download SEGM NAME=HOSPITAL, PARENT=0, BYTES=(16000,12100), RULES=(LLL,HERE) FIELD NAME=(HOSPCODE,SEQ,U), START=3, BYTES=12, TYPE=C FIELD NAME=(HOSPNAME), START=15, BYTES=17, An IMS-shipped version that runs from System Services or from the z/OS® BPXBATCH utility The IMS-shipped version of the DLIModel utility is packaged with your IMS system and is recommended for existing mainframe users with experience with IMS or z/OS development. To run this version of the utility, you must write a control statement.

185 What Does the DLI Model Utility Do?
The Utility reads in a number of source files: PSB DBD COBOL or PL/I copybook(s) …and creates: An interactive graphical model of the database (prior slide) A text-based database model report Several Java artifacts for SOA and for working with Java applications We will not focus on these in this section You can read about them in the product doc or online help file

186 What is Needed for the DLIModel Utility – 1 of 10
Download your source files – including the entire IMS Gen job stream Note the following: (In the current release) that the physical file name must match the DBD or PSB name: BMP255.PSB DEDBJN21.DBD Your DBD and PSB jobs must "gen" They must be syntactically accurate They must adhere to the DL/I data structure and processing rules In our example, we are using the following: DEDBJN21.DBD **Save as: BMP255.PSB //PSBGEN1 JOB CDC,CLASS=H,MSGLEVEL=(1,1),REGION=3000K,TIME=1440, // MSGCLASS=A /*ROUTE PRINT THISCPU/ALEXHAN //************************************************************ //* SCRATCH/ALLOC TEMP LIBRARY FOR VSO TESTING * //SCRDSETS EXEC PGM=IEHPROGM //SYSPRINT DD SYSOUT=A //DD DD UNIT=SYSDA,VOLUME=SER=000000,DISP=SHR //DD DD UNIT=SYSDA,DISP=SHR,VOLUME=SER=000000 //SYSIN DD * SCRATCH DSNAME=HOSPITAL.PSBLIB,VOL=SYSDA=000000 UNCATLG DSNAME=HOSPITAL.PSBLIB SCRATCH DSNAME=IMSTESTT.HOSPITAL.PSBLIB,VOL=SYSDA=000000 UNCATLG DSNAME=IMSTESTT.HOSPITAL.PSBLIB /* //ALLOC EXEC PGM=IEFBR14,COND=(4095,EQ) //DD DD DSN=IMSTESTT.HOSPITAL.PSBLIB,DISP=(NEW,CATLG,DELETE), // UNIT=SYSDA, // VOL=SER=000000,SPACE=(CYL,(2,1,5)), // DCB=(DSORG=PO,RECFM=U,BLKSIZE=13030) //SYSPRINT DD SYSOUT=A //PSBGEN1 EXEC ASMLK%%%, // LNKOUT='IMSTESTT.HOSPITAL.PSBLIB(BMP255),VOL=SER=000000' //ASSEM.SYSIN DD * * DSNAME=IMS%%%C.PSBLIB * VOL=IMSDCL *********************************************************************** * PCB NUMBER TP NUMBER 1 PCB TYPE=TP, C LTERM=CTRL, C ALTRESP=NO, C SAMETRM=NO, C MODIFY=NO, C EXPRESS=NO * PCB NUMBER TP NUMBER 2 LTERM=, C ALTRESP=YES, C SAMETRM=YES, C MODIFY=YES, C * PCB NUMBER TP NUMBER 3 EXPRESS=YES * PCB NUMBER TP NUMBER 4 * PCB NUMBER DB NUMBER 1 PCB TYPE=DB,DBDNAME=DEDBJN21,POS=M,PROCOPT=A,KEYLEN=26, C PCBNAME=PCB01 SENSEG NAME=HOSPITAL,PARENT=0 SENSEG NAME=PAYMENTS,PARENT=HOSPITAL,PROCOPT=GI SENSEG NAME=WARD,PARENT=HOSPITAL SENSEG NAME=PATIENT,PARENT=WARD SENSEG NAME=ILLNESS,PARENT=PATIENT SENSEG NAME=TREATMNT,PARENT=ILLNESS SENSEG NAME=DOCTOR,PARENT=TREATMNT SENSEG NAME=BILLING,PARENT=PATIENT * PCB NUMBER DB NUMBER 1 PCB TYPE=DB,DBDNAME=IVPDB1,PROCOPT=A,KEYLEN=10, C PCBNAME=PCB02 SENSEG NAME=A ,PARENT=0,PROCOPT=A PSBGEN PSBNAME=BMP255,LANG=ASSEM,CMPAT=YES END , ENDOF PSB GEN **Save as: DEDBJN21.DBD //DBDGEN JOB CDC,CLASS=W,MSGLEVEL=(1,1),REGION=0M,TIME=1440, // USER=USRT001,PASSWORD=ALL1SDUN //JOBLIB DD DSN=IMSBLD.I11ATS18.CRESLIB,DISP=SHR /*ROUTE PRINT THISCPU/IMSDV117 SCRATCH DSNAME=IMSTESTT.HOSPITAL.DBDLIB,VOL=SYSDA=000000 UNCATLG DSNAME=IMSTESTT.HOSPITAL.DBDLIB SCRATCH DSNAME=HOSPITAL.DBDLIB,VOL=SYSDA=000000 UNCATLG DSNAME=HOSPITAL.DBDLIB //ALLOC EXEC PGM=IEFBR14,COND=(4095,EQ) //DD DD DSN=IMSTESTT.HOSPITAL.DBDLIB,DISP=(NEW,CATLG), // UNIT=SYSDA, // VOL=SER=000000,SPACE=(CYL,(2,1,5)), // DCB=(DSORG=PO,RECFM=U,BLKSIZE=13030) //* DCB=(IMS320C.DBDLIB) //* //DBDGEN1 EXEC ASMLK11A, // LNKOUT='IMSTESTT.HOSPITAL.DBDLIB(DEDBJN21),VOL=SER=000000' * HOSPITAL : TITLE 'DBD FOR TESTING TO LOAD AND ACCESS' *** ONE ROOT SEG HOSPITAL *** ONE S.D.S PAYMENT *** D.D.S WARD, PATIENT, ILLNESS, BILLING, *** TREATMENT, DOCTOR, BILLING *** *** Defines 16K segments *** *** |HOSPITAL| *** | *** *** | | *** *** |PAYMENTS| | WARD | *** (SDEP) | *** *** |PATIENT| *** | | | *** *** |ILLNESS| |BILLING| *** | *** *** |TREATMENT| *** *** |DOCTOR | * DBDGEN * DSNAME=IMS11AC.DBDLIB DBD NAME=DEDBJN21, C ACCESS=(DEDB), C RMNAME=(RMOD3), C PASSWD=NO * AREA NUMBER 1 AREA DD1=HOSPAR0, C DEVICE=3330, C SIZE=(16384), C UOW=(15,10), C ROOT=(10,5) AREA DD1=HOSPAR1, C AREA DD1=HOSPAR2, C AREA DD1=HOSPAR3, C AREA DD1=HOSPAR4, C AREA DD1=HOSPAR5, C AREA DD1=HOSPAR6, C * SEGMENT NUMBER 1 SEGM NAME=HOSPITAL, C PARENT=0, C BYTES=(16000,12100), C RULES=(LLL,HERE) FIELD NAME=(HOSPCODE,SEQ,U), C START=3, C BYTES=12, C TYPE=C FIELD NAME=(HOSPNAME), C START=15, C BYTES=17, C FIELD NAME=(HOSPNAMX), C START=15982, C FIELD NAME=(HOSPLL), C START=1, C BYTES=2, C TYPE=X * SEGMENT NUMBER 2 SEGM NAME=PAYMENTS, C PARENT=HOSPITAL, C BYTES=(900,20), C TYPE=SEQ, C RULES=(LLL,FIRST) FIELD NAME=(PATMLL), C FIELD NAME=(PATNUM), C BYTES=4, C FIELD NAME=(AMOUNT), C START=7, C BYTES=8, C * SEGMENT NUMBER 3 SEGM NAME=WARD, C TYPE=DIR, C FIELD NAME=(WARDNO,SEQ,U), C FIELD NAME=(WARDNAME), C BYTES=15, C FIELD NAME=(PATCOUNT), C START=22, C TYPE=F FIELD NAME=(NURCOUNT), C START=26, C TYPE=P FIELD NAME=(DOCCOUNT), C START=30, C TYPE=H FIELD NAME=(WARDNAMX), C START=15984, C FIELD NAME=(WARDLL), C * SEGMENT NUMBER 4 SEGM NAME=PATIENT, C PARENT=WARD, C FIELD NAME=(PATNUM,SEQ,U), C FIELD NAME=(PATNAME), C BYTES=20, C FIELD NAME=(PATNAMEX), C START=15979, C FIELD NAME=(PATLL), C * SEGMENT NUMBER 5 SEGM NAME=ILLNESS, C PARENT=PATIENT, C FIELD NAME=(ILLLL), C FIELD NAME=(ILLNAME), C * SEGMENT NUMBER 6 SEGM NAME=TREATMNT, C PARENT=ILLNESS, C FIELD NAME=(TREATLL), C FIELD NAME=(TREATDAY), C FIELD NAME=(TREATMNT), C START=11, C FIELD NAME=(COMMENTS), C BYTES=10, C * SEGMENT NUMBER 7 SEGM NAME=DOCTOR, C PARENT=TREATMNT, C FIELD NAME=(DOCLL), C FIELD NAME=(DOCTNO), C FIELD NAME=(DOCNAME), C * SEGMENT NUMBER 8 SEGM NAME=BILLING, C BYTES=(200), C DBDGEN FINISH END **Save as: ivpdb1.DBD **************************** INSTALL/IVP ****************************** * * * M O D U L E P R O L O G U E * * * *********************************************************************** * * * NAME: DFSIVD * * * * DESCRIPTION: HIDAM/OSAM DBD * * * * * * Licensed Materials - Property of IBM * * * * "Restricted Materials of IBM" * * * * (C) Copyright IBM Corp. 1974, * * * * * * STATUS: IMS/ESA * * * * MODULE TYPE: ASSEMBLER * * * * CHANGES: CHANGED TO HIDAM/OSAM FOR * * * * * * * * * * SEGMENT DESCRIPTION * * ROOT ONLY DATABASE * * BYTES LAST NAME (CHARACTER) - KEY * * BYTES FIRST NAME (CHARACTER) * * BYTES INTERNAL PHONE NUMBER (NUMERIC) * * BYTES INTERNAL ZIP (CHARACTER) * * BYTES RESERVED * * * * * DBD NAME=IVPDB1,ACCESS=(HIDAM,OSAM) DATASET DD1=DFSIVD1,DEVICE=SYSDA,SIZE= SEGM NAME=A ,PARENT=0,BYTES=40,RULES=(LLV,LAST),PTR=(TB,CTR) FIELD NAME=(A ,SEQ,U),BYTES=010,START=00001,TYPE=C LCHILD NAME=(A1,IVPDB1I),POINTER=INDX,RULES=LAST DBDGEN FINISH END **Save as: ivpdb1i.DBD * NAME: DFSIVD1I * * DESCRIPTION: HIDAM INDEX DBD * * (C) Copyright IBM Corp * * CHANGES: NEW FOR * DBD NAME=IVPDB1I,ACCESS=(INDEX,VSAM,PROT) DATASET DD1=DFSIVD1I,DEVICE=SYSDA,SIZE= SEGM NAME=A1,PARENT=0,BYTES= FIELD NAME=(A1,SEQ,U),BYTES=010,START=00001,TYPE=C LCHILD NAME=(A ,IVPDB1),INDEX=A DBDGEN FINISH END The source code for these files can be found in your slide notes (for this slide) 1. Enter the slide Notes View 2. Copy/Paste the source into separate files 3. Save these files to your Workstation BMP255.PSB ivpdb1.DBD ivpdb1i.DBD

187 (Optional) Add the IMS Resources to a Local RDz Project – 2 of 10
After you have your DBD and PSB files downloaded to your workstation, you will probably want to add these files to a Local RDz Project To do this, from the File Menu: Select Import File System – as the source: Click Next Browse to the: Source Directory Where you saved the files Into folder: An existing project folder Click Finish From your project, Refresh the folder view

188 How to Install the DLIModel Utility – 3 of 10
Close RDz – if you are currently using the product Download the plug-in: From: Scroll to the Download area, and click: IMS DLIModel utility plugin You will have to login to DeveloperWorks Download the plug-in file to your workstation Install the plug-in: On your workstation From your RDz "Shared Packages" directory  Open the  plugins directory Copy the DLIModel file into it Restart RDz Note that your directories will most likely not look exactly like these screen captures

189 How to Create a Model – 4 of 10
From the IMS Perspective Switch to the IMS Perspective Create a DLIModel Utility Project: From File Select: New > DLIModel Utility Project Name your Project: Click: Next >

190 How to Create a Model – 5 of 10
Import the PSB and DBD source files you downloaded to your workstation, and Imported into a local z/OS Project Choose the PSB Source From directory: Select one or more PSB source files Choose the DBD Source Select one or more DBD source files Click Finish

191 Your DLI Model – 6 of 10 When the Utility finishes – assuming there are no generation errors, you should see: .mdl file: Graphic depiction of the segments in the hierarchy Your project expanded in the Package Explorer

192 Using the DLI Model – Optimizing Your View – 7 of 10
A few things to note: If your PSB/DBD view is large, you will probably want to see an Outline view of the database: From Window > Show View… Select Outline You can use the Outline view to move around inside the model  Alternatively on the toolbar you can configure the resolution of the graphics shown in the workbench:

193 Using the DLI Model – What are you Looking at? – 8 of 10
Each database PCB in your PSB is displayed in its own tab The lines denote relationships, established by the: DBD: SEGM/PARENT PSB: SENSEG/PARENT See Slide Notes on Secondary Index and IMS Logical database support Select any segment in the hierarchy Note the Properties view of the segment Expand a segment to see DBD FIELD definitions Different icons separate key fields Select a segment field and view Properties Segment Key Fields Note that logical databases and secondary index databases are supported at the parsing level The utility will show each database separately As of the current release however, secondary views are not displayed graphically in the model

194 The DLI Model Context Menu – 9 of 10
As of this writing, the Context Menu offers the following choices: Edit – which adds an alias into the XML produced for the database – it does not change the PSB or DBD source Import COBOL Fields (next slide) Add Field – again, adding to the XML produced Print Expand/Collapse – are shortcuts to different database viewing options Reset Layout – will re-establish the dimensions of your hierarchy to their initial display defaults, if you've moved a segment graphic around on-screen Properties – sets focus to the Properties view

195 Adding COBOL Fields to Your Model – 9 of 10
Often in IMS applications, the DBD/PSB will not specify all of the fields that occupy bytes in a segment. And it is left up to COBOL and PL/I copybooks to essentially redefine a large area as specific logical fields. To superimpose the COBOL fields on your model: Find/Select the COBOL copybook: Note – a set of declarations for a single source file (named: patient.cpy) has been added to the slide notes. Using the techniques shown earlier in this section, create a file and add it to your RDz workspace From the graphical model: Select the segment Right-click and select: Import COBOL Fields Browse to the directory on your workstation where your COBOL copybook can be found. Check the file Ensure that: To segment is correct Click Select If you have no more copybooks to map, click Finish **Save as: patient.cpy 01 Patient. 05 PatientDate. 10 DateIn pic x(8). 10 DateOut pic x(8). 05 PhoneNumber pic x(10).

196 Adding COBOL Fields to Your Model – 10 of 10
Re-display your view, and note the new COBOL fields – shown with the correct Byte displacements in your segment's graphic

197 Appendix 3 ISPF  RDz Editor Cheat Sheets
Author Notes: This is the standard session track template for IBM Rational Software Conference 2009 Additional IBM presentation resource links available on W3: Rational Core Messaging Slides Rational Image Library PowerPoint Best Practices Presentation © 2009 IBM Corporation

198 RDz – z/OS Comparison Concepts and Products and TSO
TSO/ISPF RDz – Integrated Development Environment Mainframe – z/OS PC – Windows/Linux JCL JCL. If doing offloading from z/OS. Shell scripts – on AIX machines Manually analyze code RDz (see slides in this PowerPoint), and RAAi - Edit Code - ISPF LPEX editor. Native LPEX or ISPF profile Compile/Compiler Options Validation, Syntax Check (Local or Remote) – Compiler options under RDz Property Groups Submit Job Edit JCL and submit job, or just use the Context menu and Submit Unit Test – DISPLAY/READY Trace, Xpeditor Debug Perspective – for z/OS (batch and online) applications – as well as Local COBOL projects Integration Test – Xpeditor IBM Debug Tool Integration QA – Regression Test - WinRunner Remote Systems Testing utilizing Rational Function Tester and Rational Performance Tester ABEND-AID/IBM Fault Analyzer RDz – Integrated Fault Analyzer from the IBM Problem Determination Tools File-Aid/IBM File Manager RDz – Integrated File Manager from the IBM Problem Determination Tools PDS (library) Folders - For Remote/SCM-based Projects and Local (z/OS) Projects JES Remote Systems View / JES functionality Endevor/ChangeMan – or Your SCLM 3rd Party SCMs utilize RDz's CARMA feature. RTCz and SCLM utilizing the SCLM provide their own RDz views. And there is Local History and source compare in native RDz ISPF Option 0 Window, Preferences ISPF Option 1 and Option 2 RDz Editor ISPF Option 3.1 (Library Utilities) Remote Systems view (Context Menu options) ISPF Option 3.2 (Dataset Utilities) ISPF Option 3.3 (Move and Copy) ISPF Option 3.4 (DSList) Project Explorer and Filters and Context Menu in Remote Systems Explorer and LPEX Editor ISPF Option 3.8 (Outlist) Remote Systems View – JES/My Jobs ISPF Option 3.11  3.15 (Extended Search) Search menu – covered in another RDz Distance Learning module ISPF Option 4 (Foreground) Context Menu, Run ISPF Option 6 TSO Command Shell – with some functional limitations (e.g. cannot issue Host Execs) ISHELL Remote Systems Explorer - USS files/filters + Context menu OMVS USS Command Shell SPUFI/QMF Data Perspective

199 RDz – ISPF Comparison Chart – PF-Keys
ISPF Editor LPEX Editor PF 1 = Help F1, Help Menu*** See slide notes PF 2 = Split: Split the session (lets you use two functions of TSO at the same time.) Ctrl/2 or Context Menu – Open New View. Note that you can open an unlimited number of views PF 3 = End Ctrl+F4, Ctrl + 0, or close the Content Area PF 4 = Return Ctrl+F4, or close the Content Area PF 5 = RFind (repeat last find ) F5 or Ctrl/F – and /<text> from LPEX command PF = 6 RChange (repeat lst change) F6 or Ctrl/N PF = 7 Page Backward F7 or PgUp key – or slider in window PF = 8 Page forward F8 or PgDn key – or slider in window PF = 9 Switch between screens during a split session; goes with PF 2 Mouse – or Alt + Shift + Right/Left arrows PF = 10 Page left Ctrl+PgUp or, the Home key, or slider in window PF = 11 Page right Ctrl+PgDn or, the End key, or slider in Window PF 12 Retrieve For LPEX commands, the Up Arrow Use ISPF Option 0 to customize PF-Keys Use Preferences to customize and extend Function key behavior The LPEX Context Menu can be accessed from the Right-mouse button – and from the Windows Menu key (on the keyboard between the right Alt & Ctrl keys) It should be noted that with the LPEX editor, it is not necessary for most of the above functions to actually press Ctrl/Key combinations, as the functionality is available from a context menu (right-mouse) In LPEX F1 gives you language-sensitive help (pressing F1 while the cursor is on a COBOL keyword will display help for that keyword). To get LPEX help, enter the help command from the LPEX command line.

200 RDz – ISPF Comparison Chart – Primary Edit Commands
ISPF Editor LPEX Editor Home key – Jump to the Command Line Escape key – jumps to the LPEX command line AUTOSAVE/REC Prompt for Save on exit, and Autosave (Preferences), and the asterisk – next to unsaved file names BOTtom LPEX command: bottom / Ctrl+End CANcel Close Content Area w/Save no (Ctrl CHANGE – All – NEXT, CHARS, X, ALL PREFIX, FIRST, SUFFIX, LAST, WORD, PREV, [col-1] [col-2] Supported using Change All, Next, PREV, Prefix and Suffix (with wildcards), Prev, Word, [col-1][col-2], …or… Find/Replace menu (Ctrl+F), ISPF or the Search/Replace dialog: Copy Member Name LPEX command: Get filename CREATE Save file as…, or use Snippets View FIND – NEXT, CHARS, X, ALL PREFIX, FIRST, SUFFIX, LAST, WORD, PREV, [col-1] [col-2] Supported using findText, Ctrl+F, or the Search window: Find All, Next, PREV, Prefix and Suffix (with wildcards), Prev, Word, [col-1][col-2], P Not supported: First, Last HEX – Displays all lines in Hexadecimal Display one individual lines in Hex ISPF Macros Not available – but can be re-written using Java for LPEX. Also, note that with the LPEX functionality some of the Macro functionality may not be necessary LOCATE Ctrl+L, or use the Outline View MODEL Snippets and Templates (both options) MOVE Member Name LPEX Get command, in a different way, the Snippets View NUMBER LPEX command: number std (columns 7380), or number cob PRINT – from ISPF 3.4 LPEX command: print, or Ctrl+P PROFILE – are the changes made to your profile Preferences Replace Member Name Snippets functionality RESet RES command, or: Ctrl+W, or expandAll, or: action showAll Save Ctrl/S or LPEX: save command Sort LPEX command: sort STATS – updates statistics Windows updates file statisticsautomatically SUBmit LPEX command: Submit, or edit JCL/Context Menu/Submit, or use Context Menu/Submit option TABS Set margins in Preferences, LPEX Editor, Tabs TOP LPEX command: top / Ctrl+Home TSO SUB LPEX command: submit, and edit JCL/Context Menu/Submit, or use Context Menu/Submit option UNNUM LPEX command: unnum ***Changes to Preferences are persistent, even if they are changed via LPEX commands. Also you can write/modify User Profiles which customize LPEX settings (but this requires writing a Java class and a plug-in).

201 RDz – ISPF Comparison Chart – Find Commands – Picture Strings
ISPF Editor LPEX Editor Simple String Y Previous String Find Previous / F5 Delimited String Text string Picture Strings – special characters Y – with regular expressions P'=' – any character Ctlr+F,  Regular Expression, . P'-' – any non-blank character Ctlr+F,  Regular Expression, [^\s] P'.' – any non-displayable character Ctlr+F,  Regular Expression, [^\x20-\x7E] P'#' – any numeric character Ctlr+F,  Regular Expression, [0-9] P'-' – any non-numeric character Ctlr+F,  Regular Expression, [^0-9\x20] – any alphabetic character Ctlr+F,  Regular Expression, [A-Za-z] P'<' – any lower-case character Ctlr+F,  Regular Expression, [a-z] P'>' any upper-case alphabetic character Ctlr+F,  Regular Expression, [A-Z] P'$' – any special character (not alphanumeric) Ctlr+F,  Regular Expression, [^A-Za-z0-9] . Dot, any single character \ special Expression ^ logical NOT \x Hexadecimal Ctrl+F Note: for more Regular expression searches:

202 RDz – ISPF Comparison Chart – Prefix Area Commands
ISPF Editor LPEX Editor – ISPF Mode LPEX Editor – lpex Mode A, An – After A, An Context menu B, Bn – Before B, Bn COLS – show columns Columns always shown C, Cn, CC – Copy C, Cn, CC D, Dn, DD Context menu or Ctrl+Backspace F, Fn – First (used with eXclude) F, Fn (used with eXclude) N - Find excludes lines of code I, In – Insert lines I, In Press <Enter>, or LPEX command: insert LPEX command: add L, Ln – Last (used with eXclude) M, Mn, MM – Move M, Mn, MM-Move, and Context menu R, Rn, RR, RRn – Repeat lines R, Rn, RR, RRn, and Context menu, Ctrl+D Context menu – or Ctrl+D S, Sn – Show (used with eXclude) S, Sn – Show (used with eXclude) and Filter Filter TABS – used with TAB On Set with Preferences X, Xn, XX eXclude X, Xn, XX O, On, OO – Overlay O, On, OO Use Rectangle Copy/Paste LC, UC – Lower-case/Upper-case LC, UC Use the Context menu TS, TSn – Text Split Ctrl+<Enter> <Enter> <, <n, <<N Shift Data Left <, <n, <<n Use Rectangle Select – shift >, >n, >>n Shift Data right >, >n, >>n (, (n, ((, ((N – columns left – Used with COBOL (, (n, ((n ), )n, )), ))n – Columns Right ), )n, ))n I don't know what all the supported line commands are off the top of my head, but see the following help page: Developing > Developing COBOL, PL/I, Assembler, and C++ applications > Language Editors > System z LPEX Editor > z/OS extensions to the base LPEX editor > System z LPEX commands > ISPF LPEX commands. The ISPF commands come from a number of different products/development teams, so the documentation is a bit convoluted, but the above page contains links to all the relevant documentation.

203 RDz – ISPF Comparison Chart – LPEX Editing Operations – 1 of 2
LPEX Editor ISPF Editor Refactor – Remove Noise Words: - IS, THEN, PROCEED TO N/A Multiple Line Comment/Uncomment Virtual margins – in the editor Code completion (Content Assist) Open Copybook Open Declaration – of variable or PERFORM'd paragraph from anywhere in the Procedure Division Perform Hierarchy Refactor – wizard for intelligent variable name changes Outline View Filter View – Show only Divisions, SQL,CICS,DL/I, Code (no comments), etc. COBOL, PL/I and HLASM keyword / language help Show lines that have been changed during edit (before save) Find and Change against multiple file types Block Marking (Ctrl+Down, Ctrl+Up, Ctrl+Home, Ctrl+End) Virtual 'A' and 'B' Column lines in the source code Allocate Like Remote System Filters Side-by-side Compare and/or Restore from Local History Close all split screens in one operation (context menu) See file attributes and statistics at all times (in a View)

204 RDz – ISPF Comparison Chart – LPEX Editing Operations
LPEX Editor ISPF Editor See file attributes and statistics at all times (in a View) N/A Wizard-driven approach to creating Web Services (WSDL files) from: CICS and IMS TM applications Wizard-driven approach to creating, testing and deploying DB2 Stored Procedures Copy files from one LPAR to another Edit/Compile/Unit Test if the mainframe is offline Syntax error – automatically select line with problem See 46  76 lines of source at once Templatized program development Regular expression searches – including across Filtered files of different file types Keystroke recorder (useful for repetitive tasks and online testing) Bookmark and Tasks (both lines of source and filtered views) Find "Last Changed" line of source code / Ctrl+J Mark lines – including individual names Find Marked Lines / Find named Marked Lines Syntax errors as you type Syntax check in the editor

205 The COBOL Café and Rational - z/OS Product Training from IBM
To become more innovative and more competitive, companies know that education – in all forms is necessary - today more than ever. To help, IBM has implemented solutions that feature community-based knowledge sharing - that give your developers instant, secure access to shared content, and expertise in: COBOL / IMS / CICS / DB2 and z/OS Technologies Rational Developer for System z (RDz) Rational Application Analyzer (RAA) Check out the COBOL Café And check out upcoming free, self-paced IBM training in: RDz / RAA / COBOL / IMS / CICS / DB2

206 IBM Rational software: www.ibm.com/software/rational
Mandatory IBM Rational standard closing slide to be included in all external presentations. Learn more links: IBM Rational software: Rational launch announcements: Rational Software Delivery Platform: Accelerate change and delivery: Deliver enduring quality: Enable enterprise modernization: Ensure Web site security and compliance: Improve project success: Manage architecture: Manage evolving requirements: Small and midsized business: Targeted solutions: Rational trial downloads: Leading Innovation Web site: developerWorks Rational: IBM Rational TV: IBM Rational Business Partners: IBM Rational Case Studies: © Copyright IBM Corporation 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. 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, Rational, the Rational logo, Telelogic, the Telelogic logo, and other IBM products and services are 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.


Download ppt "Introduction to Rational Developer for System z For ISPF Developers"

Similar presentations


Ads by Google