home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Collection - Online Library - January 1996 / CKITOS2196.ISO / diskette / gg244043.dsk / unc.dsk / LS30UTIL / INSASN.CMD < prev    next >
OS/2 REXX Batch file  |  1993-03-05  |  4KB  |  110 lines

  1. /*******************************************************************/
  2. /* INSASN.CMD                                                      */
  3. /*                                                                 */
  4. /* Insert logon assignemts from a assignment list file.            */
  5. /* The procedure sets the logon assignments for users and logon    */
  6. /* assignments listed in a assignment file. The assignment file    */
  7. /* can be generated as a result from the GETASN.CMD and ALLASN.CMD */
  8. /* procedures. The format of the logon assignment input file is    */
  9. /* for example:                                                    */
  10. /*                                                                 */
  11. /*                  userid= DEPT001                                */
  12. /*                  D=   G:     FILESDIR                           */
  13. /*                  A=          PUBLICAP                           */
  14. /*                                                                 */
  15. /*                  userid= DEPT002                                */
  16. /*                  D=   O:     FILESDIR                           */
  17. /*                  D=   COM7   COMPORT                            */
  18. /*                  A=          PUBLICAP                           */
  19. /*                                                                 */
  20. /* The argument is:                                                */
  21. /*                                                                 */
  22. /*  assignListFile  The file name of the users assignments         */
  23. /*                                                                 */
  24. /* If an logon assignment is already set, a return code 85         */
  25. /* will be received. (ERROR_ALREADY_ASSIGNED)                      */
  26. /*                                                                 */
  27. /*******************************************************************/
  28.  
  29. parse upper arg assignListFile dummy
  30.  
  31. call LoadFuncs; /* Load DLL utility functions */
  32.  
  33. /* Must have all arguments with values */
  34. if userList='' then do
  35.  say 'User assign list file is required for the insert assignments'
  36.  say 'procedure.'
  37.  exit 9
  38. end
  39.  
  40. /* Ready to read assignment list file */
  41. parse upper value linein(assignListFile,1,1) with type device aliasname
  42. if LINES(assignListFile) = '0' then do
  43.  say 'Could not obtain correct logon assignment list file'
  44.  exit 9
  45. end
  46.  
  47. do until LINES(assignListFile) = '0'
  48.  
  49.  if firstTime = 0 then do
  50.   parse upper value linein(assignListFile) with type device aliasname
  51.  end
  52.  else do
  53.   parse upper value linein(assignListFile,1,1) with type device aliasname
  54.   firstTime = 0
  55.  end
  56.  
  57.  select
  58.   when type = 'USERID=' then do
  59.    userid = device
  60.   end
  61.   when type = 'A=' then do
  62.    if aliasname = '' then do
  63.     aliasname = device
  64.     device = ''
  65.    end
  66.    rc = SetLogonAsn(userid, type, device, STRIP(aliasname) )
  67.    if rc <> '0' then do
  68.     say 'SetLogonAsn returned ' rc
  69.    end
  70.   end
  71.   when type = 'D=' then do
  72.    if aliasname = '' then do
  73.     aliasname = device
  74.     device = ''
  75.    end
  76.    rc = SetLogonAsn(userid, type, device, STRIP(aliasname) )
  77.    if rc <> '0' then do
  78.     say 'SetLogonAsn returned ' rc
  79.    end
  80.   end
  81.   otherwise
  82.  end
  83.  
  84. end
  85.  
  86. call DropFuncs
  87. exit 0
  88.  
  89. /*************************************************************/
  90. /* Load DLL Functions                                        */
  91. /*************************************************************/
  92. LoadFuncs:
  93.  
  94.  /* Load LS30UT.DLL functions */
  95.  call RxFuncAdd 'LoadLs30utFuncs', 'LS30UT', 'LoadLs30utFuncs'
  96.  call LoadLs30utFuncs
  97.  
  98. return
  99.  
  100. /*************************************************************/
  101. /* Drop DLL Functions                                        */
  102. /*************************************************************/
  103. DropFuncs:
  104.  
  105.  /* Drop LS30UT.DLL functions */
  106.  call DropLs30utFuncs
  107.  
  108. return
  109.  
  110.