| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| How do you pull in data issued in the cmd window Example my REXX program issues "ADDRESS CMD DIR" how do I capture the response as data to be used later in the program? Is the response read as one stream or individual lines. Thanks in advance. |
|
#2
| |||
| |||
| On Jul 21, 7:24*pm, globaloney <jgol...@excite.com> wrote: > How do you pull in data issued in the cmd window > *Example *my REXX program issues "ADDRESS CMD DIR" > how do I capture the response as data to be used later in the program? > Is the response read as one stream or individual lines. > Thanks in advance. Sorry,I forgot to say I'm running Windows OS. |
|
#3
| |||
| |||
| In Message-ID:<87322844-a0d5-435c-88eb-264c0833c194@d77g2000hsb.googlegroups.com>, globaloney <jgolano@excite.com> wrote: >On Jul 21, 7:24*pm, globaloney <jgol...@excite.com> wrote: >> How do you pull in data issued in the cmd window >> *Example *my REXX program issues "ADDRESS CMD DIR" >> how do I capture the response as data to be used later in the program? >> Is the response read as one stream or individual lines. >> Thanks in advance. > >Sorry,I forgot to say I'm running Windows OS. You also forgot to specify your flavor or REXX. When I ask something that even might be related to my OS, REXX, or level, I run this and show the appropriate parts of the output: <code> say '' parse source a say "parse source output:" a say "address():" address() say '' parse version b say "parse version output:" b call rxfuncadd 'sysloadfuncs','RexxUtil','sysloadfuncs' call sysloadfuncs say "McPhee's RegUtil (aka RexxUtil)" SysUtilVersion() call rxfuncadd 'w32loadfuncs','W32util','w32loadfuncs' call w32loadfuncs parse value w32version() with ver file say "McPhee's W32Util" ver "ver" </code> However, to answer your question, in Regina, you'd code something along the lines of: address system 'dir' with output replace stem dir1. -- Arthur T. - ar23hur "at" intergate "dot" com Looking for a z/OS (IBM mainframe) systems programmer position |
|
#4
| |||
| |||
| On Jul 21, 7:24*pm, globaloney <jgol...@excite.com> wrote: > How do you pull in data issued in the cmd window > *Example *my REXX program issues "ADDRESS CMD DIR" > how do I capture the response as data to be used later in the program? > Is the response read as one stream or individual lines. > Thanks in advance. I am using ooREXX |
|
#5
| |||
| |||
| On Jul 21, 7:24*pm, globaloney <jgol...@excite.com> wrote: > How do you pull in data issued in the cmd window > *Example *my REXX program issues "ADDRESS CMD DIR" > how do I capture the response as data to be used later in the program? > Is the response read as one stream or individual lines. > Thanks in advance. I did get the following code to run however it generates errors in the cmd window. /*********************************/ rxqueue('delete','jgq') rxqueue('create','jgq') rxqueue('set','jgq') cmdstr = "dir *.txt" ADDRESS CMD cd prf ADDRESS CMD cmdstr"| rxqueue jgq " Do queued() pull qline got=got+1 /************************************************** ********/ pos1 = pos('~', qline) pos2 = pos('.TXT',qline) if pos1 > 0 and pos2 > 0 then do tr=pos1-2 orse=substr(qline,tr,12) call LINEOUT FOLENAME, orse end CALL LINEOUT (FOLENAME) /* CLOSE */ /**************************************************/ I did get the above code to run, however it generates the following(non impacting) error messages in the command window; '0' is not recognized as an internal or external command,operable program or batch file. 'JGQ' is not recognized as an internal or external command,operable program or batch file. 'SESSION' is not recognized as an internal or external command,operable program or batch file. Is there a way to suppress the messages FMI? |
|
#6
| |||
| |||
| "globaloney" <jgolano@excite.com> wrote in message news:77d535c0-d28e-4e54-923c-345c19ca9f79@8g2000hse.googlegroups.com... On Jul 21, 7:24 pm, globaloney <jgol...@excite.com> wrote: > How do you pull in data issued in the cmd window > Example my REXX program issues "ADDRESS CMD DIR" > how do I capture the response as data to be used later in the program? > Is the response read as one stream or individual lines. > Thanks in advance. I did get the following code to run however it generates errors in the cmd window. /*********************************/ rxqueue('delete','jgq') rxqueue('create','jgq') rxqueue('set','jgq') cmdstr = "dir *.txt" ADDRESS CMD cd prf ADDRESS CMD cmdstr"| rxqueue jgq " Do queued() pull qline got=got+1 /************************************************** ********/ pos1 = pos('~', qline) pos2 = pos('.TXT',qline) if pos1 > 0 and pos2 > 0 then do tr=pos1-2 orse=substr(qline,tr,12) call LINEOUT FOLENAME, orse end CALL LINEOUT (FOLENAME) /* CLOSE */ /**************************************************/ I did get the above code to run, however it generates the following(non impacting) error messages in the command window; '0' is not recognized as an internal or external command,operable program or batch file. 'JGQ' is not recognized as an internal or external command,operable program or batch file. 'SESSION' is not recognized as an internal or external command,operable program or batch file. Is there a way to suppress the messages FMI? ================================================== =========== If you use syntax like: "func(parms)" you are invoking a function and it will return a result that needs to be handled so you would use something like: "rc = func(parms)". You can use or ignore the value of the var rc. If you don't want to return a value and/or don't want it, use this: "call proc parms". This can also return a result that you can find in the var "result". When you don't handle the function result, it is passed to the OS and it doesn't understand what it sees and offers the messages you see. These are Windows messages. Phil --- |
|
#7
| |||
| |||
| globaloney wrote: > How do you pull in data issued in the cmd window > Example my REXX program issues "ADDRESS CMD DIR" If you are specifically looking for solutions to get the listing of a directory, there is a very nice API in ooRexx named SysFileTree which returns a stem variable of results. Others, I see, have answered your "screen scrap" question. -- Michael Lueck Lueck Data Systems http://www.lueckdatasystems.com/ |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.