home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / cemt2.zip / cemtutil.CMD next >
OS/2 REXX Batch file  |  1995-08-05  |  15KB  |  385 lines

  1. /* ╔═════════════════════════════ REXX ═════════════════════════════╗ */
  2. /* ║                                                                ║ */
  3. /* ║  Name: CEMTUTIL.CMD                                            ║ */
  4. /* ║                                                                ║ */
  5. /* ║  Type: OS/2 command procedure                                  ║ */
  6. /* ║                                                                ║ */
  7. /* ║  Desc: REXX procedure to test the features of the CEMTUTIL.DLL ║ */
  8. /* ║                                                                ║ */
  9. /* ║  Creation date: 5 Aug 1995, creation time: 14:18:34            ║ */
  10. /* ║                                                                ║ */
  11. /* ║  Author: (c) Volker Bandke                                     ║ */
  12. /* ║                                                                ║ */
  13. /* ╚════════════════════════════════════════════════════════════════╝ */
  14.  
  15. SIGNAL ON HALT
  16. SIGNAL ON ERROR
  17. SIGNAL ON FAILURE
  18. SIGNAL ON SYNTAX
  19.  
  20. /*┌─────────────────────────────────────────────────────────────────┐*/
  21. /*│ Load all additional functions that we need                      │*/
  22. /*└─────────────────────────────────────────────────────────────────┘*/
  23. Call RxFuncAdd "SysLoadFuncs",  "rexxutil",  "SysLoadFuncs"
  24. call SysLoadFuncs
  25. call RxFuncAdd "Rx_CEMT_LoadFuncs", "CEMTUTIL", "Rx_CEMT_LoadFuncs"
  26. call Rx_CEMT_LoadFuncs
  27. /*┌─────────────────────────────────────────────────────────────────┐*/
  28. /*│ Test of Rx_CEMT_ListSystems call                                │*/
  29. /*└─────────────────────────────────────────────────────────────────┘*/
  30. call SysCls;
  31. say
  32. say "┌─────────────────────────────────────────────────────────────────┐"
  33. say "│ Testing the Rx_CEMT_ListSystems call                            │"
  34. say "└─────────────────────────────────────────────────────────────────┘"
  35. say
  36. RC=Rx_CEMT_ListSystems("CICSSYS")
  37. say "Returncode from Rx_CEMT_ListSystems is" RC
  38. if (rc=0) then
  39.  do
  40.   select
  41.    when CICSSYS.0=0 then X= "There is no system"
  42.    when CICSSYS.0=1 then X= "There is one system"
  43.    otherwise             X= "There are" CICSSYS.0 "systems"
  44.   end
  45.   say X "that can be connected to"
  46.   if CICSSYS.0 > 0 then
  47.    do i = 1 to CICSSYS.0
  48.     parse value CICSSYS.i with sysid description
  49.     if description="" then description="(none)"
  50.     say "SYSID:" sysid ", Description:" description
  51.    end
  52.  end
  53. else
  54.  do
  55.   say "Rx_CEMT_ListSystems ended with RC=" RC
  56.   say "The ECI Error code was" CICSSYS.ECI_RC
  57.   say "This error code actually means" CICSSYS.ECI_RC$
  58.  end
  59. /* endif */
  60. /*┌─────────────────────────────────────────────────────────────────┐*/
  61. /*│ Test of Rx_CEMT_Inq_System call                                 │*/
  62. /*└─────────────────────────────────────────────────────────────────┘*/
  63. say "Press the <ENTER> key to continue"
  64. pull dummy
  65. call SysCls;
  66. say
  67. say "┌─────────────────────────────────────────────────────────────────┐"
  68. say "│ Testing the Rx_CEMT_Inq_System call                             │"
  69. say "└─────────────────────────────────────────────────────────────────┘"
  70. say
  71. parse value Rx_CEMT_Inq_System() with eci_code sysid applid opsys cicsrel oprel cwalen
  72. if (eci_code=0) then
  73.  do
  74.   say "Sysid ....................." sysid
  75.   say "Applid ...................." applid
  76.   select
  77.    when opsys='P' then opsys='OS/2'
  78.    when opsys='X' then opsys='MVS/ESA'
  79.    otherwise opsys="Unknown"
  80.   end
  81.   say "Operating system .........." opsys
  82.   say "Operating system release .." oprel%10 ||'.'|| oprel//10
  83.   say "CICS release .............." substr(cicsrel,1,2)||'.'||substr(cicsrel,3,2)
  84.   say "Length of CWA ............." cwalen
  85.  end
  86. else
  87.  do
  88.   say "The Rx_CEMT_INQ_System failed with ECI_RC =" eci_code
  89.  end
  90. /*endif (RC=0) then */
  91. /*┌─────────────────────────────────────────────────────────────────┐*/
  92. /*│ Test of Rx_CEMT_Inq_Tasks call                                  │*/
  93. /*└─────────────────────────────────────────────────────────────────┘*/
  94. say "Press the <ENTER> key to continue"
  95. pull dummy
  96. test:
  97. call SysCls;
  98. say
  99. say "┌─────────────────────────────────────────────────────────────────┐"
  100. say "│ Testing the Rx_CEMT_Inq_Tasks call                              │"
  101. say "└─────────────────────────────────────────────────────────────────┘"
  102. say
  103. RC=Rx_CEMT_Inq_Tasks("CICSTSK");
  104. say "Returncode from Rx_CEMT_Inq_Tasks was" RC
  105. if (RC = 0) then
  106.  do
  107.   x = CICSTSK.0
  108.   say "There are" x "Tasks currently running"
  109.   if x > 0 then
  110.    say "┌─────────┬───────┬──────┬──────┬──────┐"
  111.    say "│ tasknum │ trans │ Type │ fac. │ prty │"
  112.    say "├─────────┼───────┼──────┼──────┼──────┤"
  113.    do i = 1 to CICSTSK.0
  114.     parse value CICSTSK.i with tasknum transid fac factype prty
  115.     tasknum=tasknum+0
  116.     prty=prty+0
  117.     tasknum="│ " || right(tasknum,7) || " "
  118.     transid="│ " || right(transid,5) || " "
  119.     factype="│ " || right(factype,4) || " "
  120.     fac    ="│ " || right(fac    ,4) || " "
  121.     prty   ="│ " || right(prty   ,3) || "  │"
  122.     say tasknum||transid||factype||fac||prty
  123.    end
  124.    say "└─────────┴───────┴──────┴──────┴──────┘"
  125.  end
  126. /* endif */
  127. say "ECI Return code was " CICSTSK.ECI_RC
  128. say "This has the following meaning: " CICSTSK.ECI_RC$
  129. if CICSTSK.ABCODE\= " " then say "The transaction has abended with abendcode" CICSCON.ABCODE
  130. /*┌─────────────────────────────────────────────────────────────────┐*/
  131. /*│ Test of Rx_CEMT_Inq_Connections call                            │*/
  132. /*└─────────────────────────────────────────────────────────────────┘*/
  133. say "Press the <ENTER> key to continue"
  134. pull dummy
  135. call SysCls;
  136. say
  137. say "┌─────────────────────────────────────────────────────────────────┐"
  138. say "│ Testing the Rx_CEMT_Inq_Connections call                        │"
  139. say "└─────────────────────────────────────────────────────────────────┘"
  140. say
  141. RC=Rx_CEMT_Inq_Connections("CICSCON");
  142. say "Returncode from Rx_CEMT_Inq_Connections was" RC
  143. if (RC = 0) then
  144.  do
  145.   x = CICSCON.0
  146.   say "There are" x "connections defined to other systems"
  147.   if x > 0 then
  148.    do i = 1 to CICSCON.0
  149.      parse value CICSCON.i with sysid netname servstat acqstat
  150.      select
  151.       when servstat='I' then servstat = "In Service    "
  152.       when servstat="O" then servstat = "Out of service"
  153.       when servstat="G" then servstat = "Going Out     "
  154.       otherwise servstat="Unknown"
  155.      end
  156.      select
  157.       when acqstat='A' then acqstat = "Acquired"
  158.       when acqstat='R' then acqstat = "Released"
  159.       otherwise acqstat             = "Unknown "
  160.      end
  161.      say "Sysid:" sysid ", netname:" netname "is" servstat "and" acqstat
  162.    end
  163.  end
  164. /* endif */
  165. say "ECI Return code was " CICSCON.ECI_RC
  166. say "This has the following meaning: " CICSCON.ECI_RC$
  167. if CICSCON.ABCODE\= " " then say "The transaction has abended with abendcode" CICSCON.ABCODE
  168. /*┌─────────────────────────────────────────────────────────────────┐*/
  169. /*│ Test of Rx_CEMT_Inq_Transactions call                           │*/
  170. /*└─────────────────────────────────────────────────────────────────┘*/
  171. say "Press the <ENTER> key to continue"
  172. pull dummy
  173. test:
  174. call SysCls;
  175. say
  176. say "┌─────────────────────────────────────────────────────────────────┐"
  177. say "│ Testing the Rx_CEMT_Inq_Transactions call                       │"
  178. say "└─────────────────────────────────────────────────────────────────┘"
  179. say
  180. RC=Rx_CEMT_Inq_Transactions("CICSTRN");
  181. say "Returncode from Rx_CEMT_Inq_Transactions was" RC
  182. if (RC=0) then
  183.  do
  184.   x = CICSTRN.0
  185.   say "There are" x "transactions defined in this CICS system"
  186.   if x > 0 then
  187.    do i = 1 to CICSTRN.0
  188.     parse value CICSTRN.I with transid program enastat purgstat rsysid rtranid
  189.     select
  190.      when enastat="E" then enastat="enabled"
  191.      when enastat="D" then enastat="disabled"
  192.      otherwise enastat="unknown"
  193.     end
  194.     select
  195.      when purgstat="P" then purgstat="purgeable"
  196.      when purgstat="N" then purgstat="nonpurgeable"
  197.      otherwise purgstat="unknown"
  198.     end
  199.     if program="(remote)" then
  200.      say "Transaction:" transid "is" enastat "and" purgstat "and remote in" rsysid "as" rtranid
  201.      else say "Transaction:" transid ", program: " program "is" enastat "and" purgstat
  202.    end
  203.   /* endif */
  204.  end
  205. /* endif RC=0 */
  206. say "Returncode from ECI was " CICSTRN.ECI_RC
  207. say "This returncode actually means" CICSTRN.ECI_RC$
  208. if CICSTRN.ABCODE\=" " then say "The CICS transaction abended with abcode" CICSTRN.ABCODE
  209. /*┌─────────────────────────────────────────────────────────────────┐*/
  210. /*│ Test of Rx_CEMT_Inq_File call                                   │*/
  211. /*└─────────────────────────────────────────────────────────────────┘*/
  212. say "Press the <ENTER> key to continue"
  213. pull dummy
  214. call SysCls;
  215. say
  216. say "┌─────────────────────────────────────────────────────────────────┐"
  217. say "│ Testing the Rx_CEMT_Inq_Files call                              │"
  218. say "└─────────────────────────────────────────────────────────────────┘"
  219. say
  220. RC=Rx_CEMT_Inq_Files("CICSFIL");
  221. say "Returncode from Rx_CEMT_Inq_Files was" RC
  222. if (RC=0) then
  223.  do
  224.   x = CICSFIL.0
  225.   say "There are" x "datasets defined in this CICS system"
  226.   if x > 0 then
  227.    do i = 1 to CICSFIL.0
  228.      parse value CICSFIL.I with filename enastat openstat
  229.      select
  230.       when enastat="E" then enastat="is enabled"
  231.       when enastat="D" then enastat="is disabled"
  232.       when enastat="U" then enastat="is unenabled"
  233.       otherwise enastat="has unknown enablestatus"
  234.      end
  235.      select
  236.       when openstat="O" then openstat="is open"
  237.       when openstat="C" then openstat="is closed"
  238.       otherwise openstat="has unknown openstatus"
  239.      end
  240.      say "The file" filename enastat "and" openstat
  241.    end
  242.   /* endif */
  243.  end
  244. /* endif */
  245. say "Returncode from ECI was " CICSFIL.ECI_RC
  246. say "This returncode actually means" CICSFIL.ECI_RC$
  247. if CICSFIL.ABCODE\=" " then say "The CICS transaction abended with abcode" CICSFIL.ABCODE
  248. /*┌─────────────────────────────────────────────────────────────────┐*/
  249. /*│ Test of Rx_CEMT_Inq_Programs call                               │*/
  250. /*└─────────────────────────────────────────────────────────────────┘*/
  251. say "Press the <ENTER> key to continue"
  252. pull dummy
  253. call SysCls;
  254. say
  255. say "┌─────────────────────────────────────────────────────────────────┐"
  256. say "│ Testing the Rx_CEMT_Inq_Programs call                           │"
  257. say "└─────────────────────────────────────────────────────────────────┘"
  258. say
  259. RC=Rx_CEMT_Inq_Programs("CICSPRG");
  260. say "Returncode from Rx_CEMT_Inq_Programs was" RC
  261. if (rc=0) then,
  262.  do
  263.   x = CICSPRG.0
  264.   say "There are" x "programs defined in this CICS system"
  265.   if x > 0 then
  266.    do i = 1 to CICSPRG.0
  267.      parse value CICSPRG.i with program enastatus
  268.      select
  269.       when enastatus="E" then enastatus="is enabled"
  270.       when enastatus="D" then enastatus="is disabled"
  271.       otherwise enastatus="has unknown enabledstatus"
  272.      end
  273.      say program enastatus
  274.    end
  275.   /* endif */
  276.  end
  277. /* endif */
  278. say "Returncode from ECI was " CICSPRG.ECI_RC
  279. say "This returncode actually means" CICSPRG.ECI_RC$
  280. if CICSPRG.ABCODE\=" " then say "The CICS transaction abended with abcode" CICSPRG.ABCODE
  281. /*┌─────────────────────────────────────────────────────────────────┐*/
  282. /*│ Test of Rx_CEMT_Inq_TDQueues call                               │*/
  283. /*└─────────────────────────────────────────────────────────────────┘*/
  284. say "Press the <ENTER> key to continue"
  285. pull dummy
  286. call SysCls;
  287. say
  288. say "┌─────────────────────────────────────────────────────────────────┐"
  289. say "│ Testing the Rx_CEMT_Inq_TDQueues call                           │"
  290. say "└─────────────────────────────────────────────────────────────────┘"
  291. say
  292. RC=Rx_CEMT_Inq_TDQueues("CICSTDQ");
  293. say "Returncode from Rx_CEMT_Inq_TDQueues is" RC
  294. if (RC=0) then
  295.  do
  296.   x = CICSTDQ.0
  297.   say "There are" x "transient data queues defined in this CICS system"
  298.   if x > 0 then
  299.    do i = 1 to CICSTDQ.0
  300.      parse value CICSTDQ.i with qname qtype enastat openstat term tran trigger req
  301.      select
  302.       when qtype="I" then qtype="Intra"
  303.       when qtype="E" then qtype="Extra"
  304.       when qtype="N" then qtype="Indirect"
  305.       when qtype="R" then qtype="Remote"
  306.       otherwise qtype="Unknown"
  307.      end
  308.      select
  309.       when enastat="E" then enastat="Ena"
  310.       when enastat="D" then enastat="Dis"
  311.       otherwise enastat="n/a"
  312.      end
  313.      select
  314.       when openstat="O" then openstat="Ope"
  315.       when openstat="C" then openstat="Clo"
  316.       otherwise openstat="n/a"
  317.      end
  318.      x = qname qtype enastat openstat
  319.      if qtype="Intra" then x = X || " " || term  || " " || tran || " " || trigger
  320.      say x
  321.    end
  322.   /* endif */
  323.  end
  324. /* endif */
  325. say "Returncode from ECI was " CICSTDQ.ECI_RC
  326. say "This returncode actually means" CICSTDQ.ECI_RC$
  327. if CICSTDQ.ABCODE\=" " then say "The CICS transaction abended with abcode" CICSTDQ.ABCODE
  328. /*┌─────────────────────────────────────────────────────────────────┐*/
  329. /*│ Test of Rx_CEMT_Inq_Terminals call                              │*/
  330. /*└─────────────────────────────────────────────────────────────────┘*/
  331. say "Press the <ENTER> key to continue"
  332. pull dummy
  333. call SysCls;
  334. say
  335. say "┌─────────────────────────────────────────────────────────────────┐"
  336. say "│ Testing the Rx_CEMT_Inq_Terminals call                          │"
  337. say "└─────────────────────────────────────────────────────────────────┘"
  338. say
  339. RC=Rx_CEMT_Inq_Terminals("CICSTRM");
  340. say "Returncode from Rx_CEMT_Inq_Terminals was" RC
  341. if (RC=0) then
  342.  do
  343.   x = CICSTRM.0
  344.   say "There are" x "terminals defined in this CICS system"
  345.   if x > 0 then
  346.    do i = 1 to CICSTRM.0
  347.      parse value CICSTRM.I with termid netname  acqstatus servstatus atistatus
  348.      select
  349.       when  acqstatus="A" then acqstatus = "is acquired"
  350.       when  acqstatus="R" then acqstatus = "is released"
  351.       otherwise nop
  352.      end
  353.      select
  354.       when  servstatus="I" then servstatus="and in service."
  355.       when  servstatus="O" then servstatus="and out of service."
  356.       when  servstatus="G" then servstatus="and going out of service."
  357.       otherwise nop
  358.      end
  359.      select
  360.       when atistatus="A" then atistatus=" ATI is allowed"
  361.       when atistatus="N" then atistatus=" ATI is not allowed"
  362.       otherwise nop
  363.      end
  364.      say "The terminal" termid "("||netname||")" acqstatus servstatus atistatus
  365.    end
  366.   /* endif */
  367.  end
  368. /* endif */
  369. say "Returncode from ECI was " CICSTRM.ECI_RC
  370. say "This returncode actually means" CICSTRM.ECI_RC$
  371. if CICSTRM.ABCODE\=" " then say "The CICS transaction abended with abcode" CICSTRM.ABCODE
  372. say "Press the <ENTER> key to continue"
  373. pull dummy
  374. exit
  375.  
  376. SYNTAX:
  377. ERROR:
  378. FAILURE:
  379.  say "A Syntax error occurred in line " SIGL
  380.  say "The offending statement was:"
  381.  say Sourceline(SIGL)
  382.  call vardump
  383. HALT:
  384. exit
  385.