Highlighted
Absent Member.
Absent Member.
386 views

[archive] Cobol calling java - boolean Parameters always true in java class

[Migrated content. Thread originally posted on 16 January 2009]

Hi to all,
I have a problem with boolean parameters passed to java class from cobol (v7.0.1).

I have this piece of cobol code:

working-storage section.
01 booleanVal1 pic 9.
01 booleanVal2 pic 9.
01 booleanVal3 pic 9.
01 booleanVal4 pic 9.
01 name pic x(200).
01 dat pic x(200).
01 source pic x(200).
01 new pic x(200).
01 signature pic x(400).
................
................
procedure division.
main.
.....
......
move "a" to name.
move "b" to dat.
move "c" to source.
move "d" to new.
move 0 to booleanVal1.
move 0 to booleanVal2.
move 0 to booleanVal3.
move 0 to booleanVal4.

initialize signature.
string "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava lang/String;ZZZZ)V"
delimited by size into signature.

CALL "C$JAVA" USING CJAVA-CALL, MODELTEST, "it/test/ModelTest",
"configureModel",
signature,
name, dat, source, new,
booleanVal1, booleanVal2, booleanVal3, booleanVal4
GIVING STATUS-VAL.


at the java-side I have this piece of code:

public void configureModel(String name, String dat, String source, String new, boolean val1, boolean val2, boolean val3, boolean val4) {
cblLog("Configure");
cblLog("boolean val1 = " + val1);
cblLog("boolean val2 = " + val2);
cblLog("boolean val3 = " + val3);
cblLog("boolean val4 = " + val4);
.................
.................
}


When cobol call the Java method, in the log file, java report that all the boolean value are true despite I have set it to false.

Any ideas?
The signature it's valid because status-val return 0 and the boolean value it's set to 0 in the cobol after the java call.

Thanks in advandce.
0 Likes
2 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Cobol calling java - boolean Parameters always true in java class

It is suggested you should set bool values to low-value instead of 0. Try that.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Cobol calling java - boolean Parameters always true in java class

It is suggested you should set bool values to low-value instead of 0. Try that.


Thanks gforseth!
Passing low-value for false value solve the problem.
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.