Highlighted
Absent Member.
Absent Member.
2703 views

getting started with OO and method calls

Jump to solution

[Migrated content. Thread originally posted on 23 October 2011]

I am an experienced COBOL programmer looking to move to a project using OO cobol and doing a little self education.
I have a pretty good grasp of JAVA and C# so was expecting to pick it up reasonably easily. It will be syntax and basic program/class structure I need to get to grips with.

My first attempt at a COBOL JVM project using visual COBOL for eclipse.
I am getting error "COBCH0829S could not find method "storeData" with this signature".

Any guidance on where to look for and how to fix it would be appreciated.

Cheers,
Gary.

IDENTIFICATION DIVISION.
class-id Learning1.

class-object.
data division.
working-storage section.
01 classField pic x(1).

procedure division.
method-id storeData.

working-storage section.
linkage section.
01 methodField pic x(10).
procedure division using methodField.
move methodField to classField
goback.
end method.

method-id. returnData.
working-storage section.
linkage section.
01 methodField pic x(10).
procedure division returning methodField.
move classField to methodField
goback.
end method.

end class-object.


IDENTIFICATION DIVISION.
program-id Learning2.

ENVIRONMENT DIVISION.

OBJECT SECTION.
CLASS-CONTROL.
Learning1 IS CLASS "Learning1".

DATA DIVISION.

working-storage section.
01 myLearning usage object reference.
01 passField pic x(10) value low-values.

PROCEDURE DIVISION.

INVOKE Learning1 "NEW" returning myLearning
INVOKE myLearning "storeData" using passField

goback.

COBCH0829S could not find method "storeData" with this signature

0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.
Absent Member.

RE: getting started with OO and method calls

Jump to solution
Hi Gary. Looking at your program, the compile error you're getting is caused by declaring learning1 as object reference instead of type Learning. Have a look at the COBOL JVM samples included with Visual COBOL to see how the syntax has evolved to make writing OO code easier.

View solution in original post

0 Likes
8 Replies
Highlighted
Absent Member.
Absent Member.

RE: getting started with OO and method calls

Jump to solution
Hi Gary. Looking at your program, the compile error you're getting is caused by declaring learning1 as object reference instead of type Learning. Have a look at the COBOL JVM samples included with Visual COBOL to see how the syntax has evolved to make writing OO code easier.

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: getting started with OO and method calls

Jump to solution
Thanks for the response Paul.
That helped, I have fixed it now.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: getting started with OO and method calls

Jump to solution
Hi Paul,
even though I fixed the problem, where do I find the example code for COBOL JVM classes? In particular I am looking for an explanation of syntax for nesting classes ie. equivalent to COBOL occurs array containing multiple (same type) classes.

Appears I have fixed my problem by prefixing the class name with the package name (I had been using the default package previously). Is it necessary to add the prefix or is there an option somewhere to control this?

Thanks for your time,
Gary.
0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: getting started with OO and method calls

Jump to solution
The demonstration programs are installed in subfolders under C:\Users\Public\Documents\Micro Focus\Visual COBOL 2010\Samples.

Note: On older versions of Windows the samples might be installed in a different folder, such as for Windows XP, C:\Documents and Settings\All Users\Documents\Micro Focus\Visual COBOL 2010\Samples.

To access the demonstrations:

Click Start menu > All Programs > Micro Focus Visual COBOL 2010 > Visual COBOL Samples.
This opens the Samples Browser form.

Select a sample in the central pane and click Open sample folder.
Open the sample in Eclipse.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: getting started with OO and method calls

Jump to solution
Thanks Chris,
I followed that path. I am getting "Readme Not Found!" in the bottom panel and nothing is clickable.

Thanks for your assistance,
Gary.
0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: getting started with OO and method calls

Jump to solution
You might want to open up a Support Incident with Customer Care for this as I am not experiencing the same problem.
Are you using the Visual COBOL R4 release for Eclipse?

The Readme files are located in the project folders for the various samples for example:

C:\Users\Public\Documents\Micro Focus\Visual COBOL 2010\Samples\Eclipse\jvm_cobol\Arrays\readme.xml

The following are the instructions for importing the various samples into an Eclipse Workspace so they can be used.

Importing the Project into Eclipse

First you have to import the Demonstration project into your Eclipse workspace.

Select File -> Import. The Import | Select dialog box opens.
Select General -> Existing Projects into Workspace, then Next. The Import | Import Projects dialog box opens.
Select the Select root directory radio button, then Browse. The Browse for Folder dialog box opens.
Navigate to the samples folder.
Select the demonstration project(s) in the Projects list in Import | Projects.
Select Copy projects into workspace
Select Finish.

Now the Demonstration project(s) should be displayed in the Navigator window.

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: getting started with OO and method calls

Jump to solution
Thanks Chris, I have sorted it out. Somehow one of my folders had been renamed (I'm not the only user on my PC).

Sorry for the delayed reply, I have just got back to learning again.

Gary.
0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: getting started with OO and method calls

Jump to solution
Not a problem Gary, thanks for the update...
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.