OO-Cobol. Moving between MVS and UNIX From MVS, use a TSO command to start a UNIX shell: TSO OMVS Or TSO ISHELL From UNIX, use the exit command to return.

Slides:



Advertisements
Similar presentations
Introduction to the Omega Server CSE Overview Intro to Omega Basic Unix Command Files Directories Printing C and C++ compilers GNU Debugger.
Advertisements

Lecture 2: Object Oriented Programming I
Slides prepared by Rose Williams, Binghamton University Chapter 13 Interfaces and Inner Classes.
CS1020: Intro Workshop. Topics CS1020Intro Workshop Login to UNIX operating system 2. …………………………………… 3. …………………………………… 4. …………………………………… 5. ……………………………………
Guide To UNIX Using Linux Third Edition
Introduction to Unix (CA263) Introduction to Shell Script Programming By Tariq Ibn Aziz.
Prof. R. Willingale Department of Physics and Astronomy 2nd Year C+R 2 nd Year C and R Workshop Part of module PA2930 – 2.5 credits Venue: Computer terminal.
7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE1 Unix Comp-145 C HAPTER 2.
Java Methods By J. W. Rider. Java Methods Modularity Declaring methods –Header, signature, prototype Static Void Local variables –this Return Reentrancy.
Programming Languages and Paradigms Object-Oriented Programming.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
OO Cobol in z/OS.
Introduction to Shell Script Programming
Understanding the CORBA Model. What is CORBA?  The Common Object Request Broker Architecture (CORBA) allows distributed applications to interoperate.
Introduction to COBOL. COBOL  COBOL is an acronym which stands for Common Business Oriented Language.  The name indicates the target area of COBOL applications.
History COBOL (Common Business Oriented Language) was one of the earliest high-level programming languages. COBOL was first proposed in 1959 by the Conference.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
Chapter Two Exploring the UNIX File System and File Security.
Functions Kernighan/Ritchie: Kelley/Pohl: Chapter 4 Chapter 5.
UNIX Commands. Why UNIX Commands Are Noninteractive Command may take input from the output of another command (filters). May be scheduled to run at specific.
Learners Support Publications Classes and Objects.
Getting started: Basics Outline: I.Connecting to cluster: ssh II.Connecting outside UCF firewall: VPN client III.Introduction to Linux IV.Intoduction to.
Comp 249 Programming Methodology Chapter 13 Interfaces & Inner Classes Dr. Aiman Hanna Department of Computer Science & Software Engineering Concordia.
Java Classes. Consider this simplistic class public class ProjInfo {ProjInfo() {System.out.println("This program computes factorial of number"); System.out.println("passed.
Java™ How to Program, 10/e © Copyright by Pearson Education, Inc. All Rights Reserved.
C++ Class Members Class Definition – class Name – { – public: » constructor(s) » destructor » function members » data members – protected: » function members.
More About Objects and Methods Chapter 5. Outline Programming with Methods Static Methods and Static Variables Designing Methods Overloading Constructors.
CPS4200 Unix Systems Programming Chapter 2. Programs, Processes and Threads A program is a prepared sequence of instructions to accomplish a defined task.
Unix Environment Input Output 2  List Content (ls) ◦ ls (list current directory) ◦ ls –all (include hidden files/folders)  Make directory (mkdir) ◦
Introduction to Java Chapter 7 - Classes & Object-oriented Programming1 Chapter 7 Classes and Object-Oriented Programming.
Inheritance. Inheritance - Introduction Idea behind is to create new classes that are built on existing classes – you reuse the methods and fields and.
Classes. Constructor A constructor is a special method whose purpose is to construct and initialize objects. Constructor name must be the same as the.
1 Chapter 5: Defining Classes. 2 Basics of Classes An object is a member of a class type What is a class? Fields & Methods Types of variables: –Instance:
Chapter 10: Classes and Data Abstraction. Objectives In this chapter, you will: Learn about classes Learn about private, protected, and public members.
IBM-Mainframes COBOL Class-1. Background and History  COBOL is an acronym for: Common Business Oriented Language  COBOL was developed in 1959 by the.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 9 Java Fundamentals Objects/ClassesMethods Mon.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
CSI 3125, Preliminaries, page 1 Class. CSI 3125, Preliminaries, page 2 Class The most important thing to understand about a class is that it defines a.
COBOL VS. JAVA in Object Orientation
Java Programming, Second Edition Chapter Twelve Advanced Inheritance Concepts.
Classes, Interfaces and Packages
Programming in java Packages Access Protection Importing packages Java program structure Interfaces Why interface Defining interface Accessing impln thru.
Makefiles1 MAKEFILES Purpose: contain UNIX commands and will run them in a specified sequence. Syntax Definition : { Section-name: {unix command #1} …
+ Storage Classes and Linkage. + Introduction Scope describe the region or regions of a program that can access and identifier Variables can be shared.
Chapter 10: Classes and Data Abstraction. Classes Object-oriented design (OOD): a problem solving methodology Objects: components of a solution Class:
Methods.
Creating Java Applications (Software Development Life Cycle) 1. specify the problem requirements - clarify 2. analyze the problem - Input? Processes? Output.
Learners Support Publications Constructors and Destructors.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 10 Java Fundamentals Objects/ClassesMethods.
Methods, classes, and Objects Dr. Jim Burns. Question  Which of the following access modifiers is the default modifier?  public  private  protected.
Constructors and Destructors
UNIX To do work for the class, you will be using the Unix operating system. Once connected to the system, you will be presented with a login screen. Once.
Friend Class Friend Class A friend class can access private and protected members of other class in which it is declared as friend. It is sometimes useful.
Java Primer 1: Types, Classes and Operators
Chapter 3: Using Methods, Classes, and Objects
Programming in COBOL.
This pointer, Dynamic memory allocation, Constructors and Destructor
Comp 249 Programming Methodology
Chapter 3 Introduction to Classes, Objects Methods and Strings
Chapter 3 Introduction to Classes, Objects Methods and Strings
Java Programming Language
Packages and Interfaces
Constructors and Destructors
Run Java file with Window cmd
Classes and Objects.
Java – Inheritance.
Inner Classes.
Object Oriented Programming in java
Programming in COBOL.
SPL – PS3 C++ Classes.
Presentation transcript:

OO-Cobol

Moving between MVS and UNIX From MVS, use a TSO command to start a UNIX shell: TSO OMVS Or TSO ISHELL From UNIX, use the exit command to return to MVS: exit

Logging Directly into z/OS UNIX You can telnet directly to z/OS UNIX from a command prompt: c:\> telnet You cannot switch to TSO. You can use the TSO SHELL command to run a TSO command from your shell session You can use the UNIX vi editor or UNIX-style command- line editing You cannot use OEDIT to edit a file

Basic z/OS UNIX Commands Use the change directory (cd) command to move to a specific directory: CSUP004:/u: cd /u/csu/csup004 Use the list command (ls) to list subdirectories and files in the current directory: CSUP004:/u: ls

Basic z/OS UNIX Commands Use the remove (rm) command to remove a file or subdirectory: CSUP004:/u: rm myprog.java Use a shell command (oedit) to edit or create a file: CSUP004:/u: oedit myprog.java

Defining a Cobol Class IDENTIFICATION DIVISION. … ENVIRONMENT DIVISION. … FACTORY. (optional) … OBJECT. (optional) … END CLASS

IDENTIFICATION DIVISION Identification Division. Class-id. Account inherits Base. Names the class you are defining Names the immediate superclass (Java or Cobol) Base is defined in the Repository All classes must be derived directly or indirectly from java.lang.Object

Repository Environment Division. Configuration Section. Repository. Class Base is “java.lang.Object” Class Account is “Account”. Connects the internal names to external class names Base is required, Account is optional Specify the external class name if the name contains non-Cobol characters, or any referenced class that is part of a Java package

Class Instance Data Define a Data Division and a Working-Storage section in the Object section to define instance data The Object section is immediately preceded by an Identification Division. Identification Division. Object. Data Division Working-Storage section. 01 AccountNumber pic 9(6). 01 AccountBalance pic s9(9) value zero. … End Object.

Initializing Instance Data Initialize instance data by using value clauses Complex instance data can be initialized by calling customized methods Cobol instance data is equivalent to Java private nonstatic member data.

cbl dll,thread,pgmname(longmixed) Identification Division. Class-id. Account inherits Base. Environment Division. Configuration section. Repository. Class Base is "java.lang.Object" Class Account is "Account". * Identification division. Object. Data division. Working-storage section. 01 AccountNumber pic 9(6). 01 AccountBalance pic S9(9) value zero. * Procedure Division. ** (Instance method definitions here) * End Object. * End class Account.

Defining Instance Methods Define instance methods in the Procedure Division of the Object paragraph Each instance method has four divisions: 1) Identification – names the method 2) Environment – names the files the method uses 3) Data – defines files and creates local variables 4) Procedure – defines the executable statements that provide the service

Method – Identification Division Identification Division. Method-id. “credit”.

Local Storage Section A separate copy of Local-Storage is allocated for each invocation of the method, and is freed on return If a value clause is coded, the item is initialized to that value on each invocation of the method

Working Storage Section A single copy of Working-Storage is allocated. Data persists in its last-used state until the run unit ends The same copy of data is used whenever the method is invoked, regardless of the invoking object or thread A value clause is used to intialize a data item on the first invocation of the method

Linkage Section This works like any linkage section to provide addressability to data outside the method

Procedure Division for Methods Code the executable statements for a method in the Procedure Division Compile with the THREAD option You can code EXIT METHOD or GOBACK If you specify RETURNING upon invocation of the method, the EXIT METHOD or GOBACK returns the value of the data item to the invoking client There is an implicit EXIT METHOD at the end of each Procedure Division for each method Coding STOP RUN kills the entire run unit Code End Method for each Method body

Defining a Method Procedure Division. * Identification Division. Method-id. "getBalance". Data division. Linkage section. 01 outBalance pic S9(9) binary. * Procedure Division returning outBalance. Move AccountBalance to outBalance. End method "getBalance". ** (Other instance methods not shown) End Object. * End class Account.

Client Programs In a Cobol or Java client, you can: 1)Create object instances of Java and Cobol classes. 2)Invoke instance methods on Java and Cobol objects 3)Invoke Cobol factory methods and Java static methods

Client Programs Each client has four divisions: 1)Identification - a) Declare program RECURSIVE in the Program-Id paragraph. b) Compile with the THREAD option 2)Environment – define a repository 3)Data – define local client data 4)Procedure – create classes, manipulate objects

Client Data Division Data Division. Local-storage section. 01 anAccount usage object reference Account. 01 aCheckingAccount usage object referenceCheckingAccount. 01 aCheck usage object reference Check. 01 payee usage object reference Account. Object reference variables are like reference variables in Java If the class name is omitted after “object reference”, the reference can point to any object and have limited interoperability with Java You must define class-names that are used in the object reference phrase. The definitions belong in the Repository.

Comparing Object References One way to compare object references is by coding conditional statements: If anAccount = Null … If anAccount = Nulls … You can also invoke the JNI IsSameObject service: Set address of JNIEnv to JNIEnvPtr Set address of JNINativeInterface to JNIEnv Call IsSameObject Using by value JNIEnvPtr object1 object2 returning

Comparing Object References You can also invoke the JNI IsSameObject service: 01 is-same Pic X. 88 is-same-false value x’00’. 88 is-same-true value x’01’ through x’FF’. Linkage Section. Copy JNI. Procedure Division. Set address of JNIEnv to JNIEnvPtr Set address of JNINativeInterface to JNIEnv Call IsSameObject Using by value JNIEnvPtr object1 object2 returning is-same If is-same-true …

Comparing Object References Within a method, calling IsSameObject with SELF compares an object reference to see if it refers to the same object as the one on which the method was invoked

Setting References An object reference can be set to null: Set anAccount to Null. An object reference can be set to another reference: Set anAccount to otherAccount. An object reference can point to the containing object: Set anAccount to SELF.

Invoking Methods Use Invoke to execute a method: Invoke Account "createAccount" using by value returning anAccount Invoke anAccount "credit" using by value 500. The createAccount method must be a Cobol factory method if Account is a Cobol program Variable anAccount must be defined: 01anAccount usage object Reference Account.

Defining a Factory Factory methods and data are associated with the class (similar to Java static members) Identification Division. Factory. Data Division. Working-storage section. … Procedure Division. … End Factory

Compiling, Linking Cobol Classes To compile a Cobol class: cob2 -c -qdll,thread Accounta.cbl To compile the Java version: javac Accounta.java To link in the sidefiles and build a DLL: cob2 -bdll -o libAccounta.so Accounta.o /u/Java5_31/J5.0/bin/j9vm/libjvm.x /usr/lpp/cobol/lib/igzcjava.x

Java Client To Compile: javac Actrunr.java To execute: java Actrunr