Tuesday, February 5, 2008

Create your own Edit Codes:

One of the better features of OS/400 is the ability to create your own edit codes. Three that are commonly used are, a modified "Y" edit code, a social security edit code and a telephone number edit code. User defined edit codes can be of any number between 5 to 9. The edit code commands are Create Edit Description (CRTEDTD), Delete Edit Description (DLTEDTD), and Display Edit Description (DSPEDTD). There is no command to change an edit code description.
To create an edit code of your own, you must first delete one of the edit codes numbered 5-9 that IBM provides as samples (e.g., DLTEDTD 5). Then you can replace that code with one of your own. The below sample will use a lowercase "x" for the edit code. We can choose your own. The character "b" in the following commands represents a blank.

CRTEDTD EDTD(x) INTMASK('b0/bb/bb') +
DECPNT(*NONE) ZEROBAL(*NO) +
TEXT('Similar to Y, but no print if date = 000000')

CRTEDTD EDTD(x) INTMASK('bbb-bb-bbbb') DECPNT(*NONE) +
FILLCHAR(0) ZEROBAL(*YES) +
TEXT('Social Security Edit Code')

CRTEDTD EDTD(x) INTMASK('(bbb)&bbb-bbbb') DECPNT(*NONE) +
ZEROBAL(*NO) LFTCNS('(') TEXT('Telephone edit code')

No comments: