Created On:  18 October 2010

Problem:

The following program, works with DB2 but now with Oracle it throws up an error. The issue is in the following section:

364200      EXEC SQL                                                                                    36420000
                   SET :PSTMP = CURRENT_TIMESTAMP                             36430000
364400      END-EXEC.                                                                                 36440000


Error:
COBCH0149S No SQL directives have been set  : D:\\MICROFOCUS\\SUMMERJOB\\SOURCES\\CBL_TCP1\\JOB.CBL(3680,16)

The variable PSTMP is defined as Pic X(26). The Oracle directives are:
p(COBSQL) COBSQLTYPE=ORACLE8 MAKESYN KEEPCBL  END-C DECLARE_SECTION=NO COMP5=NO date_format='dd.mm.yyyy'  END_OF_FETCH=100 p(cp) sql confirm ENDP

Resolution:

The correct way to get a Timestamp in the host variable is:

Select sysdate
into :hostvariable
from dual;

select to_char(sysdate,'dd-mon-yyyy hh24:mi:ss') into :host-string from dual;