Problem solve Get help with specific problems with your technologies, process and projects.

Initialize date/time fields w/o C-specs

This tip shows you how to initialize date/time fields w/o C-specs.

RPG IV allows you to initialize a date/time/timestamp field to the current system date/time. Using *JOB in place of *SYS on the INZ() keyword causes the date field to be initialized to the date value from the job (in short using *DATE). INZ(*JOB) is not valid with time and timestamp fields.


 

D SysDate         	   S               D    DATFMT(*ISO) INZ(*SYS)
D SysTime         	   S               T    DATFMT(*HMS) INZ(*SYS)



The block of code above is the same as doing using the bock of code below.

D      DS          INZ                  
D sysdattim 14  0                      
D  sysdate   8  0  OVERLAY(sysdattim:7)
D  systime   6  0  OVERLAY(sysdattim:1)
     .
     .
     .
C  TIME     SysDatTim     

==================================
MORE INFORMATION ON THIS TOPIC
==================================

The Best Web Links: tips, tutorials and more.

Ask your programming questions--or help out your peers by answering them--in our live discussion forums.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.

Dig Deeper on iSeries CL programming

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close