OpenESQL

OpenESQL supports using all of the formats for host variables with some qualifications. If you use timestamp1 format, OpenESQL requires you to compile applications with the DETECTDATE SQL directive.

For example:

$set sql(dbman=odbc, detectdate) 
 01 timestamp1 pic x(26).
  . . . 
     move "{ts'1965-11-02 12:08:30'} to timestamp1 
     exec sql 
         insert into emp (TransDate) values (:timestamp1) 
     end-exec 

If you use timestamp2 format, you can just move the date time literal without the special characters.

For example:

01 timestamp2 SQL TYPE IS TIMESTAMP.
  . . . 
     move "1965-11-02 08:12:56”  to timestamp2
     exec sql 
         insert into emp (TransDate) values (:timestamp2) 
     end-exec 

For more information on how to use the timestamp3 format, see the OpenESQL SQL TYPEs in this chapter.