home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / ls4adm.zip / Aliases.cmd next >
OS/2 REXX Batch file  |  1994-04-26  |  3KB  |  91 lines

  1. /***************************/
  2. /* (c) IBM Australia 1994  */
  3. /* Author:  Paul Szilard   */
  4. /***************************
  5. Function:
  6. ~~~~~~~~~
  7. Lists all aliases and their servers, paths, etc in CSV format
  8. allowing ready insertion into spreadsheets or database files
  9. for further analysis or reporting.
  10.  
  11. Simply redirect the output to save for further use.
  12.  
  13. Usage: ALIASES [/H | /NH]
  14.  
  15.           /H = With    Column Headers
  16.          /NH = Without Column Headers
  17.           /? = Help
  18.            ? = Help
  19.  
  20. Pre/Co-Reqs: 
  21.        Basic OS/2 REXX. No extensions required in this prog.
  22.  
  23. Notes: 1) Error handling is non-existant. Check output!
  24.        2) To read into Excel 4, just open redirected output file
  25.           and select Comma as delimiter for text files. Save as
  26.           Normal Excel file.
  27. ***************************/
  28. /* Set default: 1= HEADER  0= NO HEADER */
  29. HEADER=0
  30. parse upper arg OPTIONS .
  31. OPTIONS=strip(OPTIONS)
  32. select
  33.    when OPTIONS='/H'  then HEADER=1
  34.    when OPTIONS='/NH' then HEADER=0
  35.    when POS('?',OPTIONS)>0 then do
  36.       call USAGE
  37.       exit
  38.       end  /* Do */
  39.    otherwise nop
  40. end  /* select */
  41.  
  42. '@net alias | rxqueue/fifo'
  43. call PULLQUEUE
  44.  
  45. do i=4 to LINE.0-1
  46.    ALIAS.i=word(LINE.i,1)
  47. end /* do */
  48.  
  49. if HEADER=1 then say '"'ALIAS'","'DESCRIPTION'","'SERVER'","'PATH'","'WHEN SHARED'","'MAX USERS'"'
  50.  
  51. do i=4 to LINE.0-1
  52.    '@net alias' ALIAS.i '| rxqueue /fifo'
  53.    call PULLQUEUE
  54.    do j=2 to 6
  55.       parse var LINE.j title ':' FIELD.j
  56.       field.j=strip(field.j)
  57.    end /* do */
  58.    say '"'ALIAS.i'","'FIELD.2'","'field.3'","'field.4'","'field.5'","'field.6'"'
  59. end /* do */
  60.  
  61. exit(0)
  62.  
  63. /*-----------*/
  64. /* Functions */
  65. /*-----------*/
  66.  
  67. PULLQUEUE: procedure expose LINE.
  68.   LINE.0 = queued()
  69.   do i = 1 to LINE.0
  70.     parse pull LINE.i
  71.   end
  72. return
  73.  
  74. USAGE:
  75. say 'Function:                                                    '
  76. say '~~~~~~~~~                                                    '
  77. say 'Lists all aliases and their servers, paths, etc in CSV format'
  78. say 'allowing ready insertion into spreadsheets or database files '
  79. say 'for further analysis or reporting.                           '
  80. say '                                                             '
  81. say 'Simply redirect the output to save for further use.          '
  82. say '                                                             '
  83. say 'Usage: ALIASES [/H | /NH]                                    '
  84. say '                                                             '
  85. say '          /H = With    Column Headers                        '
  86. say '         /NH = Without Column Headers                        '
  87. say '          /? = Help                                          '
  88. say '           ? = Help                                          '
  89. say '                                                             '
  90. return
  91.