[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

SQR Date problem/Informix



Below is a snip of code that is not working and appears it should be.  A
date retrieved from the database cannot be used in a select where clause in
Windows NT version.  For those of the PeopleSoft persuasion, this problem
showed its head from PER001.SQR in Version 8, using SQR version
6.1.4.  PER001 runs in Unix SQR, but not in Windows NT.

The program below is a small one that produces very similar results as
PER001.  An additional symptom is if we cut/paste the SQL statements from
the program into the SQL Editor and replace $date with a hard coded date in
the format 'YYYY-MM-DD' it works.  In the SQR, however, a hard coded date
like that returns an error when trying to evaluate the SQL statement.

The pastes below are the SQR Program, the LOG file output, and the #ifdef
INFORMIX section of our SETENV.SQC process.

===========
PROGRAM
===========

#include 'setenv.sqc'    !Set environment
#include 'SETUP01.SQC'

begin-report
   do init-datetime
   do load-asofdate
   do check-jobs-1
end-report

begin-procedure load-asofdate
begin-select
ASOFDATE
from PSASOFDATE
end-select
end-procedure

begin-procedure check-jobs-1
   move &ASOFDATE to $date
   show $date
begin-select
K.EMPLID
from PS_JOB K
where K.EFFDT <= $date
end-select
end-procedure

#include 'datetime.sqc'

=========================
OUTPUT
=========================
2000-04-30
(SQR 5528) INFORMIX SQL OPEN/EXECUTE error -1204 (ISAM: 0) in cursor 5:
    Invalid year in date


Error on line 20:
    (SQR 3723) Problem executing cursor.

SQR: Program Aborting.

========================
SETENV SNIP
========================
!  Standard INFORMIX parameters
!
#ifdef INFORMIX
#define PT-DBType           'INFORMIX'
#define Native-DateTime      YYYY-MM-DD_HH:MI:SS
#define Native-DateTimeMask 'YYYY-MM-DD HH:MI:SS.NNN'
#define Native-DateMask     'YYYY-MM-DD'
#define Native-TimeMask     'HH:MI:SS.NNN'
#define Native-Time24Mask   'HH:MI:SS.NNN'

#define NativeTimeFmt '0'          !0 = NativeTime-24hr, 1 = NativeTime-12hr
#define NTimeDel      ':'          !Native Time Delimiter
#define Time24        '1'          !iTime; 0 = 12 hour day
#define TLZero        '1'          !0 = no leading zero
#define TZ1159        ''           !s1159
#define TZ2359        ''           !s2359
!
! Meta SQL (For Use in SQL Statements Only)
!
#define PTConCat      ||
#define PTTRUNCATE    DELETE FROM
#define PTSubStr      substr
!
! Date Wrappers
!
#define DateTimeOut-Prefix
#define DateTimeOut-Suffix
#define DYN-DateTimeOut-Prefix
#define DYN-DateTimeOut-Suffix
#define DateTimeIn-Prefix
#define DateTimeIn-Suffix
#define DYN-DateTimeIn-Prefix
#define DYN-DateTimeIn-Suffix
#define DateOut-Prefix
#define DateOut-Suffix
#define DYN-DateOut-Prefix
#define DYN-DateOut-Suffix
#define DateIn-Prefix
#define DateIn-Suffix
#define DYN-DateIn-Prefix
#define DYN-DateIn-Suffix
#define TimeOut-Prefix     TRIM(
#define TimeOut-Suffix     || ' ')
#define DYN-TimeOut-Prefix TRIM(
#define DYN-TimeOut-Suffix || '' '')
#define TimeIn-Prefix
#define TimeIn-Suffix
#define DYN-TimeIn-Prefix ''
#define DYN-TimeIn-Suffix ''
#define Time24Out-Prefix     TRIM(
#define Time24Out-Suffix     || ' ')
#define DYN-Time24Out-Prefix TRIM(
#define DYN-Time24Out-Suffix || '' '')
#define Time24In-Prefix
#define Time24In-Suffix
#define DYN-Time24In-Prefix ''
#define DYN-Time24In-Suffix ''
#end-if