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



Ooops I didn't modify the MyText definition:

D MyCLOBFile S SQLTYPE(CLOB_File)

D MyText S 120A



D Start S 10I 0

D RowLen S 5I 0 inz(120)

D Index S 3U 0



D ParIFSFile S 256A Varying

D inz('/home/Hauser/MyText.csv')



*------------------------------------------------------------------------

/Free

MyCLOBFile_Name = %Trim(ParIFSFile);

MyCLOBFile_NL = %Len(%Trim(MyCLOBFile_Name));

MyCLOBFile_FO = SQFRD; //Read Only



DOU %Len(%Trim(MyText)) = *Zeros;



Start = (Index-1) * RowLen + 1;

Exec SQL Set :MyText = Substr(:MyCLOBFile, :Start, :RowLen);

If SQLCODE = 100 or SQLCODE < *Zeros

or %Len(%Trim(MyText)) = *Zeros;

Leave;

EndIf;

//Do whatever you want

EndDO;

*INLR = *ON;

Return;

/End-Free



Mit freundlichen Grüßen / Best regards



Birgitta Hauser



"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)

"If you think education is expensive, try ignorance." (Derek Bok)

"What is worse than training your staff and losing them? Not training them
and keeping them!"





-----Ursprüngliche Nachricht-----
Von: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von Birgitta Hauser
Gesendet: Wednesday, 15.8 2012 17:39
An: 'Midrange Systems Technical Discussion'
Betreff: AW: Is there a way to use SQL to read files directly of the IFS



It is possible to read IFS files directly with embedded SQL by using
LOB-files or LOB Locators.

... but a LOB-file or a LOB Locator can only be handled with SQL functions
as if it would be a character field, that means you need to split the *.csv
file into columns by yourself.



Example:

D MyCLOBFile S SQLTYPE(CLOB_File)

D MyText S 50A



D Start S 10I 0

D RowLen S 5I 0 inz(120)

D Index S 3U 0



D ParIFSFile S 256A Varying

D inz('/home/Hauser/MyText.csv')



*---------------------------------------------------------------------------

----------------------

/Free

MyCLOBFile_Name = %Trim(ParIFSFile);

MyCLOBFile_NL = %Len(%Trim(MyCLOBFile_Name));

MyCLOBFile_FO = SQFRD; //Read Only



DOU %Len(%Trim(MyText)) = *Zeros;



Start = (Index-1) * RowLen + 1;

Exec SQL Set :MyText = Substr(:MyCLOBFile, :Start, :RowLen);

If SQLCODE = 100 or SQLCODE < *Zeros

or %Len(%Trim(MyText)) = *Zeros;

Leave;

EndIf;

//Do whatever you want

EndDO;



*InLR = *On;

/END-FREE





Mit freundlichen Grüßen / Best regards



Birgitta Hauser



"Shoot for the moon, even if you miss, you'll land among the stars." (Les

Brown)

"If you think education is expensive, try ignorance." (Derek Bok) "What is
worse than training your staff and losing them? Not training them and
keeping them!"





-----Ursprüngliche Nachricht-----

Von: <mailto:midrange-l-bounces@xxxxxxxxxxxx>
midrange-l-bounces@xxxxxxxxxxxx

<mailto:[mailto:midrange-l-bounces@xxxxxxxxxxxx]>
[mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von Darryl Freinkel

Gesendet: Wednesday, 15.8 2012 16:09

An: <mailto:midrange-l@xxxxxxxxxxxx> midrange-l@xxxxxxxxxxxx

Betreff: Is there a way to use SQL to read files directly of the IFS



I have some large files on the IFS that I create from the native database.

Periodically there is a problem with that data but it's only discovered days
later when the original data is gone but in the IFS. I could copy it back to
the data base file but it would be more convenient if we could read directly
from the IFS. The files are in a CSV format.





TIA





Darryl Freinkel | Assignment 400 Group, Inc.



Tel: 770.321.8562 ext 111 | Fax 770.321.8562



--

This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: <mailto:MIDRANGE-L@xxxxxxxxxxxx>
MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,

visit: <http://lists.midrange.com/mailman/listinfo/midrange-l>
http://lists.midrange.com/mailman/listinfo/midrange-l

or email: <mailto:MIDRANGE-L-request@xxxxxxxxxxxx>
MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to
review the archives at <http://archive.midrange.com/midrange-l>
http://archive.midrange.com/midrange-l.





--

This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: <mailto:MIDRANGE-L@xxxxxxxxxxxx>
MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,

visit: <http://lists.midrange.com/mailman/listinfo/midrange-l>
http://lists.midrange.com/mailman/listinfo/midrange-l

or email: <mailto:MIDRANGE-L-request@xxxxxxxxxxxx>
MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to
review the archives at <http://archive.midrange.com/midrange-l>
http://archive.midrange.com/midrange-l.




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.