HI
Env Windows 7 gnucobol 3.1-dev.0
To process command ouput i use (example..)
CALL 'SYSTEM' USING 'ipconfig >output.txt'
then i open output.txt ,read records ,process records and then close ....
it function ...
Is this the correct way to process command output ?
...or there is a simplier way ?
thanks in advance
Maurizio
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I can't imagine a simpler method - you've told the OS what command you want to execute and where to put the resulting output. - perfect.
I tend to do a similar thing to decide if a file is present or not by 'dir > textfile - then I open the textfile & read it -
IF I get any records then the file is present - but if it takes the at end path then it's not.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
HI
Env Windows 7 gnucobol 3.1-dev.0
To process command ouput i use (example..)
then i open output.txt ,read records ,process records and then close ....
it function ...
Is this the correct way to process command output ?
...or there is a simplier way ?
thanks in advance
Maurizio
This is definitely a reasonable approach that will work with most compilers.
There's no "simple" or "correct" approach here. Two other options you may want to look at that use pipes instead of redirection:
*
I can't imagine a simpler method - you've told the OS what command you want to execute and where to put the resulting output. - perfect.
I tend to do a similar thing to decide if a file is present or not by 'dir > textfile - then I open the textfile & read it -
IF I get any records then the file is present - but if it takes the at end path then it's not.
Minimal topic drift - You may want to have a look at
CBL_CHECK_FILE_EXIST[if there are any questions on this please create a new topic].Hi
i opened this topic just to know if another method is available ....
Sounds like my suggestions above are relevent than - so everything is fine, isn't it?