Hello,
I have this program so far;
My thoughts here are pretty simple;
Fetch most recent record from FILE
Check the date/time of the record retrieved;
if it's greater that the last stored value in CHKERROR- email me some details via SNDDST
if it's the same or less, end program
So I have gotten as far as the above and I thought I'd compile it to check the data structures are defined correctly so far and unfortunately it fails during the SQL part stating;
I thought I could just define xDate/xTime in their own data structure and then compare xDatTim with xSdatStim - so either I can't do this or I've set it up wrong.
So my question is; can I use xDate/xTime for SQL variables and define them in a data structure? Or do I need 2 different fields in the DS and then just move xDate/xTime into them and compare that way? (For now; I'll do the latter, as I need something in place but I'd rather do the former)
Thanks,
Ryan
I have this program so far;
Code:
0001.00 D xDate S 8 0 0002.00 D xTime S 6 0 0003.00 D xRefno S 8 0 0004.00 0005.00 D DatTim Ds DTAARA(CHKERROR) 0005.01 D xDatTim 1 14 0 0006.00 D xDat 1 8 0 0007.00 D xTim 9 14 0 0008.00 0009.00 D SdatStim Ds 0010.00 D xSDatStim 1 14 0 0010.01 D xDate 1 8 0 0011.00 D xTime 9 14 0 0012.00 0013.00 /free 0014.00 // Read CHKERROR data area 0015.00 in xDatTim; 0016.00 0017.00 // Run SQL to check for more recent examples 0018.00 Exec SQL 0019.00 SELECT DATE, TIME, REFNO 0020.00 INTO :xDate, :xTime, :xRefno 0021.00 FROM FILE 0022.00 ORDER BY DATE DESC, TIME DESC 0023.00 FETCH FIRST ROW ONLY; 0024.00 0025.00 // End program 0026.00 *INLR = *ON 0027.00 0028.00 /End-Free
Fetch most recent record from FILE
Check the date/time of the record retrieved;
if it's greater that the last stored value in CHKERROR- email me some details via SNDDST
if it's the same or less, end program
So I have gotten as far as the above and I thought I'd compile it to check the data structures are defined correctly so far and unfortunately it fails during the SQL part stating;
Code:
MSG ID SEV RECORD TEXT SQL0314 35 20 Position 20 Host variable XDATE not unique. SQL0314 35 20 Position 28 Host variable XTIME not unique.
So my question is; can I use xDate/xTime for SQL variables and define them in a data structure? Or do I need 2 different fields in the DS and then just move xDate/xTime into them and compare that way? (For now; I'll do the latter, as I need something in place but I'd rather do the former)
Thanks,
Ryan
Comment