ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Retrieve system date from stored procedure

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

  • Retrieve system date from stored procedure

    Currently i have a stored procedure in my company system which work like this:

    VBPGM ------> PROC_DATE -----> UPDDTEC ------> UPDDTE
    (VB.Net Program) (Stored Procedure) (CL Program) (RPG Program)

    A Visual Basic .Net program will call the stored procedure and pass in some parameter. The RPG program will retrieve the system date and write into a PF.

    Before this, there is no problem with it. But this few days, it keeps on getting the same date (2007/02/07) instead of the actual date. When i check the system date from the AS/400 system, it shows the correct date. When i call the CL program from AS/400 system, the date retrieved is also correct. Can i know what is the causes please?

    For your information, the system have not been power down since 2007/02/07. Previously. the system is power down every day. Is it this will affect the system date retrieved?

    Your help is really appreciated. Thank you.
    Last edited by keanhoo168; February 13, 2007, 07:58 PM.

  • #2
    Re: Retrieve system date from stored procedure

    please show the code you are using to retrieve the date...
    and 1 question why retrieve the date from the iseries when you already have it on the server?

    thanks
    jamie
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      Re: Retrieve system date from stored procedure

      answer your question first, because we may direct call the CL program from another CL program in iSeries in case the server with vb.net is not available.

      I have tried 2 methods to retrieve the system date:
      1. combine UDAY, UMONTH & UYEAR in data structure.
      2. use *DATE

      But both fail. Is this the correct way to get system date? I means in RPG program.

      Comment


      • #4
        Re: Retrieve system date from stored procedure

        IPLin the box is not your problem. It seems that you are retrieving the job date from a program that is started at IPL and runs until the next IPL.

        Code:
             d ISODate         s               d 
         /free                                 
        
         Isodate = %date();
        
        /end-free
        I also found this:

        I am calling some RPG programs remotely via a Stored Procedure.

        Unfortunately the Job Date that gets carried through to the RPG programs via UDATE and *DATE, is the date that the Prestart job QRWTSRVR got started. (ie invariably Saturday, after our backup!)

        Lots of legacy code so don't want to change them to all to use TIME opcode, am tinkering with changing the job date via QWTCHGJOB API but am stingy and don't want to make an additional call for every request , is there a better way...
        Our solution was to write a short CL program that does a CHGJOB on job QZDASRVSD to change the job date. This runs as a scheduled job each morning at 00:00:01.
        Seems to work fine.
        All my answers were extracted from the "Big Dummy's Guide to the As400"
        and I take no responsibility for any of them.

        www.code400.com

        Comment

        Working...
        X