Sign in

docs RPG Reference

Simple Edit Codes

Simple Edit Codes

You can use simple edit codes to edit numeric fields without having to specify any punctuation. These codes and their functions are:

  • The X edit code ensures a hexadecimal F sign for positive fields and a hexadecimal D sign for negative fields. However, because the system does this, you normally do not have to specify this code. Leading zeros are not suppressed. You can use %EDITC with the X edit code to convert a number to character with leading zeros. However, be aware that negative numbers can produce unexpected results; for example, %EDITC(-00123:‘X’) will give the result ‘0012L’.

  • The Y edit code is normally used to edit a 3- to 9-digit date field. It suppresses the leftmost zeros of date fields, up to but not including the digit preceding the first separator. Slashes are inserted to separate the day, month, and year. The DATEDIT(fmt{separator}) and DECEDIT(*JOBRUN | ‘value’) keywords on the control specification can be used to alter edit formats.

    Note: The Y edit code is not valid for *YEAR, *MONTH, and *DAY.

  • The Z edit code removes the sign (plus or minus) from and suppresses the leading zeros of a numeric field. The decimal point is not placed in the field.