home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
viscobv7.zip
/
vac22os2
/
ibmcobol
/
macros
/
iwzmmsg.lx
< prev
next >
Wrap
Text File
|
1998-01-08
|
16KB
|
526 lines
/* Reinvoking as "REXX %0 %1 %2 %3 %4 %5 %6 %7 %8 %9" 2>nul
@goto runit */
/*********************************************************************/
/* Licensed Material - Property of IBM */
/* 5639-B92 , 5639-D65 (C) Copyright IBM Corp., 1997, 1998 */
/* All rights reserved. */
/* US Government Users Restricted Rights - Use, duplication or */
/* disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */
/*********************************************************************/
trace off;
signal on novalue;
parse source opsys . whoami rest;
/* cobolroot is now set by iwzmIR.CMD */
if opsys = 'OS/2' then
do;
env = 'OS2ENVIRONMENT';
callit = '@Call';
call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs';
call SysLoadFuncs;
end;
else
do;
env = 'ENVIRONMENT';
callit = '@Rexx';
end;
tempdir = value('TMP',,env);
tempout = SysTempFileName(tempdir'\TM?????.OUT');
tempout2 = SysTempFileName(tempdir'\T2?????.OUT');
xx = Get_MVSINFO();
if xx <> 0 then
exit 16;
call Set_MVSINFO_Vars;
if tracemod = '*' |,
wordpos(translate(substr(whoami,lastpos('\',whoami)+1)),tracemod) > 0 then
do;
if trace > 3 then trace results;
if trace > 4 then trace ?;
end;
parse arg the_input_args;
call traceit 1 'Entry' '!'the_input_args'!';
parse upper arg mvsname recfm lrecl dsorg seqnum alias badhex memexist fileext tempdsn rest;
'set messages on';
'extract name into filename';
'extract docnum into docnum';
call traceit 2 'File =' filename ', docnum =' docnum ', temp =' tempdsn;
'extract classes into classes';
if wordpos('MVSMSG',classes) > 0 then
do;
call traceit 1 'Normal exit';
exit 0;
end;
'set classes' classes 'MVSMSG USERMARK';
/* 'macro mvsmark.lx'; */
if badhex <> 'NO' |,
fileext = 'OBJ' | fileext = 'EXE' | fileext = 'LST' |,
fileext = 'ADT' | fileext = 'PPR' | fileext = 'OUT' then
ronly = 'yes';
else
ronly = 'no';
lpexmsg = mvsname;
lpexmsg = lpexmsg '"TYPE='fileext;
lpexmsg = lpexmsg ', LRECL='lrecl '('recfm')';
if ronly = 'no' then
do;
if (seqnum = 'YES' | seqnum = 'ISPF') then
do;
if seqnum = 'YES' then
lpexmsg = lpexmsg ', SEQ';
else
lpexmsg = lpexmsg ', SEQ (ISPF)';
end;
else
do;
if substr(recfm,1,1) = 'F' & lrecl = 80 then
do;
'extract global.keys into keys';
if keys = 'ISPF' | keys = 'XEDIT' then
lpexmsg = lpexmsg ', COLS 73-80 SEP';
end;
end;
end;
if ronly = 'yes' then
lpexmsg = lpexmsg ', R/O';
if badhex <> 'NO' then
lpexmsg = lpexmsg ', HEX';
if alias = 'YES' then
lpexmsg = lpexmsg ', ALIAS';
if alias = 'BASE' then
lpexmsg = lpexmsg ', ALIAS BASE';
lpexmsg = lpexmsg'" ';
prefix = 'INFO ';
if substr(recfm,1,1) = 'V' then
lrecluse = lrecl - 4;
else
lrecluse = lrecl;
lrecluse = lrecluse - length(prefix);
if lrecluse > (80 - length(prefix)) then
lrecluse = 80 - length(prefix);
if seqnum <> 'NO' then
lrecluse = 72 - length(prefix);
minlrecl = 72 - length(prefix);
if ronly = 'yes' | alias = 'ALIAS' | alias = 'BASE' then
domsgs = 'yes';
else
domsgs = 'no';
/* 'set actionbar.~View.Show_user_marked_lines 97 ;SET INCLUDE USERMARK;SET EXCLUDE';
'set actionbar.~View.Refresh_user_mark 98 MACRO MVSMARK.LX'; */
nummsg = 0;
if domsgs <> 'no' then
do;
'set actionbar.~View.Exclude_MVS_INFO_lines 99 SET EXCLUDE MVSMSG';
'check';
'extract changes into changes';
'extract readonly into readonly';
'extract highlight into highlight';
'set readonly off';
'set highlight' highlight 'MVSMSG';
'top';
if lrecluse >= minlrecl then
'splitjoin split';
call message 01 lrecluse;
end;
parse var mvsname dsn1 '(' member ')' dsn2;
if alias <> 'NO' then
do;
call addmsg ' ';
if alias = 'YES' then
do;
call message 02;
end;
if alias = 'BASE' then
do;
call message 03;
end;
end;
if ronly = 'yes' then
do;
call message 04;
if fileext = 'OBJ' | fileext = 'EXE' | fileext = 'LST' |,
fileext = 'ADT' | fileext = 'PPR' | fileext = 'OUT' then
do;
call addmsg ' ';
select;
when fileext = 'OBJ' then
call message 05;
when fileext = 'EXE' then
call message 06;
when fileext = 'LST' then
call message 07;
when fileext = 'ADT' then
call message 08;
when fileext = 'PPR' then
call message 09;
when fileext = 'OUT' then
call message 10;
otherwise
nop;
end;
end;
if badhex <> 'NO' then
do;
call message 11 'dd'x;
'set synonym.quit macro iwzmqt.lx quit' badhex;
'set synonym.qquit macro iwzmqt.lx qquit' badhex;
end;
end;
if domsgs <> 'no' then
do;
call message 12 lrecluse;
'set readonly' readonly;
'check';
'set changes' changes;
end;
if badhex = 'NO' & tempdsn <> '*' then
do;
parse var tempdsn tempdsn2 '/' maxrec;
'set synonym.quit macro iwzmqt.lx quit' tempdsn2;
'set synonym.qquit macro iwzmqt.lx qquit' tempdsn2;
end;
'set global.tempdsn_'docnum tempdsn;
'set global.mvsrecfm_'docnum recfm;
'set global.mvslrecl_'docnum lrecl;
'extract doctype into doctype';
'extract synonym.save into synsave';
if translate(doctype) <> 'CBL' | pos('copyfile.lx',synsave) = 0 then
'set synonym.save macro iwzmsav.lx';
if fileext = 'JCL' & ronly = 'no' then
'set actionbar.Submit_Job.Submit_job 6 MACRO iwzmESB.LX USERID';
'top'
'msg' lpexmsg;
'sshow';
if domsgs <> 'no' then
do;
do ii = 1 to nummsg;
'next';
end;
'alarm';
end;
call traceit 1 'Normal exit';
exit 0;
/* */
addmsg:
if domsgs = 'no' then
return;
if lrecluse < minlrecl then
return;
parse arg themsg;
nummsg = nummsg + 1;
if nummsg = 1 then
'set content' prefix||themsg;
else
'insert' prefix||themsg;
'set show on';
'set class mvsmsg';
return;
/* */
errmsg:
parse arg the_msg;
'msg' the_msg;
'alarm';
call traceit 1 'Error exit';
exit 16;
/* */
message:
parse arg iwz_message_num,
iwz_message_arg1 '\\',
iwz_message_arg2 '\\',
iwz_message_arg3 '\\',
iwz_message_arg4 '\\',
iwz_message_arg5 '\\',
iwz_message_arg6 '\\',
iwz_message_arg7 '\\',
iwz_message_arg8;
select;
when language = 'ENG' then
call message_eng;
when language = 'JPN' then
call message_jpn;
otherwise
call message_eng;
end;
return;
/* */
message_eng:
select;
when iwz_message_num = 1 then do;
call addmsg center(' Start of MVS data set information ',iwz_message_arg1,'-');
end;
when iwz_message_num = 2 then do;
call addmsg 'The member name is an alias name. If you update';
call addmsg 'the member it will break the alias connection.';
end;
when iwz_message_num = 3 then do;
call addmsg 'The member name has alias names. If you update';
call addmsg 'the member it will break the alias connections.';
end;
when iwz_message_num = 4 then do;
call addmsg ' ';
call addmsg 'The editing session has been set to read only to prevent';
call addmsg 'the data set from being modified due to the following:';
end;
when iwz_message_num = 5 then do;
call addmsg '- The data set contains object code';
end;
when iwz_message_num = 6 then do;
call addmsg '- The data set is a load module';
end;
when iwz_message_num = 7 then do;
call addmsg '- The data set contains a compilation listing';
end;
when iwz_message_num = 8 then do;
call addmsg '- The data set contains a ADATA output';
end;
when iwz_message_num = 9 then do;
call addmsg '- The data set contains pre-compiler output';
end;
when iwz_message_num = 10 then do;
call addmsg '- The data set contains MVS job SYSOUT output';
end;
when iwz_message_num = 11 then do;
call addmsg ' ';
call addmsg '- The data set contains characters whose hex positions';
call addmsg ' are either below hex 40 or represent non-printable';
call addmsg ' characters. These characters cannot be converted';
call addmsg ' between MVS EBCDIC and workstation ASCII for';
call addmsg ' editing at the workstation. Note that the file you';
call addmsg ' are viewing is a copy of your original file where';
call addmsg ' these characters appear as' iwz_message_arg1;
end;
when iwz_message_num = 12 then do;
call addmsg ' ';
call addmsg center(' End of MVS data set information ',iwz_message_arg1,'-');
end;
otherwise
call sayit 'Invalid message number' iwz_message_num;
end;
return;
/* */
message_jpn:
call addmsg 'Japanese message';
select;
when iwz_message_num = 1 then do;
call addmsg center(' Start of MVS data set information ',iwz_message_arg1,'-');
end;
when iwz_message_num = 2 then do;
call addmsg 'The member name is an alias name. If you update';
call addmsg 'the member it will break the alias connection.';
end;
when iwz_message_num = 3 then do;
call addmsg 'The member name has alias names. If you update';
call addmsg 'the member it will break the alias connections.';
end;
when iwz_message_num = 4 then do;
call addmsg ' ';
call addmsg 'The editing session has been set to read only to prevent';
call addmsg 'the data set from being modified due to the following:';
end;
when iwz_message_num = 5 then do;
call addmsg '- The data set contains object code';
end;
when iwz_message_num = 6 then do;
call addmsg '- The data set is a load module';
end;
when iwz_message_num = 7 then do;
call addmsg '- The data set contains a compilation listing';
end;
when iwz_message_num = 8 then do;
call addmsg '- The data set contains a ADATA output';
end;
when iwz_message_num = 9 then do;
call addmsg '- The data set contains pre-compiler output';
end;
when iwz_message_num = 10 then do;
call addmsg '- The data set contains MVS job SYSOUT output';
end;
when iwz_message_num = 11 then do;
call addmsg ' ';
call addmsg '- The data set contains characters whose hex positions';
call addmsg ' are either below hex 40 or represent non-printable';
call addmsg ' characters. These characters cannot be converted';
call addmsg ' between MVS EBCDIC and workstation ASCII for';
call addmsg ' editing at the workstation. Note that the file you';
call addmsg ' are viewing is a copy of your original file where';
call addmsg ' these characters appear as' iwz_message_arg1;
end;
when iwz_message_num = 12 then do;
call addmsg ' ';
call addmsg center(' End of MVS data set information ',iwz_message_arg1,'-');
end;
otherwise
call sayit 'Invalid message number' iwz_message_num;
end;
return;
Get_MVSINFO:
Procedure expose env cobolroot mvsinfo. whoami tempdir trace
rtn = 0
null = '0000'x
crlf = '0D0A'x
mvsinfo. = ''
mvsinfoQ = translate('iwzm_MVSINFO.DAT_YALE');
oldq = rxqueue('Set',mvsinfoQ) /* switch to mvsinfo queue */
if queued() = 0 then do /* if Q is missing we'll */
qname = rxqueue('Create',mvsinfoQ) /* create it and put a bad */
if qname = mvsinfoQ then push 'Sven' /* timestamp on it, else */
else x=rxqueue('Delete',qname) /* it was in use (we hope) */
end /* so we'll assume we can */
parse pull mvsstuff; push mvsstuff /* get/replace Q contents */
parse value mvsstuff with ts (null) . cobolroot (null) mvsstuff /* get */
/* timestamp and cobolroot */
if ts <> 'Sven' then do;
mvsinfo = cobolroot'\MACROS\MVSINFO.DAT'
bad_mvsinfo = ' **' whoami '****'crlf' **error*' mvsinfo,
'is unavailable, missing or empty **'
x=SysFileTree(mvsinfo,'ts','F') /* get MVSINFO.DAT's timestamp */
if ts.0 <> 1 then do
say bad_mvsinfo
return 12;
end
parse var ts.1 v0 v1 v2 .
timestamp ='mvsinfo.dat.timestamp' v0 v1 v2
end;
else
timestamp = 'Yale'
if timestamp <> ts then do /* timestamps match? */
pull mvsstuff /* no, remove bad contents */
rtn = "iwzmIR.CMD"() /* ask for new stuff */
if rtn = 0 then do
parse pull mvsstuff; push mvsstuff /* get/replace Q contents */
/* remove timestamp and */
/* cobolroot */
parse value mvsstuff with . (null) . cobolroot ( null) mvsstuff
end
end
qname = rxqueue('Set',oldq) /* restore normal queue */
do while (mvsstuff<>'') & (rtn=0) /* mvsinfo. structure */
parse value mvsstuff with key val (null) mvsstuff
if mvsinfo.key = '' then do /* e.g. mvsinfo.TYPE='' */
mvsinfo.KEYS = mvsinfo.KEYS key /* no substitution for KEYS */
mvsinfo.key.1 = val /* e.g. mvsinfo.TYPE.1=val */
mvsinfo.key = 1 /* e.g. mvsinfo.TYPE=1 */
end
else do
x = mvsinfo.key + 1 /* e.g. mvsinfo.TYPE+1 */
mvsinfo.key.x = val /* e.g. mvsinfo.TYPE.2=val */
mvsinfo.key = x /* e.g. mvsinfo.TYPE=2 */
end
end
return rtn
Set_MVSINFO_Vars:
parse var mvsinfo.CLOSECMD.1 closecmd;
parse var mvsinfo.CLOSEFILE.1 closefile;
parse var mvsinfo.FILESYS.1 filesys accessmon testaccess;
parse var mvsinfo.FSSTARTCMD.1 fsstartcmd;
parse var mvsinfo.FSSTOPCMD.1 fsstopcmd;
parse var mvsinfo.HEADER.1 header;
parse var mvsinfo.JOBLOG.1 joblog;
parse var mvsinfo.MAXCMD.1 maxcmd;
parse var mvsinfo.LANGUAGE.1 language;
parse var mvsinfo.MOUNTCMD.1 mountcmd;
parse var mvsinfo.MVSCOMM.1 mvscomm;
parse var mvsinfo.iwzmEDT.1 iwzmedt;
parse var mvsinfo.NFS.1 nfs;
parse var mvsinfo.NULLSTDIN.1 nullstdin;
parse var mvsinfo.OUTSHOW.1 outshow;
parse var mvsinfo.PROTSAVE.1 protsave tempmult;
parse var mvsinfo.PWD.1 pwd pwdasis pwdt pwde;
parse var mvsinfo.READTIMEOUT.1 readtimeout;
parse var mvsinfo.REXECCMD.1 rexeccmd;
parse var mvsinfo.SDU.1 sdu;
parse var mvsinfo.SIGYCLST.1 sigyclst;
parse var mvsinfo.SYSPROC.1 sysproc;
parse var mvsinfo.SYSTEM.1 system;
parse var mvsinfo.TEMPDRIVE.1 tempdrive;
parse var mvsinfo.TEMPDATA.1 tempdata;
parse var mvsinfo.TESTFILE.1 testfile;
parse var mvsinfo.TRACE.1 trace tracekeep;
parse var mvsinfo.TRACECMD.1 tracecmd;
parse var mvsinfo.TRACEMOD.1 tracemod;
parse var mvsinfo.UMOUNTCMD.1 umountcmd;
parse var mvsinfo.USERID.1 userid;
parse var mvsinfo.WORKSYS.1 worksys;
parse var mvsinfo.WRITETIMEOUT.1 writetimeout;
parse var mvsinfo.DRIVE numdrive;
if numdrive = '' then
numdrive = 0;
do ii = 1 to numdrive;
parse var mvsinfo.DRIVE.ii,
drive.ii highqual.ii trans.ii mapping.ii sidefile.ii;
end;
parse var mvsinfo.TYPE numtype;
if numtype = '' then
numtype = 0;
do ii = 1 to numtype;
parse var mvsinfo.TYPE.ii type.ii ext.ii;
end;
return
/* */
Traceit:
parse arg iwz_trc_level iwz_trc_message;
if iwz_trc_level > trace then
return;
if pwd <> '********' & pwd <> '++++++++' & pwd <> '========' then
do;
do forever;
if pos(pwd,iwz_trc_message) = 0 then
leave;
parse var iwz_trc_message iwz_trc_message1 (pwd) iwz_trc_message2;
iwz_trc_message = iwz_trc_message1||'********'||iwz_trc_message2
end;
end
iwz_trc_message = date('O') time('L') whoami':' iwz_trc_message;
xx = lineout(tempdir'\iwzmTRC.TRC',iwz_trc_message);
xx = stream(tempdir'\iwzmTRC.TRC','C','CLOSE');
if tracecmd <> '' then
interpret tracecmd;
return;
/* */
sayit:
parse arg iwz_sayit_arg;
if trace > 2 then
call traceit 3 '--->' iwz_sayit_arg;
say iwz_sayit_arg;
return;
/*
:runit
@rexx %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
@rem */