× 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.



Tyra,

Not a good example at hand right now, donig this by heart.

The SQLDA is a DS with an array within.

The first 16 characters contain subfields for the SQLN (number of columns 
porvided) SQLD (number of columns returned) SQLDABC (length of SQLDA, based on 
(SQLDN * 80) + 16), the SQLDABC subfield has to be calculated once.

The other 80 characters are for the SQL_VAR array, that only requires the data 
type, length, a pointer to the receiving programme variable, a pointer to the 
null indicator (5I 0) for each column in the result set or for a value passed 
at OpenCursor time. Normally the routine is to use a seperate DS (SQLVAR), fill 
that in and move thet in the SQL_VAR(index). 

The length of the columns are the butes provided in the receiver variable. Mind 
for packed and zoned  dat colums you have to d  a liitle calculation: (Length 
of variable * 256) +  number of digits; the manuals are talkking about 
precision and scale for those two.

After filling a SQLVAR move it into an SQL_VAR(ix) array element, where SQL_VAR 
is part of the SQLDA.

I see you want to use it on the OpenCursor; then you have to provide the 
pointers for the variables that contain the values to pass to the SQL optimizer.

In the SQL statement you want to prepare you should use parameter markers in 
the WHERE clause: 
SELECT name, function, age, division FROM EMPLOYEE WHERE department = ?

See the SQL Reference Manual appendices B, C and D about SQL data types and 
SQLDA  (I think you already did that)

Hope this helps; this is all from my rusty memory.
 
Regards,
Carel Teijgeler.

*********** REPLY SEPARATOR  ***********

On 17-6-05 at 9:30 Tyra Brodsky wrote:

> So, I can tell that I have a problem with the address in SQLDATA.  I think 
> the error is in reference to my
>open statement.  I assume I need to have an eval statement for the
>SQLDATA, but I don't have a clue what to put there.... Here is a snippet
>of my code.  Any ideas of what I'm doing wrong?  I've also tried it with
>sqldabc = 1 * 80 + 16 and sqldabc = 2 * 80 + 16 for the second occurance.  
>Same error
>
>
>                               C                   eval      SQLN = 2
>                               C                   eval      SQLD = 2
>                               C                   eval      SQLTYPE = 452     
>          
>                               C                   eval      SQLLEN  = 1       
>          
>                               C                   eval      SQLNAME = 
> 'SAMPLE'         
>                               C                   eval      sqldabc = 
> SQLN*80+16       
>                               C                   movea     sqlvar    
>sql_var(1)   
>                               C                   eval      SQLTYPE = 452     
>          
>                               C                   eval      SQLLEN  = 1       
>          
>                               C                   eval      SQLNAME = 
> 'SAMPLE1'        
>                               C                   eval      sqldabc = 
> SQLN*80+16       
>                               C                   movea     sqlvar
>sql_var(2)   
>                               C/Exec SQL
>                               C+        PREPARE SQL_Stmt FROM :SQL_String     
>          
>                               C/End-Exec
>                               C/Exec SQL  
>                               C+        DECLARE SQL_Read SCROLL CURSOR for 
> SQL_Stmt   
>                               C/End-Exec
>                               C/Exec SQL
>                               C+        OPEN SQL_Read Using DESCRIPTOR :SQLDA 
>         
>                               C/End-Exec




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.