Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

RPGLE and date/time stamp

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • RPGLE and date/time stamp

    Change the field to data type = 'TIMESTAMP' and let DB2 do the work! bobh

  • #2
    RPGLE and date/time stamp

    Create a data structure with a date subfield and a time subfield. D timestamp ds D date d datfmt(*mdy) inz(*sys) D 1a D time t timfmt(*usa) inz(*sys) You won't be able to do any RPG timestamp operations on this "timestamp" field, though.

    Comment


    • #3
      RPGLE and date/time stamp

      It's verbose, but it works.
      Code

      Comment


      • #4
        RPGLE and date/time stamp

        Another similar solution, that also puts the AM or PM: timestamp30 = %char(%date(workdate) : *MDY) + ' ' + %char(%time(workdate) : *HMS + ' '
        Code

        Comment


        • #5
          RPGLE and date/time stamp

          Is there a way to code a dds and/or RPGLE program so that a date/time stamp field is automatically filled in when a record is created? I thought there was but the other programmers tell me I am wrong, that you have to move the timestamp into the record before you write it. I thought if you defined a field as date/time stamp (type Z) then the system would automatically fill it in when a new record is written.

          Comment


          • #6
            RPGLE and date/time stamp

            Nancy, I think you need to create a LF over the PF where you explicitly list the fields but don't list the native date/time (d/t/z) fields. Then when you write to the LF, the date/time fields are initialized to the current system date/time for you. Chris

            Comment


            • #7
              RPGLE and date/time stamp

              I need to update a character field in a database with a date/time stamp in the format of (using todays date): 10/26/01 08:45:15 AM Does anybody know how I can do this with RPGLE ? I have been able to get the following result..... 2001-10-26-08.51.10.561000 using the following code..... 'define Workdate as TimeStamp data type D Workdate S Z 'clear timestamp field...and define as 30 long... C Move *Blanks TimeStamp30 30 C Time Workdate C *iso Movel Workdate TimeStamp30 Can someone help me out ??? Thank you !!! Jim Sovick jim.sovick@jostens.com

              Comment


              • #8
                RPGLE and date/time stamp

                Chris, this is exactly correct. I do this all the time, at least with timestamp fields. Simply create a logical view without the timestamp field, then write to the logical file and the timestamp will be filled in with the current time and date.

                Comment

                Working...
                X