Example: Loading current timestamps

The massload utility is given the information below to update the offer with an OFFER_ID of 10123. The start date has a value of CURRENT TIMESTAMP, and the end date has a value of CURRENT TIMESTAMP + 14 DAYS.

  <OFFER 
    OFFER_ID="10123"
    STARTDATE="CURRENT TIMESTAMP">
    ENDDATE="CURRENT TIMESTAMP + 14 DAYS"
  />

The massload utility recognizes that the columns STARTDATE and ENDDATE are of a timestamp data type in the database. Based on the CurrentTimeStampLiteral property, the values are determined to have values specified in the current-timestamp format. The value for STARTDATE matches the InputCurrentTimeStampFormat.1 pattern, and it is converted to the pattern specified by the CurrentTimeStampFormat.JDBC property. The value for ENDDATE matches the format of the InputCurrentTimeStampFormat.2 property, and it is also converted to the pattern specified by the CurrentTimeStampFormat.JDBC property.

 

Examples of adding durations to current timestamps

The massload utility gives you the ability to add durations to current timestamps. For example, you may want to load an offer without inputting a specific date. To do that, create an end date that is some duration after the start date. The following example works well with DB2:

  <Offer
    Startdate="Current Timestamp"
    Enddate="Current Timestamp +14 Days +4 Months +1 Year +0 Hours 
      +0 Minutes +0 Seconds"
  />

To handle current-timestamp durations in a platform-independent way, however, customize the current-timestamp formats by modifying the masks in the massload utility customizer property file. Here is an example of customized current-timestamp property specifications:

  CurrentTimestampLiteral=Current Timestamp

  InputCurrentTimestampFormat.0=Current Timestamp
  InputCurrentTimestampFormat.1=Current Timestamp %D Days
  InputCurrentTimestampFormat.2=Current Timestamp %M Months
  InputCurrentTimestampFormat.3=Current Timestamp %Y Years
  InputCurrentTimestampFormat.4=Current Timestamp %D Days %M Months
  InputCurrentTimestampFormat.5=Current Timestamp %D Days %M Months %Y Years
  InputCurrentTimestampFormat.6=Current Timestamp %D Days %M Months %Y Years %H Hours %m Minutes %s Seconds

  CurrentTimestampFormat.JDBC=Current Timestamp %D Days %M Months %Y Years %H Hours %m Minutes %s Seconds

Use the offer example and these property specifications, the end date for the offer matches the InputCurrentTimestampFormat.6 pattern. This yields the following offer information using the CurrentTimestampFormat.JDBC.

  <Offer
    Startdate="Current Timestamp"
    Enddate="Current Timestamp +14 Days +4 Months +1 Year +0 Hours +0 Minutes +0 Seconds"
  />

The preceding example shows how the massload utility can input multiple current-timestamp formats and format them appropriately to a desired output format.

Related concepts

Related tasks

Related reference