TechTalk: DATE Keyword Quirk

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

In our shop, we recently developed a batch job that is always running in its own job queue. This job produces, on demand, one-page reports for our users. One of our printer file standards is that the date and time always be displayed in the upper-right corner of the report. To produce the report, I used an external printer file with the DATE and TIME DDS keywords.

In running the report, I noticed the program was always printing the current system time but that the printed date was the date the job was submitted to the system. I checked the DDS manual for printer files and found that, indeed, the DDS keyword TIME always prints the current system time while the DDS keyword DATE always prints the current job date-i.e., the date the job started. What this means is that, if your report is printed out across midnight, the time will remain current while the date will not change.

Fortunately, there is a simple solution, but it involves retrieving the date manually rather than using DDS. In your DDS for the printer file, replace the DATE keyword with a user-defined variable as shown in 1.

Fortunately, there is a simple solution, but it involves retrieving the date manually rather than using DDS. In your DDS for the printer file, replace the DATE keyword with a user-defined variable as shown in Figure 1.

Field DATE6N is your substitute for the DATE keyword. In your program, perform the code shown in 2 before you print the date in variable DATE6N.

Field DATE6N is your substitute for the DATE keyword. In your program, perform the code shown in Figure 2 before you print the date in variable DATE6N.

Editor's Note: The same quirk applies to display files. Suppose you design a display file that uses the DATE and TIME keywords, to be used in an interactive file maintenance program. A user starts the job at 23:45 on December 1, 1992. Twenty minutes later, the time has advanced to 00:05, but the date remains the same.


TechTalk: DATE Keyword Quirk

Figure 1 Replacement for DATE keyword

 Figure 1: Replacement for DATE Keyword ... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 A DATE6N 6 0 10EDTCDE(Y) 
TechTalk: DATE Keyword Quirk

Figure 2 Retrieving date in RPG/400

 Figure 2: Retrieving Date in RPG/400 ... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 C TIME SYSCLK 120 C Z-ADDSYSCLK DATE6N 
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: