Entry screens that allow the user to enter or modify a date can sometimes cause confusion when the field has the date edit code (Y) on it. The user may not know whether he should enter the date with or without the separator characters. Actually, he can enter it either way; but if he keys the separator characters, he's wasting keystrokes.
You can prevent this type of confusion in two ways. If your workstation is attached to a controller that supports an enhanced data stream, you can use the DDS Edit Mask (EDTMSK) keyword (5). This keyword allows you to protect specific areas (positions) within a field. If you don't have one of these controllers, I have developed a technique which offers the same functionality as the EDTMSK keyword.
You can prevent this type of confusion in two ways. If your workstation is attached to a controller that supports an enhanced data stream, you can use the DDS Edit Mask (EDTMSK) keyword (Figure 5). This keyword allows you to protect specific areas (positions) within a field. If you don't have one of these controllers, I have developed a technique which offers the same functionality as the EDTMSK keyword.
My technique allows you to create a field which displays the date separator characters and skips over them as the user enters the date. The user can only enter values into positions 1, 2, 4, 5, 7, and 8. Positions 3 and 6 contain a slash (/) separator character as output only. If you want to see this technique in action, try running the sample program shown in 6.
My technique allows you to create a field which displays the date separator characters and skips over them as the user enters the date. The user can only enter values into positions 1, 2, 4, 5, 7, and 8. Positions 3 and 6 contain a slash (/) separator character as output only. If you want to see this technique in action, try running the sample program shown in Figure 6.
This technique works by exploiting a quirk in the way the Clear Line (CLRL) record-level keyword works. CLRL lets you write more than one record format on the same line. The input-capable fields in all formats remain input-capable.
Date Entry Fields
Figure 5 Display File XMS003DF
A*=============================================================== A* To compile: A* A* CRTDSPF FILE(XXX/XMS003DF) SRCFILE(XXX/QDDSSRC) A* A*=============================================================== A*. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 A DSPSIZ(24 80 *DS3) A CA03(03) A R DSP01 A MM 2Y 0B 4 10 A DD 2Y 0B 4 13 A YY 2Y 0B 4 16 A R DSP02 A CLRL(*NO) A MMDDYY 6Y 0O 4 10EDTCDE(Y) A DSPATR(UL)
Date Entry Fields
Figure 6 RPG Program XMS003RG
*=============================================================== * To compile: * * CRTRPGPGM PGM(XXX/XMS003RG) SRCFILE(XXX/QRPGSRC) * *=============================================================== *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 FXMS003DFCF E WORKSTN I IDS I 1 60MMDDYY I 1 20MM I 3 40DD I 5 60YY C *INKC DOUEQ*ON C WRITEDSP01 C WRITEDSP02 C READ DSP01 99 C ENDDO C MOVE *ON *INLR
LATEST COMMENTS
MC Press Online