3

We were using below code to get the name of the computer.

def new shared var cHost as char format "x(40)" no-undo. 
INPUT THROUGH hostname NO-ECHO. 
SET cHost. 
INPUT CLOSE.
DISPLAY chost.

After we have updated our computers (Windows 10 - 1703), it no longer works. It seems SET cHost is the part where it fails. I have tried IMPORT UNFORMATTED cHost but it does not work.

PS: I can get computer name using OS-GETENV("COMPUTERNAME") but I have to do it using INPUT THROUGH statement.


Edit: It seems that it is not only a problem with 10.2A but a more general one. Also it is not just related to hostname but all console applications and ms-dos commands. Now I will try to replace INPUT THROUGH statement with another Progress command if there is any, or try to communicate with existing console applications with some other method.

aza
  • 115
  • 13

3 Answers3

0

The first thing I would do is to verify that the 'hostname' command is still working properly from a command window.

Assuming that it is I would code your snippet something like this:

INPUT THROUGH VALUE( "hostname" ).
IMPORT UNFORMATTED cHost.
INPUT CLOSE.
DISPLAY cHOST format "x(60)".

Which might reveal a more useful error message than "it no longer works".

Since COMPUTERNAME meets your needs but you must use INPUT THROUGH for some very mysterious reason you might also try:

INPUT THROUGH VALUE( "echo %COMPUTERNAME%" ).
IMPORT UNFORMATTED cHost.
INPUT CLOSE.
DISPLAY cHOST format "x(60)".
Tom Bascom
  • 13,405
  • 2
  • 27
  • 33
  • Hi Tom, I'm happy that you are the one who responds to my question. I have checked, **hostname** and **echo %computername%** commands still work. I have not written any error messages because it does not give any. It does not display anything. It just runs as if there is no display command. Howewer, if you remove **SET cHost** line it shows a procedure editor screen with an empty string as it should. I have tried your codes and it is the same; codes run but no procedure editor screen appears as if there is no display command. – aza Apr 26 '17 at 06:42
  • I have found out that this problem applies to **all console applications** returning any value. I have written sample console applications using c# and vb.net to test the problem, I have tested with a dummy bat file too, the problem still persists. – aza Apr 26 '17 at 09:47
  • Are you saying that it "hangs" at the SET (or IMPORT) statement and does not proceed to the DISPLAY? – Tom Bascom Apr 26 '17 at 11:34
  • It seems it exits procedure. It does not hang. I have created a similar example to clarify the problem and outputs are as follows: This is the working version of the code on a not-updated-windows-10 [working_version](http://update.modhotel.com/working.png) and this is the version of the same code on an updated-windows-10 [not_working_version](http://update.modhotel.com/notworking.png) – aza Apr 26 '17 at 12:06
  • I think you should contact tech support and report a bug. – Tom Bascom Apr 26 '17 at 13:17
0

It seems the problem may not be limited to Openedge version 10. I am running a windows 10 winver 1703 device for development, using Progress/Openedge 8.3 and I am no longer able to execute this.

    def var a as char format "x(70)".

    input through "echo %cd%" no-echo.
    import unformatted a.
    input close.

    message a. pause.

This runs on a windows server 2012 R2, using progress/openedge 8.3.

Where is no longer works, it just exits from within the program when it hits the import command.

NeilM
  • 51
  • 1
  • 1
  • 6
  • Then it is a more general problem. If you put it in a procedure and call it, it only exits the called procedure, program continues to work. I have tested for different cases; it seems this problem occurs for **all console applications** and **ms-dos commands**. I hope someone comes up with a solution because there are some programs calls that I cannot change since they are written in other languages. Also it means we can not communicate with other programs anymore :( . – aza Apr 27 '17 at 16:24
0

Since it seems as a bug, until someone comes up with a better solution, this is how I will change my codes:

DEF VAR cHost AS CHAR FORMAT "x(40)" NO-UNDO. 
OS-CREATE-DIR VALUE("c:\temp").
OS-COMMAND SILENT VALUE("hostname >c:\temp\hostname.txt").
INPUT FROM VALUE("c:\temp\hostname.txt").
IMPORT UNFORMATTED cHost.
INPUT CLOSE.
MESSAGE cHost.

This code can be used for other ms-dos commands and console applications as well.

DEF VAR cHost AS CHAR FORMAT "x(40)" NO-UNDO. 
OS-CREATE-DIR VALUE("c:\temp").
OS-COMMAND SILENT VALUE("ECHO %cd% >c:\temp\result.txt").
INPUT FROM VALUE("c:\temp\result.txt").
IMPORT UNFORMATTED cHost.
INPUT CLOSE.
MESSAGE cHost.

Thanks for your help.

aza
  • 115
  • 13