Consultor Eletrônico



Kbase P26456: How to know in which Operating System and version an Application is Running?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   27/09/2005
Status: Unverified

GOAL:

How to know in which Operating System and version an Application is Running?

GOAL:

How to get the Operating System and version using 4GL statements.

FIX:

Use the OPSYS function to shield operating system calls.

Checking for the Operating System Example:

MESSAGE OPSYS VIEW-AS ALERT-BOX.
This will return the current Operating System.
If version is required run the following code:

DEFINE VARIABLE v_sysname AS char format "x(50)".
CASE OPSYS:

WHEN "WIN32" THEN OS-COMMAND SILENT ver > version.txt.

WHEN "UNIX" THEN OS-COMMAND SILENT uname -a > version.txt.
END CASE.
INPUT FROM version.txt.
DO WHILE TRUE:
IMPORT UNFORMATTED v_sysname.
IF v_sysname NE "" THEN MESSAGE v_sysname VIEW-AS ALERT-BOX INFORMATION.
END.
INPUT CLOSE.