home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / readsum.zip / MAKESEL.CMD < prev    next >
OS/2 REXX Batch file  |  1994-12-18  |  3KB  |  108 lines

  1. /* rexx */
  2.  
  3. /* 
  4. Date: 12/17/94 - version 1
  5. Author: Jamie Hoglund
  6. Contact: jhoglund@cscns.com
  7.          70244,3234@compuserve.com
  8. Script: 3/3 
  9.  
  10.   Create a _selection_ file from GroupFil and SortFil
  11.  
  12.   part of 3 Rexx files designed to aid in selecting from Summary
  13.   Files created by the uqwk Offline reader program.
  14.  
  15. -------------------------------------------------------------------------
  16.          Note: Configuration can be done by editing this file.
  17.                Use your editors "Search" function to search for
  18.                lines that have the string: "@CFG" in them.
  19. -------------------------------------------------------------------------
  20.  
  21. Use this program to create a file to upload to Uqwk for selecting articles.
  22.  
  23. GroupFil - Sortfil Seek Position, Tagged articles, Newsgroup name
  24.  
  25. SortFil - Newsgroup number, Article text, Message number
  26.  
  27. Outfil - this is created in the format that uqwk accepts.
  28.          *** newsgroup.name
  29.          0000:
  30.          0001:
  31.  
  32.          *** newsgroup.name
  33.          ...
  34.  
  35. Known Bugs:
  36.     In this script, I don't know of any. ReadSum.CMD contains a few though.
  37.     If you find any, or fix any, please let me know.
  38. */
  39.  
  40. /* Configuration information */
  41. SortFil = "SortFil.Tmp"      /*Article data, Output by Sortsum.CMD        @CFG*/
  42. GroupFil  = "Groups.Tmp"     /*Groups and Tag info, Output by Readsum.CMD @CFG*/
  43. OutFil    = "Selected.sel"   /* File for uploading to uqwk -Output        @CFG*/
  44.  
  45. /* make sure files exist */
  46. If Length(Stream(Sortfil,"C","Query exists")) = 0 then do
  47.   Say SortFil"  - Does not exist, must run sortsum.cmd, Readsum.cmd or re-configure"
  48.   exit
  49. end
  50. If Length(Stream(Groupfil,"C","Query exists")) = 0 then do
  51.   Say GroupFil"  - Does not exist, must run sortsum.cmd, Readsum.cmd or re-configure"
  52.   exit
  53. end
  54.  
  55. /* Main processing loop */
  56. Say "Creating a selection file for uqwk, Please wait..."
  57. Current_Group = 0
  58. Do Until Lines(Groupfil) = 0
  59.   Gbuf = Linein(Groupfil)
  60.   Current_Group = Current_Group + 1
  61.   
  62.   Parse Var Gbuf Sp TagDat GrpName      /* Seek Pos. Tag info, Group name */
  63.   Group.Current_Group = GrpName         /* Save group name */
  64.  
  65.   Call Read_Id       /* Read Message Id's into MessageId.Current_Group.[n] */
  66. END
  67.  
  68. DO I = 1 to Current_Group
  69.    Call LineOut Outfil,"*** "Group.I          /* Newsgroup name */
  70.  
  71.    DO T = 1 to MessageID.I.0                 /* Output selected articles */
  72.      Call Lineout Outfil,MessageID.I.t":"
  73.    end 
  74.  
  75.    Call Lineout OutFil,""       /* Blank line at end of list */
  76. end
  77.  
  78. /* close files & exit */
  79. Call Stream GroupFil,"C","Close"
  80. Call Stream outFil,"C","Close"
  81. Call Stream SortFil,"C","Close"
  82. exit
  83.  
  84. /* 
  85.    read all tagged article numbers from SortFil, and produce a list of
  86.    Selected articles.
  87.  
  88.    SP
  89.    TagDat
  90.    -----
  91.    MessageID.Current_Group.[n] = List of Message ID's
  92.    MessageID.Current_Group.0   = Number of articles selected.
  93. */
  94. Read_Id:
  95. A = 0                           /* article pointer */
  96. MessageId.Current_Group.0 = 0   /* Number of selected articles from Newsgroup */
  97. DO I = 1 to LENGTH(TagDat)
  98.   Abuf = TRANSLATE(Linein(SortFil),D2C(254)" "," "D2C(254))  /* swap spaces */
  99.   If Substr(TagDat,I,1) = "1" then do
  100.     A = A + 1
  101.     Parse Var Abuf Group Dat ID
  102.     MessageId.Current_Group.A = ID    
  103.   end
  104. END
  105. MessageId.Current_Group.0 = A /* Store the number of selected articles */
  106. Return
  107.  
  108.