home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / viscobv7.zip / vac22os2 / ibmcobol / macros / iwzmsva.lx < prev    next >
Text File  |  1997-12-17  |  7KB  |  207 lines

  1. /* Reinvoking as "REXX %0 %1 %2 %3 %4 %5 %6 %7 %8 %9"  2>nul
  2. @goto runit */
  3. /*********************************************************************/
  4. /* Licensed Material - Property of IBM                               */
  5. /* 5639-B92 , 5639-D65 (C) Copyright IBM Corp., 1997, 1998           */
  6. /* All rights reserved.                                              */
  7. /* US Government Users Restricted Rights - Use, duplication or       */
  8. /* disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */
  9. /*********************************************************************/
  10. trace off;
  11. signal on novalue;
  12. parse source opsys . whoami rest;
  13. /* cobolroot is now set by iwzmIR.CMD */
  14. if opsys = 'OS/2' then
  15.   do;
  16.   env = 'OS2ENVIRONMENT';
  17.   callit = '@Call';
  18.   call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs';
  19.   call SysLoadFuncs;
  20.   end;
  21. else
  22.   do;
  23.   env = 'ENVIRONMENT';
  24.   callit = '@Rexx';
  25.   end;
  26. tempdir = value('TMP',,env);
  27. tempout = SysTempFileName(tempdir'\TM?????.OUT');
  28. tempout2 = SysTempFileName(tempdir'\T2?????.OUT');
  29. xx = Get_MVSINFO();
  30. if xx <> 0 then
  31.   exit 16;
  32. call Set_MVSINFO_Vars;
  33. if tracemod = '*' |,
  34.   wordpos(translate(substr(whoami,lastpos('\',whoami)+1)),tracemod) > 0 then
  35.   do;
  36.   if trace > 3 then trace results;
  37.   if trace > 4 then trace ?;
  38.   end;
  39. parse arg the_input_args;
  40. call traceit 1 'Entry' '!'the_input_args'!';
  41. parse arg the_args;
  42. if substr(the_args,1,2) = '!!' then
  43.   do;
  44.   'set global.protsave_saveall null';
  45.   the_args = substr(the_args,3);
  46.   if the_args <> '' then
  47.     do;
  48.     'lxi' the_args;
  49.     lpex_rc = rc;
  50.     call traceit 1 'Normal exit';
  51.     exit lpex_rc;
  52.     end;
  53.   exit 0;
  54.   end;
  55. 'set global.protsave_saveall saveall';
  56. 'lxn saveall prompt macro iwzmsva.lx !!'the_args;
  57. saveall_rc = rc;
  58. 'set global.protsave_saveall null';
  59. call traceit 1 'Normal exit';
  60. exit saveall_rc;
  61. Get_MVSINFO:
  62. Procedure expose env cobolroot mvsinfo. whoami tempdir trace
  63.  
  64. rtn = 0
  65. null = '0000'x
  66. crlf = '0D0A'x
  67. mvsinfo. = ''
  68. mvsinfoQ = translate('iwzm_MVSINFO.DAT_YALE');
  69.  
  70. oldq = rxqueue('Set',mvsinfoQ)   /* switch to mvsinfo queue */
  71. if queued() = 0 then do                   /* if Q is missing we'll */
  72.   qname = rxqueue('Create',mvsinfoQ)      /* create it and put a bad */
  73.   if qname = mvsinfoQ then push 'Sven'    /* timestamp on it, else */
  74.   else x=rxqueue('Delete',qname)          /* it was in use (we hope) */
  75.   end                                     /* so we'll assume we can */
  76. parse pull mvsstuff; push mvsstuff        /* get/replace Q contents */
  77. parse value mvsstuff with ts (null) . cobolroot (null) mvsstuff /* get */
  78.                                         /* timestamp and cobolroot */
  79. if ts <> 'Sven' then do;
  80.   mvsinfo = cobolroot'\MACROS\MVSINFO.DAT'
  81.   bad_mvsinfo = '    **' whoami '****'crlf'    **error*' mvsinfo,
  82.                 'is unavailable, missing or empty **'
  83.  
  84.   x=SysFileTree(mvsinfo,'ts','F')       /* get MVSINFO.DAT's timestamp */
  85.   if ts.0 <> 1 then do
  86.     say bad_mvsinfo
  87.     return 12;
  88.     end
  89.   parse var ts.1 v0 v1 v2 .
  90.   timestamp ='mvsinfo.dat.timestamp' v0 v1 v2
  91.   end;
  92. else
  93.   timestamp = 'Yale'
  94. if timestamp <> ts then do              /* timestamps match? */
  95.   pull mvsstuff                         /* no, remove bad contents */
  96.   rtn = "iwzmIR.CMD"()                /* ask for new stuff */
  97.   if rtn = 0 then do
  98.     parse pull mvsstuff; push mvsstuff    /* get/replace Q contents */
  99.                                         /* remove timestamp and     */
  100.                                         /* cobolroot                */
  101.     parse value mvsstuff with . (null) . cobolroot ( null) mvsstuff
  102.     end
  103.   end
  104. qname = rxqueue('Set',oldq)      /* restore normal queue */
  105.  
  106. do while (mvsstuff<>'') & (rtn=0)   /* mvsinfo. structure */
  107.   parse value mvsstuff with key val (null) mvsstuff
  108.   if mvsinfo.key = '' then do       /* e.g. mvsinfo.TYPE='' */
  109.     mvsinfo.KEYS = mvsinfo.KEYS key /* no substitution for KEYS */
  110.     mvsinfo.key.1 = val             /* e.g. mvsinfo.TYPE.1=val  */
  111.     mvsinfo.key = 1                 /* e.g. mvsinfo.TYPE=1      */
  112.     end
  113.   else do
  114.     x = mvsinfo.key + 1             /* e.g. mvsinfo.TYPE+1     */
  115.     mvsinfo.key.x = val             /* e.g. mvsinfo.TYPE.2=val */
  116.     mvsinfo.key = x                 /* e.g. mvsinfo.TYPE=2     */
  117.     end
  118.   end
  119.  
  120. return rtn
  121.  
  122. Set_MVSINFO_Vars:
  123.  
  124.  parse var mvsinfo.CLOSECMD.1 closecmd;
  125.  parse var mvsinfo.CLOSEFILE.1 closefile;
  126.  parse var mvsinfo.FILESYS.1 filesys accessmon testaccess;
  127.  parse var mvsinfo.FSSTARTCMD.1 fsstartcmd;
  128.  parse var mvsinfo.FSSTOPCMD.1 fsstopcmd;
  129.  parse var mvsinfo.HEADER.1 header;
  130.  parse var mvsinfo.JOBLOG.1 joblog;
  131.  parse var mvsinfo.MAXCMD.1 maxcmd;
  132.  parse var mvsinfo.LANGUAGE.1 language;
  133.  parse var mvsinfo.MOUNTCMD.1 mountcmd;
  134.  parse var mvsinfo.MVSCOMM.1 mvscomm;
  135.  parse var mvsinfo.iwzmEDT.1 iwzmedt;
  136.  parse var mvsinfo.NFS.1 nfs;
  137.  parse var mvsinfo.NULLSTDIN.1 nullstdin;
  138.  parse var mvsinfo.OUTSHOW.1 outshow;
  139.  parse var mvsinfo.PROTSAVE.1 protsave tempmult;
  140.  parse var mvsinfo.PWD.1 pwd pwdasis pwdt pwde;
  141.  parse var mvsinfo.READTIMEOUT.1 readtimeout;
  142.  parse var mvsinfo.REXECCMD.1 rexeccmd;
  143.  parse var mvsinfo.SDU.1 sdu;
  144.  parse var mvsinfo.SIGYCLST.1 sigyclst;
  145.  parse var mvsinfo.SYSPROC.1 sysproc;
  146.  parse var mvsinfo.SYSTEM.1 system;
  147.  parse var mvsinfo.TEMPDRIVE.1 tempdrive;
  148.  parse var mvsinfo.TEMPDATA.1 tempdata;
  149.  parse var mvsinfo.TESTFILE.1 testfile;
  150.  parse var mvsinfo.TRACE.1 trace tracekeep;
  151.  parse var mvsinfo.TRACECMD.1 tracecmd;
  152.  parse var mvsinfo.TRACEMOD.1 tracemod;
  153.  parse var mvsinfo.UMOUNTCMD.1 umountcmd;
  154.  parse var mvsinfo.USERID.1 userid;
  155.  parse var mvsinfo.WORKSYS.1 worksys;
  156.  parse var mvsinfo.WRITETIMEOUT.1 writetimeout;
  157.  
  158.  parse var mvsinfo.DRIVE numdrive;
  159.  if numdrive = '' then
  160.    numdrive = 0;
  161.  do ii = 1 to numdrive;
  162.    parse var mvsinfo.DRIVE.ii,
  163.              drive.ii highqual.ii trans.ii mapping.ii sidefile.ii;
  164.    end;
  165.  
  166.  parse var mvsinfo.TYPE numtype;
  167.  if numtype = '' then
  168.    numtype = 0;
  169.  do ii = 1 to numtype;
  170.    parse var mvsinfo.TYPE.ii type.ii ext.ii;
  171.    end;
  172.  
  173. return
  174.  
  175. /* */
  176. Traceit:
  177.  parse arg iwz_trc_level iwz_trc_message;
  178.  if iwz_trc_level > trace then
  179.    return;
  180.  if pwd <> '********' & pwd <> '++++++++' & pwd <> '========' then
  181.    do;
  182.    do forever;
  183.      if pos(pwd,iwz_trc_message) = 0 then
  184.        leave;
  185.      parse var iwz_trc_message iwz_trc_message1 (pwd) iwz_trc_message2;
  186.      iwz_trc_message = iwz_trc_message1||'********'||iwz_trc_message2
  187.      end;
  188.    end
  189.  iwz_trc_message = date('O') time('L') whoami':' iwz_trc_message;
  190.  xx = lineout(tempdir'\iwzmTRC.TRC',iwz_trc_message);
  191.  xx = stream(tempdir'\iwzmTRC.TRC','C','CLOSE');
  192.  if tracecmd <> '' then
  193.    interpret tracecmd;
  194. return;
  195.  
  196. /* */
  197. sayit:
  198.  parse arg iwz_sayit_arg;
  199.  if trace > 2 then
  200.    call traceit 3 '--->' iwz_sayit_arg;
  201.  say iwz_sayit_arg;
  202. return;
  203. /*
  204. :runit
  205. @rexx %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
  206. @rem */
  207.