Troubleshooting
Problem
This document is an overview of Query/400 numeric date representation and numeric field editing.
Resolving The Problem
In Query/400, there are different options to format a date which is represented by numeric data. By numeric data, we are referring to zoned or packed fields, not the actual Date type data type. While the operating system only views this representation as a numeric value, numeric field editing in Query/400 can be used to give the field a more meaningful appearance in an on-screen or printed report. Following are five popular formats for numeric dates along with editing suggestions.
MMDDYY (six digits) | Option 2 or edit code 'Y' under Define Numeric Field Editing is suggested. |
YYMMDD (six digits) | Option 2 or edit code 'Y' in this case will result in a leading zero being truncated. For example, January 1, 2000, would appear as 0/01/01. To see the leading zero, use Option 4 and specify the following edit word: '0 / / ' (zero, two spaces, separator, two spaces, separator, two spaces) This is further documented in APAR SA80011. |
YYYYMMDD (eight digits) | Option 2 or edit code 'Y' can be used if you wish to drop the first two digits in the year. To see the full eight digits, use the following edit word: ' / / ' (four spaces, separator, two spaces, separator, two spaces) |
MMDDYYYY (eight digits) | At releases V4R2M0 and later, the 'Y' edit code will properly format this date, but only if the following PTFs are applied: V4R2M0 - SF57768 and SF57787 V4R3M0 - SF57769 and SF57788 V4R4M0 - SF57789 and SF57792 At prior releases, or without the above PTFs, use the following edit word: ' / / ' (two spaces, separator, two spaces, separator, four spaces) |
CMMDDYY | In this case use Option 2 to exclude the century value (mm/dd/yy), or the 'Y' edit code to include it (cmm/dd/yy). For information on how to convert a date in this format to a MMDDYYYY format, see Technote Query/400 to Convert a Date Data Type to a Century Marker. |
Below is a sample query output showing how several different dates will appear using the above numeric editing choices:
MMDDYY YYMMDD YYYYMMDD MMDDYYYY CMMDDYY
000001 12/15/99 99/12/15 1999/12/15 12/15/1999 12/15/99
000002 1/01/00 00/01/01 2000/01/01 1/01/2000 1/01/00
000003 2/15/00 00/02/15 2000/02/15 2/15/2000 2/15/00
000004 10/20/00 00/10/20 2000/10/20 10/20/2000 10/20/00
000005 4/21/74 74/04/21 1974/04/21 4/21/1974 4/21/74
000006 10/25/01 01/10/25 2001/10/25 10/25/2001 10/25/01
000007 1/01/15 15/01/01 2015/01/01 1/01/2015 1/01/15
[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.1.0"}]
Historical Number
18264642
Was this topic helpful?
Document Information
Modified date:
18 December 2019
UID
nas8N1019594
Manage My Notification Subscriptions