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



I am trying desperately to get this embedded sql down and thought I had it 
after the last go around, unfortunately I must be 1. dumber than I thought, 
2. losing my mind or 3. had too much gaterade today.  In any event, I am 
using the following code to extract the records from the logical file:

C     BLDSQL        BEGSR                                        
C/EXEC SQL                                                       
C+    DECLARE SQLCURSOR CURSOR                                   
C+    FOR SELECT                                                 
C+    ILNSOLDTO,                                                 
C+    ICMNAME,                                                   
C+    SUM(ILNEPRICE),                                            
C+    SUM(ILNEUAVCST),                                           
C+    SUM(ILNEPRICE) - SUM(ILNEUAVCST) AS MARGIN,                
C+    (SUM(ILNEPRICE) - SUM(ILNEUAVCST)) / SUM(ILNEPRICE) AS MPCT
C+    FROM SPECGASLF                                             
C+    WHERE                            
C+          ILNINVDATE > :STARTDATE AND
C+          ILNINVDATE <= :ENDDATE     
C+    GROUP BY                         
C+             ILNSOLDTO,              
C+             ICMNAME                 
C+    ORDER BY                         
C+             MPCT DESC               
C/END-EXEC                             

I am then opening the cursor with the very next sql statement:

C/EXEC SQL          
C+    OPEN SQLCURSOR
C/END-EXEC          

Then I set the indicators for my subfile:

C                   EVAL      *IN52 = *ON 
C                   WRITE     SPECCTL     
C                   EVAL      *IN52 = *OFF
C                   DOU       RRN = 10    

I am then using a fetch statement to extract the record, move them into 
variables and then write it to the subfile, however when I was in debug mode 
and viewed the variables at it was moving them into the subfiles fields it 
wasn't passing any data.....so of course it errors on a blank record.

Ideas, suggestions? or just tell me to get lost......


If you bought, it was hauled by a truck - somewhere, sometime.


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.