× 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: RE: embedded sql-substr of flat file
  • From: "Leland, David" <dleland@xxxxxxxxxx>
  • Date: Fri, 15 Jun 2001 09:39:43 -0500

Title: RE: embedded sql-substr of flat file

You haven't told us how you're trying to print the fields.

-----Original Message-----
From: Smith, Mike [mailto:Mike_Smith@RGCResources.com]
Sent: Friday, June 15, 2001 8:39 AM
To: 'RPG400-L@midrange.com'
Subject: embedded sql-substr of flat file


Ok, all my sql guru friends

here is my situation.

I have an embedded SQL program that uses a flat file.  I need to seperate
the fields out of the flat file via SUBSTR.    
here is the declare of my cursor,
I want to print the fields GRADE, LAST, FIRST, ETC. but it won't let me
print these fields.  it tells me they are not defined which i guess they
really aren't, but i'm not sure where to go from here. 


/EXEC SQL                                                         
+ DECLARE FULCURS CURSOR FOR SELECT SUBSTR(TOTRCD,7,1) AS GRADE,  
+ SUBSTR(TOTRCD,9,30) AS LAST, SUBSTR(TOTRCD,39,6) AS FIRST,      
+ SUBSTR(TOTRCD,45,8) AS NUMB, SUBSTR(TOTRCD,53,20) AS STREET,    
+ SUBSTR(TOTRCD,75,20) AS CITY, SUBSTR(TOTRCD,107,10) AS ZIP,     
+ SUBSTR(TOTRCD,117,3) AS AREACODE, SUBSTR(TOTRCD,120,3) AS       
+ PHONEPRE, SUBSTR(TOTRCD,123,4) AS PHONEEND, SUBSTR(TOTRCD,147,7)
+ AS ACCT FROM RGCDNOUT ORDER BY GRADE, ACCT                      
/END-EXEC                                                         


SO, how can i substring a flat file and print the resulting fields. 

thanks
hope that makes sense.

Michael Smith
Information Systems
RGC Resources
777-3882

+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-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 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.