Problem:
A group level item is not seen as greater than spaces by MFE v3.1.
This was compiled with Enterprise Cobol as a dialect.
Identification Division.
Program-id. LORINCE.
Environment Division.
Data Division.
Working-Storage Section.
1 group14.
2 packed1 pic s9(3)v99 comp-3 value 0003.
2 filler pic 9(8) value 01012007.
procedure division.
If group14 greater than spaces
display 'spaces'
else
display 'not spaces'
End-If
Goback.
Resolution:
This gets into an area where the exact value of the data matters. In the supplied sample, the entire groups value is:
group14 x'00003F' (Packed Decimal)
filler x'F0F1F0F1F2F0F0F7' (Zoned Decimal)
So the IF verb looks to see if x'00' is greater that spaces x'40' and it stops right there because it is not, however; if the groups value is:
group14 x'41000C'
filler x'F0F1F0F1F2F0F0F7'
then the IF statement would know that the value is greater than Spaces after comparing the first byte x'41' because it is greater than x'40'.
Either way, one must remember what IBM has long documented about programs and the valid data they should be using. Reference this strong statement from IBM in its VS Cobol II manual and a more 'favorable politically correct' one from their z\\OS Compiler.
Title: VS COBOL II Application Programming Guide
Document Number: SC26-4045-05
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGYA1101/3.3.2?SHELF=IGYSH007&DT=19930312141355
Notice the last sentence of the second paragraph:
It is your responsibility to ensure that the contents of a data item
conform to its PICTURE and USAGE clauses before using
the data item in any further processing steps.
IBM has since made this more 'politically correct' in their latest compiler manuals saying:
Title: Enterprise Cobol for z\\OS
Programming Guide Version 3 Release 4
Document Number: SC27-1412-03
http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3pg32/1.3.7?DT=20061117131343
Again, last sentence of second paragraph:
Ensure that the contents of a data item conform to its PICTURE
and USAGE clauses before using the data item in any further
processing steps.
So, IBM is saying that all data must be valid before using it, but it is doublespeak because their default numeric processing compiler option is NUMPROC(NOPFD), which means they will perform sign validation processing trying to 'fix up' the user's data. This was done for
compatibility with the old IBM OS/VS Cobol compiler, but it doesn't always work.
http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3pg32/2.4.35?DT=20061117131343
Things sometimes 'work' on the host because IBM's generated Assembler code
strips off the Zone portion of a Zoned Decimal field, does an arithmetic operation
using packed data, then takes the resultant numeric answer and unpacks it into
the original field. That is why a x'40' can be interpreted as a x'F0' - the first half byte
is ignored. An ASCII Zero is a x'30', period. Micro Focus expects valid data.
Should you find a case where you feel we need to emulate the mainframe, report it to
SupportLine for review.
#MFDS
#EnterpriseDeveloper




