Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

OOPS concept in COBOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
amiya_mf

New User


Joined: 01 Mar 2005
Posts: 19

PostPosted: Fri Apr 13, 2007 5:27 pm    Post subject: OOPS concept in COBOL
Reply with quote

hI,

Can anybody help me to develop a object oriented program in cobol. i tried but could not sucessed.

Regards,
Amiya
Back to top
View user's profile Send private message

agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 686
Location: Earth

PostPosted: Fri Apr 13, 2007 5:30 pm    Post subject:
Reply with quote

Post what you tried and what problem you faced?
then we may be able to offer some suggestions.
Back to top
View user's profile Send private message
amiya_mf

New User


Joined: 01 Mar 2005
Posts: 19

PostPosted: Mon Apr 16, 2007 5:49 pm    Post subject: OOPS concept in COBOL
Reply with quote

Hi Abhijit,

Following is the program i am trying but getting compilation error...

Could you please suggest and let me know what should i do ?

Code:
*************************** Top of Data ******************
 IDENTIFICATION DIVISION.                                 
*                                                         
* ORDERS IS THE NAME OF THE CLASS                         
* ORDERS INHERITS FROM SOMOBJECT (SOM BASE CLASS)         
*                                                         
 CLASS-ID. Orders INHERITS SOMObject.                     
/                                                         
 ENVIRONMENT DIVISION.                                   
 CONFIGURATION SECTION.                                   
 REPOSITORY.                                             
     CLASS SOMObject IS 'SOMObject'                       
     CLASS Orders IS 'Orders'.                           
/                                                         
 DATA DIVISION.                                           
 WORKING-STORAGE SECTION.                                 
*                                                         
* INSTANCE DATA FOR ORDERS CLASS                         
*                                                         
 01  ORDER-NUMBER PIC 9(5).                               
 01  ORDER-DATE PIC X(8).                                 
 01  ORDER-COUNT PIC 99.                                 
 01  ORDER-TABLE.                                         
     02  ORDER-ENTRY OCCURS 10 TIMES.                     
         03  ORDER-ITEM PIC X(5).                         
/                                                         
 PROCEDURE DIVISION.                                     
*                                                         
* METHOD DEFINITIONS IN HERE                             
 IDENTIFICATION DIVISION.                                 
 METHOD-ID. 'somInit' OVERRIDE.                           
 PROCEDURE DIVISION.                                     
*                                                         
     MOVE FUNCTION CURRENT-DATE(1:8) TO order-date.       
     COMPUTE order-number = FUNCTION RANDOM ( 99999 ).   
     MOVE 0 TO order-count.                               
     INITIALIZE order-table.                             
     EXIT METHOD.                                         
 END METHOD 'somInit'.   
* Method to add an item to an order 
 IDENTIFICATION DIVISION.                                 
 METHOD-ID. AddItem.                                       
 DATA DIVISION.                                           
* Use LOCAL-STORAGE for items that should be allocated     
* and initialized for each invocation of the method       
 LOCAL-STORAGE SECTION.                                   
 77 sub PIC 99.                                           
 01  found-flag PIC 9 VALUE 1.                             
     88 found VALUE 0.                                     
 LINKAGE SECTION.                                         
 01 in-item PIC X(5).                                     
 01 add-flag PIC 9.                                       
 PROCEDURE DIVISION USING in-item RETURNING add-flag.     
     MOVE 1 TO add-flag.                                   
     PERFORM VARYING sub FROM 1 BY 1                       
       UNTIL (sub > 10) OR (found)                         
        IF order-item (sub) = SPACES                       
           MOVE in-item TO order-item (sub)               
           ADD 1 TO order-count                           
           MOVE 0 TO add-flag                             
           SET found TO TRUE                               
        END-IF                                             
     END-PERFORM.                                         
     EXIT METHOD.                                         
 END METHOD AddItem.                                       
 END CLASS Orders.                                         
*********************************************


agkshirsagar wrote:
Post what you tried and what problem you faced?
then we may be able to offer some suggestions.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Apr 18, 2007 12:54 am    Post subject:
Reply with quote

Hello,

You should also post the output messages from the copiler.

For starters (if this is a single program) you have multiple identification division statements. This is not allowed. How much COBOL experience have you?

If you don't already have one, you might want to create a non-OO version of the program to prove the logic works.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Wed Apr 18, 2007 10:33 am    Post subject:
Reply with quote

Amiya,

Are you trying to write a cobol nested program? As pointed out by dick, you have multiple id division statements in the program.
Back to top
View user's profile Send private message
vinila

New User


Joined: 23 Feb 2007
Posts: 4
Location: Mumbai

PostPosted: Wed Apr 18, 2007 12:36 pm    Post subject: Re: OOPS concept in COBOL
Reply with quote

Cobol is not a Object Oriented programming language
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Wed Apr 18, 2007 12:50 pm    Post subject:
Reply with quote

Vinila,

Quote:
Cobol is not a Object Oriented programming language


Are you sure about this?
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 686
Location: Earth

PostPosted: Wed Apr 18, 2007 1:06 pm    Post subject:
Reply with quote

Dick,
Multiple Procedure divisions are allowed, in this case each procedure division belongs to one mehod. methods can have their own Procedure divisions.

Amiya,
I need some time to play with it. BTW ,have you tried googling about OO features of COBOL.
paste the error messages which you got.
Code:

Cobol is not a Object Oriented programming language

It is not object oriented language but it has Object Oriented features.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Apr 18, 2007 7:09 pm    Post subject:
Reply with quote

Hello,

Yes, but i didn't mention procedure division. I don't recall multiple identification divisions being allowed. . .

Vinala - this is not complete accurate
Quote:
Cobol is not a Object Oriented programming language

While the language is not know as an OO language, it does support OO methods.
Back to top
View user's profile Send private message
amiya_mf

New User


Joined: 01 Mar 2005
Posts: 19

PostPosted: Thu Apr 19, 2007 5:45 pm    Post subject: OOPS concept in COBOL
Reply with quote

Hi Dick,

Are u really aware of OOPS concept in Enterprise COBOL. If yes you would not ask me about my experience in cobol. First gothrough the ibm reference pdf then reply to such types of mails.

Sorry, its just to maintain decipline in the room. Asking how much experience to a member is not a good behaviour.

For your kind information multiple IDENTIFICATION DIVISION is allowed in entprise cobol Version - 3 and Release 4.

If you have any sample program then send me across.

Regards,
Amiya

dick scherrer wrote:
Hello,

You should also post the output messages from the copiler.

For starters (if this is a single program) you have multiple identification division statements. This is not allowed. How much COBOL experience have you?

If you don't already have one, you might want to create a non-OO version of the program to prove the logic works.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Apr 19, 2007 8:07 pm    Post subject:
Reply with quote

Hello Amiya,

I believe you are quite mistaken with this
Quote:
Sorry, its just to maintain decipline in the room. Asking how much experience to a member is not a good behaviour.


First, you are not yet in a position to "maintain discipline". Second, it is quite appropriate to know the technical level of the person we are trying to provide information for. The forum has many people who are working in the mainframe environment for their first time. There are also many who are not comfortable with COBOL and the other "standard" mainframe tools/concepts. Knowing the experience level of the requestor often guides us on how to word a response. If you are upset that your level of experience was questioned, sorry 'bout that - get over it.

People with some depth of experience know how to post their questions. This
Quote:
Can anybody help me to develop a object oriented program in cobol. i tried but could not sucessed.
pretty much shouts rookie. Someone with any experience at all would initially post what they tried and why it did not work, including compiler messages and/or run-time errors. If you would prefer not to have your experience questioned, improve your presentation method. Also, i don't believe you've yet posted the info requested above. . . Mentioning "but getting compilation error... " provides nothing for anyone to work on.

To answer your question about OO-COBOL on the mainframe - i am aware of it but do not claim proficiency with it - i don't have any client who wants me to spend time using it (yet). The OO things i work with are on UNIX or Win-based systems. The mainframe will follow (maybe even this year) icon_smile.gif

We get many people here with very little experience and are we most willing to help them. There is nothing wrong with being new. We all started fresh at some time icon_smile.gif
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 686
Location: Earth

PostPosted: Fri Apr 20, 2007 12:05 am    Post subject:
Reply with quote

Dick,
You really took it cool! icon_wink.gif
(This shows you have a way larger experience than OP icon_smile.gif )

Apart from that-
I could find this link, Technically it is OO program but don't know OP will accept it icon_confused.gif
http://publib.boulder.ibm.com/infocenter/pdthelp/v1r1/index.jsp?topic=/com.ibm.entcobol4.doc/rpooo10e.htm
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 686
Location: Earth

PostPosted: Fri Apr 20, 2007 12:13 am    Post subject:
Reply with quote

Well it seems Ameya was doing SOM based cobol but SOM-based object-oriented COBOL applications are no longer supported with Enterprise COBOL. OO COBOL syntax has been retargeted for Java-based object-oriented pogramming to facilitate interoperation of COBOL and Java.

See the link below-
http://publib.boulder.ibm.com/infocenter/pdthelp/v1r1/index.jsp?topic=/com.ibm.entcobol4.doc/rpooo10e.htm

I don't think that I should spend my time on this thread now! icon_cool.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm
No new posts COBOL DB2 program - zIIP eligible vasanthz COBOL Programming 7 Wed May 31, 2017 5:12 am
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us