× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: SQL question
  • From: Cyndi Bradberry <CyndiB@xxxxxxxx>
  • Date: Mon, 18 Jun 2001 12:34:13 -0600

First off. I'm an SQL newbie.
I wrote an SQLRPGLE program to read thru a file. This file has Date Data
type fields in it, defined as DATFMT(*ISO).  I originally defined an
external DS to put the record into, but I have since defined my DS in the
program.  No matter what I do, I can't get this to compile.  It wants to
define the Date fields as 8 positions long, not 10. 

Here is the compiler listing showing my data structure for the file: 

     27                                                        
     28 D MasterRcd       DS                                   
     29 D  MS8STA                        1                     
     30 D  MS8LOAN#                     10S 0                  
     31 D  MS8DTE1                        D   DatFmt(*ISO)     
     32 D  MS8DTE2                        D   DatFmt(*ISO)     
     33                                                        

Here is the information from the SQL with the error:


     94 D                 DS
OPEN                       
     95 D  SQL_00000              1      2B 0 INZ(64)
length of header           
     96 D  SQL_00001              3      4B 0 INZ(3)
statement number           
     97 D  SQL_00002              5      8B 0 INZ(0)
invocation mark            
     98 D  SQL_00003              9      9A   INZ('0')
data is okay               
     99 D  SQL_00004             10     63A
end of header              
    100 D  SQL_00005             64     64A
end of header              
    101 D                 DS
FETCH                      
    102 D  SQL_00006              1      2B 0 INZ(64)
length of header           
    103 D  SQL_00007              3      4B 0 INZ(4)
statement number           
    104 D  SQL_00008              5      8B 0 INZ(0)
invocation mark            
    105 D  SQL_00009              9      9A   INZ('0')
data is okay               
    106 D  SQL_00010             10     63A
end of header              
    107 D  SQL_00011             65     65A
MS8STA                     
    108 D  SQL_00012             66     75S 0
MS8LOAN#                   
    109 D  SQL_00013             76     83D   DATFMT(*ISO)
MS8DTE1  
 ======> aaaaaaaaaaaaaaa

 *RNF0525 20 a      006900  The length must be 10 for date format *ISO-.

    110 D  SQL_00014             84     91D   DATFMT(*ISO)
MS8DTE2                            
 ======> aaaaaaaaaaaaaaa

 *RNF0525 20 a      006900  The length must be 10 for date format *ISO-.

    111 D                 DS
CLOSE                              
    112 D  SQL_00015              1      2B 0 INZ(64)
length of header                   
    113 D  SQL_00016              3      4B 0 INZ(5)
statement number                   
    114 D  SQL_00017              5      8B 0 INZ(0)
invocation mark                    
    115 D  SQL_00018              9      9A   INZ('0')
data is okay                       
    116 D  SQL_00019             10     63A
end of header                      
    117 D  SQL_00020             64     64A
end of header                      

        Here is my SQL Statements....We found the Set Option stuff in a
book, but are not sure if we are using it correctly.

    126 C*Exec SQL

    127 C*   Set Option DatFmt = *ISO,

    128 C*              DatSep = '-'

    129 C*End-Exec

    130 C*Exec SQL

    131 C* Declare MasterTable Cursor

    132 C*   For Select *

    133 C*   From MSGLIB/MSGC08

    134 C*   Where (MS8STA = 'A')

    135 C*   Order By MS8LOAN#

    136 C*   For Update of MS8STA, MS8DTE2

    137 C*End-Exec


This is what the SQL pre-compiler listing has for the fields:
 Data Names                    Define    Reference

 MS8DTE1                          31       DATE(8) IN MASTERRCD

 MS8DTE1                          64       DATE(10) COLUMN (NOT NULL) IN
MSGLIB.MSGC08      
 MS8DTE2                          32       DATE(8) IN MASTERRCD

 MS8DTE2                          ****     COLUMN

                                           64 200

 MS8DTE2                          64       DATE(10) COLUMN (NOT NULL) IN
MSGLIB.MSGC08      

I can look at the data in the file, it is in standard *ISO format dates.
What am i doing wrong ?  Specific links to manuals are recieved with joy. I
have both the SQL/400 Developer's Guide and SQL/400 by example.  I have not
read them cover to cover yet, but I haven't found anything yet that tells me
what to do.



TIA.

Cyndi B.
Bosie, ID
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

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.