home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rplrxenu.zip / rplrxenu.cmd
OS/2 REXX Batch file  |  1996-02-20  |  7KB  |  197 lines

  1. /**2/REXX*********************************************************************/
  2. /* Function Name: RPLRXENU                                                   */
  3. /*****************************************************************************/
  4. /* Function Description:                                                     */
  5. /*                                                                           */
  6. /* This routine will list a specified amount of information for all RIPL     */
  7. /* machines of a specific type using the RxNetEnumRIPLMachine API call.      */
  8. /*****************************************************************************/
  9. /* Example:                                                                  */
  10. /*                                                                           */
  11. /* RPLRXENU /L:2 /T:O                                                        */
  12. /*****************************************************************************/
  13. /* Algorithm:                                                                */
  14. /*                                                                           */
  15. /* begin rplrxenu                                                            */
  16. /* |>if there are no input parameters then display the syntax                */
  17. /* |>load and verify input parameters                                        */
  18. /* |>call RxNetEnumRIPLMachine API                                           */
  19. /* |>display the information returned from the API                           */
  20. /* |>exit with resulting return code                                         */
  21. /* end rplrxenu                                                              */
  22. /*****************************************************************************/
  23. /* trace ?i */
  24. if arg() = 0 then
  25. do
  26.   say 'Enumerate RIPL Machines--Command Syntax:'
  27.   say 'RPLRXENU /L: /T: [/S:]'
  28.   say '/L: Level of detail from API(0-2)'
  29.   say '/T: Type of RIPL clients to enumerate(O | D | A)'
  30.   say '    O->OS/2'
  31.   say '    D->DOS'
  32.   say '    A->All'
  33.   say '/S: remote IPL Server name(<= 15)'
  34.   exit 0
  35. end
  36. Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  37. Call SysLoadFuncs
  38. call RxFuncAdd 'RxRegRIPLFuncs', 'RXRPLEXT', 'RXREGRIPLFUNCS'
  39. call RxRegRIPLFuncs
  40. /*****************************************************************************/
  41. /* initialize variables                                                      */
  42. /*****************************************************************************/
  43. rc       = 0
  44. level    = -1
  45. type     = ''
  46. ripl_svr = ''
  47. /*****************************************************************************/
  48. /* load and verify parameters                                                */
  49. /*****************************************************************************/
  50. arg p.0 p.1 p.2 p.3
  51. if p.3 <> '' then
  52. do
  53.   rc = 8
  54.   call error
  55. end
  56. do i = 0 to 2
  57.   if p.i <> '' then
  58.   do
  59.     sep_pos = pos(':', p.i)
  60.     if sep_pos = 0 then
  61.     do
  62.       rc = 19
  63.       call error
  64.     end
  65.     parm_sec     = sep_pos - 1
  66.     parm         = substr(p.i, 1, parm_sec)
  67.     parm_val_sec = length(p.i) - sep_pos
  68.     parm_val     = substr(p.i, sep_pos+1, parm_val_sec)
  69.     if      parm = '/L' then
  70.     do
  71.       if (parm_val <> 0) & (parm_val <> 1) & (parm_val <> 2) then
  72.       do
  73.         rc = 20
  74.         call error
  75.       end
  76.       level = parm_val
  77.     end
  78.     else if parm = '/T' then
  79.     do
  80.       if (parm_val <> 'O') & (parm_val <> 'D') & (parm_val <> 'A') then
  81.       do
  82.         rc = 21
  83.         call error
  84.       end
  85.       type = parm_val
  86.     end
  87.     else if parm = '/S' then
  88.     do
  89.       if length(parm_val) > 15 then
  90.       do
  91.         rc = 16
  92.         call error
  93.       end
  94.       ripl_svr = '\\' || parm_val
  95.     end
  96.     else
  97.     do
  98.       rc = 17
  99.       call error
  100.     end
  101.   end
  102. end
  103. if (level = -1) | (type = '') then
  104. do
  105.   rc = 5
  106.   call error
  107. end
  108. say '▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓'
  109. say '▓RIPL Client Enumeration Data▓'
  110. say '▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓'
  111. if (type = 'O') | (type = 'A') then
  112. do
  113.   call RxNetEnumRIPLMachine ripl_svr, level, '1', stem
  114.   if RESULT <> 0 then
  115.   do
  116.     if RESULT < 2100 then
  117.       msg = SysGetMessage(RESULT)
  118.     else
  119.       msg = SysGetMessage(RESULT, 'NET.MSG')
  120.     say msg
  121.     exit RESULT
  122.   end
  123. /*****************************************************************************/
  124. /* display the enumerated information for all of the OS/2 RIPL               */
  125. /* client(s) specified                                                       */
  126. /*****************************************************************************/
  127.   do i = 1 to stem.0
  128.       say ''
  129.       say '░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░OS' || ,
  130.           '/2░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░'
  131.       say 'machine ID:         'stem.i.name
  132.     if level <> 0 then
  133.       say 'description:        'stem.i.remark
  134.     if level = 2 then
  135.     do
  136.       say 'adapter address:    'stem.i.adapter
  137.       say 'OS/2 boot drive:    'stem.i.os2bootdrive
  138.       say 'server record ID:   'stem.i.os2recid
  139.       say 'OS/2 config. flags: 'stem.i.os2flags
  140.     end
  141.   end
  142. end
  143. if (type = 'D') | (type = 'A') then
  144. do
  145.   call RxNetEnumRIPLMachine ripl_svr, level, '2', stem
  146.   if RESULT <> 0 then
  147.   do
  148.     if RESULT < 2100 then
  149.       msg = SysGetMessage(RESULT)
  150.     else
  151.       msg = SysGetMessage(RESULT, 'NET.MSG')
  152.     say msg
  153.     exit RESULT
  154.   end
  155. /*****************************************************************************/
  156. /* display the enumerated information for all of the DOS RIPL                */
  157. /* client(s) specified                                                       */
  158. /*****************************************************************************/
  159.   do i = 1 to stem.0
  160.       say ''
  161.       say '░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░DO' || ,
  162.           'S░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░'
  163.       say 'machine ID:         'stem.i.name
  164.     if level <> 0 then
  165.       say 'description:        'stem.i.remark
  166.     if level = 2 then
  167.     do
  168.       say 'adapter address:    'stem.i.adapter
  169.       say 'DOS image ID:       'stem.i.dosimageid
  170.       say 'server record ID:   'stem.i.dosrecid
  171.     end
  172.   end
  173. end
  174. exit 0
  175. /*****************************************************************************/
  176. /* this routine displays the appropriate error message then exits            */
  177. /*****************************************************************************/
  178. error:
  179. if      rc = 5 then
  180.   say 'at least one of the necessary parameters was not specified'
  181. else if rc = 8 then
  182.   say 'an incorrect number of parameters was specified'
  183. else if rc = 16 then
  184. do
  185.   say 'the remote IPL server name specified is more than 15 characters in'
  186.   say 'length'
  187. end
  188. else if rc = 17 then
  189.   say 'an invalid parameter was specified'
  190. else if rc = 19 then
  191.   say 'a parameter was specified with an invalid format'
  192. else if rc = 20 then
  193.   say 'an incorrect value was specified for the level(/L:) parameter'
  194. else if rc = 21 then
  195.   say 'an incorrect value was specified for the type(/T:) parameter'
  196. exit rc
  197.