IBM Support

PH06572: HLASM TRUNCATION CHECKS FOR CONSTANTS

A fix is available

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as unreproducible in next release.

Error description

  • When a constant is defined with an explicit length, the
    specified value will be truncated to fit if necessary.  This
    could however happen accidentally, so HLASM should provide
    options to warn about cases which might be in error.
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED: Users of HLASM for z/OS, z/VM, zVSE and      *
    *                 Linux                                        *
    ****************************************************************
    * PROBLEM DESCRIPTION: Optional truncation warnings for DC     *
    *                      values                                  *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    If an explicit length is specified on a DC constant, any
    specified value is documented as being truncated to that length.
    Up to now there has been no way to check whether this process is
    causing values to be changed by accident.
    

Problem conclusion

Temporary fix

Comments

  • Three new FLAG suboptions are introduced.
    
     TRUNC
      Instructs the assembler to issue diagnostic warning message
      ASMA225W if the value specified on a DC constant was changed
      by the process of being truncated to fit the specified field
      length.  Removal of leading leading zeros for a numeric field
      or trailing spaces for a character or graphic field does not
      count as a change for this purpose.
    
     LONGER
      Instructs the assembler to issue diagnostic warning message
      ASMA226W if the implicit length of a specified value exceeds
      the specified field length. If FLAG(TRUNC) is in effect and
      the value has been changed by truncation, then that takes
      precedence.
    
     SIGNED
      Instructs the assembler to issue diagnostic warning message
      ASMA227W if a signed (negative) value is specified for a
      A-type, AD-type or Y-type address constant with an explicit
      length less than the full length, which expects an unsigned
      value.
    
    Warnings produced by FLAG(TRUNC) could indicate potentially
    harmful coding errors, so it is recommended that this option
    should be used where possible (although the default is NOTRUNC
    in order to avoid triggering new warnings for existing
    programs).
    
    Warnings produced by FLAG(LONGER) and FLAG(SIGNED) are more
    likely to be harmless and do not necessarily indicate a coding
    error, as existing code (including macro instructions supplied
    with IBM products) may simply be relying on truncation as a way
    of simplifying source code. These options can be used
    temporarily to to check for possible errors, but if existing
    code triggers unnecessary warnings the options should be turned
    off again.
    
    In some cases the list of FLAG options in the OPTIONS report
    could now exceed the listing line length, so the list is now
    continued on the next line if necessary.
    
    Although S-type constants are not affected by the new checks,
    the existing range checks for an S-type constant were found to
    be incomplete and have now been fixed to ensure that a negative
    offset with an explicit base register, for example DC S(-1(9)),
    will be rejected with message ASMA028E Invalid displacement.
    
    DOCUMENTATION UPDATES:
    
    In HLASM Programmer's Guide, SC26-4941-08:
    
    In existing section for the FLAG option, insert documentation
    of the new options in the appropriate alphabetic positions
    (ignoring the "NO" prefix).
    
    Add new option pairs LONGER/NOLONGER, SIGNED/NOSIGNED and
    TRUNC/NOTRUNC to the syntax diagram.
    
    In the default list, insert NOLONGER, NOSIGNED and NOTRUNC.
    
    In the abbreviations list, insert LONG, NOLONG, SI, NOSI, TR,
    NOTR.
    
    In the sub-option descriptions, add the following:
    
     LONGER
       Instructs the assembler to issue diagnostic warning message
       ASMA226W if the implicit length of the value for a string
       constant (type B, C, CU, G, P or Z) is greater than the
       explicit length of the field.  For a hexadecimal field with a
       length specified in bits, it only issues the warning if the
       implicit length is at least 4 bits longer than the explicit
       length, because hexadecimal digits cannot represent less than
       4 bits.  If FLAG(TRUNC) is also in effect, the truncation
       warning takes precedence, so this message will only appear if
       the truncated part of the string value consists of leading
       zeros for a numeric value or trailing spaces for a character
       or graphics value.
     NOLONGER
       Instructs the assembler not to issue diagnostic warning
       message ASMA226W.
     SIGNED
       Instructs the assembler to issue diagnostic warning message
       ASMA227W if a negative value has been specified for an
       address constant (type A, AD or Y) with an explicit length
       less than the full length, which expects an unsigned value.
       If FLAG(TRUNC) is in effect, any truncation warning takes
       precedence.
     NOSIGNED
       Instructs the assembler not to issue diagnostic warning
       message ASMA227W.
     TRUNC
       Instructs the assembler to issue diagnostic warning message
       ASMA225W if the stored value of a constant has been changed
       from the specified value by being truncated to fit the
       specified length.  A numeric string value (type B, P, X or Z)
       is not considered changed if only leading zeros were removed.
       A character or graphics string value (type C, CU or G) is not
       considered changed if only trailing spaces were removed.  For
       an address constant (type A, AD or Y), the value is not
       considered changed if all truncated leading bits are zero, or
       (to tolerate signed values being used in unsigned contexts)
       if the value is negative and all truncated leading bits and
       the first bit of the truncated value are one.
     NOTRUNC
       Instructs the assembler not to issue diagnostic warning
       message ASMA225W.
    
    In appendix C, Associated data file output, in the section
    "Options record" define the last three bits in Option Byte 13 as
    follows:
    
     .... .1..
             Bit 1 - FLAG(TRUNC), Bit 0 - FLAG(NOTRUNC)
     .... ..1.
             Bit 1 - FLAG(LONGER), Bit 0 - FLAG(NOLONGER)
     .... ...1
             Bit 1 - FLAG(SIGNED), Bit 0 - FLAG(NOSIGNED)
    
    Add new messages ASMA225W, ASMA226W and ASMA227W to the list of
    messages in appendix F:
    
     ASMA225W Value truncated to fit field; stored value is
              incomplete - xxxxxxxx
    
     Explanation: The option FLAG(TRUNC) is in effect and the
     specified value needs to be truncated to fit within the
     specified length, causing the value to be changed.  This
     warning is not issued if truncation only resulted in the
     removal of leading zeros for a numeric value or trailing
     spaces for a character or graphics value.
    
     System action: The value is truncated to fit the field.
    
     Programmer response: Specify a smaller value or a larger field.
    
     Severity: 4
    
     ASMA226W Specified value is longer than field length -
              xxxxxxxxx
    
     Explanation: The option FLAG(LONGER) is in effect and the
     implicit length of the value for a string constant (type B, C,
     CU, G, P or Z) is greater than the explicit length of the
     field.  For a hexadecimal field with a length specified in
     bits, this warning is only issued if the implicit length is at
     least 4 bits more than the explicit length, because hexadecimal
     digits cannot represent less than 4 bits.  If FLAG(TRUNC) is
     also in effect, the truncation warning takes precedence, so
     this message will only appear if the truncated part of the
     string value consists of leading zeros for a numeric value or
     trailing spaces for a character or graphics value.
    
     System action: The value is truncated to fit the field.
    
     Programmer response: Check whether the truncation is intended,
     and if not use a smaller value or a larger field. To suppress
     this message, use the option FLAG(NOLONGER).
    
     Severity: 4
    
     ASMA227W Signed value specified for unsigned field; equivalent
              unsigned binary value used - xxxxxxxxx
    
     Explanation: The option FLAG(SIGNED) is in effect and a
     negative value has been specified for an address constant (type
     A, AD or Y) with an explicit length less than the full length,
     which expects an unsigned value.  If FLAG(TRUNC) is in effect,
     any truncation warning takes precedence.
    
     System action: The unsigned value with the same binary
     representation is used.
    
     Programmer response: To suppress this warning message, specify
     the value as the equivalent unsigned binary value, or use the
     option FLAG(NOSIGNED).
    
     Severity: 4
    
    In HLASM Language Reference, SC26-4940-08:
    
    In the section on the ACONTROL statement, document the three
    new FLAG options as in the Programmer's Guide.
    
    In HLASM Installation and Customization Guide, SC26-3494-07:
    
    In the section on ASMAOPT options, there are three new
    operands to set the defaults for the new FLAG options,
    as for the existing FLAG options:
    
    LONGERWARN=YES|NO
    SIGNEDWARN=YES|NO
    TRUNCWARN=YES|NO
    
    In each case the default is NO. These new operands are also
    added to those which can be fixed using the DELETE= operand.
    
    END OF DOCUMENTATION UPDATES
    ×**** AE19/02/13 FIX IN ERROR. SEE APAR PH08424  FOR DESCRIPTION
    ×**** AE19/04/15 FIX IN ERROR. SEE APAR PH10983  FOR DESCRIPTION
    

APAR Information

  • APAR number

    PH06572

  • Reported component name

    HLASM MVS, VM &

  • Reported component ID

    569623400

  • Reported release

    160

  • Status

    CLOSED UR1

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    YesSpecatt / New Function / Xsystem

  • Submitted date

    2018-12-18

  • Closed date

    2019-01-28

  • Last modified date

    2019-04-16

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

    UI60965 UI60966 UI60967

Modules/Macros

  •    ASMADATA ASMADOPT ASMAINFO ASMAOPT  ASMA01
    ASMA03   ASMA2G   ASMA7DE  ASMA7EN  ASMA7ES  ASMA7JP  ASMA7UE
    ASMA9Z
    

Publications Referenced
SC26494008 SC26494108 SC26349407    

Fix information

  • Fixed component name

    HLASM MVS, VM &

  • Fixed component ID

    569623400

Applicable component levels

  • R160 PSY UI60966

       UP19/01/29 P F901

  • R360 PSY UI60965

       UP19/01/28 P 1901

  • R689 PSY UI60967

       UP19/01/28 I 1000

Fix is available

  • Select the PTF appropriate for your component level. You will be required to sign in. Distribution on physical media is not available in all countries.



Document information

More support for: z/OS family

Software version: 160

Reference #: PH06572

Modified date: 16 April 2019