Run DOS commands in Regina REXX programs

Help
2007-02-15
2013-05-14
  • Joe Winograd

    Joe Winograd - 2007-02-15

    Platform: WinXP Pro SP2
    I've been a user of another REXX package for many years, but decided to give Regina REXX a spin. In the package I'm using now, in order to run a DOS command/program (including .BAT files), I simply enclose the command/program name/batch file name in quotes (single or double) inside the REXX program. I tried that in Regina REXX and it doesn't work. How can I do this in a Regina REXX program? Thanks much, Joe

     
    • Mike Protts

      Mike Protts - 2007-02-16

      If you use the 'Address System approach you can also manage input/output and errors.

      Example to invoke gpg with provided standard in and trap output from stdout and stderr:

      /* Set up some variables */
      user = 'me@somewhere.com'
      filename = 'xxx'
      gpg. = ''
      gpgin.0 = 1
      gpgin.1 = 'gpgkeyphrase'
      gpgparms = '--yes --trust-mode always --batch --encrypt -a  -o - --passphrase-fd 0 -r'

      /* Invoke command */
      address SYSTEM 'gpg.exe' gpgparms user '"'filename'"' WITH INPUT stem gpgin. OUTPUT STEM gpg. ERROR STEM cmd_err.

      /* handle output */
      if (.rs \= 0) then do
          say 'return code' .rs 'from gpg'
          do j = 1 to gpg.0
               say j gpg.j
          end
          do j = 1 to cmd_err.0
               say j cmd_err.j
          end
      end

      Mike

       
      • Joe Winograd

        Joe Winograd - 2007-02-17

        Mike, thanks very much for the reply. Regards, Joe

         

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks