home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
INIT_A.ZIP
/
INIT.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1991-10-17
|
7KB
|
191 lines
/* REXX */
/**********************************************************************
* *
* This exec is intended primarily to be run from STARTUP.CMD. It *
* display a DM panel. This panel provides choices of the most common *
* OS/2 EE Managers which one might wish to be started at IPL time. *
* *
* LINES 42 - 47 MUST BE MODIFIED TO REFLECT THE INSTALATION PATHS *
* FOR YOUR OS/2 SYSTEM. THE CURRENT SETTINGS ASSUME THE BASE OS ON *
* DRIVE C: WITH THE EE MANAGERS ON HPFS DRIVE E:. ALL DIRECTORY *
* NAMES ARE THE OS/2 DEFAULTS. *
* *
* ALSO IF YOU USED THE SUPPLIED INSTALL PROGRAM OR MANUALLY COPIED *
* THE FILES INTO THE 'C:\DMAPP' DIRECTORY YOU SHOULD ENSURE THAT *
* DIRECTORY IS IN YOUR PATH. ALTERNATELY YOU MAY MOVE 'BEGIN.CMD' *
* TO A DIRECTORY ON YOUR PATH *
* *
* If a feature will be needed EVERY time it would be better to add it *
* to a menu and have PM kick it off during initalization. The *
* purpose here is to allow for things that you need often but not *
* always. *
* *
* Since everyone has his favorite editor, A command line argument *
* may be supplied to cause the dialog to invoke whichever one is *
* desired. If one is not supplied it will default to the system *
* editor. *
* *
* Syntax: PMREXX INIT <editor name> *
* NOTE: full editor path must be specified if *
* the editor is not in PATH env var *
* *
* The DTL Markup is included. It should be easy to expand upon if *
* you have the toolkit DTL compiler. *
* *
**********************************************************************/
/* Establish know environment */
RC = setlocal();
/* THESE VARIABLES MUST BE SET FOR PROPER SYSTEM OPERATION */
RUN_PATH = 'C:\DMAPP'; /* PATH FOR THIS EXEC */
DOS_BOOT = 'C:\OS2\BOOT.COM' /* OS/2 BOOT PROGRAM */
FILE_MGR = 'C:\OS2\PMFILE.EXE' /* OS/2 FILE MANAGER */
COMM_MGR = 'E:\CMLIB\STARTCM.CMD' /* OS/2 COMM MANAGER */
QUERY_MGR = 'E:\SQLLIB\QUERYMGR.EXE' /* OS/2 QUERY MANAGER */
DATABASE_MGR = 'E:\SQLLIB\STARTDBM.EXE' /* OS/2 DATABASE MANAGER */
NewDir = directory(RUN_PATH);
arg editor_name;
if length(editor_name) = 0 then
EDITOR_NAME = 'C:\OS2\E.EXE';
/* Now open parm file from current directory */
file_path = stream('init.prm','c','query exists')
if length(file_path) = 0 then do;
FileStat = stream('init.prm','c','open write');
FileStat = charout('init.prm','0000',1);
FileStat = stream('init.prm','c','close');
end;
FileStat = stream('init.prm','c','open');
file = charin('init.prm',1,1);
comm = charin('init.prm',,1);
dbm = charin('init.prm',,1);
edit = charin('init.prm',,1);
/* Check for available subsystem managers */
DOSA = 1;
FILEA = 1;
COMMA = 1;
EDITA = 1;
QMA = 1;
DBMA = 1;
file_path = stream(DOS_BOOT,'c','query exists')
if length(file_path) = 0 then
DOSA = 0;
file_path = stream(FILE_MGR,'c','query exists')
if length(file_path) = 0 then
FILEA = 0;
file_path = stream(COMM_MGR,'c','query exists')
if length(file_path) = 0 then
COMMA = 0;
file_path = stream(QUERY_MGR,'c','query exists')
if length(file_path) = 0 then
QMA = 0;
file_path = stream(DATABASE_MGR,'c','query exists')
if length(file_path) = 0 then
DBMA = 0;
file_path = stream(EDITOR_NAME,'c','query exists')
if length(file_path) = 0 then
EDITA = 0;
rxsubcom register ispcir ispcir ispcir
address ispcir 'dmopen applid(ipl) dmcomm(dmcomm)'
address ispcir 'libdef library liblist(init.dtl) dmcomm(dmcomm)'
address ispcir 'libdef help liblist(init.hlp) dmcomm(dmcomm)'
if rc > 0 then
signal error;
elap = jul();
BEGIN = 1;
loop:
address ispcir 'display panel(init) dmcomm(dmcomm)';
select;
when rc = 0 then
nop;
when rc = 4 then
signal loop;
when rc = 8 then
signal endrun;
otherwise
signal error;
end;
select;
when zcmd = 'END' then
signal endrun;
when zcmd = 'DOS' then do;
if DosRq2 = 1 then do;
'START /N ' || DOS_BOOT || ' /DOS < Y'
signal endrun;
end;
address ispcir 'display msg(INTA001) msgloc(DOS1) lock dmcomm(dmcomm)';
if rc > 0 then do
signal error;
end;
DosRq2 = 1;
signal loop;
end;
when zcmd = 'INIT' then do;
if file = 1; then
'START "File Manager" /PGM ' || FILE_MGR
if comm = 1 then
'START /C ' || COMM_MGR || ' 2>NUL'
if qm = 1 then
'START /PGM ' || QUERY_MGR
else
if dbm = 1 then
'START /N ' || DATABASE_MGR
if edit = 1 then
'START '|| EDITOR_NAME;
signal endrun; /* always close after init */
end;
otherwise;
DosRq2 = 0;
signal loop;
end;
endrun:
address ispcir 'dmclose dmcomm(dmcomm)'
rxsubcom drop ispcir;
/* Save option choices for next time */
FileStat = charout('init.prm',file,1);
FileStat = charout('init.prm',comm);
FileStat = charout('init.prm',dbm);
FileStat = charout('init.prm',edit);
FileStat = stream('init.prm','c','close');
RC = endlocal();
exit;
error:
FileStat = stream('error.log','c','open write');
FileStat = lineout('error.log',"ERROR LOG FOR DM REXX EXEC INIT",1);
beep(100,500);
say Unrecoverable Error encountered
say This information will be logged to 'error.log'
loop =1;
do while loop <17
string = 'DMCOMM value ' loop ' = ' dmcomm.loop;
FileStat = lineout('error.log',string);
say string
loop = loop + 1;
end;
FileStat = stream('error.log','c','close');
address ispcir 'dmclose dmcomm(dmcomm)'
rxsubcom drop ispcir;
exit;