home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / prmtomr2.zip / PRMtoMR2.CMD next >
OS/2 REXX Batch file  |  1996-02-11  |  23KB  |  573 lines

  1. /*--------------------------------------------------------------------------*/
  2. /* This script translates Post Road Mailer Address Books into MR/2 ICE      */
  3. /* addresses and groups.                                                    */
  4. /*                                                                          */
  5. /* So that one can understand what I did to perform the conversion, I'll    */
  6. /* explain a few things as I understand them...                             */
  7. /*                                                                          */
  8. /* The Post Road Mailer (tm) holds both e-mail addresses and groups in      */
  9. /* address books.  Each address book is a separate file with the extension  */
  10. /* ADR.  All of the files are contained in the Post Road Mailer directory.  */
  11. /* Each address book entry can contain quite a bit of information:          */
  12. /* First name, last name, organization, up to 5 e-mail addresses, two       */
  13. /* telephone numbers, a fax number, and a note.                             */
  14. /*                                                                          */
  15. /* The biggest hurdle in creating this converter was the binary format      */
  16. /* of the Post Road Mailer address books.  Needless to say, a hex-editor    */
  17. /* came in very, very useful...                                             */
  18. /*                                                                          */
  19. /*                     *      *      *                                      */
  20. /*                                                                          */
  21. /* MR/2 ICE, on the other hand, holds its e-mail addresses in a single file */
  22. /* with the extension ADR.  You can define other files to be used but that  */
  23. /* doesn't concern this conversion.  In addition, MR/2 ICE holds its group  */
  24. /* definitions in a separate file with the extension GRP.  Both of these    */
  25. /* files are in the MR/2 ICE directory.  And, thankfully, both of these     */
  26. /* files are basically ASCII files.                                         */
  27. /*                                                                          */
  28. /* Each address entry contains a full name, e-mail address, alias and a     */
  29. /* note.                                                                    */
  30. /*                                                                          */
  31. /*                     *      *      *                                      */
  32. /*                                                                          */
  33. /* Now, how I decided to do this conversion.  For e-mail address entries:   */
  34. /*                                                                          */
  35. /* 1).  The first name and last name are combined and used.                 */
  36. /* 2).  Each e-mail address for a given PRM address book entry is given     */
  37. /*      a separate entry in the MR/2 address file.                          */
  38. /* 3).  The alias used for each e-mail address is either the nickname in    */
  39. /*      the PRM address file entry for that e-mail address, or, if a nick-  */
  40. /*      name doesn't exist.  The last name is used.  If a duplicate alias   */
  41. /*      exists, I append a number to new alias.                             */
  42. /* 4).  Finally, the note for the MR/2 ICE address consists of the PRM      */
  43. /*      note, organization, telephone numbers and fax number.  This note    */
  44. /*      is attached to each e-mail address entry.                           */
  45. /*                                                                          */
  46. /* For groups:                                                              */
  47. /*                                                                          */
  48. /* 1).  Every group from each PRM address book is placed in the MR/2 ICE    */
  49. /*      group file.  Groups aliases are checked for duplication.            */
  50. /* 2).  In addition, for each PRM address book, I allow the user to         */
  51. /*      optionally create a MR/2 ICE group consisting of all of the         */
  52. /*      addresses in that address book.  The alias for that group is the    */
  53. /*      file name minus the extension of that address book.                 */
  54. /*                                                                          */
  55. /*      An example would probably be helpful.  If you have two PRM address  */
  56. /*      books, each containing 5 e-mail addresses and 2 groups.  Say the    */
  57. /*      first file is called smeg.adr (with the description "friends") and  */
  58. /*      the second is called head.adr (with the description "enemas").      */
  59. /*                                                                          */
  60. /*      This converter would add all 10 e-mail addresses to the MR/2 ICE    */
  61. /*      address list.  It would add all 4 groups to the MR/2 ICE group      */
  62. /*      file.  In addition, if the user says 'yes' to the add address books */
  63. /*      as groups question, it would add a group with the alias 'smeg'      */
  64. /*      containing the 5 e-mail addresses and it would add a group with the */
  65. /*      alias 'head' with the other 5 e-mail addresses                      */
  66. /*                                                                          */
  67. /*      If you don't like these additional groups, then it's easy enough to */
  68. /*      to any one you don't want.                                          */
  69. /*                                                                          */
  70. /*--------------------------------------------------------------------------*/
  71. /*  Load the Rexx Functions if they're not already loaded                   */
  72. /*--------------------------------------------------------------------------*/
  73. IF RxFuncQuery('SysLoadFuncs') THEN DO
  74.     /* load the load-function */
  75.     CALL RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  76.  
  77.     /* load the Sys* utilities */
  78.     CALL SysLoadFuncs
  79. END
  80.  
  81. /*--------------------------------------------------------------------------*/
  82. /*  Initialize names, etc.                                                  */
  83.  
  84. hex01 = '01'x
  85. crlf = '0D'x'0A'x
  86.  
  87. books_to_groups = 'Y'
  88.  
  89. description = ''
  90.  
  91. names.0 = 0
  92. names.0.firstname = ''
  93. names.0.lastname = ''
  94. names.0.nick.1 = ''
  95. names.0.nick.2 = ''
  96. names.0.nick.3 = ''
  97. names.0.nick.4 = ''
  98. names.0.nick.5 = ''
  99. names.0.firstname = ''
  100. names.0.organization = ''
  101. names.0.email.0 = 0
  102. names.0.email.1 = ''
  103. names.0.email.2 = ''
  104. names.0.email.3 = ''
  105. names.0.email.4 = ''
  106. names.0.email.5 = ''
  107. names.0.phone1 = ''
  108. names.0.phone2 = ''
  109. names.0.fax = ''
  110. names.0.notes = ''
  111.  
  112. groups.0.0 = 0
  113. groups.0.desc = ''
  114. groups.0.1 = ''
  115.  
  116. mr2namelist.0 = 0
  117. mr2grplist.0 = 0
  118.  
  119. /*--------------------------------------------------------------------------*/
  120. /*--------------------------------------------------------------------------*/
  121. /*  Check prm_location for *.ADR files  (PRM address files)                 */
  122.  
  123. SAY "Please Enter the path to the Post Road Mailer Directory"
  124. PARSE UPPER PULL prm_location
  125.  
  126. IF SUBSTR(prm_location,LENGTH(prm_location),1) = '\' THEN
  127.   prm_location = SUBSTR(prm_location,1,LENGTH(prm_location)-1)
  128. tempstring = prm_location||"\*.ADR"
  129. rcode = SysFileTree(tempstring,prmfiles,"FO")
  130. IF prmfiles.0 = 0 THEN DO
  131.   SAY "No Address files found in "prm_location
  132.   SAY "Please restart PRM2MR2 and input the correct PRM location"
  133.   EXIT 1
  134. END
  135. ELSE DO
  136.   SAY "In '"prm_location"' the following address files were found:"
  137.   DO ii = 1 TO prmfiles.0
  138.     SAY "Found "prmfiles.ii
  139.   END
  140.   SAY ""
  141. END
  142. /*--------------------------------------------------------------------------*/
  143. /*--------------------------------------------------------------------------*/
  144. /*  Check mr2_location for MR2I.ADR files  (MR2 basic address file)         */
  145.  
  146. SAY "Please Enter the path to MR/2 ICE Directory"
  147. PARSE UPPER PULL mr2_location
  148.  
  149. IF SUBSTR(mr2_location,LENGTH(mr2_location),1) = '\' THEN
  150.   mr2_location = SUBSTR(mr2_location,1,LENGTH(mr2_location)-1)
  151.  
  152. SAY "Checking '"mr2_location"' for mr2i.adr file"
  153. mr2addfile = mr2_location||"\MR2I.ADR"
  154. rcode = STREAM(mr2addfile,'C','QUERY EXISTS')
  155. IF rcode = "" THEN DO
  156.   SAY "No MR/2 Address file found in "mr2_location
  157.   SAY "Will Create a new one"
  158.   rcode = STREAM(mr2addfile,'C','OPEN WRITE')
  159.   SAY ""
  160. END
  161. ELSE DO
  162.   SAY "Updating "rcode
  163.   rcode = STREAM(mr2addfile,'C','OPEN')
  164.   rcode = STREAM(mr2addfile,'C','SEEK < 2')
  165.   last2 = CHARIN(mr2addfile,,2)
  166.   IF last2 \= crlf THEN DO
  167.     rcode = STREAM(mr2addfile,'C','QUERY SIZE')
  168.     IF rcode \= 0 THEN rcode = CHAROUT(mr2addfile,crlf,2)
  169.   END
  170.   rcode = GetMR2NameList(mr2addfile, mr2namelist)
  171.   SAY ""
  172. END
  173. /*--------------------------------------------------------------------------*/
  174. /*--------------------------------------------------------------------------*/
  175. /*  Check mr2_location for MR2I.GRP files  (MR2 basic address file)         */
  176.  
  177. SAY "checking for mr2i.grp file"
  178. mr2grpfile = mr2_location||"\MR2I.GRP"
  179. rcode = STREAM(mr2grpfile,'C','QUERY EXISTS')
  180. IF rcode = "" THEN DO
  181.   SAY "No MR/2 Group file found in "mr2_location
  182.   SAY "Will Create a new one"
  183.   rcode = STREAM(mr2grpfile,'C','OPEN WRITE')
  184.   SAY ""
  185. END
  186. ELSE DO
  187.   SAY "Updating "rcode
  188.   rcode = STREAM(mr2grpfile,'C','OPEN')
  189.   rcode = STREAM(mr2grpfile,'C','SEEK < 2')
  190.   last2 = CHARIN(mr2grpfile,,2)
  191.   IF last2 \= crlf THEN DO
  192.     rcode = STREAM(mr2grpfile,'C','QUERY SIZE')
  193.     IF rcode \= 0 THEN rcode = CHAROUT(mr2grpfile,crlf,2)
  194.   END
  195.   rcode = GetMR2GroupList(mr2grpfile, mr2grplist)
  196.   SAY ""
  197. END
  198. /*--------------------------------------------------------------------------*/
  199. /*--------------------------------------------------------------------------*/
  200. /*  Ask about adding address books as groups                                */
  201. DO UNTIL(books_to_groups = 'Y' | books_to_groups = 'N')
  202.   SAY "Do you want to make a group for each PRM address book? (Y/n)"
  203.   PARSE UPPER PULL books_to_groups
  204.   IF (books_to_groups \= 'Y' & books_to_groups \= 'N') THEN
  205.     SAY "Please answer Y or N only"
  206. END
  207. SAY ""
  208. SAY "And off we go..."
  209. SAY ""
  210. /*--------------------------------------------------------------------------*/
  211. /*--------------------------------------------------------------------------*/
  212. /*  Start processing input files                                            */
  213.  
  214. DO ii = 1 TO prmfiles.0
  215.   rcode = STREAM(prmfiles.ii,'C','OPEN READ')
  216.   rcode = Read_PRMAddress_Book(prmfiles.ii,description,names,groups)
  217.   rcode = STREAM(prmfiles.ii,'C','CLOSE')
  218.  
  219.   IF names.0 \= 0 THEN DO
  220.     SAY "Updating MR/2 Address File with addresses from"
  221.     SAY description
  222.     rcode = Update_Address_Book(mr2addfile,names)
  223.   END
  224.   SAY description " addresses added"
  225.   SAY ""
  226.   SAY "Updating MR/2 Group File"
  227.   rcode = Update_Group_Book(prmfiles.ii,mr2grpfile,description,names,groups)
  228.   SAY description " groups added"
  229.   SAY ""
  230.  
  231. END
  232.  
  233. EXIT 0
  234. /*--------------------------------------------------------------------------*/
  235. /*--------------------------------------------------------------------------*/
  236. /*  Reads a MR2 address file to get shortnames                              */
  237. GetMR2NameList:
  238.   PARSE ARG mr2addfile, mr2namelist
  239.  
  240.   mr2namelist.0 = 0
  241.   rcode = STREAM(mr2addfile,'C','CLOSE')
  242.   rcode = STREAM(mr2addfile,'C','OPEN READ')
  243.   DO WHILE(LINES(mr2addfile) \= 0)
  244.     inline = LINEIN(mr2addfile)
  245.     IF SUBSTR(inline,1,1) = hex01 THEN DO
  246.       tempstring = SUBSTR(inline,2,LENGTH(inline)-1)
  247.       comment_length = 0
  248.       PARSE VAR tempstring comment_length
  249.       comment = CHARIN(mr2addfile,,comment_length+2)
  250.     END
  251.     ELSE DO
  252.       pos1 = POS('\',inline)
  253.       pos2 = POS('\',inline,pos1+1)
  254.       pos3 = POS('\',inline,pos2+1)
  255.       IF pos3 \= 0 THEN DO
  256.         mr2namelist.0 = mr2namelist.0 + 1
  257.         index = mr2namelist.0
  258.         mr2namelist.index = STRIP(SUBSTR(inline,pos3+1,LENGTH(inline)-pos3))
  259.       END
  260.     END
  261.   END
  262.   rcode = STREAM(mr2addfile,'C','CLOSE')
  263.   rcode = STREAM(mr2addfile,'C','OPEN WRITE')
  264.   rcode = STREAM(mr2addfile,'C','SEEK < 0')
  265.  
  266. RETURN 0
  267. /*--------------------------------------------------------------------------*/
  268. /*--------------------------------------------------------------------------*/
  269. /*  Reads a MR2 group file to get aliases                                   */
  270. GetMR2GroupList:
  271.   PARSE ARG mr2grpfile, mr2grplist
  272.  
  273.   mr2grplist.0 = 0
  274.   rcode = STREAM(mr2grpfile,'C','CLOSE')
  275.   rcode = STREAM(mr2grpfile,'C','OPEN READ')
  276.   DO WHILE(LINES(mr2grpfile) \= 0)
  277.     inline = LINEIN(mr2grpfile)
  278.     IF SUBSTR(inline,1,1) = '!' THEN DO
  279.       mr2grplist.0 = mr2grplist.0 + 1
  280.       index = mr2grplist.0
  281.       mr2grplist.index = SUBSTR(inline,2,POS('\',inline)-2)
  282.     END
  283.   END
  284.   rcode = STREAM(mr2grpfile,'C','CLOSE')
  285.   rcode = STREAM(mr2grpfile,'C','OPEN WRITE')
  286.   rcode = STREAM(mr2grpfile,'C','SEEK < 0')
  287. RETURN 0
  288. /*--------------------------------------------------------------------------*/
  289. /*--------------------------------------------------------------------------*/
  290. /*  Reads a PRM address book                                                */
  291. Read_PRMAddress_Book:
  292.   PARSE ARG infile, description, names, groups
  293.  
  294.   shortvalue = Read_Short(infile)
  295.   description = Read_String(infile)
  296.   SAY "Starting with Address Book:  "description
  297.   shortvalue = Read_Short(infile)
  298.   names.0 = Read_Short(infile)
  299.   SAY "Number of Address Entries:  "names.0
  300.   shortvalue = Read_Short(infile)
  301.   shortvalue = Read_Short(infile)
  302.   groups.0 = Read_Short(infile)
  303.   SAY "Number of Groups:  "groups.0
  304.   shortvalue = Read_Short(infile)
  305.  
  306.   DO jj = 1 to names.0
  307.     names.jj.lastname = Read_String(infile)
  308.     DO kk = 1 TO 5
  309.       names.jj.nick.kk = Read_String(infile)
  310.       IF names.jj.nick.kk = '' THEN names.jj.nick.kk = names.jj.lastname
  311.     END
  312.     names.jj.firstname = Read_String(infile)
  313.     names.jj.organization = Read_String(infile)
  314.     DO kk = 1 TO 5
  315.       names.jj.email.kk = Read_String(infile)
  316.     END
  317.     names.jj.phone1 = Read_String(infile)
  318.     names.jj.phone2 = Read_String(infile)
  319.     names.jj.fax = Read_String(infile)
  320.     names.jj.notes = Read_String(infile)
  321.  
  322.     names.jj.email.0 = 0
  323.     tempindex = 0
  324.     DO kk = 1 TO 5
  325.       IF names.jj.email.kk \= '' THEN DO
  326.         tempindex = tempindex + 1
  327.         names.jj.email.tempindex = names.jj.email.kk
  328.         names.jj.nick.tempindex = names.jj.nick.kk
  329.       END
  330.     END
  331.  
  332.     names.jj.email.0 = tempindex
  333.  
  334.     IF names.jj.phone1 = '' THEN DO
  335.       IF names.jj.phone2 \= '' THEN DO
  336.         names.jj.phone1 = names.jj.phone2
  337.         names.jj.phone2 = ''
  338.       END
  339.     END
  340.  
  341.     rcode = CHAROUT(stdout,'.')
  342.   END
  343.   SAY ""
  344.  
  345.   IF groups.0 \= 0 THEN DO
  346.  
  347.     DO jj = 1 TO groups.0
  348.       groups.jj.desc = Read_String(infile)
  349.       SAY "Group "jj" description:  "groups.jj.desc
  350.       shortvalue = Read_Short(infile)
  351.       groups.jj.0 = Read_Short(infile)
  352.       SAY "Group "jj" number:  "groups.jj.0
  353.       shortvalue = Read_Short(infile)
  354.       DO kk = 1 TO groups.jj.0
  355.         groups.jj.kk = Read_String(infile)
  356.       END
  357.     END
  358.     rcode = CHAROUT(stdout,'.')
  359.   END
  360.  
  361.   SAY ""
  362.   SAY "Reading "description" address book complete"
  363.   SAY ""
  364. RETURN 0
  365. /*--------------------------------------------------------------------------*/
  366. /*--------------------------------------------------------------------------*/
  367. /*  Reads a string from the input PRM address file                          */
  368. Read_String:
  369.   PARSE ARG infile
  370.   stringlength = Read_Short(infile)
  371.   IF stringlength = 0 THEN readstring = ''
  372.   ELSE readstring = CHARIN(infile,,stringlength)
  373.   shortvalue = Read_Short(infile)
  374. RETURN readstring
  375. /*--------------------------------------------------------------------------*/
  376. /*--------------------------------------------------------------------------*/
  377. /*  Reads a short from the input PRM address file                           */
  378. Read_Short:
  379.   PARSE ARG infile
  380.   tempstring = CHARIN(infile,,4)
  381.   short_value = C2D(SUBSTR(tempstring,1,1))
  382.   short_value = short_value + C2D(SUBSTR(tempstring,2,1)) * 16
  383.   short_value = short_value + C2D(SUBSTR(tempstring,3,1)) * 256
  384.   short_value = short_value + C2D(SUBSTR(tempstring,4,1)) * 4096
  385. RETURN short_value
  386. /*--------------------------------------------------------------------------*/
  387. /*--------------------------------------------------------------------------*/
  388. /*  Updates the MR2 address book                                            */
  389. Update_Address_Book:
  390.   PARSE ARG outfile, names
  391.  
  392.   DO jj = 1 TO names.0
  393.     IF names.jj.email.0 \= 0 THEN DO
  394.                                   /*----------------------------------------*/
  395.                                   /* set up the full name                   */
  396.                                   /*----------------------------------------*/
  397.       fullname = names.jj.firstname||" "||names.jj.lastname
  398.                                   /*----------------------------------------*/
  399.                                   /* set up phone numbers                   */
  400.                                   /*----------------------------------------*/
  401.       IF names.jj.phone1 \= '' THEN DO
  402.         phone = " Telephone:  "||names.jj.phone1
  403.         IF names.jj.phone2 \= '' THEN phone = phone||" & "||names.jj.phone2
  404.       END
  405.       ELSE phone = ''
  406.                                   /*----------------------------------------*/
  407.                                   /* set up fax numbers                     */
  408.                                   /*----------------------------------------*/
  409.       IF names.jj.fax \= '' THEN DO
  410.         faxnum = " Fax:  "||names.jj.fax
  411.       END
  412.       ELSE faxnum = ''
  413.                                   /*----------------------------------------*/
  414.                                   /* put together the note                  */
  415.                                   /*----------------------------------------*/
  416.       allnotes = names.jj.notes||" "||phone||" "||faxnum
  417.                                   /*----------------------------------------*/
  418.                                   /* do each email address                  */
  419.                                   /*----------------------------------------*/
  420.       DO kk = 1 TO names.jj.email.0
  421.         IF names.jj.email.kk \= '' THEN DO
  422.           firstline = fullname||"\"||names.jj.email.kk||"\N\"
  423.           IF names.jj.nick.kk \= '' THEN DO
  424.             nickname = names.jj.nick.kk
  425.             rcode = CheckNickName(nickname)
  426.             firstline = firstline||nickname
  427.           END
  428.           ELSE DO
  429.             nickname = names.jj.lastname
  430.             rcode = CheckNickName(nickname)
  431.             firstline = firstline||nickname
  432.           END
  433.           names.jj.nick.kk = nickname
  434.  
  435.           secondline = hex01||LENGTH(allnotes)
  436.                                   /*----------------------------------------*/
  437.                                   /* write entry                            */
  438.                                   /*----------------------------------------*/
  439.           rcode = LINEOUT(outfile,firstline)
  440.           rcode = LINEOUT(outfile,secondline)
  441.           rcode = LINEOUT(outfile,allnotes)
  442.         END
  443.       END
  444.     END
  445.     rcode = CHAROUT(stdout,'+')
  446.   END
  447.   SAY ""
  448.  
  449. RETURN 0
  450. /*--------------------------------------------------------------------------*/
  451. /*--------------------------------------------------------------------------*/
  452. /*  Updates the MR2 groups book                                             */
  453. Update_Group_Book:
  454.   PARSE ARG infile, outfile, description, names, groups
  455.  
  456.   IF names.0 \= 0 & books_to_groups = 'Y'  THEN DO
  457.     infilename = FILESPEC("NAME",infile)
  458.     dotpos = POS('.',infilename)
  459.     IF dotpos > 9 THEN dotpos = 9
  460.     alias = SUBSTR(infilename,1,dotpos-1)
  461.     rcode = CheckGroupAlias(alias)
  462.     firstline = "!"||alias||"\"||description||"\N"
  463.     secondline = "#"||LENGTH(description)
  464.     thirdline = description
  465.     rcode = LINEOUT(outfile,firstline)
  466.     rcode = LINEOUT(outfile,secondline)
  467.     rcode = LINEOUT(outfile,thirdline)
  468.     DO jj = 1 TO names.0
  469.       IF names.jj.email.0 \= 0 THEN DO
  470.         DO kk = 1 TO names.jj.email.0
  471.           outline = "+"||names.jj.nick.kk
  472.           rcode = LINEOUT(outfile,outline)
  473.         END
  474.       END
  475.     END
  476.     rcode = CHAROUT(stdout,'+')
  477.   END
  478.  
  479.   IF groups.0 \= 0 THEN DO
  480.     DO jj = 1 TO groups.0
  481.  
  482.       alias = STRIP(SUBSTR(groups.jj.desc,1,8))
  483.       rcode = CheckGroupAlias(alias)
  484.       firstline = "!"||alias||"\"||groups.jj.desc||"\N"
  485.       secondline = "#"||LENGTH(groups.jj.desc)
  486.       thirdline = groups.jj.desc
  487.       rcode = LINEOUT(outfile,firstline)
  488.       rcode = LINEOUT(outfile,secondline)
  489.       rcode = LINEOUT(outfile,thirdline)
  490.  
  491.       DO kk = 1 TO groups.jj.0
  492.         temp = groups.jj.kk
  493.         pos1 = POS("<",temp,1) + 1
  494.         pos2 = POS(">",temp,pos1+1)
  495.         email = SUBSTR(temp, pos1, (pos2 - pos1))
  496.         outline = "+"||email
  497.         rcode = LINEOUT(outfile,outline)
  498.       END
  499.       rcode = CHAROUT(stdout,'+')
  500.     END
  501.   END
  502.   SAY ""
  503.  
  504. RETURN 0
  505. /*--------------------------------------------------------------------------*/
  506. /*--------------------------------------------------------------------------*/
  507. CheckNickName:
  508.   PARSE ARG nickname0
  509.  
  510.   found = 0
  511.   DO ll = 1 TO mr2namelist.0
  512.     IF nickname0 = mr2namelist.ll THEN DO
  513.       ll = mr2namelist.0 + 1
  514.       found = 1
  515.     END
  516.   END
  517.   IF found = 1 THEN DO
  518.     count = 0
  519.     DO WHILE(found = 1)
  520.       found = 0
  521.       count = count + 1
  522.       nickname = nickname0||count
  523.       DO ll = 1 TO mr2namelist.0
  524.         IF nickname = mr2namelist.ll THEN DO
  525.           ll = mr2namelist.0 + 1
  526.           found = 1
  527.         END
  528.       END
  529.     END
  530.     nickname0 = nickname
  531.   END
  532.  
  533.   mr2namelist.0 = mr2namelist.0 + 1
  534.   index = mr2namelist.0
  535.   mr2namelist.index = nickname0
  536.  
  537. RETURN 0
  538. /*--------------------------------------------------------------------------*/
  539. /*--------------------------------------------------------------------------*/
  540. CheckGroupAlias:
  541.   PARSE ARG groupalias0
  542.  
  543.   found = 0
  544.   DO ll = 1 TO mr2grplist.0
  545.     IF groupalias0 = mr2grplist.ll THEN DO
  546.       ll = mr2grplist.0 + 1
  547.       found = 1
  548.     END
  549.   END
  550.   IF found = 1 THEN DO
  551.     count = 0
  552.     DO WHILE(found = 1)
  553.       found = 0
  554.       count = count + 1
  555.       groupalias = groupalias0||count
  556.       DO ll = 1 TO mr2grplist.0
  557.         IF groupalias = mr2grplist.ll THEN DO
  558.           ll = mr2grplist.0 + 1
  559.           found = 1
  560.         END
  561.       END
  562.     END
  563.     groupalias0 = groupalias
  564.   END
  565.  
  566.   mr2grplist.0 = mr2grplist.0 + 1
  567.   index = mr2grplist.0
  568.   mr2grplist.index = groupalias0
  569.  
  570. RETURN 0
  571. /*--------------------------------------------------------------------------*/
  572. /*--------------------------------------------------------------------------*/
  573.