• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • SQL Understands Microseconds

    July 31, 2002 Timothy Prickett Morgan

    Hey, Ted:

    I am writing regarding your article, “Using Timestamps as Unique Keys ,” which printed on July 17 in Midrange Guru, OS/400 Edition. I would like to add the following option for consideration.

    Although the timestamp microsecond value returned by the TIME operation code is only accurate to three positions, SQL’s current timestamp register returns a value accurate to six positions.

    To verify this assumption, I created the following simple SQLRPGLE program:

    D timestamp1      s               z
    D timestamp2      s               z
    
    C                   time                    timestamp1
    C/exec sql
    C+ set :timestamp2 = current timestamp
    C/end-exec
    C
    C                   eval      *inlr = *on
    

    When I executed this program in debug, I found the two timestamp fields to have the following values:

    TIMESTAMP1 = '2002-07-17-07.26.56.573000'
    TIMESTAMP2 = '2002-07-17-07.26.56.573256'
    

    Also, if the database file is updated using the SQL UPDATE or INSERT statements, the value can be directly set using the CURRENT TIMESTAMP register. For example, assume a file called paywork, in which the last field is a timestamp field called tstamp:

    insert into mylib/paywork
       values(757, 1000.00, 'M', 2, 1, 100.00, 50.00, current timestamp)
    
    update mylib/paywork
       set tstamp = current timestamp
       where pwclock = 900
    

    –Jeff Haddix

    Thanks for bringing it up, Jeff. Speaking of INSERT, if you omit the timestamp field from the list of fields, the system inserts a timestamp with six-digit microseconds:

    insert into mylib/paywork
       (pwclock, pwgross, pwmarstat, pwnbrdep,
        pwnbrper, pwstatetax, pwlocaltax)
       values(747, 1000.00, 'm', 2, 1, 
       100.00, 50.00)
     

    Along the same line, suppose there is a logical file over the paywork file, but this logical file does not include the tstamp field in its field list. If you write to the logical file, the tstamp field will be updated with a value that includes six microsecond digits.

    — Ted

    Sponsored By
    ADVANCED SYSTEMS CONCEPTS

    SEQUEL meets all your iSeries and AS/400 data access needs in a single, integrated solution:

    • Windows, Web or host user interfaces

    • Convert AS/400 data into PC file formats

    • E-mail or FTP query results, reports and spool files
    • Run-time prompted queries and reports for end users

    • IF-THEN-ELSE logic in queries and reports

    • Report, form and label formatting second to none

    • Easily convert date fields, character-to-numeric, numeric-to-character and other data manipulation

    • SORT or JOIN using a calculated field

    • Quick summarization of data with Tabling function

    • Run multiple SEQUEL requests as one with the SEQUEL Scripting function

    • OLAP Business Intelligence at a fraction of the cost of comparable solutions

    Take 6 minutes to view a SEQUEL ViewPoint ScreenCam movie to see how simple Windows-based AS/400 and iSeries data access can be! In just a few short minutes, you can find out ways to make your job easier and improve data access throughout your organization. Download the ViewPoint movie here .

    For more information or a FREE trial of SEQUEL, call 847/605-1311 or visit Advanced Systems Concepts.

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags: Tags: mgo_rc, Volume 2, Number 57 -- July 31, 2002

    Sponsored by
    WorksRight Software

    Do you need area code information?
    Do you need ZIP Code information?
    Do you need ZIP+4 information?
    Do you need city name information?
    Do you need county information?
    Do you need a nearest dealer locator system?

    We can HELP! We have affordable AS/400 software and data to do all of the above. Whether you need a simple city name retrieval system or a sophisticated CASS postal coding system, we have it for you!

    The ZIP/CITY system is based on 5-digit ZIP Codes. You can retrieve city names, state names, county names, area codes, time zones, latitude, longitude, and more just by knowing the ZIP Code. We supply information on all the latest area code changes. A nearest dealer locator function is also included. ZIP/CITY includes software, data, monthly updates, and unlimited support. The cost is $495 per year.

    PER/ZIP4 is a sophisticated CASS certified postal coding system for assigning ZIP Codes, ZIP+4, carrier route, and delivery point codes. PER/ZIP4 also provides county names and FIPS codes. PER/ZIP4 can be used interactively, in batch, and with callable programs. PER/ZIP4 includes software, data, monthly updates, and unlimited support. The cost is $3,900 for the first year, and $1,950 for renewal.

    Just call us and we’ll arrange for 30 days FREE use of either ZIP/CITY or PER/ZIP4.

    WorksRight Software, Inc.
    Phone: 601-856-8337
    Fax: 601-856-9432
    Email: software@worksright.com
    Website: www.worksright.com

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Sending Escape Messages from RPG Free Software from Kisco

    Leave a Reply Cancel reply

MGO Volume: 2 Issue: 57

This Issue Sponsored By

    Table of Contents

    • Retrieving Query Definitions
    • SQL Understands Microseconds
    • Changing Languages on a 5250 Screen

    Content archive

    • The Four Hundred
    • Four Hundred Stuff
    • Four Hundred Guru

    Recent Posts

    • Meet The Next Gen Of IBMers Helping To Build IBM i
    • Looks Like IBM Is Building A Linux-Like PASE For IBM i After All
    • Will Independent IBM i Clouds Survive PowerVS?
    • Now, IBM Is Jacking Up Hardware Maintenance Prices
    • IBM i PTF Guide, Volume 27, Number 24
    • Big Blue Raises IBM i License Transfer Fees, Other Prices
    • Keep The IBM i Youth Movement Going With More Training, Better Tools
    • Remain Begins Migrating DevOps Tools To VS Code
    • IBM Readies LTO-10 Tape Drives And Libraries
    • IBM i PTF Guide, Volume 27, Number 23

    Subscribe

    To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

    Pages

    • About Us
    • Contact
    • Contributors
    • Four Hundred Monitor
    • IBM i PTF Guide
    • Media Kit
    • Subscribe

    Search

    Copyright © 2025 IT Jungle