home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / doc / intlist / folio / os2folio / startdos.doc < prev    next >
Encoding:
Text File  |  1994-01-19  |  5.3 KB  |  123 lines

  1. REVISION HISTORY 
  2.  
  3. 25OCT93: settings.exe; sprintf pid into term queue name 
  4. 11OCT93: fix rexx file search bug; tweak readme 
  5. 09OCT93: tweak readme; new Rexx API SetSessionTitle() 
  6. 21SEP93: new Rexx API SetCommandArgs() 
  7. 27AUG93: default session full screen; searches PATH environment 
  8. for CMD file; startdata length changed to 32. 
  9. 06MAY93: first release. 
  10.  
  11. --------------------------------------------------------------------------- 
  12.  
  13. Usage: STARTDOS <Rexx CMD file> <optional command.com arguments> 
  14.  
  15. StartDos is an OS/2 program to start virtual DOS mode sessions under OS/2. 
  16. The nature of DOS sessions under OS/2 is controlled by DOS settings, some of 
  17. which can only be set at session startup.  StartDos accepts these settings 
  18. via a Rexx command file, then starts a DOS session with those settings. 
  19.  
  20. Examples of some settings that can only be specified at start time: 
  21.  
  22.   DOS_DEVICE=<device driver file spec> 
  23.   DOS_HIGH=1                                ("ON" changed to 1) 
  24.   DPMI_MEMORY_LIMIT=8                       (integer represents megabytes) 
  25.  
  26. Most settings that require ON accept either ON or 1. Some settings must have a 
  27. 1 instead of ON. For more info on settings, see the settings dialog in the 
  28. Workplace Shell. 
  29.  
  30. To specify DOS settings to StartDos, name a Rexx command file on the 
  31. command line. StartDos looks in the current directory for the Rexx file. If 
  32. not present, then it searches the PATH. StartDos invokes the Rexx 
  33. interpreter, and the command file executes in a special StartDos 
  34. environment. In this environment, the Rexx program can call functions in 
  35. StartDos like AddDosSetting() and StartBackground(). See the complete list 
  36. of callable StartDos functions below. Example Rexx: 
  37.  
  38.   /* Rexx command file for StartDos (comment mandatory on first line!) */ 
  39.   parse arg szCommandComArgs 
  40.   if 'STARTDOS' <> address()  then do 
  41.     say 'Expected STARTDOS environment' 
  42.     return 2 
  43.   end 
  44.   rc = AddDosSetting( 'DPMI_MEMORY_LIMIT=8' ) 
  45.   rc = AddDosSetting( 'DOS_HIGH=ON'  ) 
  46.   /* override the default and start the session in a PM window */ 
  47.   rc = StartWindowed() 
  48.   return 0 
  49.  
  50. These special functions are available to Rexx programs invoked from StartDos: 
  51.  
  52.   AddDosSetting( <setting string> )    /* may be called multiple times */ 
  53.   StartForeground()                    /* foreground start is default */ 
  54.   StartBackground() 
  55.   StartFullscreen()                    /* fullscreen start is the default */ 
  56.   StartWindowed() 
  57.   ExecSynchronous()                    /* asynchronous start is default */ 
  58.   SetCommandArgs( <command.com args> ) /* args acceptable to command.com */ 
  59.   SetSessionTitle( <session title> )   /* title to appear in window list */ 
  60.  
  61. When the Rexx program ends with a zero result code, StartDos starts the DOS 
  62. session. 
  63.  
  64. The default exec is asynchronous; i.e., StartDos will end as soon as the 
  65. child DOS session is started.  A synchronous exec is one where StartDos waits 
  66. until the child DOS session ends before StartDos itself ends.  In this case, 
  67. StartDos will return the same errorlevel as COMMAND.COM.  COMMAND.COM in OS/2 
  68. returns the same errorlevel as the DOS program invoked with the /c option. 
  69. Therefore, a synchronous exec and /c option causes StartDos to return with 
  70. the same errorlevel as the DOS program.  This is important when invoking DOS 
  71. programs from OS/2 make files. 
  72.  
  73. Other arguments to StartDos are optional.  If given, they must make sense to 
  74. the DOS command shell COMMAND.COM.  These arguments are passed to the Rexx 
  75. program by StartDos.  Example StartDos command lines: 
  76.  
  77.   |----- example -----------|     |----- explanation ---------> 
  78.   startdos sets.cmd               starts command.com alone 
  79.   startdos sets                   same as above; defaults to sets.cmd 
  80.   startdos sets /c procomm /fcis  /fcis is an arg to procomm 
  81.   startdos sets /c wp             /c for call; session exits with wp 
  82.   startdos sets /k dir            /k for keep; dir and session stays 
  83.                                   (/c and /k are command.com-defined switches) 
  84.   startdos sets /c winos2 word    starts winos2 and a windows program 
  85.  
  86. COMMAND.COM arguments to StartDos are optional. As of 21SEP93 version of 
  87. StartDos, COMMAND.COM arguments may be set from the Rexx file using 
  88. SetCommandArgs(). Assume there is a DOS program CLEANDSK.EXE and the Rexx 
  89. file is called CLEAN.CMD. 
  90.  
  91.    /* clean.cmd */ 
  92.    parse arg szCommandComArgs 
  93.    select 
  94.      when 'CMD' = address()  then do 
  95.        'STARTDOS clean' 
  96.      end 
  97.      when 'STARTDOS' = address()  then do 
  98.        rc = StartBackground() 
  99.        rc = ExecSynchronous( ) 
  100.        rc = SetCommandArgs( "/c cleandsk a:" ) 
  101.      end 
  102.      otherwise do 
  103.        say 'Unexpected execution environment' 
  104.        return 4 
  105.      end 
  106.    end 
  107.    return 0 
  108.  
  109. Then from an OS/2 prompt, enter 
  110.  
  111.    CLEAN 
  112.  
  113. CMD.EXE runs it first and spawns StartDos. Ultimately, StartDos gets the 
  114. COMMAND.COM arguments via the SetCommandArgs() functions. StartDos will wait 
  115. until the DOS program completes. 
  116.  
  117. Concerning error checking:  if you specify an incorrect DOS setting, chances 
  118. are the session will start anyway.  You may get an error message from OS/2. 
  119. StartDos itself may exit with a failed assertion. 
  120.  
  121. StartDos written by Monte Copeland, IBM Boca Raton. 
  122. StartDos program (C) Copyright IBM Corporation 1993. 
  123.