Problem:
We have a field that is defined as Pic S9(8) but it contains x'F0F0F0F0F0F0F0F0' instead of the last two bytes being x'F0C0'. This fails a compare in an IF statement such as:
If field = Zero
What can we do?
Resolution:
With a dialect of Enterprise Cobol in Mainframe Express. The following program will not compare as true for the first IF statement until SIGNFIXUP is passed as an Additional Directive.
Identification Division.
Program-Id. LORINCE.
Environment Division.
Data Division.
Working-Storage Section.
1 Ws1.
2 Field1 Pic S9(8).
2 Field1a Redefines Field1 Pic X(8).
1 Field2 Pic 9(8).
1 Field2a Redefines Field2 Pic X(8).
Procedure Division.
P1.
Move x'F0F0F0F0F0F0F0F0' to Field1a
If Field1 is Zero
Display ' Field1 is Zero '
Else
Display ' Field1 is Not Zero '
End-If
Move x'F0F0F0F0F0F0F0F0' to Field2a
If Field2 is Zero
Display ' Field2 is Zero '
Else
Display ' Field2 is Not Zero '
End-If
Stop Run.
Although IBM documents that data should match its PICTURE representation, they do not enforce it. This explains why some programs will run on the host, but not in Mainframe Express until we have an exact failure to match for emulation.
--------------------
From the IBM Enterprise Cobol for z/OS Progrmming Guide:
http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3pg32/1.3.7?DT=20061117131343
1.3.7 Checking for incompatible data (numeric class test)
The compiler assumes that values you supply for a data item are valid for the PICTURE and USAGE clauses, and does not check their validity. Ensure that the contents of a data item conform to the PICTURE and USAGE clauses before using the item in additional processing.
--------------------
IBM is saying that ensuring valid data is used is up to the programmer.
#MFDS
#EnterpriseDeveloper




