Rational Developer for System z
Enterprise COBOL for z/OS, Version 4.1, Language Reference


Sign condition

The sign condition determines whether the algebraic value of a numeric operand is greater than, less than, or equal to zero.

Read syntax diagramSkip visual syntax diagram
Format: sign condition

>>-operand-1--+----+--+-----+--+-POSITIVE-+--------------------><
              '-IS-'  '-NOT-'  +-NEGATIVE-+   
                               '-ZERO-----'   

operand-1
Must be defined as a numeric identifier, or as an arithmetic expression that contains at least one reference to a variable. operand-1 can be defined as a floating-point identifier.

The operand is:

  • POSITIVE if its value is greater than zero
  • NEGATIVE if its value is less than zero
  • ZERO if its value is equal to zero

An unsigned operand is either POSITIVE or ZERO.

NOT
One algebraic test is executed for the truth value of the sign condition. For example, NOT ZERO is regarded as true when the operand tested is positive or negative in value.

The results of the sign condition test depend on the setting of the NUMPROC compiler option. For details, see the Enterprise COBOL Programming Guide.

Date fields in sign conditions

The operand in a sign condition can be a date field, but is treated as a nondate for the sign condition test. Thus if the operand is an identifier of a windowed date field, date windowing is not done, so the sign condition can be used to test a windowed date field for an all-zero value.

However, if the operand is an arithmetic expression, then any windowed date fields in the expression will be expanded during the computation of the arithmetic result prior to using the result for the sign condition test.

For example, given that:

  • Identifier WIN-DATE is defined as a windowed date field and contains a value of zero
  • Compiler option DATEPROC is in effect
  • Compiler option YEARWINDOW (starting-year) is in effect, with a starting-year other than 1900

then this sign condition would evaluate to true:

WIN-DATE IS ZERO

whereas this sign condition would evaluate to false:

WIN-DATE + 0 IS ZERO

Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)