Skip to main content

For displaying reports my acucobol programs call winword through the C$SYSTEM.  ie,

05   winword-location  pic x(60) value "c:\\progra~1\\micros~1\\root\\office15\\winword.exe "

CALL "C$SYSTEM" USING winword-location report-name.txt  giving exit-status

Is there a better way for displaying reports instead of using command prompt to call Word? 

The program which calls Word maintains a hardcoded list of locations for WinWord.exe and if its not found, the program calls NotePad.  Got two problems - 1) WinWord always moves location when new o/s comes out, so it'd be nice if there was an easy way that always worked for locating WinWord.  2) The latest version of Word is 64 bit and having problems calling it from 32bit environment. 

Thanks alot 


#reports
#CSYSTEM
#WinWord
#CommandPrompt

For displaying reports my acucobol programs call winword through the C$SYSTEM.  ie,

05   winword-location  pic x(60) value "c:\\progra~1\\micros~1\\root\\office15\\winword.exe "

CALL "C$SYSTEM" USING winword-location report-name.txt  giving exit-status

Is there a better way for displaying reports instead of using command prompt to call Word? 

The program which calls Word maintains a hardcoded list of locations for WinWord.exe and if its not found, the program calls NotePad.  Got two problems - 1) WinWord always moves location when new o/s comes out, so it'd be nice if there was an easy way that always worked for locating WinWord.  2) The latest version of Word is 64 bit and having problems calling it from 32bit environment. 

Thanks alot 


#reports
#CSYSTEM
#WinWord
#CommandPrompt

One way would be to call Explorer with C$SYSTEM. For example:

CALL "C$SYSTEM" USING "Explorer report-name.txt" giving exit-status.

This will open the default program for a .txt file. You can use this for any type of Windows action even to send mail likes this:

CALL "C$SYSTEM" USING "Explorer mailto:test@testcompani.org"

It also works in a thin client environment - you simple add @[DISPLAY]: in front of the argument eg.:

CALL "C$SYSTEM" USING "@DISPLAY]:explorer report-name.txt" giving exit-status.


For displaying reports my acucobol programs call winword through the C$SYSTEM.  ie,

05   winword-location  pic x(60) value "c:\\progra~1\\micros~1\\root\\office15\\winword.exe "

CALL "C$SYSTEM" USING winword-location report-name.txt  giving exit-status

Is there a better way for displaying reports instead of using command prompt to call Word? 

The program which calls Word maintains a hardcoded list of locations for WinWord.exe and if its not found, the program calls NotePad.  Got two problems - 1) WinWord always moves location when new o/s comes out, so it'd be nice if there was an easy way that always worked for locating WinWord.  2) The latest version of Word is 64 bit and having problems calling it from 32bit environment. 

Thanks alot 


#reports
#CSYSTEM
#WinWord
#CommandPrompt

use registry to read where winword is installed.

      78  wo-path value "Software\\Microsoft\\Windows\\CurrentVersion\\App

     -                  "Paths\\Winword.exe".

       78  reg-null               value x"00".
       77  reg-handle                            usage is unsigned-long.
       77  reg-size                              usage is unsigned-long.
       77  reg-code               pic s9(4).
       77  reg-path               pic x(255)     value spaces.

      ***********************************************************
       word-handle section.
      ***  check registry
           move    wo-path to reg-path
           perform registry-handle.

           if reg-path = spaces
              move 6 to fKomm-Err
              go to  word-handle-ende.

      ***  call parameter
           if fKomm-Url = spaces
              move 4 to fKomm-Err
              go to  word-handle-ende.

           inspect fKomm-Url replacing trailing spaces by "¿".

      ***  Word mit Dokument starten
           string reg-path(1:reg-size - 1) " "
                  "/q /f " fKomm-Url
                  delimited by "¿" into fk-run.

           call   "c$run" using fk-run.

       word-handle-ende.
           exit.
       word-handle-e.
      ***********************************************************

       registry-handle section.
      ***  key öffnen
           call "REG_OPEN_KEY" using  HKEY_LOCAL_MACHINE,
                                      reg-path,
                                      reg-handle,
                               giving reg-code.

           move spaces to reg-path.

           if reg-code not = zeroes
              go to registry-handle-finish.

      ***  entry lesen
           call "REG_QUERY_VALUE_EX" using  reg-handle,
                                            " "
                                            "REG_SZ",
                                            reg-path,
                                            reg-size,
                                     giving reg-code.

           if reg-code not = zeroes
              move spaces to reg-path.

       registry-handle-finish.
      ***  close key
           call "REG_CLOSE_KEY" using reg-handle.

       registry-handle-ende.
           exit.
       registry-handle-e.
      ***********************************************************

It's only a example from a programm we use...


For displaying reports my acucobol programs call winword through the C$SYSTEM.  ie,

05   winword-location  pic x(60) value "c:\\progra~1\\micros~1\\root\\office15\\winword.exe "

CALL "C$SYSTEM" USING winword-location report-name.txt  giving exit-status

Is there a better way for displaying reports instead of using command prompt to call Word? 

The program which calls Word maintains a hardcoded list of locations for WinWord.exe and if its not found, the program calls NotePad.  Got two problems - 1) WinWord always moves location when new o/s comes out, so it'd be nice if there was an easy way that always worked for locating WinWord.  2) The latest version of Word is 64 bit and having problems calling it from 32bit environment. 

Thanks alot 


#reports
#CSYSTEM
#WinWord
#CommandPrompt

Thank you for your excellent suggestions.  I like the added info about emailing, too.