English 中文(简体)
Rexx - Portability
  • 时间:2024-12-22

Rexx - Portabipty


Previous Page Next Page  

Portabipty is an important aspect in any programming language. As one knows, Rexx is available in a variety of operating systems such as Windows and Linux. So it need to be ensured that when one develops a program on the Windows platform, that it has the necessary precautions taken if the same programs runs on a Linux platform.

Rexx has the abipty to run system level commands. There are commands which can be used to understand what is the operating system on which it is running on. Based on the output it can then take the appropriate actions to see what are the commands that can be run on this operating system.

Example

The following example shows how the parse functions are used to get the details of the operating system on which the program is running.

/* Main program */ 
parse version language level date month year. 
parse source system invocation filename. 
language = translate(language) 

if pos( REGINA ,language) = 0 then 
   say  Error , the default interpreter is not Regina  language 
   say  The Interpreter version/release date is:  date month year 
   say  The Language level is:   level say  The Operating System is   

   select 
when system =  WIN32  then 
    ver 
when system =  UNIX  | system =  LINUX  then 
    uname -a  
   otherwise 
   say  Unknown System:  system 
end 
if rc <> 0 then 
   say  Error :  rc 

The output will vary depending on operating system. A sample output is given below.

The Interpreter version/release date: 5 Apr 2015 
The Language level is:  5.00 
The Operating System is 
Unknown System: WIN64 
Bad return code: RC 
Advertisements