home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / viscobv7.zip / vac22os2 / ibmcobol / macros / out.lxl < prev    next >
Text File  |  1998-01-06  |  9KB  |  279 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. 'set actionbar.~View.Major_JES_messages 3 ;SET INCLUDE JESMSG;SET EXCLUDE';
  42. 'set actionbar.~View.TSO_output 4 ;SET INCLUDE TSOOUT;SET EXCLUDE';
  43. 'extract classes into classes';
  44. 'set classes' classes 'JESMSG TSOOUT';
  45. 'extract protect into protect';
  46. 'set protect' protect 'JESMSG TSOOUT';
  47. 'extract highlight into highlight';
  48. 'set highlight' highlight 'TSOOUT';
  49. 'set font.e bright red/white';
  50. 'set font.i bright grey/white';
  51. 'set font.w bright blue/white';
  52. 'set font.e reverse';
  53. 'set font.i reverse';
  54. 'set font.w reverse';
  55. call traceit 2 'Before call to mout';
  56. 'mout'
  57. call traceit 2 'After call to mout';
  58. 'extract classes into classes';
  59. 'extract name into outfile';
  60. testpartial = 'no';
  61. 'extract global.mvs_sysout_partial into partname';
  62. if partname = '' | partname = 'null' then
  63.   do;
  64.   if length(outfile) > 8 then
  65.     do;
  66.     len = length(outfile) - 7;
  67.     if substr(translate(outfile),len,8) = '.OUTLIST' then
  68.       testpartial = 'yes';
  69.     end;
  70.   end;
  71. else
  72.   do;
  73.   'extract name into namesave';
  74.   'godoc' partname;
  75.   'lxi quit';
  76.   'godoc'
  77.   'set global.mvs_sysout_partial null';
  78.   'godoc' namesave;
  79.   parse var partname newname '/' rest;
  80.   'set name' newname;
  81.   end;
  82. if testpartial = 'yes' then
  83.   do;
  84.   'extract elements into numlines';
  85.   if numlines > 0 then
  86.     do;
  87.     'bottom';
  88.     'extract content into line';
  89.     reinvoke = 'no';
  90.     if line <> '' then
  91.       do;
  92.       if substr(line,1,1) = '1a'x |,
  93.         substr(line,1,1) = '0b'x |,
  94.         substr(line,1,1) = '11'x |,
  95.         substr(line,1,1) = '19'x |,
  96.         substr(line,1,1) = 'a4'x then
  97.           reinvoke = 'yes'
  98.       end;
  99.     else
  100.       do;
  101.       if numlines > 1 then
  102.         do;
  103.         'prev';
  104.        'extract content into line';
  105.        if line <> '' then
  106.          do;
  107.          if substr(line,1,1) = '1a'x |,
  108.            substr(line,1,1) = '0b'x |,
  109.            substr(line,1,1) = '11'x |,
  110.            substr(line,1,1) = '19'x |,
  111.            substr(line,1,1) = 'a4'x then
  112.              reinvoke = 'yes'
  113.           end;
  114.         end;
  115.       end;
  116.     'top';
  117.     if reinvoke = 'yes' then
  118.      do;
  119.      'set name' outfile'/partial';
  120.      'msg Probable missing output, also invoking via iwzmedt';
  121.      'set global.mvs_sysout_partial' outfile'/partial';
  122.      'alarm';
  123.      'sshow';
  124.      if opsys = 'OS/2' then
  125.        address cmd '@start /c /i iwzmedt.cmd' outfile;
  126.      else
  127.        address cmd '@start /i rexx iwzmedt.cmd' outfile;
  128.      end;
  129.     end;
  130.   end;
  131. call traceit 1 'Normal exit';
  132. exit 0;
  133. Get_MVSINFO:
  134. Procedure expose env cobolroot mvsinfo. whoami tempdir trace
  135.  
  136. rtn = 0
  137. null = '0000'x
  138. crlf = '0D0A'x
  139. mvsinfo. = ''
  140. mvsinfoQ = translate('iwzm_MVSINFO.DAT_YALE');
  141.  
  142. oldq = rxqueue('Set',mvsinfoQ)   /* switch to mvsinfo queue */
  143. if queued() = 0 then do                   /* if Q is missing we'll */
  144.   qname = rxqueue('Create',mvsinfoQ)      /* create it and put a bad */
  145.   if qname = mvsinfoQ then push 'Sven'    /* timestamp on it, else */
  146.   else x=rxqueue('Delete',qname)          /* it was in use (we hope) */
  147.   end                                     /* so we'll assume we can */
  148. parse pull mvsstuff; push mvsstuff        /* get/replace Q contents */
  149. parse value mvsstuff with ts (null) . cobolroot (null) mvsstuff /* get */
  150.                                         /* timestamp and cobolroot */
  151. if ts <> 'Sven' then do;
  152.   mvsinfo = cobolroot'\MACROS\MVSINFO.DAT'
  153.   bad_mvsinfo = '    **' whoami '****'crlf'    **error*' mvsinfo,
  154.                 'is unavailable, missing or empty **'
  155.  
  156.   x=SysFileTree(mvsinfo,'ts','F')       /* get MVSINFO.DAT's timestamp */
  157.   if ts.0 <> 1 then do
  158.     say bad_mvsinfo
  159.     return 12;
  160.     end
  161.   parse var ts.1 v0 v1 v2 .
  162.   timestamp ='mvsinfo.dat.timestamp' v0 v1 v2
  163.   end;
  164. else
  165.   timestamp = 'Yale'
  166. if timestamp <> ts then do              /* timestamps match? */
  167.   pull mvsstuff                         /* no, remove bad contents */
  168.   rtn = "iwzmIR.CMD"()                /* ask for new stuff */
  169.   if rtn = 0 then do
  170.     parse pull mvsstuff; push mvsstuff    /* get/replace Q contents */
  171.                                         /* remove timestamp and     */
  172.                                         /* cobolroot                */
  173.     parse value mvsstuff with . (null) . cobolroot ( null) mvsstuff
  174.     end
  175.   end
  176. qname = rxqueue('Set',oldq)      /* restore normal queue */
  177.  
  178. do while (mvsstuff<>'') & (rtn=0)   /* mvsinfo. structure */
  179.   parse value mvsstuff with key val (null) mvsstuff
  180.   if mvsinfo.key = '' then do       /* e.g. mvsinfo.TYPE='' */
  181.     mvsinfo.KEYS = mvsinfo.KEYS key /* no substitution for KEYS */
  182.     mvsinfo.key.1 = val             /* e.g. mvsinfo.TYPE.1=val  */
  183.     mvsinfo.key = 1                 /* e.g. mvsinfo.TYPE=1      */
  184.     end
  185.   else do
  186.     x = mvsinfo.key + 1             /* e.g. mvsinfo.TYPE+1     */
  187.     mvsinfo.key.x = val             /* e.g. mvsinfo.TYPE.2=val */
  188.     mvsinfo.key = x                 /* e.g. mvsinfo.TYPE=2     */
  189.     end
  190.   end
  191.  
  192. return rtn
  193.  
  194. Set_MVSINFO_Vars:
  195.  
  196.  parse var mvsinfo.CLOSECMD.1 closecmd;
  197.  parse var mvsinfo.CLOSEFILE.1 closefile;
  198.  parse var mvsinfo.FILESYS.1 filesys accessmon testaccess;
  199.  parse var mvsinfo.FSSTARTCMD.1 fsstartcmd;
  200.  parse var mvsinfo.FSSTOPCMD.1 fsstopcmd;
  201.  parse var mvsinfo.HEADER.1 header;
  202.  parse var mvsinfo.JOBLOG.1 joblog;
  203.  parse var mvsinfo.MAXCMD.1 maxcmd;
  204.  parse var mvsinfo.LANGUAGE.1 language;
  205.  parse var mvsinfo.MOUNTCMD.1 mountcmd;
  206.  parse var mvsinfo.MVSCOMM.1 mvscomm;
  207.  parse var mvsinfo.iwzmEDT.1 iwzmedt;
  208.  parse var mvsinfo.NFS.1 nfs;
  209.  parse var mvsinfo.NULLSTDIN.1 nullstdin;
  210.  parse var mvsinfo.OUTSHOW.1 outshow;
  211.  parse var mvsinfo.PROTSAVE.1 protsave tempmult;
  212.  parse var mvsinfo.PWD.1 pwd pwdasis pwdt pwde;
  213.  parse var mvsinfo.READTIMEOUT.1 readtimeout;
  214.  parse var mvsinfo.REXECCMD.1 rexeccmd;
  215.  parse var mvsinfo.SDU.1 sdu;
  216.  parse var mvsinfo.SIGYCLST.1 sigyclst;
  217.  parse var mvsinfo.SYSPROC.1 sysproc;
  218.  parse var mvsinfo.SYSTEM.1 system;
  219.  parse var mvsinfo.TEMPDRIVE.1 tempdrive;
  220.  parse var mvsinfo.TEMPDATA.1 tempdata;
  221.  parse var mvsinfo.TESTFILE.1 testfile;
  222.  parse var mvsinfo.TRACE.1 trace tracekeep;
  223.  parse var mvsinfo.TRACECMD.1 tracecmd;
  224.  parse var mvsinfo.TRACEMOD.1 tracemod;
  225.  parse var mvsinfo.UMOUNTCMD.1 umountcmd;
  226.  parse var mvsinfo.USERID.1 userid;
  227.  parse var mvsinfo.WORKSYS.1 worksys;
  228.  parse var mvsinfo.WRITETIMEOUT.1 writetimeout;
  229.  
  230.  parse var mvsinfo.DRIVE numdrive;
  231.  if numdrive = '' then
  232.    numdrive = 0;
  233.  do ii = 1 to numdrive;
  234.    parse var mvsinfo.DRIVE.ii,
  235.              drive.ii highqual.ii trans.ii mapping.ii sidefile.ii;
  236.    end;
  237.  
  238.  parse var mvsinfo.TYPE numtype;
  239.  if numtype = '' then
  240.    numtype = 0;
  241.  do ii = 1 to numtype;
  242.    parse var mvsinfo.TYPE.ii type.ii ext.ii;
  243.    end;
  244.  
  245. return
  246.  
  247. /* */
  248. Traceit:
  249.  parse arg iwz_trc_level iwz_trc_message;
  250.  if iwz_trc_level > trace then
  251.    return;
  252.  if pwd <> '********' & pwd <> '++++++++' & pwd <> '========' then
  253.    do;
  254.    do forever;
  255.      if pos(pwd,iwz_trc_message) = 0 then
  256.        leave;
  257.      parse var iwz_trc_message iwz_trc_message1 (pwd) iwz_trc_message2;
  258.      iwz_trc_message = iwz_trc_message1||'********'||iwz_trc_message2
  259.      end;
  260.    end
  261.  iwz_trc_message = date('O') time('L') whoami':' iwz_trc_message;
  262.  xx = lineout(tempdir'\iwzmTRC.TRC',iwz_trc_message);
  263.  xx = stream(tempdir'\iwzmTRC.TRC','C','CLOSE');
  264.  if tracecmd <> '' then
  265.    interpret tracecmd;
  266. return;
  267.  
  268. /* */
  269. sayit:
  270.  parse arg iwz_sayit_arg;
  271.  if trace > 2 then
  272.    call traceit 3 '--->' iwz_sayit_arg;
  273.  say iwz_sayit_arg;
  274. return;
  275. /*
  276. :runit
  277. @rexx %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
  278. @rem */
  279.