Ask Sawal

Discussion Forum
Notification Icon1
Write Answer Icon
Add Question Icon

how to fix igz0279w?

2 Answer(s) Available
Answer # 1 #

Note that the NUMCLS installation option for IBM COBOL 6.2 governs the behavior of the IF NUMERIC class test, an implicit version of which is generated by the NUMCHECK compile option. If your packed data is defined without sign, i.e.

then the documentation indicates a sign nibble of x'F' is the only sign nibble which will pass an IF NUMERIC class test. Any other value for the sign nibble is considered invalid.

Excerpt from IBM Documentation for Enterprise COBOL 6.2...

The wording for the documentation for the NUMCLS option for IBM COBOL 4.2 is definitely different...

You might want to check at https://www.ibm.com/support/pages/node/604539#112918 to see if any of the PTFs apply to your situation.

You could attempt to raise an issue with IBM, but here's the problem: if you have unsigned data, then an argument can be made that having a sign nibble indicating a positive (x'C') or negative (x'D') sign is invalid. I suspect this is part of the reason the NUMCHECK option works the way it does.

Possible solutions include having your Assembler programs invoking your COBOL programs do a sign fix on any packed data they pass. Maybe an OI on the last byte. You might be able to write control cards for your shop's SORT utility to fix packed data in your flat files. You could change your unsigned packed data items in your COBOL programs to be signed.

It all depends on what behavior you desire. You say you cannot trust the content of your numeric variables. If that means you sometimes have a sign nibble of x'A' instead of x'C' for a positive value, you can use NUMPROC(NOPFD) if NUMCLS(ALT) is in effect.

Another possible solution to your situation, if NUMCLS(ALT) is in effect, is to compile with NUMPROC(NOPFD) and use signed fields to initially hold your data. According to the documentation, moving the data to an unsigned field will fix the sign. Note that NUMPROC(NOPFD) does not perform as well as NUMPROC(PFD).

[3]
Edit
Query
Report
Octavia Aiono
Theatre Practitioner
Answer # 2 #

IBM has long documented this and so has Micro Focus.

Here is the quote from IBM:

--------------------------------------------------------------------------------------

IBM Enterprise Cobol for z/OS Programming Guide V3R4

Numeric Class test

http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3pg31/1.3.7?DT=20060329003636

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.

It can happen that values are passed into your program and assigned to items

that have incompatible data descriptions for those values. For example,

nonnumeric data might be moved or passed into a field that is defined as

numeric, or a signed number might be passed into a field that is defined as

unsigned. In either case, the receiving fields contain invalid data. When you

give an item a value that is incompatible with its data description, references

to that item in the PROCEDURE DIVISION are undefined and your results

are unpredictable.

You can use the numeric class test to perform data validation. For example:

Linkage Section.

01  Count-x   Pic 999.

. . .

Procedure Division Using Count-x.

If Count-x is numeric then display "Data is good"

The numeric class test checks the contents of a data item against a set of

values that are valid for the PICTURE and USAGE of the data item.

For example, a packed-decimal item is checked for hexadecimal values

X'0' through X'9' in the digit positions and for a valid sign value in the

sign position (whether separate or nonseparate).

For zoned decimal and packed-decimal items, the numeric class test is

affected by the NUMPROC compiler option and the NUMCLS option

(which is set at installation time). To determine the NUMCLS setting

used at your installation, consult your system programmer.

If NUMCLS(PRIM) is in effect at your installation, use the following table

to find the values that the compiler considers valid for the sign.

Table 7. NUMCLS(PRIM) and valid signs

NUMPROC(NOPFD)         NUMPROC(PFD)           NUMPROC(MIG)

Signed       C, D, F                                C, D, 0 (positive           C, D, F

zero)

Unsigned        F                                     F                                      F

Separate sign          , -                       , -, 0 (positive                   ,-

zero)

--------------------------------------------------------------------------------------

The key sentences from IBM are these:

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.

and

When you give an item a value that is incompatible with its data

description, references to that item in the PROCEDURE DIVISION

are undefined and your results are unpredictable.

So as you can see the IF NUMERIC test will fail if any other sign except for

a 'F' exists for an unsigned data item. IBM will not check data. Micro Focus will

check data when Animating. But for the numeric class test MFE and IBM are

consistent in this. One could re-code to add a MOVE statement such as in

this sample program. For the MFE reference go to the online Help and type

in 'numeric test'.

Here is a sample program to show when items will pass the IF NUMERIC test:

Identification Division.

Program-Id.  LORINCE.

* This program should produce these results:

*

*Test Positive Number

* Move 55 to Both Numeric Fields

*  U9-18 item is not numeric

*  S9-18 item is numeric

*Test Negative Number

* Move -33 to Both Numeric Fields

*  U9-18 item is not numeric

*  S9-18 item is numeric

*Move Signed Number to Test Field

* Move -33 to TestField From S9-18

*  TestField is numeric

* Move 55 to TestField From S9-18

*  TestField is numeric

*Move Unsigned Number to Test Field

* Move 33 to TestField From U9-18

*  TestField is numeric

* Move 55 to TestField From U9-18

*  TestField is numeric

*

Environment Division.

Data Division.

Working-Storage Section.

1   Ws1.

2   U9-18       Pic 9(18).

2   S9-18  Redefines  U9-18

Pic S9(18).

2   TestField   Pic S9(18).

Procedure Division.

P1.

*  Test Positive number

Display 'Test Positive Number'

Move 55 to S9-18

Display ' Move 55 to Both Numeric Fields '

If U9-18 is Numeric

Display '  U9-18 item is numeric '

Else

Display '  U9-18 item is not numeric '

End-If

If S9-18 is Numeric

Display '  S9-18 item is numeric '

Else

Display '  S9-18 item is not numeric '

End-If

*  Test Negative number

Display 'Test Negative Number'

Move -33 to S9-18

Display ' Move -33 to Both Numeric Fields '

If U9-18 is Numeric

Display '  U9-18 item is numeric '

Else

Display '  U9-18 item is not numeric '

End-If

If S9-18 is Numeric

Display '  S9-18 item is numeric '

Else

Display '  S9-18 item is not numeric '

End-If

*  Move Signed numbers to Test Field

Display 'Move Signed Number to Test Field'

Move -33 to S9-18

Move S9-18 to TestField

Display ' Move -33 to TestField From S9-18 '

If TestField is Numeric

Display '  TestField is numeric '

Else

Display '  TestField is not numeric '

End-If

Move 55 to S9-18

Move S9-18 to TestField

Display ' Move 55 to TestField From S9-18 '

If TestField is Numeric

Display '  TestField is numeric '

Else

Display '  TestField is not numeric '

End-If

*  Move Unsigned numbers to Test Field

Display 'Move Unsigned Number to Test Field'

Move 33 to U9-18

Move S9-18 to TestField

Display ' Move 33 to TestField From U9-18 '

If TestField is Numeric

Display '  TestField is numeric '

Else

Display '  TestField is not numeric '

End-If

Move 55 to U9-18

Move S9-18 to TestField

Display ' Move 55 to TestField From U9-18 '

If TestField is Numeric

Display '  TestField is numeric '

Else

Display '  TestField is not numeric '

End-If

Stop Run.

The program above illustrates that the data must match its

PICTURE definition. So the best thing to do is REDEFINE

an item using the same definitions (signed or unsigned,

numeric or alphanumeric, COMP, COMP-3) and do not

mix PICTURE definitions (numeric COMP redefined as

[2]
Edit
Query
Report
Priyanshu Spruell
Geoprofessions