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