GUI and Object Oriented Programming in COBOL
Total Page:16
File Type:pdf, Size:1020Kb
DOCUMENT RESUME ED 422 922 IR 057 080 AUTHOR Lorents, Alden C. TITLE GUI and Object Oriented Programming in COBOL. PUB DATE 1997-00-00 NOTE 9p.; In: Proceedings of the International Academy for Information Management Annual Conference (12th, Atlanta, GA, December 12-14, 1997); see IR 057 067. PUB TYPE Reports Descriptive (141) Speeches/Meeting Papers (150) EDRS PRICE MF01/PC01 Plus Postage. DESCRIPTORS *Computer Interfaces; *Computer Science Education; Computer Software Development; *Computer System Design; Curriculum Development; Design Preferences; Higher Education; *Programming; *Programming Languages IDENTIFIERS COBOL Programming Language; *Graphical User Interfaces; *Object Oriented Programming ABSTRACT Various schools are struggling with the introduction of Object Oriented (00) programming concepts and GUI (graphical user interfaces) within the traditional COBOL sequence. 00 programming has been introduced in some of the curricula with languages such as C++, Smalltalk, and Java. Introducing 00 programming into a typical COBOL sequence presents some interesting challenges. There are a number of new concepts to introduce along with various design issues that are relatively new to 00 program design, such as file maintenance and data objects. Most C++ programming courses tend to work with objects that are more user interface related, such as traditional GUI objects. This paper describes an example of using 00 COBOL and Dialog Systems (GUI builder) in an advanced programming applications course. (Author/AEF) ******************************************************************************** Reproductions supplied by EDRS are the best that can be made from the original document. ******************************************************************************** GUI AND OBJECT ORIENTED PROGRAMMING IN COBOL U.S. DEPARTMENT OF EDUCATION "PERMISSION TO REPRODUCE THIS Office of Educational Research and Improvement .C4 EDUCATIONAL RESOURCES INFORMATION MATERIAL HAS BEEN GRANTED BY C1 CENTER (ERIC) Alden C. Lorents ON 0 This document has been reproducedas T. Case CN 1 received from the person or organization Northern Arizona University originating it. Tr 0 Minor changes have been madeto 0 improve reproduction quality. 44 TO THE EDUCATIONAL RESOURCES Points of view or opinions stated inthis document do not necessarilyrepresent INFORMATION CENTER (ERIC)." official OERI position or policy. Various schools are struggling with the introduction of Object Oriented (00) programming concepts and GUI within the traditional COBOL sequence. 00 programming has been introduced in some of the curriculums with languages such as C++, Smalltalk, and Java.Introducing 00 programming into a typical COBOL sequence presents some interesting challenges.There are a number of new concepts to introduce along with various design issues that are relatively new to 00 program design such as file maintenance and data objects. Most C++ programming courses tend to work with objects that are more user interface related such as traditional GUI objects. This paper describes an example of using 00 COBOL and Dialog Systems (GUI builder) in an Advanced Programming Applications course. INTRODUCTION GUI AND COBOL USING DIALOG SYSTEMS "COBOL is in a unique position to bridge the past with the future. COBOL practitioners bring a Adding GUI (windows) to COBOL program wealth of experience spanning all phases of the development is very easy today with the use of software life cycle including analysis, design, either Micro-Focus Dialog Systems or IBM Visual implementation,databaseintegration,and Age for COBOL. The examples shown in this maintenance" [Arranga, 1997]. The inventory of paper were done using Dialog Systems. The legacy systems continues to be estimated at window shown in figure1is a passenger around 180 billion lines of COBOL code. Some reservation window that is used to maintain data organizations (typically technology and using a traditional VSAM file structure with a engineering based companies) have migrated primary key(itinerarynumber) and two away from using COBOL. They have done this by alternate keys (passenger name and flight going to client-server systems using databases number). such as Oracle, Sybase and DB2 along with client tools such as Visual Basic, Powerbuilder, and FIGURE 1 Oracle tools.Many organizations are still committed to their COBOL based systems file because of the high investment in these systems, Passenger the high cost to rebuild the systems, and the Itinerary No:1000005 Name: !Anderson Ole inability of the newer client-server technologies to Phone:520.526.8396 handle the loads in large systems (salability). 00 COBOL, GUI builders (such as Micro Focus Date:01/25/1997 Flight No:0099 Fare: 10101.00 Dialog Systems and IBM Visual Age for COBOL) and the integration of these products with common objectstandards (Common Object NEXT OUERY COMPLETED Request Broker Architecture CORBA), may provide an alternativefor many of these OFM1 I organizations to migrate their legacy systems into jaP. !plant newer systems based on the new technologies. Proceedings of the 12°' Annual Conference of the International Academy for Information Management 107 2 FIGURE 2 .',',.:111MMIN11111:111::: :::: iiii::::::1:1111i1:::. :': :'oi -I .1,::.:..::::11.1.1. .:::: .:::::. : '''::::::: .. ':::::101119::: l'''' FileEditObjectScreensetViewOjitionsiools H lp ia :17,' :.,:,..kz T'pe Window insole DEFAULT II7 48.0 Ilt 1896.106 It*I Nieto00e r Reservation LIktjt Passenger----%-- ----- a ifinetary No: Pii-jNOM et:x(20) i ti Phoncix(1 2) I) ate.; i x(1 0) night No;9(4) FarC 9(4).9(2) ; I Too , rr- In pc14 01 r 0 ,.._._.,. I A r f Cl 0 Add mom L.,1104:1 Exit Rein! F4 1 ' -- ' r qfj Lsmrlitz.1 Print ViRizti Frta* 1 E tilkirv WIR,PAS 5 I The window is built using the Dialog Systems object palette or object pull down menu shown in FIGURE 3 figure 2. Objects available include primary window,secondarywindow(clippedand FLD NO FIELDNAME FORMATLENGTH unclipped), dialog box, message box, entry field, multiple line entry field, push button, radio 1 X300-ITINERARY-NO 9 6.00 button, check box, list box, selection box, text box, group box, bitmap and notebook. 2 X300-NAME X 20.00 3 X300-PHONE X 12.00 Normally you start the build process by defining a set of data to be used with the window. The data 4 X300-DATE X 10.00 is referred to as a data block and is defmed 5 X300-FLIGHT-NO 9 4.00 similar to COBOL. The data block can be entered in Dialog Systems or imported from a COBOL 6 X300-FARE 9 4.02 data definition.The data block used for this X300-ACTION X 1.00 window is shown in figure 3. 8 X300-MESSAGE X 40.00 Normally a data element is defined for each field supported on the window along with any other application program knows which button theuser fields necessary to support communication pushed when control is turnedover to the between the window and theapplication application program. Each of the other fields is program. X300-Action is used to communicate a associated with a entry field or display fieldon codetotheapplication program,sothe the window.A copy block (file) of COBOL 108 Proceedings of the 12 'h Annual Conference of the International Academyfor Information Management definitions corresponding to each field on the FIGURE 4 window is generated by a command on the file menu. This file is called using a copy statement GLOBAL DIALOG: in the Working Storage Section of the COBOL ESC program. This assures that the data definitions MOVE "X" X300-ACTION in the application program are exactly the same RETC as the data definitions on the window. CLOSED-WINDOW MOVE "X" X300-ACTION The operation of a window is controlled by events. RETC Events can be trapped at various levels such global (events associated with all windows in the LOCAL DIALOG: set), for each specific window, and for each @MNU-EXIT specific object on a window. Examples of events MOVE "X" X300-ACTION include window created, closed window, item RETC selected, mouse over, button selected, gained focus, lost focus and various other events. Each DIALOG FOR PUSH BUTTON : PB-ADD event can be trapped at different levels and BUTTON-SELECTED programmed to carry out various functions. This MOVE "A" X300-ACTION programming is called script and is executed as RETC part of the windows operating system. Figure 4 REFRESH-OBJECT $WINDOW shows some examples of script that are used on this window. Escape and Closed-Window have been defined in this application to exit the Two blocks of data (data block and control block) application. The application program has been pass between the application program and the programmed to exit when it sees an 'X' in the Dialog Systems Program (DSRUN) each time action code. The command RETC is a script control is passed from one to the other. The command to leave the window and return to the application program calls the Dialog Systems calling (application) program.The local dialog program with a subprogram Call Statement. The for the window traps the exit menu selection code in the application program that is used to under File and also closes the application. If the communicate with Dialog Systems is shown in escape and closed-window events under GLOBAL Figure 5.The program-initialize routine is were moved to LOCAL for the window win-pass, executed once at the beginning of the application then those events would be trapped only when to set up some of the parameters in the control that window is in focus. block. The Call-Dialog routine is used each time the application program returns control to the Script is written for each button to tell the window. Note that the Call statement calls application program which routine to execute Dialog-System as a subprogram using the control when control is returned to the application block and the data block. program. When the application program returns to the window, the window program continues to Setting up windows like this allows faculty to execute the script that is was on when it turned illustrate all of the components of client-server control over to the application program.