home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Extra 1997 #5 / AmigaPlus_Extra-CD_5-97.iso / online-tools / mail / ems / rexx / count.ems < prev    next >
Text File  |  1993-07-29  |  2KB  |  72 lines

  1. /* Count.ems */
  2.  
  3. options results
  4. signal on error
  5. signal on syntax
  6.  
  7. if( ~show( 'l', "ems_rexx.library" ) ) then
  8. do
  9.    if( ~addlib( "ems_rexx.library", 0, -30, 0 ) )then
  10.    do
  11.       say "Could not open ems_rexx.library"
  12.       exit 10
  13.    end
  14. end
  15.  
  16. call EMS_Areas( 'areas' )
  17.  
  18. count_msg.0  = areas.0 + 1; tot_msg  = 0
  19. count_file.0 = areas.0 + 1; tot_file = 0
  20.  
  21. do i=1 to areas.0
  22.  
  23.    count_msg.i  = 0
  24.    count_file.i = 0
  25.  
  26.    if EMS_Area_Msg_DBname(  areas.i ) ~= '' then do; call EMS_Area_Item_List( areas.i, 'MSG' , 'items' ); count_msg.i  = items.0; drop items.; end
  27.    if EMS_Area_File_DBname( areas.i ) ~= '' then do; call EMS_Area_Item_List( areas.i, 'FILE', 'items' ); count_file.i = items.0; drop items.; end
  28.  
  29.    tot_msg  = tot_msg  + count_msg.i
  30.    tot_file = tot_file + count_file.i
  31.  
  32. end
  33.  
  34. count_msg.i  = tot_msg
  35. count_file.i = tot_file
  36.  
  37. width_areas = EMS_Calc_Stem_Width( 'areas'     , 'ADAPT'       )
  38. width_msg   = EMS_Calc_Stem_Width( 'count_msg' , 'ADAPT_RIGHT' )
  39. width_file  = EMS_Calc_Stem_Width( 'count_file', 'ADAPT_RIGHT' )
  40.  
  41. say '|'
  42. say '| Number of messages in areas:'
  43.  
  44.  
  45. do i=1 to areas.0
  46.  
  47.    say '| Area' areas.i 'has' count_msg.i 'message(s)  ' count_file.i 'file(s)'
  48.  
  49.  
  50. end
  51.  
  52.  
  53. say '|------------------------------------------------------------------'
  54. say '|' copies( ' ', width_areas ) 'Total : ' count_msg.i 'message(s)  ' count_file.i 'file(s)'
  55. say '| End Of List'
  56.  
  57.  
  58. call EMS_FreeScriptData()
  59. exit 0
  60.  
  61. error:
  62. syntax:
  63.  
  64. error_text = EMS_LastError()
  65.  
  66. if error_text = '' then error_text = rc ErrorText( rc )
  67.  
  68. say '| ***BREAK: error at' sigl error_text
  69.  
  70. call EMS_FreeScriptData()
  71. exit rc
  72.