Date Entry Fields

RPG
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

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 
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: