Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2003
    Location
    Florida
    Posts
    16

    Unanswered: Retreiving Current Timestamp from db2 registers

    when we tried to compile a C program on OS/390 in which this statement included. It gives syntax error. Can anyone pls correct this.......

    EXEC SQL
    SET :CurrtTime = CURRENT TIMESTAMP;

    pls do let me know incase of any clarifications.

    Thanks and Regards,
    Nagesh
    Nagesh

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: Retreiving Current Timestamp from db2 registers

    I assume it should be
    EXEC SQL
    select CURRENT TIMESTAMP into :cirrtTime from sysibm.sysdummy1 ;

    Cheers
    Sathyaram



    Originally posted by zip2nagesh
    when we tried to compile a C program on OS/390 in which this statement included. It gives syntax error. Can anyone pls correct this.......

    EXEC SQL
    SET :CurrtTime = CURRENT TIMESTAMP;

    pls do let me know incase of any clarifications.

    Thanks and Regards,
    Nagesh
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    Jul 2003
    Location
    Florida
    Posts
    16

    Re: Retreiving Current Timestamp from db2 registers

    Sathya,

    u r right. This is one way of extracting the current timestamp from the database. We wanted the other one which i mentioned to work it out so that we do not need to access any of the tables.

    EXEC SQL
    SET :CurrTime = CURRENT TIMESTAMP;

    ps: pls get back to me for clarifications...

    For reference look at this cobol procedure division code :

    PROCEDURE DIVISION.

    EXEC SQL SET :CURR-TIMESTAMP = CURRENT TIMESTAMP END-EXEC.
    DISPLAY '*** START *** ' CURR-TIMESTAMP.

    The same statement works out with c programming and i have done that earlier. Don't really know whats the current problem.

    Nagesh


    Originally posted by sathyaram_s
    I assume it should be
    EXEC SQL
    select CURRENT TIMESTAMP into :cirrtTime from sysibm.sysdummy1 ;

    Cheers
    Sathyaram
    Nagesh

  4. #4
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    The method suggested by Sathyaram doesn't actually access any tables.

    However you are correct that the SET host-variable statement is probably more elegant. This is a new SQL statement for DB2 for OS/390 V7.

    There is no exact equivalent SQL statement for DB2 for Linux, UNIX, and Windows. They have the SET variable statement which is slightly different. Check out the SQL manual for details.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •