Rocket® Visual COBOL (formerly a Micro Focus® product)

 View Only
  • 1.  Linkage Section Problem in JVM Cobol

    Posted 12-09-2012 10:04

    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 :


    #Eclipse
    #JVMCOBOL
    #VisualCOBOLautoscalemodescreenresolution
    #COBOL


  • 2.  RE: Linkage Section Problem in JVM Cobol
    Best Answer

    Posted 12-09-2012 15:49

    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)



  • 3.  RE: Linkage Section Problem in JVM Cobol

    Posted 12-09-2012 20:09

    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.



  • 4.  RE: Linkage Section Problem in JVM Cobol
    Best Answer

    Posted 12-10-2012 11:22

    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.