Skip to main content

We are converting some GCOS (Bull) mainframe programs to work on a Microfocus platform. I have a lot of calls for this particular item.


The variable is defined as pic x, and 0 is moved to it, Alphanumeric check. But in the mainframe code (in lots of places) this value is checked against zero (the word, numeric value). In microfocus COBOL this is false, but in GCOS it is true. If I change this:

IF IN-STATUS NOT = ZERO GO TO 580-GET-OUT

to this:

IF IN-STATUS NOT = "0" GO TO 580-GET-OUT

it works in Microfocus (probably for GCOS too, I didn't specifically check). The second statement is true in GCOS.


Is there a setting for the program which will allow "0" to be checked against ZERO or 0?

We are converting some GCOS (Bull) mainframe programs to work on a Microfocus platform. I have a lot of calls for this particular item.


The variable is defined as pic x, and 0 is moved to it, Alphanumeric check. But in the mainframe code (in lots of places) this value is checked against zero (the word, numeric value). In microfocus COBOL this is false, but in GCOS it is true. If I change this:

IF IN-STATUS NOT = ZERO GO TO 580-GET-OUT

to this:

IF IN-STATUS NOT = "0" GO TO 580-GET-OUT

it works in Microfocus (probably for GCOS too, I didn't specifically check). The second statement is true in GCOS.


Is there a setting for the program which will allow "0" to be checked against ZERO or 0?

It's not clear what you mean by "works" in your description.  Can you be more specific?

In standard (and Micro Focus) COBOL, moving 0 to an PIC X item results in the character "0" being stored in the data item (there is an implied conversion from numeric to alphanumeric).  Comparing the PIC X item to ZERO or "0" is the same alphanumeric comparison for a PIC X(n) item, it's different in that it's a comparison to a string with n "0" characters in it.  The figurative constant ZERO (ZEROES, ZEROS) is either alphanumeric when associated with an alphanumeric item or numeric when associated with a numeric item.

When you said in-status is defined as pic x, did you mean equivalently pic x(1) or generic pic x(n), where n not equal 1?  If n not = 1, then the result of moving 0 to it would be one "0" character followed by n - 1 spaces.  This would not be equal to ZERO (the figurative constant).  I don't see how GCOS could call its language COBOL if it says a PIC X(n), where n is greater than 1, is equal to ZERO after 0 or "0" is moved to it.  Moving ZERO to PIC X(n) would set all its characters to "0" and then it would compare equal to ZERO as expected.


We are converting some GCOS (Bull) mainframe programs to work on a Microfocus platform. I have a lot of calls for this particular item.


The variable is defined as pic x, and 0 is moved to it, Alphanumeric check. But in the mainframe code (in lots of places) this value is checked against zero (the word, numeric value). In microfocus COBOL this is false, but in GCOS it is true. If I change this:

IF IN-STATUS NOT = ZERO GO TO 580-GET-OUT

to this:

IF IN-STATUS NOT = "0" GO TO 580-GET-OUT

it works in Microfocus (probably for GCOS too, I didn't specifically check). The second statement is true in GCOS.


Is there a setting for the program which will allow "0" to be checked against ZERO or 0?

It's not clear what you mean by "works" in your description.  Can you be more specific?

In standard (and Micro Focus) COBOL, moving 0 to an PIC X item results in the character "0" being stored in the data item (there is an implied conversion from numeric to alphanumeric).  Comparing the PIC X item to ZERO or "0" is the same alphanumeric comparison for a PIC X(n) item, it's different in that it's a comparison to a string with n "0" characters in it.  The figurative constant ZERO (ZEROES, ZEROS) is either alphanumeric when associated with an alphanumeric item or numeric when associated with a numeric item.

When you said in-status is defined as pic x, did you mean equivalently pic x(1) or generic pic x(n), where n not equal 1?  If n not = 1, then the result of moving 0 to it would be one "0" character followed by n - 1 spaces.  This would not be equal to ZERO (the figurative constant).  I don't see how GCOS could call its language COBOL if it says a PIC X(n), where n is greater than 1, is equal to ZERO after 0 or "0" is moved to it.  Moving ZERO to PIC X(n) would set all its characters to "0" and then it would compare equal to ZERO as expected.


We are converting some GCOS (Bull) mainframe programs to work on a Microfocus platform. I have a lot of calls for this particular item.


The variable is defined as pic x, and 0 is moved to it, Alphanumeric check. But in the mainframe code (in lots of places) this value is checked against zero (the word, numeric value). In microfocus COBOL this is false, but in GCOS it is true. If I change this:

IF IN-STATUS NOT = ZERO GO TO 580-GET-OUT

to this:

IF IN-STATUS NOT = "0" GO TO 580-GET-OUT

it works in Microfocus (probably for GCOS too, I didn't specifically check). The second statement is true in GCOS.


Is there a setting for the program which will allow "0" to be checked against ZERO or 0?

It's not clear what you mean by "works" in your description.  Can you be more specific?

In standard (and Micro Focus) COBOL, moving 0 to an PIC X item results in the character "0" being stored in the data item (there is an implied conversion from numeric to alphanumeric).  Comparing the PIC X item to ZERO or "0" is the same alphanumeric comparison for a PIC X(n) item, it's different in that it's a comparison to a string with n "0" characters in it.  The figurative constant ZERO (ZEROES, ZEROS) is either alphanumeric when associated with an alphanumeric item or numeric when associated with a numeric item.

When you said in-status is defined as pic x, did you mean equivalently pic x(1) or generic pic x(n), where n not equal 1?  If n not = 1, then the result of moving 0 to it would be one "0" character followed by n - 1 spaces.  This would not be equal to ZERO (the figurative constant).  I don't see how GCOS could call its language COBOL if it says a PIC X(n), where n is greater than 1, is equal to ZERO after 0 or "0" is moved to it.  Moving ZERO to PIC X(n) would set all its characters to "0" and then it would compare equal to ZERO as expected.


We are converting some GCOS (Bull) mainframe programs to work on a Microfocus platform. I have a lot of calls for this particular item.


The variable is defined as pic x, and 0 is moved to it, Alphanumeric check. But in the mainframe code (in lots of places) this value is checked against zero (the word, numeric value). In microfocus COBOL this is false, but in GCOS it is true. If I change this:

IF IN-STATUS NOT = ZERO GO TO 580-GET-OUT

to this:

IF IN-STATUS NOT = "0" GO TO 580-GET-OUT

it works in Microfocus (probably for GCOS too, I didn't specifically check). The second statement is true in GCOS.


Is there a setting for the program which will allow "0" to be checked against ZERO or 0?

My second paragraph in my previous response needs a punctuation change to be clearer.  It should have read as follows:

In standard (and Micro Focus) COBOL, moving 0 to an PIC X item results in the character "0" being stored in the data item (there is an implied conversion from numeric to alphanumeric).  Comparing the PIC X item to ZERO or "0" is the same alphanumeric comparison.  For a PIC X(n) item, it's different in that it's a comparison to a string with n "0" characters in it.  The figurative constant ZERO (ZEROES, ZEROS) is either alphanumeric when associated with an alphanumeric item or numeric when associated with a numeric item.


We are converting some GCOS (Bull) mainframe programs to work on a Microfocus platform. I have a lot of calls for this particular item.


The variable is defined as pic x, and 0 is moved to it, Alphanumeric check. But in the mainframe code (in lots of places) this value is checked against zero (the word, numeric value). In microfocus COBOL this is false, but in GCOS it is true. If I change this:

IF IN-STATUS NOT = ZERO GO TO 580-GET-OUT

to this:

IF IN-STATUS NOT = "0" GO TO 580-GET-OUT

it works in Microfocus (probably for GCOS too, I didn't specifically check). The second statement is true in GCOS.


Is there a setting for the program which will allow "0" to be checked against ZERO or 0?

My second paragraph in my previous response needs a punctuation change to be clearer.  It should have read as follows:

In standard (and Micro Focus) COBOL, moving 0 to an PIC X item results in the character "0" being stored in the data item (there is an implied conversion from numeric to alphanumeric).  Comparing the PIC X item to ZERO or "0" is the same alphanumeric comparison.  For a PIC X(n) item, it's different in that it's a comparison to a string with n "0" characters in it.  The figurative constant ZERO (ZEROES, ZEROS) is either alphanumeric when associated with an alphanumeric item or numeric when associated with a numeric item.


We are converting some GCOS (Bull) mainframe programs to work on a Microfocus platform. I have a lot of calls for this particular item.


The variable is defined as pic x, and 0 is moved to it, Alphanumeric check. But in the mainframe code (in lots of places) this value is checked against zero (the word, numeric value). In microfocus COBOL this is false, but in GCOS it is true. If I change this:

IF IN-STATUS NOT = ZERO GO TO 580-GET-OUT

to this:

IF IN-STATUS NOT = "0" GO TO 580-GET-OUT

it works in Microfocus (probably for GCOS too, I didn't specifically check). The second statement is true in GCOS.


Is there a setting for the program which will allow "0" to be checked against ZERO or 0?

Thank you for your clarification. I came to find out that this value (IN-STATUS) was in a copybook, and the definition was changed to PIC X(10). As a status value, it should be Pic X(02). When IN-STATUS is set to "00", then the statement IF IN-STATUS = ZERO returns true. It was my ignorance of the value of ZERO, and your pointing out the PIC X(N) idea that led to the solution.

Thanks a lot!