Why is a date field not being populated by the Fetch?
*
We are using SQL to retrieve records into a data structure and then build a subfile.
The pgm bombs at an Eval-Corr statement.

The error message is RNQ0112, Date, Time or Timestamp value is not valid .
The date field causing the error has a Null value.  It is valid... a valid Null.
*
Stepping through the pgm in debug mode, the date field is not changed at all after the Fetch statement. 
*
So, after the Fetch, we set the value in the date field  & then the error doesn't occur.
*
Here is the relevant code.. 
Files CaAgen & CaAgenJ76 are essentially the same, except the J file is a join file with a few extra fields.
We hope someone can suggest a solution.
Thank you
*
*
     D AgRecDs       E DS                  ExtName(CAAGEN) qualified
     D AgRec         E DS                  ExtName(CAAGENJ76)
     D nullFlags       S              2b 0 dim(50)                       


 Begsr LoadSubfile;
        // Open the cursor
       If *In75;
         Exec Sql Declare cursor75 CURSOR For
              Select   *
              From     CAAGEN
              Where    AGCMDATE = :PgmCmDate
              order by AGCMDATE, AgAgType;
              For Read Only;
         Exec Sql Open  cursor75 ;
       Endif;                        
 : : : : : : : : : : : : : : : : : : : : : : : : :
 : : : : : : : : : : : : : : : : : : : : : : : : :
        If *In75;
           Exec SQL Fetch next from cursor75 Into :AgRecDs :nullFlags;
           If (SqlStt = '02000');
              *In86 = *On;
           else;
              eval-corr AgRec = AgRecDs;
           ENDIF;
        Endif; 
Endsr;




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.