home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / doc / intlist / folio / os2folio / dcreate.cmd < prev    next >
Encoding:
Text File  |  1993-10-19  |  9.0 KB  |  168 lines

  1. /* Recursive REXX procedure to create an OS/2 VDM for Folio v3.0 DOS CREATE */ 
  2. DCREATE:
  3.  parse arg DCREATE_Args
  4.  
  5. /*
  6.    This is a recursive REXX procedure which is intended to create a Virtual
  7.    DOS Machine (VDM) which will run the "DCREATE.EXE" program for Folio v3.0
  8.    under OS/2 v2.1. The design objective of this procedure is to take full
  9.    advantage of OS/2's preemptive multi-tasking and memory management features
  10.    so as to allow one or more Folio Databases to be created at the same time,
  11.    under the control of batch production scrips written in REXX and/or OS/2
  12.    command language. To maintain compatibility with the Folio "DCREATE.EXE"
  13.    program, the arguments passed to this REXX procedure must be the same as
  14.    those supported by "DCREATE.EXE". Any OS/2 extensions will be implemented
  15.    through the use of OS/2 environment variables or code changes to this REXX
  16.    procedure.
  17.  
  18.    The version of Folio v3.0 which executes under DOS, uses Borland DOS
  19.    Protected Mode Interface (DPMI) drivers to access memory above 1MB. Folio
  20.    v3.0 makes no use of the Expanded Memory Specification (EMS) and only 64KB
  21.    of Extended Memory Specification (XMS) memory is required if DOS and other
  22.    system drivers are to be loaded high. Since the "DCREATE.EXE" program is
  23.    character based, additional memory can be saved by restricting the video
  24.    mode to "CGA". On a standard DOS bases system, Folio v3.0 is restricted
  25.    to the available DPMI memory defined by hardware. Under OS/2, a VDM can
  26.    have access to DPMI memory which is virtual. The maximum allocation size,
  27.    which is also the default, is 64MB of DPMI memory. For most DOS and Windows
  28.    applications executing under OS/2, setting the DPMI default to the maximum
  29.    is not a problem because these applications tend to use EMS or XMS memory
  30.    for which the default limits are lower. Folio v3.0 applications in general,
  31.    and the Folio v3.0 CREATE programs for DOS and Windows in particular, are
  32.    designed to use all available DPMI memory up to a maximum of 32MB. On OS/2
  33.    systems with less than 32MB of real memory one unrestricted Folio CREATE
  34.    program for DOS or Windows can have serious impact on its own performance
  35.    as well as the rest of the system. Folio v3.0 was designed with the
  36.    assumption that the DPMI memory which it is using is real. Folio v3.0
  37.    CREATE functions runs must effectively under OS/2 when the DPMI memory
  38.    used by the Folio processes are contained in real OS/2 memory. Care should
  39.    be taken that the total DPMI memory committed to all Folio v3.0 CREATE
  40.    processes plus that used by other active OS/2 applications and the OS/2
  41.    operating system not exceed real memory.
  42.  
  43.    In this procedure the parameter "DPMI_MEMORY_LIMIT" is used to control
  44.    the total amount of DPMI memory committed to this Folio DOS CREATE process.
  45.    The default DPMI size in this procedure is 8MB but can be altered by
  46.    setting the OS/2 environment variable "FOLIO_DCREATE_DPMI" in the
  47.    "CONFIG.SYS" file or in-line proceeding the execution of this procedure.
  48.    An example would by:
  49.  
  50.        SET FOLIO_DCREATE_AUTOEXEC=C:\DOSVIEWS\AUTOEXEC.BAT
  51.        SET FOLIO_DCREATE_DPMI=16
  52.        DCREATE.CMD input.fff /fFLATIMP output.nfo /o
  53.  
  54.    Remember, total DPMI memory should always be less than total real memory.
  55.    
  56.    In many cases the DOS Setting which are defined below are the default
  57.    values. These definitions are included to ensure that the desired values
  58.    are used and as a documentation aid if the settings are ever changed in
  59.    the future. If you are not sure of how memory is being allocated to the
  60.    VDM, you can use the DOS utilities "C:\OS2\MDOS\WINOS2\MSD.EXE" or
  61.    "C:\OS2\MDOS\MEM.EXE" to view total memory allocation. "MSD.EXE" or
  62.    "MEM.EXE" can be executed from the "AUTOEXEC.BAT" file of the VDM or the
  63.    VDM can be kept open after the termination of "DCREATE.EXE" (see below)
  64.    and "MSD.EXE" or "MEM.EXE" can be executed manually.
  65.  
  66.    The state of this procedure can be altered through the use of three OS/2
  67.    environment variables which have been implemented for that purpose. These
  68.    OS/2 variables are as follows:
  69.  
  70.    1)  FOLIO_DCREATE_DPMI
  71.        This OS/2 environment variable can be used to set the amount of DPMI
  72.        memory in megabytes committed to "DCREATE.EXE". The default value is 8MB.
  73.        Example:
  74.                   SET FOLIO_DCREATE_DPMI=16
  75.  
  76.    2)  FOLIO_DCREATE_AUTOEXEC
  77.        This OS/2 environment variable can be used to define an alternate DOS
  78.        start-up batch command file. The default value is "C:\AUTOEXEC.BAT".
  79.        Example:
  80.                   SET FOLIO_DCREATE_AUTOEXEC=C:\DOSVIEWS\AUTOEXEC.BAT 
  81.  
  82.    3)  FOLIO_DCREATE_EXIT
  83.        This OS/2 environment variable can be used to keep the VDM open after
  84.        the termination of "DCREATE.EXE" program. This will allow time to read
  85.        error messages or perform additional tests. The default value is "CLOSE". 
  86.        Example:
  87.                   SET FOLIO_DCREATE_EXIT=OPEN
  88.  
  89.    When this procedure was written there was a logic error in "DCREATE.EXE"
  90.    parsing of command line arguments. For this reason, when the argument
  91.    list is passed for the second time to "DCREATE.EXE" for execution all
  92.    leading and trailing blanks are striped and a carriage return is appended
  93.    to the end of the argument list.
  94.  
  95.    The DOS settings "IDLE_SECONDS" and "IDLE_SENSITIVITY" are defined so as
  96.    to allow control over "DCREATE.EXE" use of the processor. Many DOS
  97.    applications assume that they have total control of the system and will
  98.    implement delays by looping. Based of the values defined in these DOS
  99.    setting OS/2 will detect such conditions and give more of the processor
  100.    resource to other tasks. With the exception of its use of DPMI memory
  101.    "DCREATE.EXE" runs as a well behaved VDM under OS/2. Given the same
  102.    memory resource and work task the Windows "WCREATE.EXE" program has a
  103.    much high impact on OS/2 and is slower as compared to "DCREATE.EXE". For
  104.    large tasks use "DCREATE.EXE" if at all possible. The system default
  105.    value for "IDLE_SENSITIVITY" is 75; while this program uses a value of 50.
  106.    Based on the load which your OS/2 system supports you may wish to
  107.    increase or decrease these values.
  108. */
  109.  
  110.  select 
  111.      when 'CMD' = address()       /* First time DCREATE.CMD is called by user, and then */
  112.      then                         /* calls STARTDOS.EXE pointing to itself and passing  */
  113.      do                           /* all it arguments.      */
  114.          '@STARTDOS.EXE DCREATE.CMD ' || DCREATE_Args
  115.      end 
  116.      when 'STARTDOS' = address()  /* Second time DCREATE.CMD is called by STARTDOS.EXE, */
  117.      then                         /* which returns the arguments that are used to       */
  118.      do                           /* setup the VDM running DCREATE.EXE.                 */
  119.  
  120.          rc = StartWindowed( )
  121. /*       rc = StartFullscreen( ) */
  122.          rc = StartBackground( ) 
  123. /*       rc = StartForeground( ) */
  124.          rc = ExecSynchronous( ) 
  125.          rc = SetSessionTitle( 'Folio v3.0 DOS CREATE' ) 
  126.          exit_state = translate(strip(value('FOLIO_DCREATE_EXIT',,'OS2ENVIRONMENT')))
  127.          if exit_state = 'OPEN'        /* The default is to "CLOSE" VDM.  */
  128.              then cmd_state = '/k'     /* Do not close VDM on completion. */
  129.              else cmd_state = '/c'     /* Close VDM on completion.        */
  130.          rc = SetCommandArgs(cmd_state || ' DCREATE.EXE ' || strip(DCREATE_Args) || d2c(13) ) 
  131.  
  132.          auto = strip(value('FOLIO_DCREATE_AUTOEXEC',,'OS2ENVIRONMENT'))
  133.          if auto = '' then auto = 'C:\AUTOEXEC.BAT'
  134.          rc = AddDosSetting( 'DOS_AUTOEXEC=' || auto)
  135.  
  136.          rc = AddDosSetting( 'DOS_RMSIZ=640' )           /* Low memory should be 640KB. */ 
  137.          rc = AddDosSetting( 'DOS_HIGH=1' )
  138.          rc = AddDosSetting( 'DOS_UMB=1' )
  139.          rc = AddDosSetting( 'VIDEO_MODE_RESTRICTION=CGA            ' )
  140.  
  141.          rc = AddDosSetting( 'EMS_FRAME_LOCATION=NONE' ) /* Remove all EMS memory.     */
  142.          rc = AddDosSetting( 'EMS_HIGH_OS_MAP_REGION=0' )
  143.          rc = AddDosSetting( 'EMS_LOW_OS_MAP_REGION=0' )
  144.          rc = AddDosSetting( 'EMS_MEMORY_LIMIT=0' )
  145.  
  146.          rc = AddDosSetting( 'XMS_HANDLES=4' )           /* Allocate 64KB of XMS so    */
  147.          rc = AddDosSetting( 'XMS_MEMORY_LIMIT=64' )     /* DOS can load high.         */
  148.          rc = AddDosSetting( 'XMS_MINIMUM_HMA=0' )
  149.  
  150.          dpmi = strip(value('FOLIO_DCREATE_DPMI',,'OS2ENVIRONMENT'))
  151.          if dpmi = '' | verify(dpmi, '0123456789') <> 0 then dpmi = '8'
  152.          rc = AddDosSetting( 'DPMI_DOS_API=ENABLED' )      /* Enable DPMI for Borland DOS memory manager. */ 
  153.          rc = AddDosSetting( 'DPMI_MEMORY_LIMIT=' || dpmi) /* Set DPMI to size needed by DCREATE. */
  154.          rc = AddDosSetting( 'DPMI_NETWORK_BUFF_SIZE=8' ) 
  155.  
  156.          rc = AddDosSetting( 'IDLE_SECONDS=0' )
  157.          rc = AddDosSetting( 'IDLE_SENSITIVITY=50' )
  158.  
  159.      end 
  160.      otherwise
  161.      do 
  162.          say 'Unexpected STARTDOS execution environment "'address()'" for DCREATE.CMD.' 
  163.          return 4 
  164.      end 
  165.  end 
  166.  
  167.  return 0
  168.