home *** CD-ROM | disk | FTP | other *** search
- /* Recursive REXX procedure to create an OS/2 VDM for Folio v3.0 DOS CREATE */
- DCREATE:
- parse arg DCREATE_Args
-
- /*
- This is a recursive REXX procedure which is intended to create a Virtual
- DOS Machine (VDM) which will run the "DCREATE.EXE" program for Folio v3.0
- under OS/2 v2.1. The design objective of this procedure is to take full
- advantage of OS/2's preemptive multi-tasking and memory management features
- so as to allow one or more Folio Databases to be created at the same time,
- under the control of batch production scrips written in REXX and/or OS/2
- command language. To maintain compatibility with the Folio "DCREATE.EXE"
- program, the arguments passed to this REXX procedure must be the same as
- those supported by "DCREATE.EXE". Any OS/2 extensions will be implemented
- through the use of OS/2 environment variables or code changes to this REXX
- procedure.
-
- The version of Folio v3.0 which executes under DOS, uses Borland DOS
- Protected Mode Interface (DPMI) drivers to access memory above 1MB. Folio
- v3.0 makes no use of the Expanded Memory Specification (EMS) and only 64KB
- of Extended Memory Specification (XMS) memory is required if DOS and other
- system drivers are to be loaded high. Since the "DCREATE.EXE" program is
- character based, additional memory can be saved by restricting the video
- mode to "CGA". On a standard DOS bases system, Folio v3.0 is restricted
- to the available DPMI memory defined by hardware. Under OS/2, a VDM can
- have access to DPMI memory which is virtual. The maximum allocation size,
- which is also the default, is 64MB of DPMI memory. For most DOS and Windows
- applications executing under OS/2, setting the DPMI default to the maximum
- is not a problem because these applications tend to use EMS or XMS memory
- for which the default limits are lower. Folio v3.0 applications in general,
- and the Folio v3.0 CREATE programs for DOS and Windows in particular, are
- designed to use all available DPMI memory up to a maximum of 32MB. On OS/2
- systems with less than 32MB of real memory one unrestricted Folio CREATE
- program for DOS or Windows can have serious impact on its own performance
- as well as the rest of the system. Folio v3.0 was designed with the
- assumption that the DPMI memory which it is using is real. Folio v3.0
- CREATE functions runs must effectively under OS/2 when the DPMI memory
- used by the Folio processes are contained in real OS/2 memory. Care should
- be taken that the total DPMI memory committed to all Folio v3.0 CREATE
- processes plus that used by other active OS/2 applications and the OS/2
- operating system not exceed real memory.
-
- In this procedure the parameter "DPMI_MEMORY_LIMIT" is used to control
- the total amount of DPMI memory committed to this Folio DOS CREATE process.
- The default DPMI size in this procedure is 8MB but can be altered by
- setting the OS/2 environment variable "FOLIO_DCREATE_DPMI" in the
- "CONFIG.SYS" file or in-line proceeding the execution of this procedure.
- An example would by:
-
- SET FOLIO_DCREATE_AUTOEXEC=C:\DOSVIEWS\AUTOEXEC.BAT
- SET FOLIO_DCREATE_DPMI=16
- DCREATE.CMD input.fff /fFLATIMP output.nfo /o
-
- Remember, total DPMI memory should always be less than total real memory.
-
- In many cases the DOS Setting which are defined below are the default
- values. These definitions are included to ensure that the desired values
- are used and as a documentation aid if the settings are ever changed in
- the future. If you are not sure of how memory is being allocated to the
- VDM, you can use the DOS utilities "C:\OS2\MDOS\WINOS2\MSD.EXE" or
- "C:\OS2\MDOS\MEM.EXE" to view total memory allocation. "MSD.EXE" or
- "MEM.EXE" can be executed from the "AUTOEXEC.BAT" file of the VDM or the
- VDM can be kept open after the termination of "DCREATE.EXE" (see below)
- and "MSD.EXE" or "MEM.EXE" can be executed manually.
-
- The state of this procedure can be altered through the use of three OS/2
- environment variables which have been implemented for that purpose. These
- OS/2 variables are as follows:
-
- 1) FOLIO_DCREATE_DPMI
- This OS/2 environment variable can be used to set the amount of DPMI
- memory in megabytes committed to "DCREATE.EXE". The default value is 8MB.
- Example:
- SET FOLIO_DCREATE_DPMI=16
-
- 2) FOLIO_DCREATE_AUTOEXEC
- This OS/2 environment variable can be used to define an alternate DOS
- start-up batch command file. The default value is "C:\AUTOEXEC.BAT".
- Example:
- SET FOLIO_DCREATE_AUTOEXEC=C:\DOSVIEWS\AUTOEXEC.BAT
-
- 3) FOLIO_DCREATE_EXIT
- This OS/2 environment variable can be used to keep the VDM open after
- the termination of "DCREATE.EXE" program. This will allow time to read
- error messages or perform additional tests. The default value is "CLOSE".
- Example:
- SET FOLIO_DCREATE_EXIT=OPEN
-
- When this procedure was written there was a logic error in "DCREATE.EXE"
- parsing of command line arguments. For this reason, when the argument
- list is passed for the second time to "DCREATE.EXE" for execution all
- leading and trailing blanks are striped and a carriage return is appended
- to the end of the argument list.
-
- The DOS settings "IDLE_SECONDS" and "IDLE_SENSITIVITY" are defined so as
- to allow control over "DCREATE.EXE" use of the processor. Many DOS
- applications assume that they have total control of the system and will
- implement delays by looping. Based of the values defined in these DOS
- setting OS/2 will detect such conditions and give more of the processor
- resource to other tasks. With the exception of its use of DPMI memory
- "DCREATE.EXE" runs as a well behaved VDM under OS/2. Given the same
- memory resource and work task the Windows "WCREATE.EXE" program has a
- much high impact on OS/2 and is slower as compared to "DCREATE.EXE". For
- large tasks use "DCREATE.EXE" if at all possible. The system default
- value for "IDLE_SENSITIVITY" is 75; while this program uses a value of 50.
- Based on the load which your OS/2 system supports you may wish to
- increase or decrease these values.
- */
-
- select
- when 'CMD' = address() /* First time DCREATE.CMD is called by user, and then */
- then /* calls STARTDOS.EXE pointing to itself and passing */
- do /* all it arguments. */
- '@STARTDOS.EXE DCREATE.CMD ' || DCREATE_Args
- end
- when 'STARTDOS' = address() /* Second time DCREATE.CMD is called by STARTDOS.EXE, */
- then /* which returns the arguments that are used to */
- do /* setup the VDM running DCREATE.EXE. */
-
- rc = StartWindowed( )
- /* rc = StartFullscreen( ) */
- rc = StartBackground( )
- /* rc = StartForeground( ) */
- rc = ExecSynchronous( )
- rc = SetSessionTitle( 'Folio v3.0 DOS CREATE' )
- exit_state = translate(strip(value('FOLIO_DCREATE_EXIT',,'OS2ENVIRONMENT')))
- if exit_state = 'OPEN' /* The default is to "CLOSE" VDM. */
- then cmd_state = '/k' /* Do not close VDM on completion. */
- else cmd_state = '/c' /* Close VDM on completion. */
- rc = SetCommandArgs(cmd_state || ' DCREATE.EXE ' || strip(DCREATE_Args) || d2c(13) )
-
- auto = strip(value('FOLIO_DCREATE_AUTOEXEC',,'OS2ENVIRONMENT'))
- if auto = '' then auto = 'C:\AUTOEXEC.BAT'
- rc = AddDosSetting( 'DOS_AUTOEXEC=' || auto)
-
- rc = AddDosSetting( 'DOS_RMSIZ=640' ) /* Low memory should be 640KB. */
- rc = AddDosSetting( 'DOS_HIGH=1' )
- rc = AddDosSetting( 'DOS_UMB=1' )
- rc = AddDosSetting( 'VIDEO_MODE_RESTRICTION=CGA ' )
-
- rc = AddDosSetting( 'EMS_FRAME_LOCATION=NONE' ) /* Remove all EMS memory. */
- rc = AddDosSetting( 'EMS_HIGH_OS_MAP_REGION=0' )
- rc = AddDosSetting( 'EMS_LOW_OS_MAP_REGION=0' )
- rc = AddDosSetting( 'EMS_MEMORY_LIMIT=0' )
-
- rc = AddDosSetting( 'XMS_HANDLES=4' ) /* Allocate 64KB of XMS so */
- rc = AddDosSetting( 'XMS_MEMORY_LIMIT=64' ) /* DOS can load high. */
- rc = AddDosSetting( 'XMS_MINIMUM_HMA=0' )
-
- dpmi = strip(value('FOLIO_DCREATE_DPMI',,'OS2ENVIRONMENT'))
- if dpmi = '' | verify(dpmi, '0123456789') <> 0 then dpmi = '8'
- rc = AddDosSetting( 'DPMI_DOS_API=ENABLED' ) /* Enable DPMI for Borland DOS memory manager. */
- rc = AddDosSetting( 'DPMI_MEMORY_LIMIT=' || dpmi) /* Set DPMI to size needed by DCREATE. */
- rc = AddDosSetting( 'DPMI_NETWORK_BUFF_SIZE=8' )
-
- rc = AddDosSetting( 'IDLE_SECONDS=0' )
- rc = AddDosSetting( 'IDLE_SENSITIVITY=50' )
-
- end
- otherwise
- do
- say 'Unexpected STARTDOS execution environment "'address()'" for DCREATE.CMD.'
- return 4
- end
- end
-
- return 0