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

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