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 >
Text File  |  1998-01-08  |  16KB  |  526 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 upper arg mvsname recfm lrecl dsorg seqnum alias badhex memexist fileext tempdsn rest;
  42. 'set messages on';
  43. 'extract name into filename';
  44. 'extract docnum into docnum';
  45. call traceit 2 'File =' filename ', docnum =' docnum ', temp =' tempdsn;
  46. 'extract classes into classes';
  47. if wordpos('MVSMSG',classes) > 0 then
  48.   do;
  49.   call traceit 1 'Normal exit';
  50.   exit 0;
  51.   end;
  52. 'set classes' classes 'MVSMSG USERMARK';
  53. /* 'macro mvsmark.lx'; */
  54. if badhex <> 'NO' |,
  55.   fileext = 'OBJ' | fileext = 'EXE' | fileext = 'LST' |,
  56.   fileext = 'ADT' | fileext = 'PPR' | fileext = 'OUT' then
  57.   ronly = 'yes';
  58. else
  59.   ronly = 'no';
  60. lpexmsg = mvsname;
  61. lpexmsg = lpexmsg '"TYPE='fileext;
  62. lpexmsg = lpexmsg ', LRECL='lrecl '('recfm')';
  63. if ronly = 'no' then
  64.   do;
  65.   if (seqnum = 'YES' | seqnum = 'ISPF') then
  66.     do;
  67.     if seqnum = 'YES' then
  68.       lpexmsg = lpexmsg ', SEQ';
  69.     else
  70.       lpexmsg = lpexmsg ', SEQ (ISPF)';
  71.     end;
  72.   else
  73.     do;
  74.     if substr(recfm,1,1) = 'F' & lrecl = 80 then
  75.       do;
  76.       'extract global.keys into keys';
  77.       if keys = 'ISPF' | keys = 'XEDIT' then
  78.         lpexmsg = lpexmsg ', COLS 73-80 SEP';
  79.       end;
  80.     end;
  81.   end;
  82. if ronly = 'yes' then
  83.   lpexmsg = lpexmsg ', R/O';
  84. if badhex <> 'NO' then
  85.   lpexmsg = lpexmsg ', HEX';
  86. if alias = 'YES' then
  87.   lpexmsg = lpexmsg ', ALIAS';
  88. if alias = 'BASE' then
  89.   lpexmsg = lpexmsg ', ALIAS BASE';
  90. lpexmsg = lpexmsg'" ';
  91. prefix = 'INFO ';
  92. if substr(recfm,1,1) = 'V' then
  93.   lrecluse = lrecl - 4;
  94. else
  95.   lrecluse = lrecl;
  96. lrecluse = lrecluse - length(prefix);
  97. if lrecluse > (80 - length(prefix)) then
  98.   lrecluse = 80 - length(prefix);
  99. if seqnum <> 'NO' then
  100.   lrecluse = 72 - length(prefix);
  101. minlrecl = 72 - length(prefix);
  102. if ronly = 'yes' | alias = 'ALIAS' | alias = 'BASE' then
  103.   domsgs = 'yes';
  104. else
  105.   domsgs = 'no';
  106. /* 'set actionbar.~View.Show_user_marked_lines 97 ;SET INCLUDE USERMARK;SET EXCLUDE';
  107. 'set actionbar.~View.Refresh_user_mark 98 MACRO MVSMARK.LX'; */
  108. nummsg = 0;
  109. if domsgs <> 'no' then
  110.   do;
  111.   'set actionbar.~View.Exclude_MVS_INFO_lines 99 SET EXCLUDE MVSMSG';
  112.   'check';
  113.   'extract changes into changes';
  114.   'extract readonly into readonly';
  115.   'extract highlight into highlight';
  116.   'set readonly off';
  117.   'set highlight' highlight 'MVSMSG';
  118.   'top';
  119.   if lrecluse >= minlrecl then
  120.     'splitjoin split';
  121.   call message 01 lrecluse;
  122.   end;
  123. parse var mvsname dsn1 '(' member ')' dsn2;
  124. if alias <> 'NO' then
  125.   do;
  126.   call addmsg ' ';
  127.   if alias = 'YES' then
  128.     do;
  129.     call message 02;
  130.     end;
  131.   if alias = 'BASE' then
  132.     do;
  133.     call message 03;
  134.     end;
  135.   end;
  136. if ronly = 'yes' then
  137.   do;
  138.   call message 04;
  139.   if fileext = 'OBJ' | fileext = 'EXE' | fileext = 'LST' |,
  140.     fileext = 'ADT' | fileext = 'PPR' | fileext = 'OUT' then
  141.     do;
  142.     call addmsg ' ';
  143.     select;
  144.       when fileext = 'OBJ' then
  145.         call message 05;
  146.       when fileext = 'EXE' then
  147.         call message 06;
  148.       when fileext = 'LST' then
  149.         call message 07;
  150.       when fileext = 'ADT' then
  151.         call message 08;
  152.       when fileext = 'PPR' then
  153.         call message 09;
  154.       when fileext = 'OUT' then
  155.         call message 10;
  156.       otherwise
  157.         nop;
  158.       end;
  159.     end;
  160.   if badhex <> 'NO' then
  161.     do;
  162.     call message 11 'dd'x;
  163.     'set synonym.quit macro iwzmqt.lx quit' badhex;
  164.     'set synonym.qquit macro iwzmqt.lx qquit' badhex;
  165.     end;
  166.   end;
  167. if domsgs <> 'no' then
  168.   do;
  169.   call message 12 lrecluse;
  170.   'set readonly' readonly;
  171.   'check';
  172.   'set changes' changes;
  173.   end;
  174. if badhex = 'NO' & tempdsn <> '*' then
  175.   do;
  176.   parse var tempdsn tempdsn2 '/' maxrec;
  177.   'set synonym.quit macro iwzmqt.lx quit' tempdsn2;
  178.   'set synonym.qquit macro iwzmqt.lx qquit' tempdsn2;
  179.   end;
  180. 'set global.tempdsn_'docnum tempdsn;
  181. 'set global.mvsrecfm_'docnum recfm;
  182. 'set global.mvslrecl_'docnum lrecl;
  183. 'extract doctype into doctype';
  184. 'extract synonym.save into synsave';
  185. if translate(doctype) <> 'CBL' | pos('copyfile.lx',synsave) = 0 then
  186.   'set synonym.save macro iwzmsav.lx';
  187. if fileext = 'JCL' & ronly = 'no' then
  188.   'set actionbar.Submit_Job.Submit_job 6 MACRO iwzmESB.LX USERID';
  189. 'top'
  190. 'msg' lpexmsg;
  191. 'sshow';
  192. if domsgs <> 'no' then
  193.   do;
  194.   do ii = 1 to nummsg;
  195.     'next';
  196.     end;
  197.   'alarm';
  198.   end;
  199. call traceit 1 'Normal exit';
  200. exit 0;
  201. /* */
  202. addmsg:
  203. if domsgs = 'no' then
  204.   return;
  205. if lrecluse < minlrecl then
  206.   return;
  207. parse arg themsg;
  208. nummsg = nummsg + 1;
  209. if nummsg = 1 then
  210.   'set content' prefix||themsg;
  211. else
  212.   'insert' prefix||themsg;
  213. 'set show on';
  214. 'set class mvsmsg';
  215. return;
  216. /* */
  217. errmsg:
  218. parse arg the_msg;
  219. 'msg' the_msg;
  220. 'alarm';
  221. call traceit 1 'Error exit';
  222. exit 16;
  223. /* */
  224. message:
  225. parse arg iwz_message_num,
  226.           iwz_message_arg1 '\\',
  227.           iwz_message_arg2 '\\',
  228.           iwz_message_arg3 '\\',
  229.           iwz_message_arg4 '\\',
  230.           iwz_message_arg5 '\\',
  231.           iwz_message_arg6 '\\',
  232.           iwz_message_arg7 '\\',
  233.           iwz_message_arg8;
  234. select;
  235.   when language = 'ENG' then
  236.     call message_eng;
  237.   when language = 'JPN' then
  238.     call message_jpn;
  239.   otherwise
  240.     call message_eng;
  241.   end;
  242. return;
  243. /* */
  244. message_eng:
  245. select;
  246.  
  247. when iwz_message_num = 1 then do;
  248. call addmsg center(' Start of MVS data set information ',iwz_message_arg1,'-');
  249. end;
  250.  
  251. when iwz_message_num = 2 then do;
  252. call addmsg 'The member name is an alias name.  If you update';
  253. call addmsg 'the member it will break the alias connection.';
  254. end;
  255.  
  256. when iwz_message_num = 3 then do;
  257. call addmsg 'The member name has alias names.  If you update';
  258. call addmsg 'the member it will break the alias connections.';
  259. end;
  260.  
  261. when iwz_message_num = 4 then do;
  262. call addmsg ' ';
  263. call addmsg 'The editing session has been set to read only to prevent';
  264. call addmsg 'the data set from being modified due to the following:';
  265. end;
  266.  
  267. when iwz_message_num = 5 then do;
  268. call addmsg '- The data set contains object code';
  269. end;
  270.  
  271. when iwz_message_num = 6 then do;
  272. call addmsg '- The data set is a load module';
  273. end;
  274.  
  275. when iwz_message_num = 7 then do;
  276. call addmsg '- The data set contains a compilation listing';
  277. end;
  278.  
  279. when iwz_message_num = 8 then do;
  280. call addmsg '- The data set contains a ADATA output';
  281. end;
  282.  
  283. when iwz_message_num = 9 then do;
  284. call addmsg '- The data set contains pre-compiler output';
  285. end;
  286.  
  287. when iwz_message_num = 10 then do;
  288. call addmsg '- The data set contains MVS job SYSOUT output';
  289. end;
  290.  
  291. when iwz_message_num = 11 then do;
  292. call addmsg ' ';
  293. call addmsg '- The data set contains characters whose hex positions';
  294. call addmsg '  are either below hex 40 or represent non-printable';
  295. call addmsg '  characters.  These characters cannot be converted';
  296. call addmsg '  between MVS EBCDIC and workstation ASCII for';
  297. call addmsg '  editing at the workstation.  Note that the file you';
  298. call addmsg '  are viewing is a copy of your original file where';
  299. call addmsg '  these characters appear as' iwz_message_arg1;
  300. end;
  301.  
  302. when iwz_message_num = 12 then do;
  303. call addmsg ' ';
  304. call addmsg center(' End of MVS data set information ',iwz_message_arg1,'-');
  305. end;
  306.  
  307. otherwise
  308. call sayit 'Invalid message number' iwz_message_num;
  309. end;
  310. return;
  311. /* */
  312. message_jpn:
  313. call addmsg 'Japanese message';
  314. select;
  315.  
  316. when iwz_message_num = 1 then do;
  317. call addmsg center(' Start of MVS data set information ',iwz_message_arg1,'-');
  318. end;
  319.  
  320. when iwz_message_num = 2 then do;
  321. call addmsg 'The member name is an alias name.  If you update';
  322. call addmsg 'the member it will break the alias connection.';
  323. end;
  324.  
  325. when iwz_message_num = 3 then do;
  326. call addmsg 'The member name has alias names.  If you update';
  327. call addmsg 'the member it will break the alias connections.';
  328. end;
  329.  
  330. when iwz_message_num = 4 then do;
  331. call addmsg ' ';
  332. call addmsg 'The editing session has been set to read only to prevent';
  333. call addmsg 'the data set from being modified due to the following:';
  334. end;
  335.  
  336. when iwz_message_num = 5 then do;
  337. call addmsg '- The data set contains object code';
  338. end;
  339.  
  340. when iwz_message_num = 6 then do;
  341. call addmsg '- The data set is a load module';
  342. end;
  343.  
  344. when iwz_message_num = 7 then do;
  345. call addmsg '- The data set contains a compilation listing';
  346. end;
  347.  
  348. when iwz_message_num = 8 then do;
  349. call addmsg '- The data set contains a ADATA output';
  350. end;
  351.  
  352. when iwz_message_num = 9 then do;
  353. call addmsg '- The data set contains pre-compiler output';
  354. end;
  355.  
  356. when iwz_message_num = 10 then do;
  357. call addmsg '- The data set contains MVS job SYSOUT output';
  358. end;
  359.  
  360. when iwz_message_num = 11 then do;
  361. call addmsg ' ';
  362. call addmsg '- The data set contains characters whose hex positions';
  363. call addmsg '  are either below hex 40 or represent non-printable';
  364. call addmsg '  characters.  These characters cannot be converted';
  365. call addmsg '  between MVS EBCDIC and workstation ASCII for';
  366. call addmsg '  editing at the workstation.  Note that the file you';
  367. call addmsg '  are viewing is a copy of your original file where';
  368. call addmsg '  these characters appear as' iwz_message_arg1;
  369. end;
  370.  
  371. when iwz_message_num = 12 then do;
  372. call addmsg ' ';
  373. call addmsg center(' End of MVS data set information ',iwz_message_arg1,'-');
  374. end;
  375.  
  376. otherwise
  377. call sayit 'Invalid message number' iwz_message_num;
  378. end;
  379. return;
  380. Get_MVSINFO:
  381. Procedure expose env cobolroot mvsinfo. whoami tempdir trace
  382.  
  383. rtn = 0
  384. null = '0000'x
  385. crlf = '0D0A'x
  386. mvsinfo. = ''
  387. mvsinfoQ = translate('iwzm_MVSINFO.DAT_YALE');
  388.  
  389. oldq = rxqueue('Set',mvsinfoQ)   /* switch to mvsinfo queue */
  390. if queued() = 0 then do                   /* if Q is missing we'll */
  391.   qname = rxqueue('Create',mvsinfoQ)      /* create it and put a bad */
  392.   if qname = mvsinfoQ then push 'Sven'    /* timestamp on it, else */
  393.   else x=rxqueue('Delete',qname)          /* it was in use (we hope) */
  394.   end                                     /* so we'll assume we can */
  395. parse pull mvsstuff; push mvsstuff        /* get/replace Q contents */
  396. parse value mvsstuff with ts (null) . cobolroot (null) mvsstuff /* get */
  397.                                         /* timestamp and cobolroot */
  398. if ts <> 'Sven' then do;
  399.   mvsinfo = cobolroot'\MACROS\MVSINFO.DAT'
  400.   bad_mvsinfo = '    **' whoami '****'crlf'    **error*' mvsinfo,
  401.                 'is unavailable, missing or empty **'
  402.  
  403.   x=SysFileTree(mvsinfo,'ts','F')       /* get MVSINFO.DAT's timestamp */
  404.   if ts.0 <> 1 then do
  405.     say bad_mvsinfo
  406.     return 12;
  407.     end
  408.   parse var ts.1 v0 v1 v2 .
  409.   timestamp ='mvsinfo.dat.timestamp' v0 v1 v2
  410.   end;
  411. else
  412.   timestamp = 'Yale'
  413. if timestamp <> ts then do              /* timestamps match? */
  414.   pull mvsstuff                         /* no, remove bad contents */
  415.   rtn = "iwzmIR.CMD"()                /* ask for new stuff */
  416.   if rtn = 0 then do
  417.     parse pull mvsstuff; push mvsstuff    /* get/replace Q contents */
  418.                                         /* remove timestamp and     */
  419.                                         /* cobolroot                */
  420.     parse value mvsstuff with . (null) . cobolroot ( null) mvsstuff
  421.     end
  422.   end
  423. qname = rxqueue('Set',oldq)      /* restore normal queue */
  424.  
  425. do while (mvsstuff<>'') & (rtn=0)   /* mvsinfo. structure */
  426.   parse value mvsstuff with key val (null) mvsstuff
  427.   if mvsinfo.key = '' then do       /* e.g. mvsinfo.TYPE='' */
  428.     mvsinfo.KEYS = mvsinfo.KEYS key /* no substitution for KEYS */
  429.     mvsinfo.key.1 = val             /* e.g. mvsinfo.TYPE.1=val  */
  430.     mvsinfo.key = 1                 /* e.g. mvsinfo.TYPE=1      */
  431.     end
  432.   else do
  433.     x = mvsinfo.key + 1             /* e.g. mvsinfo.TYPE+1     */
  434.     mvsinfo.key.x = val             /* e.g. mvsinfo.TYPE.2=val */
  435.     mvsinfo.key = x                 /* e.g. mvsinfo.TYPE=2     */
  436.     end
  437.   end
  438.  
  439. return rtn
  440.  
  441. Set_MVSINFO_Vars:
  442.  
  443.  parse var mvsinfo.CLOSECMD.1 closecmd;
  444.  parse var mvsinfo.CLOSEFILE.1 closefile;
  445.  parse var mvsinfo.FILESYS.1 filesys accessmon testaccess;
  446.  parse var mvsinfo.FSSTARTCMD.1 fsstartcmd;
  447.  parse var mvsinfo.FSSTOPCMD.1 fsstopcmd;
  448.  parse var mvsinfo.HEADER.1 header;
  449.  parse var mvsinfo.JOBLOG.1 joblog;
  450.  parse var mvsinfo.MAXCMD.1 maxcmd;
  451.  parse var mvsinfo.LANGUAGE.1 language;
  452.  parse var mvsinfo.MOUNTCMD.1 mountcmd;
  453.  parse var mvsinfo.MVSCOMM.1 mvscomm;
  454.  parse var mvsinfo.iwzmEDT.1 iwzmedt;
  455.  parse var mvsinfo.NFS.1 nfs;
  456.  parse var mvsinfo.NULLSTDIN.1 nullstdin;
  457.  parse var mvsinfo.OUTSHOW.1 outshow;
  458.  parse var mvsinfo.PROTSAVE.1 protsave tempmult;
  459.  parse var mvsinfo.PWD.1 pwd pwdasis pwdt pwde;
  460.  parse var mvsinfo.READTIMEOUT.1 readtimeout;
  461.  parse var mvsinfo.REXECCMD.1 rexeccmd;
  462.  parse var mvsinfo.SDU.1 sdu;
  463.  parse var mvsinfo.SIGYCLST.1 sigyclst;
  464.  parse var mvsinfo.SYSPROC.1 sysproc;
  465.  parse var mvsinfo.SYSTEM.1 system;
  466.  parse var mvsinfo.TEMPDRIVE.1 tempdrive;
  467.  parse var mvsinfo.TEMPDATA.1 tempdata;
  468.  parse var mvsinfo.TESTFILE.1 testfile;
  469.  parse var mvsinfo.TRACE.1 trace tracekeep;
  470.  parse var mvsinfo.TRACECMD.1 tracecmd;
  471.  parse var mvsinfo.TRACEMOD.1 tracemod;
  472.  parse var mvsinfo.UMOUNTCMD.1 umountcmd;
  473.  parse var mvsinfo.USERID.1 userid;
  474.  parse var mvsinfo.WORKSYS.1 worksys;
  475.  parse var mvsinfo.WRITETIMEOUT.1 writetimeout;
  476.  
  477.  parse var mvsinfo.DRIVE numdrive;
  478.  if numdrive = '' then
  479.    numdrive = 0;
  480.  do ii = 1 to numdrive;
  481.    parse var mvsinfo.DRIVE.ii,
  482.              drive.ii highqual.ii trans.ii mapping.ii sidefile.ii;
  483.    end;
  484.  
  485.  parse var mvsinfo.TYPE numtype;
  486.  if numtype = '' then
  487.    numtype = 0;
  488.  do ii = 1 to numtype;
  489.    parse var mvsinfo.TYPE.ii type.ii ext.ii;
  490.    end;
  491.  
  492. return
  493.  
  494. /* */
  495. Traceit:
  496.  parse arg iwz_trc_level iwz_trc_message;
  497.  if iwz_trc_level > trace then
  498.    return;
  499.  if pwd <> '********' & pwd <> '++++++++' & pwd <> '========' then
  500.    do;
  501.    do forever;
  502.      if pos(pwd,iwz_trc_message) = 0 then
  503.        leave;
  504.      parse var iwz_trc_message iwz_trc_message1 (pwd) iwz_trc_message2;
  505.      iwz_trc_message = iwz_trc_message1||'********'||iwz_trc_message2
  506.      end;
  507.    end
  508.  iwz_trc_message = date('O') time('L') whoami':' iwz_trc_message;
  509.  xx = lineout(tempdir'\iwzmTRC.TRC',iwz_trc_message);
  510.  xx = stream(tempdir'\iwzmTRC.TRC','C','CLOSE');
  511.  if tracecmd <> '' then
  512.    interpret tracecmd;
  513. return;
  514.  
  515. /* */
  516. sayit:
  517.  parse arg iwz_sayit_arg;
  518.  if trace > 2 then
  519.    call traceit 3 '--->' iwz_sayit_arg;
  520.  say iwz_sayit_arg;
  521. return;
  522. /*
  523. :runit
  524. @rexx %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
  525. @rem */
  526.