home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / INIT_A.ZIP / INIT.CMD < prev    next >
OS/2 REXX Batch file  |  1991-10-17  |  7KB  |  191 lines

  1. /* REXX */
  2. /**********************************************************************
  3. *                                                                     *
  4. * This exec is intended primarily to be run from STARTUP.CMD.  It     *
  5. * display a DM panel.  This panel provides choices of the most common *
  6. * OS/2 EE Managers which one might wish to be started at IPL time.    *
  7. *                                                                     *
  8. * LINES 42 - 47  MUST BE MODIFIED TO REFLECT THE INSTALATION PATHS    *
  9. * FOR YOUR OS/2 SYSTEM.  THE CURRENT SETTINGS ASSUME THE BASE OS ON   *
  10. * DRIVE C: WITH THE EE MANAGERS ON HPFS DRIVE E:.  ALL DIRECTORY      *
  11. * NAMES ARE THE OS/2 DEFAULTS.                                        *
  12. *                                                                     *
  13. * ALSO IF YOU USED THE SUPPLIED INSTALL PROGRAM OR MANUALLY COPIED    *
  14. * THE FILES INTO THE 'C:\DMAPP' DIRECTORY YOU SHOULD ENSURE THAT      *
  15. * DIRECTORY IS IN YOUR PATH.  ALTERNATELY YOU MAY MOVE 'BEGIN.CMD'    *
  16. * TO A DIRECTORY ON YOUR PATH                                         *
  17. *                                                                     *
  18. * If a feature will be needed EVERY time it would be better to add it *
  19. * to a menu and have PM kick it off during initalization.  The        *
  20. * purpose here is to allow for things that you need often but not     *
  21. * always.                                                             *
  22. *                                                                     *
  23. * Since everyone has his favorite editor, A command line argument     *
  24. * may be supplied to cause the dialog to invoke whichever one is      *
  25. * desired.  If one is not supplied it will default to the system      *
  26. * editor.                                                             *
  27. *                                                                     *
  28. * Syntax:  PMREXX INIT <editor name>                                  *
  29. *                      NOTE: full editor path must be specified if    *
  30. *                            the editor is not in PATH env var        *
  31. *                                                                     *
  32. * The DTL Markup is included.  It should be easy to expand upon if    *
  33. * you have the toolkit DTL compiler.                                  *
  34. *                                                                     *
  35. **********************************************************************/
  36.  
  37. /* Establish know environment */
  38. RC = setlocal();
  39.  
  40.  
  41. /* THESE VARIABLES MUST BE SET FOR PROPER SYSTEM OPERATION */
  42. RUN_PATH      =  'C:\DMAPP';                /* PATH FOR THIS EXEC    */
  43. DOS_BOOT      =  'C:\OS2\BOOT.COM'          /* OS/2 BOOT PROGRAM     */
  44. FILE_MGR      =  'C:\OS2\PMFILE.EXE'        /* OS/2 FILE MANAGER     */
  45. COMM_MGR      =  'E:\CMLIB\STARTCM.CMD'     /* OS/2 COMM MANAGER     */
  46. QUERY_MGR     =  'E:\SQLLIB\QUERYMGR.EXE'   /* OS/2 QUERY MANAGER    */
  47. DATABASE_MGR  =  'E:\SQLLIB\STARTDBM.EXE'   /* OS/2 DATABASE MANAGER */
  48.  
  49.  
  50. NewDir = directory(RUN_PATH);
  51.  
  52. arg editor_name;
  53. if length(editor_name) = 0 then
  54.    EDITOR_NAME  =  'C:\OS2\E.EXE';
  55.  
  56. /* Now open parm file from current directory */
  57. file_path = stream('init.prm','c','query exists')
  58. if  length(file_path)  =  0  then do;
  59.     FileStat  =  stream('init.prm','c','open write');
  60.     FileStat = charout('init.prm','0000',1);
  61.     FileStat = stream('init.prm','c','close');
  62. end;
  63.  
  64. FileStat  =  stream('init.prm','c','open');
  65. file = charin('init.prm',1,1);
  66. comm = charin('init.prm',,1);
  67. dbm  = charin('init.prm',,1);
  68. edit = charin('init.prm',,1);
  69.  
  70. /* Check for available subsystem managers */
  71.  
  72. DOSA  = 1;
  73. FILEA = 1;
  74. COMMA = 1;
  75. EDITA = 1;
  76. QMA   = 1;
  77. DBMA  = 1;
  78. file_path = stream(DOS_BOOT,'c','query exists')
  79. if  length(file_path)  =  0  then
  80.     DOSA = 0;
  81. file_path = stream(FILE_MGR,'c','query exists')
  82. if  length(file_path)  =  0  then
  83.     FILEA = 0;
  84. file_path = stream(COMM_MGR,'c','query exists')
  85. if  length(file_path)  =  0  then
  86.     COMMA = 0;
  87. file_path = stream(QUERY_MGR,'c','query exists')
  88. if  length(file_path)  =  0  then
  89.     QMA = 0;
  90. file_path = stream(DATABASE_MGR,'c','query exists')
  91. if  length(file_path)  =  0  then
  92.     DBMA = 0;
  93. file_path = stream(EDITOR_NAME,'c','query exists')
  94. if  length(file_path)  =  0  then
  95.     EDITA = 0;
  96.  
  97.  
  98. rxsubcom register ispcir ispcir ispcir
  99. address ispcir 'dmopen applid(ipl) dmcomm(dmcomm)'
  100. address ispcir 'libdef library liblist(init.dtl) dmcomm(dmcomm)'
  101. address ispcir 'libdef help    liblist(init.hlp) dmcomm(dmcomm)'
  102. if  rc >  0  then
  103.     signal error;
  104.  
  105. elap = jul();
  106.  
  107. BEGIN = 1;
  108. loop:
  109. address ispcir 'display panel(init)  dmcomm(dmcomm)';
  110. select;
  111. when rc = 0 then
  112.     nop;
  113. when rc = 4 then
  114.     signal loop;
  115. when rc  =  8  then
  116.     signal endrun;
  117. otherwise
  118.     signal error;
  119. end;
  120.  
  121. select;
  122. when  zcmd = 'END' then
  123.       signal endrun;
  124. when  zcmd  =  'DOS'  then do;
  125.           if  DosRq2 = 1 then do;
  126.               'START /N  ' || DOS_BOOT || ' /DOS < Y'
  127.               signal endrun;
  128.           end;
  129.           address ispcir 'display msg(INTA001) msgloc(DOS1) lock dmcomm(dmcomm)';
  130.           if  rc >  0  then do
  131.               signal error;
  132.           end;
  133.           DosRq2  =  1;
  134.           signal loop;
  135.       end;
  136. when  zcmd  =  'INIT'  then   do;
  137.       if  file = 1; then
  138.           'START "File Manager" /PGM  ' || FILE_MGR
  139.       if  comm = 1  then
  140.           'START /C  ' || COMM_MGR || ' 2>NUL'
  141.       if  qm   = 1  then
  142.           'START /PGM ' || QUERY_MGR
  143.       else
  144.           if  dbm  = 1  then
  145.               'START /N ' || DATABASE_MGR
  146.       if  edit = 1  then
  147.           'START  '|| EDITOR_NAME;
  148.       signal endrun;   /* always close after init */
  149. end;
  150. otherwise;
  151.       DosRq2  =  0;
  152.       signal loop;
  153. end;
  154.  
  155. endrun:
  156. address ispcir 'dmclose dmcomm(dmcomm)'
  157. rxsubcom drop ispcir;
  158.  
  159. /* Save option choices for next time */
  160. FileStat = charout('init.prm',file,1);
  161. FileStat = charout('init.prm',comm);
  162. FileStat = charout('init.prm',dbm);
  163. FileStat = charout('init.prm',edit);
  164. FileStat = stream('init.prm','c','close');
  165.  
  166. RC = endlocal();
  167.  
  168. exit;
  169.  
  170.  
  171.  
  172. error:
  173. FileStat  =  stream('error.log','c','open write');
  174. FileStat = lineout('error.log',"ERROR LOG FOR DM REXX EXEC INIT",1);
  175. beep(100,500);
  176. say Unrecoverable Error encountered
  177. say This information will be logged to 'error.log'
  178. loop =1;
  179. do while loop <17
  180.     string  =  'DMCOMM value ' loop ' = ' dmcomm.loop;
  181.     FileStat = lineout('error.log',string);
  182.     say string
  183.     loop = loop + 1;
  184. end;
  185. FileStat = stream('error.log','c','close');
  186.  
  187. address ispcir 'dmclose dmcomm(dmcomm)'
  188. rxsubcom drop ispcir;
  189. exit;
  190.  
  191.