File access in 4GL
Posted in 2000
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
I need to get access to the output of an operating system command in 4GL. I see that I can use the "RUN" statement to execute the system command, however this only returns the OS status to me. So I figure I can have my 4GL process spawn a process to update a file, and then I can read that. Is there any way for me to read a file from within a 4GL executable? Thanks, Wes -- Wesley Gamble Bison Consulting (on site at The Men's Wearhouse) Sent via Deja.com http://www.deja.com/ Before you buy.
Hi! You can use LOAD if your file is properly formatted (with delimiters). HTH Michael Wesley Gamble wrote: > I need to get access to the output of an operating system command in > 4GL. I see that I can use the "RUN" statement to execute the system > command, however this only returns the OS status to me. So I figure I > can have my 4GL process spawn a process to update a file, and then I can > read that. > > Is there any way for me to read a file from within a 4GL executable? > > Thanks, > Wes > > -- > Wesley Gamble > Bison Consulting > (on site at The Men's Wearhouse) > > Sent via Deja.com http://www.deja.com/ > Before you buy.
Write a custom C function that runs the command for you and passes the output back to the 4gl program Wesley Gamble wrote: > > I need to get access to the output of an operating system command in > 4GL. I see that I can use the "RUN" statement to execute the system > command, however this only returns the OS status to me. So I figure I > can have my 4GL process spawn a process to update a file, and then I can > read that. > > Is there any way for me to read a file from within a 4GL executable? > > Thanks, > Wes > > -- > Wesley Gamble > Bison Consulting > (on site at The Men's Wearhouse) > > Sent via Deja.com http://www.deja.com/ > Before you buy. -- Paul Watson # WF Software Ltd # You are only young once Tel: +44 1436 674729 # but you can be immature Fax: +44 1436 678693 # for ever www.wfsoftware.com #
Wesley Gamble wrote: > I need to get access to the output of an operating system command in > 4GL. I see that I can use the "RUN" statement to execute the system > command, however this only returns the OS status to me. So I figure I > can have my 4GL process spawn a process to update a file, and then I can > read that. > > Is there any way for me to read a file from within a 4GL executable? I'm virtually certain there is at least one set of C routines to do this in the IIUG Software Archive. At least one. No, not mine...if they were mine, I'd be certain certain. -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v0.95 -- see http://www.perl.com/CPAN #include <disclaimer.h>
If you're using Dynamic 4gl, try using channels ! They're made for reading and/or writing text files (I guess that's what is used to produce REPORTS or Load/Unload datas). Exemple (if I can remember the syntax): CALL channel::openfile("yourfileID","filename","r") WHILE channel::read("yourfileID",stringvar) ... /... END WHILE CALL channel::close("yourfileID") There's also a channel::write command and you can do it to a command instead of a file: channel::openpipe("pipeID","ls -l","r") Great no ? Finally, take care to channel::set_delimiter("fileID","|") which is the default. So, if you write or read more than one field (like UNLOAD or LOAD do) you must use a delimiter to read/write them in a single command: CALL channel::read("fID",str1,str2,str3) Wesley Gamble a écrit : > I need to get access to the output of an operating system command in > 4GL. I see that I can use the "RUN" statement to execute the system > command, however this only returns the OS status to me. So I figure I > can have my 4GL process spawn a process to update a file, and then I can > read that. > > Is there any way for me to read a file from within a 4GL executable? > > Thanks, > Wes > > -- > Wesley Gamble > Bison Consulting > (on site at The Men's Wearhouse) > > Sent via Deja.com http://www.deja.com/ > Before you buy.