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

  1. /**2/REXX*********************************************************************/
  2. /* Function Name: RPLRXDEL                                                   */
  3. /*****************************************************************************/
  4. /* Function Description:                                                     */
  5. /*                                                                           */
  6. /* This routine will delete a RIPL client using the RxNetDeleteRIPLMachine   */
  7. /* API call.                                                                 */
  8. /*****************************************************************************/
  9. /* Example:                                                                  */
  10. /*                                                                           */
  11. /* RPLRXDEL /M:A_MACH                                                        */
  12. /*****************************************************************************/
  13. /* Algorithm:                                                                */
  14. /*                                                                           */
  15. /* begin rplrxdel                                                            */
  16. /* |>if there are no input parameters then display the syntax                */
  17. /* |>load and verify input parameters                                        */
  18. /* |>call RxNetDeleteRIPLMachine API                                         */
  19. /* |>exit with resulting return code                                         */
  20. /* end rplrxdel                                                              */
  21. /*****************************************************************************/
  22. /* trace ?i */
  23. if arg() = 0 then
  24. do
  25.   say 'Delete RIPL Machine--Command Syntax:'
  26.   say 'RPLRXDEL /M: [/S:]'
  27.   say '/M: OS/2 Machine ID(<= 15) or DOS Machine ID(<= 8)'
  28.   say '/S: remote IPL Server name(<= 15)'
  29.   exit 0
  30. end
  31. Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  32. Call SysLoadFuncs
  33. call RxFuncAdd 'RxRegRIPLFuncs', 'RXRPLEXT', 'RXREGRIPLFUNCS'
  34. call RxRegRIPLFuncs
  35. /*****************************************************************************/
  36. /* initialize variables                                                      */
  37. /*****************************************************************************/
  38. rc       = 0
  39. mach_id  = ''
  40. ripl_svr = ''
  41. /*****************************************************************************/
  42. /* load and verify parameters                                                */
  43. /*****************************************************************************/
  44. arg p.0 p.1 p.2
  45. if p.2 <> '' then
  46. do
  47.   rc = 8
  48.   call error
  49. end
  50. do i = 0 to 1
  51.   if p.i <> '' then
  52.   do
  53.     sep_pos = pos(':', p.i)
  54.     if sep_pos = 0 then
  55.     do
  56.       rc = 19
  57.       call error
  58.     end
  59.     parm_sec     = sep_pos - 1
  60.     parm         = substr(p.i, 1, parm_sec)
  61.     parm_val_sec = length(p.i) - sep_pos
  62.     parm_val     = substr(p.i, sep_pos+1, parm_val_sec)
  63.     if      parm = '/M' then
  64.     do
  65.       if length(parm_val) > 15 then
  66.       do
  67.         rc = 12
  68.         call error
  69.       end
  70.       mach_id = parm_val
  71.     end
  72.     else if parm = '/S' then
  73.     do
  74.       if length(parm_val) > 15 then
  75.       do
  76.         rc = 16
  77.         call error
  78.       end
  79.       ripl_svr = '\\' || parm_val
  80.     end
  81.     else
  82.     do
  83.       rc = 17
  84.       call error
  85.     end
  86.   end
  87. end
  88. if mach_id = '' then
  89. do
  90.   rc = 5
  91.   call error
  92. end
  93. call RxNetDeleteRIPLMachine ripl_svr, mach_id
  94. if RESULT <> 0 then
  95. do
  96.   if RESULT < 2100 then
  97.     msg = SysGetMessage(RESULT)
  98.   else
  99.     msg = SysGetMessage(RESULT, 'NET.MSG')
  100.   say msg
  101.   exit RESULT
  102. end
  103. say 'the specified RIPL client was deleted successfully'
  104. exit 0
  105. /*****************************************************************************/
  106. /* this routine displays the appropriate error message then exits            */
  107. /*****************************************************************************/
  108. error:
  109. if      rc = 5 then
  110.   say 'at least one of the necessary parameters was not specified'
  111. else if rc = 8 then
  112.   say 'an incorrect number of parameters was specified'
  113. else if rc = 12 then
  114.   say 'the machine ID specified is more than 15 characters in length'
  115. else if rc = 16 then
  116. do
  117.   say 'the remote IPL server name specified is more than 15 characters in'
  118.   say 'length'
  119. end
  120. else if rc = 17 then
  121.   say 'an invalid parameter was specified'
  122. else if rc = 19 then
  123.   say 'a parameter was specified with an invalid format'
  124. exit rc
  125.