[Migrated content. Thread originally posted on 10 October 2005]
Hi,
I am looking at at java calling cobol solution for creating a web service in java that would do a call to a cobol program to read data and use existing business rule's.
The problem I am having is with the linkage section in the cobol program. How do you define Pic X variables in java. IE Pic x(200)
would be represented by a string in java, we seem to be getting linkage errors as the size of a java string is dynamic, I have read in the documentation of version 7 that you can switch off linkage checking but is this the route I want to go, is there another alternative to define the variables in java.
I am not a Java expert, from what I understand you can define actual string sizes in java, it is difficult and you might not get what you expect.
For interoperating with Java ACUCOBOL-GT provides linkage signatures
co.setOption("linkage_signature", "X200");
When using a Java string and filling it with 5 bytes, the linkage signature pads out the string to match the size of the linkage data item. This way you can be sure that you are receiving from java what your COBOL program expects (whether the data is being passed from java or a COBOL program).
I hope this helps.
[Migrated content. Thread originally posted on 10 October 2005]
Hi,
I am looking at at java calling cobol solution for creating a web service in java that would do a call to a cobol program to read data and use existing business rule's.
The problem I am having is with the linkage section in the cobol program. How do you define Pic X variables in java. IE Pic x(200)
would be represented by a string in java, we seem to be getting linkage errors as the size of a java string is dynamic, I have read in the documentation of version 7 that you can switch off linkage checking but is this the route I want to go, is there another alternative to define the variables in java.
Hi,
Forgive my ignorance but what if there are multiple linkage items in the call.
eg:
Java
====
string WhatToDo = "Read"; //10 chars
string CodeToRead = "01235"; //10 chars
string ReturnData; // 50 chars will be possibly returned
cvm.SetOption("linkage_signature","X10")
// surely this option can only apply to 1 linkage item and not multiple items
Cobol
=====
LINKAGE SECTION.
77 WhatToDo Pic X(10).
77 CodeToRead Pic X(10).
77 ReturnData Pic X(50)
thank you for the Help So Far.
[Migrated content. Thread originally posted on 10 October 2005]
Hi,
I am looking at at java calling cobol solution for creating a web service in java that would do a call to a cobol program to read data and use existing business rule's.
The problem I am having is with the linkage section in the cobol program. How do you define Pic X variables in java. IE Pic x(200)
would be represented by a string in java, we seem to be getting linkage errors as the size of a java string is dynamic, I have read in the documentation of version 7 that you can switch off linkage checking but is this the route I want to go, is there another alternative to define the variables in java.
The linkage signature would be:
cvm.SetOption("linkage_signature","X10X10X50")