Highlighted
Ahmed1 Absent Member.
Absent Member.
3940 views

Linkage Section Problem in JVM Cobol

Jump to solution

Hi

I am using Eclipse Version!!!

the problem is there is an error ==>

Multiple markers at this line
- COBCH0972S Linkage item 'CUSTOMER-MOBILE' is referenced but has no addressability.
- COBCH0972S Linkage item 'CUSTOMER-NAME' is referenced but has no addressability.
- COBCH0972S Linkage item 'CUSTOMER-ADDRESS' is referenced but has no addressability.
- COBCH0972S Linkage item 'CUSTOMER-PHONE' is referenced but has no addressability.

the code is :

0 Likes
2 Solutions

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

RE: Linkage Section Problem in JVM Cobol

Jump to solution

I am not sure why you are defining these data items in the linkage section.

Data Items defined in the linkage serction have no actual storage assigned to them.

The storage is assigned either by passing parameters to the method from a calling program using the procedure division using header, or by using set address of <linkage-data-item> to ...

In order to reference these data items as sending or receiving data you must first set them to a valid storage area in working-storage or local-storage.

You could also modify the method to use:

  procedure division using customer-name customer-address customer-phone customer-mobile.

and then pass these parameters in the invoke statement that calls this method.

invoke myobject::addCustomer(customer-name, customer-address, customer-phone, customer-mobile)

0 Likes
Micro Focus Expert
Micro Focus Expert

RE: Linkage Section Problem in JVM Cobol

Jump to solution

The linkage section is not exposed to the Java programmer, so declaring your parameters in the

linkage section is fine.   I suspect you do want to update the object, so I would declare the

parameter "by value" and use the inline syntax for example:

       class-id. Customer public.

       method-id. addCustomer public.

       procedure division using

               by value customer-name as string,

               by value customer-address as string,

               by value customer-phone as string,

               by value customer-mobile as string.

       end method.

       end class.

0 Likes
3 Replies
Micro Focus Expert
Micro Focus Expert

RE: Linkage Section Problem in JVM Cobol

Jump to solution

I am not sure why you are defining these data items in the linkage section.

Data Items defined in the linkage serction have no actual storage assigned to them.

The storage is assigned either by passing parameters to the method from a calling program using the procedure division using header, or by using set address of <linkage-data-item> to ...

In order to reference these data items as sending or receiving data you must first set them to a valid storage area in working-storage or local-storage.

You could also modify the method to use:

  procedure division using customer-name customer-address customer-phone customer-mobile.

and then pass these parameters in the invoke statement that calls this method.

invoke myobject::addCustomer(customer-name, customer-address, customer-phone, customer-mobile)

0 Likes
Ahmed1 Absent Member.
Absent Member.

RE: Linkage Section Problem in JVM Cobol

Jump to solution

I've got you, Thanks, but why you think I must not use this design pattern, in other  words how can I pass parameters to the method in other way than linkage section taking into account that I am using JVM COBOL to represent business logic of a 3-tier system so I want it to be portable with Java code.

0 Likes
Micro Focus Expert
Micro Focus Expert

RE: Linkage Section Problem in JVM Cobol

Jump to solution

The linkage section is not exposed to the Java programmer, so declaring your parameters in the

linkage section is fine.   I suspect you do want to update the object, so I would declare the

parameter "by value" and use the inline syntax for example:

       class-id. Customer public.

       method-id. addCustomer public.

       procedure division using

               by value customer-name as string,

               by value customer-address as string,

               by value customer-phone as string,

               by value customer-mobile as string.

       end method.

       end class.

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.