Skip to main content

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

  • January 20, 2009
  • 4 replies
  • 0 views

[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.

4 replies

[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.
It is suggested you should set bool values to low-value instead of 0. Try that.

[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.
It is suggested you should set bool values to low-value instead of 0. Try that.

[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.
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.

[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.
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.