home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / MSWBASE4.ZIP / MAILING / MAILIT.SBP < prev    next >
Encoding:
Text File  |  1990-01-31  |  26.0 KB  |  1,117 lines

  1. SBP
  2.   ╜ **********************************************************************
  3.   ╜ ***        Created by: Mark C. Johnson
  4.   ╜ *** Additional Design: Dan P. Browning, Simon Tranmer
  5.   ╜ ***                on: Aug, 1989
  6.   ╜ *** Text mods by BH 15-8-89
  7.   ╜ ***
  8.   ╜ ***     This is meant to be a functional mail base application
  9.   ╜ *** both to use and to learn from.  Please be advised that, while all of
  10.   ╜ *** these commands do work, they may not live up to the full
  11.   ╜ *** capabilities of a $$$ mailing program.  Still, I think this
  12.   ╜ *** program shows off many of the capabilities and
  13.   ╜ *** possibilities of this database package.  Hopefully, you will be
  14.   ╜ *** happy with the functions contained herein, if not, feel free to
  15.   ╜ *** mangle and otherwise experiment.  What use is a demo, if it can't
  16.   ╜ *** be changed?  One word of warning, though:  this is a rather
  17.   ╜ *** intricately involved package.  Many of the functions use variables
  18.   ╜ *** set up somewhere else.  The forms themselves often have functional
  19.   ╜ *** pieces not easily ascertained by just looking at the form itself.
  20.   ╜ *** Before you go making giant leaping strides, I suggest you back up
  21.   ╜ *** all the forms, etc.  so you have a base to go back to if something
  22.   ╜ *** does not quite come out right.
  23.   ╜ ***
  24.   ╜ *** This program and all its related sections are considered in the
  25.   ╜ *** public domain as long as no section or program segment of this
  26.   ╜ *** code is sold for financial gain.  Permission for using sections
  27.   ╜ *** of this code inside of applications for the express intention
  28.   ╜ *** of being sold may be obtained by writing to:
  29.   ╜ ***
  30.   ╜ ***        Precision Inc.
  31.   ╜ ***        ATTN: Applications Department
  32.   ╜ ***        8404A Sterling Street
  33.   ╜ ***        Irving, TX 75063   USA
  34.   ╜ ***
  35.   ╜ *** or by the corresponding address in England:
  36.   ╜ ***
  37.   ╜ ***        Precision Software Ltd.
  38.   ╜ ***        6 Park Terrace
  39.   ╜ ***        Worcester Park, Surrey
  40.   ╜ ***        KT4 7JZ   England
  41.   ╜ ***
  42.   ╜ ************************************************************************
  43.  
  44.   ╜ ** Config routine.  This reads in our old variables, sets up our error detection, and presets
  45.   ╜    variables used on the form.
  46.  
  47.   │ _ wErrtrap
  48.   ╫prs%(5,5),a$(3),e$(3),c$(3),c%(3)
  49.   Γ e
  50.   ╩ ╦"Setting up..."
  51.   ╩"MDEFAULT"
  52.  pth$  Ä
  53.  activity$ ""
  54.   ┤ £"Mailit"
  55.  
  56.   ¼1,1,1,"&Add to Mailing List"
  57.   ¼1,2,1,"&Merge Lists        "
  58.   ¼1,3,1,"&Edit Mailing List  "
  59.   ¼1,4,1,"Print &Labels       "
  60.   ¼1,5,1,"&Utilities          "
  61.   ¼1,6,1,"&Purge Duplicates   "
  62.   ¼1,7,1,"Set &Options        "
  63.   ¼1,8,1,"&Help               "
  64.   ¼1,9,1,"&Quit               "
  65.  
  66. MainMenu: 
  67.  
  68.   ╜ ** Main Menu - This is the routine we use to set up our system wide
  69.   ╜    commands menu.  It checks for keyboard presses, mouse clicks, and
  70.   ╜    the selection of the menu bar.  It also sets up the form and other
  71.   ╜    Nicities.
  72.  
  73.  badd$ "Add to Mailing List"
  74.  bEdit$ "Edit Mailing List"
  75.  bLabel$ "Print Labels"
  76.  bMerge$ "Merge Lists"
  77.  bUtil$ "Utilities"
  78.  bPurge$ "Purge Duplicates"
  79.  bOption$ "Set Options"
  80.  bHelp$ "Help"
  81.  bQuit$ "Quit"
  82.   ╩ σ Ñ e
  83.   ╩ ╦"Click, Type, or Select Menu Command."
  84.  activity$ ""
  85.   Äpth$
  86.   £2
  87.   Ñ1,"!GOTO Helpme"
  88.   ╩ ƒ"Microsoft Mailing List System"
  89.   ¼1,0,1,"&Commands"
  90.   ¼ │clm%,sel%
  91.   Γ e
  92.  ccr% 0:cc% 0:ent% 0:a$ "":ret% 0:helpsel% 0:zr% 0
  93.  sel% 0:a$ "":srtn% 0
  94.   ╧ ¼ 
  95.  Ñ 
  96.  ▀
  97.  
  98. MM1: 
  99.  
  100.   ╜ ** This routine actually takes the selection and finds out where the
  101.   ╜    user wanted to go.
  102.  
  103.   ¼1,0,0," "
  104.   │sel% wAddEnts,MergeEnts,EditEnts,PrintLabs,Utilities,PurgeEnts,SetOpts,Helpme,Quitit
  105.  
  106.   ╜ ** If we get to here, the user must have pressed a key or clicked on an area that is not a button
  107.  
  108.   ¥a$
  109.   vFlushBuffer
  110.  a$  >(a$)
  111.   ╔ µa$
  112.  µ"A"
  113. sel% 1: ╜ was it the Add command?
  114.  µ"M"
  115. sel% 2: ╜ Merge?
  116.  µ"E"
  117. sel% 3: ╜ Edit?
  118.  µ"L"
  119. sel% 4: ╜ Labels
  120.  µ"U"
  121. sel% 5: ╜ Utilities
  122.  µ"P"
  123. sel% 6: ╜ Purge
  124.  µ"O"
  125. sel% 7: ╜ Options
  126.  µ"H","?"
  127. sel% 8: ╜ Help(!)
  128.  µ"Q", (27)
  129. sel% 9: ╜ Get outta dodge?
  130.  µ ^
  131. sel% 0: ╜ Wasn't any key I know about, let's ignore it.
  132.   Æ ╔
  133.  
  134.   ╜   A briefer alternative to the above CASE structure is:
  135.   ╜   sel% = INSTR ("AMELUPOHQ",a$)
  136.  
  137.   ísel% wMM1
  138.   
  139.   wMainMenu
  140.  
  141. AddEnts: 
  142.  
  143.   ╜ ** Add set up area
  144.  
  145.  ret% 9:helpsel% 1
  146.   ╩ σ Ñ │
  147.   Ñ1,"!activity$=~~:open form ~Mailit~:GOTO H1"
  148.   ╩ ƒ"Add to Mailing List"
  149.  activity$ "Data Entry Form"
  150.   ┤ £"AddForm"
  151.   ╩ ╦"ESC=Stop  |  SHIFT+TAB=Previous Field  |  Shift+F1=Help"
  152.  
  153. AE1: 
  154.  
  155.   ╜ ** Actual guts of the Add routine.  Checks for a blank form for an end-of-entry
  156.  
  157.   ü £
  158.  Country  "USA"
  159.   ╬
  160.   ▀ │
  161.   ö1,0
  162.   íFirstName  ""  LastName  ""  Company  "" pactivity$ "": ┤ £"Mailit": wMainMenu
  163.   ╠ £
  164.   wAE1
  165.  
  166. MergeEnts: 
  167.  
  168.   ╜ ** Merge front end - The prg% variable is used to distinguish whether we are merging (0), or purging (9)
  169.  
  170.   £6
  171.   ╩ ╦"Merge Databases..."
  172.  ret% 9:helpsel% 2
  173.   Ñ1,"!GOTO H1"
  174.  merl% 4:automan% 1
  175.   ╩ ƒ"Merge Entries"
  176.  bModify$ "Set Thresholds"
  177.  bHelp$ "Help"
  178.  bCancel$ "Cancel Merge"
  179.  bOK$ "Begin Merge"
  180.  prg% 0
  181.   wMEBegin
  182.  
  183. PurgeEnts: 
  184.  
  185.   ╜ ** Purge front end
  186.  
  187.   £6
  188.   ╩ ╦"Purge Databases..."
  189.  ret% 9:helpsel% 6
  190.   Ñ1,"!GOTO H1"
  191.  merl% 1:automan% 1
  192.   ╩ ƒ"Purge Entries"
  193.  bModify$ "Set Thresholds"
  194.  bHelp$ "Help"
  195.  bCancel$ "Cancel Purge"
  196.  bOK$ "Begin Purge"
  197.  prg% 9
  198.  
  199. MEBegin: 
  200.   ╩ ╦"ESC=Stop  |  B=Begin  |  T=Set Thresholds"
  201.  cnt% 0
  202.   wME21
  203.  
  204. ME1: 
  205.  
  206.   ╜ ** Wait for entry then see if it was a mouse click
  207.  
  208.   ╬
  209.  cnt% 0:a$ ""
  210.   ╧ Ñ 
  211.  ▀
  212.   ¥a$
  213.   vFlushBuffer
  214.   ía$ "" wME2
  215.   ícnt% 
  216. 0 wH1
  217.   ícnt% 50 wMainMenu
  218.   ícnt% 999 wMChangePreset
  219.   ícnt% 0 wME21
  220.   wME3
  221.  
  222. ME2: 
  223.  
  224.   ╜ ** Check what key was pressed
  225.  
  226.  z%  0(a$)
  227.   íz% 0 pz% merl%
  228.  a$  >(a$)
  229.   ╔ µa$
  230.  µ"H","?"
  231.  wH1
  232.  µ"C", (27)
  233.  wMainMenu
  234.  µ"V"
  235. automan% 2: wME21
  236.  µ"M"
  237. automan% 1: wME21
  238.  µ"O"
  239. automan% 3: wME21
  240.  µ"T"
  241.  wMChangePreset
  242.  µ"B"
  243.  wME3
  244.  µ ^
  245.  íz% 5 wME1
  246. merl% z%
  247.   Æ ╔
  248.  
  249. ME21: 
  250.  
  251.   ╜ ** Set preset levels from pre-defined array
  252.  
  253.  prs1% prs%(merl%,1)
  254.  prs2% prs%(merl%,2)
  255.  prs3% prs%(merl%,3)
  256.  prs4% prs%(merl%,4)
  257.  prs5% prs%(merl%,5)
  258.   wME1 
  259.  
  260. MChangePreset: 
  261.  
  262.   ╜ ** Modify Preset levels and then store them
  263.  
  264.   ö1,5
  265.  prs%(merl%,1) prs1%
  266.  prs%(merl%,2) prs2%
  267.  prs%(merl%,3) prs3%
  268.  prs%(merl%,4) prs4%
  269.  prs%(merl%,5) prs5%
  270.   ┤"mdefault" ¢ ╢
  271.   { ½
  272.   å ╢
  273.   wME21
  274.  
  275. ME3: 
  276.  
  277.   ╜ ** Set up routine for the Find Duplications routine.  This routine
  278.   ╜    sets up the forms, then checks to see if the file is in a proper
  279.   ╜    format (if its a merge), and imports it.
  280.  
  281.   íprg% 0 pst$ "Importing":st1$ "Import" ^st$ "Purging Section of":st1$ "Purge"
  282.  R%  A("MailBase")
  283.   íprg% 0 p
  284.  ╩ ╦"Importing file..."
  285.  ┬"File to import:","",11,n%,fln$
  286.  ín% 0 wMergeEnts
  287.  í J(fln$ ".sbf") 0 p ┬"Cannot find file ",fln$ ".sbf",21,n%: wMergeEnts
  288. bModify$ "Importing...":bHelp$ "Importing...":bCancel$ "Importing...":bOK$ "Importing..."
  289.  ╬
  290.  xFieldNameData
  291. z1% 0
  292.  ┤fln$ ".sbd" ¢ ñ
  293. I1: 
  294.  ╝b$
  295.  ñ ca$
  296.  í -(a$,1) ">" pz1% 9
  297. a$  F( +(a$,15))
  298.  í >(a$)  >(b$) wNoWay
  299.  íb$ "Misc2" wOKDokey
  300.  íz1% pz1% 0: ñ ca$
  301.  wI1
  302. NoWay: 
  303.  å ñ
  304.  ┬"This file does not match the MailBase","parameters.  Re-configure and try again.",114,n%
  305.  wMainMenu
  306. OKDokey: 
  307.  å ñ
  308.  ófln$ ".sbf" q Ö"MailBase"
  309.   Æ í
  310.  
  311.   ╜ ** Now we check to see if they want to standardize the mail base.
  312.   ╜    If they do, the chances for finding duplicates increases due to
  313.   ╜    the fact that there will be less confusion over whether Ave and
  314.   ╜    Avenue are the same thing.
  315.  
  316.   íprg% 0 p
  317. srtn% 9
  318.  ┬"Do You Wish to Standardize the Database First?","",130,n%
  319.  ín% 0 psrtn% 0: wBeg
  320.  vBegStand
  321. srtn% 0
  322.   Æ í
  323.  
  324. Beg: 
  325.  
  326.   ╜ ** Now we actually jump out to the FindDupes routine and close out
  327.   ╜    after we are done, showing the total number of changed records
  328.   ╜    and so on.
  329.  
  330.  md%  A("MailBase")
  331.   vFindDupes
  332.   í(prs1% prs2% prs3% prs4% prs5% 0)  prg% p ╔ ╛ Ö"MailBase"
  333.  fl%  A("MailBase")
  334.  activity$ st1$ " complete"  (13)
  335.  activity$ activity$ "Initial Record Count was "  H( (R%,5,0)) ","  (13)
  336.   íprg% 0 p
  337. activity$ activity$  H( (md% R%,5,0)) " Records Imported"  (13)
  338.   Æ í
  339.  activity$ activity$  H( (md% fl%,5,0)) " Records Purged"  (13)
  340.  activity$ activity$  H( (fl%,5,0)) " Records Remaining"  (13)
  341.   £1
  342.   ╩ ╦"Press any key to continue..."
  343.   ╧ Ña$
  344.   wMainMenu
  345.  
  346. FindDupes: 
  347.  
  348.   ╜ ** this is the heart of the Merge/Purge routines as it actually finds
  349.   ╜    any duplications and handles them according to what the user
  350.   ╜    user wishes.
  351.  
  352.   íprg% 0  (prs1% prs2% prs3% prs4% prs5% 0) p ├
  353.   íprg%  (prs1% prs2% prs3% prs4% prs5% 0) p
  354.  ┬"WARNING! All thresholds are currently set to zero, this","will delete all records in the file. Proceed?",148,n%
  355.  ín% 0 wPurgeEnts
  356.  ┬"Are you sure?","",135,n%
  357.  ín% 0 wPurgeEnts
  358.   Æ í
  359.   ╩ ╦"Removing current index..."
  360.   Ö"MailBase"
  361.   │ _ wNoIndex
  362.   úVirField.MailBase
  363.   ╛ úVirField.MailBase
  364.   wGoOn
  365. NoIndex: 
  366.   yGoOn
  367.   Æ
  368. GoOn: 
  369.   │ _ wErrtrap
  370.  crit$ "LEFT$(Zip.MailBase,"  H( (prs%(merl%,5),2,0)) ")+LEFT$(lastname.Mailbase,"  H( (prs%(merl%,1),2,0)) ")+left$(Address1.MailBase,"  H( (prs%(merl%,2),2,0)) ")+left$(company.MailBase,"
  371.  crit$ crit$  H( (prs%(merl%,3),2,0)) ")+left$(City.MailBase,"  H( (prs%(merl%,4),2,0)) ")"
  372.   ╩ ╦"Creating Index..."
  373.   ísrtn% psrtn% 0: £5
  374.  bModify$ "Wait..."
  375.  bHelp$ "Wait..."
  376.  bCancel$ "Wait..."
  377.  bOK$ "Wait..."
  378.   ╬
  379.   «VirField.MailBase,"VirField;VTX CLC RDO;50;14;0",crit$
  380.   ë ú │VirField.MailBase
  381.  
  382.   ╜ ** at this time, we have our virtual field set up, and are going to
  383.   ╜    actually start checking for duplicates via the very handy
  384.   ╜    SELECT DUPLICATE command.
  385.  
  386.   Ö"MailBase"
  387.   íautoman% 
  388. 3 p
  389.  £5
  390.  ^
  391. activity$ "Wait, " st$ " database...": £1
  392.   Æ í
  393.   ╩ ╦st$ " database..."
  394.  bKeep$ "Keep":bDelete$ "Delete":bRplace$ "Replace"
  395.   íautoman% 1 pbKeep$ "Auto Mode":bDelete$ "Auto Mode":bRplace$ "Auto Mode"
  396.   íautoman% 2 pbDelete$ "Searching..."
  397.   ╔ `
  398.  recproc% 0
  399.  numdups% 0
  400.  
  401. FD1: 
  402.  
  403.   ╜ ** this routine is the actual loop that runs through every record in the database
  404.   ╜    searching for duplicates.
  405.  
  406.   ¥ink$
  407.   íink$  (27) 
  408. ink$ "C" p ├
  409.  a10$ VirField.MailBase
  410.  recproc% recproc% 1
  411.   íautoman% 
  412. 3 p
  413.  íautoman% 2 pbDelete$ "Searching..."
  414. a1$ FirstName.MailBase
  415. a2$ LastName.MailBase
  416. a3$ Company.MailBase
  417. a4$ Address1.MailBase
  418. a5$ Address2.MailBase
  419. a6$ City.MailBase
  420. a7$ State.MailBase
  421. a8$ Zip.MailBase
  422. a9$  (Entered.MailBase,"mm/dd/yyyy")
  423. a11$ ""
  424.  ü £: ╬: ╔ Y
  425.   Æ í
  426. FD2: 
  427.  
  428.   ╜ ** The screen is set up, and we have our current index.  Now, is
  429.   ╜    there any duplicates?
  430.  
  431.   ╔ ]
  432.   í B("MailBase") p
  433.  ╔ ▒ Ö"MailBase"
  434.  í B("MailBase") p ├
  435.  wFD1
  436.   ^
  437.  íautoman% 
  438. 2 p
  439. numdups% numdups% 1
  440.  
  441. a11$ VirField.MailBase
  442.  ╬
  443. bCmd% 0
  444. MF1: 
  445.  
  446.  ╜ ** We have found a duplicate and the user has selected
  447.  ╜    the manual mode, so we set up our display and allow
  448.  ╜    them to select whether to delete, etc.
  449.  
  450.  ╩ ╦"ESC=Stop  |  D=Delete  |  K=Keep  |  R=Replace"
  451.  ╧ Ñ 
  452.  ▀
  453.  íbCmd% 0 p ¥a$:a$  >(a$)
  454.  íbCmd% 3 
  455. a$ "R" pa11$ virfield.MailBase: ╔ Ña10$: ╔ ╛ Ö"MailBase": ╔ Ña11$: wFD1
  456.  íbCmd% 2 
  457. a$ "D" p ╔ ╛ Ö"MailBase": ╔ Ña10$: wFD1
  458.  íbCmd% 1 
  459. a$ "K" p
  460.  ╔ ▒ Ö"MailBase"
  461.  í B("MailBase") p ├
  462.  wFD1
  463.  Æ í
  464.  ía$ "C" 
  465. a$  (27) p ├
  466.  wMF1
  467.  ^
  468.  íautoman% 2 pnumdups% numdups% 1:bDelete$ "Deleting...":a11$ VirField.MailBase: ╬
  469.  ╔ ╛ Ö"MailBase"
  470.  ╔ Ña10$
  471.  wFD1
  472.  Æ í
  473.   Æ í
  474.   wFD1
  475.  
  476. EditEnts:
  477.  
  478.   ╜ ** Edit command.  This command allows you to modify, delete, and look
  479.   ╜    through all the different records.
  480.  
  481.   ╩ ƒ"Edit Mailing List"
  482.  ret% 9:helpsel% 3
  483.   ╩ σ Ñ │
  484.   Ñ1,"!activity$=~~:open form ~Mailit~:GOTO H1"
  485.   Ñ2,"!GOTO Editit"
  486.   Ñ3,"!GOTO Deleteit"
  487.   Ñ10,"!GOTO DropFunctions"
  488.  activity$ "Data Editing Form"
  489.   ╔ `
  490.   ┤ £"AddForm"
  491.  cc% 1
  492.  
  493. EE1:
  494.  
  495.   ╜ ** This actually searches for the keyboard input and turns the panel
  496.   ╜    on to allow the searching of records.
  497.  
  498.  a$ ""
  499.   ╩ ╦"ESC=Stop  |  E=Edit  |  D=Delete  |  Shift+F1=Help"
  500.   ╧ Γ 
  501.  Ñ
  502.   ¥a$
  503.   vFlushBuffer
  504.  a$  >(a$)
  505.   ía$ "?" 
  506. a$ "H" p ┤ £"Mailit": wH1
  507.   ía$ "E" wEditit
  508.   ía$ "D" wDeleteit
  509.   ía$  (27) 
  510. a$ "C" 
  511. a$ "Q" wDropFunctions
  512.   wEE1
  513.  
  514. Editit: 
  515.  
  516.   ╜ ** The user wants to edit this record, so we let them
  517.  
  518.   ╩ ╦"Editing Record..."
  519.   ▀ │
  520.   ö1,0
  521.   ╠ Ö"MailBase"
  522.   wEE1
  523.  
  524. Deleteit: 
  525.  
  526.   ╜ ** Are you sure you want to delete this record?
  527.  
  528.   ╩ ╦"Delete Record..."
  529.   ┬"Are you sure you wish to delete this record?","",135,n%
  530.   ín% p ╔ ╛ Ö"MailBase"
  531.   ╬
  532.   wEE1 
  533. DropFunctions: 
  534.  
  535.   ╜ ** Edit Exit.  Clear the function keys 
  536.  
  537.   Ñ2
  538.   Ñ3
  539.   Ñ10
  540.  cc% 0
  541.  activity$ ""
  542.   ┤ £"Mailit"
  543.   wMainMenu 
  544.  
  545. PressanyKey: 
  546.  
  547.   ╜ ** Subroutine to check for keypress
  548.  
  549.   ╩ ╦"Press any Key to continue..."
  550.   ╧a$
  551.   wMainMenu
  552.  
  553. PrintLabs: 
  554.  
  555.   ╜ ** Labels printing routine.
  556.   ╜    All labels files have the extension .SBB
  557.  
  558.   ╩ ƒ"Print Labels"
  559.   ╩ ╦"Printing Labels..."
  560.  c$ ""
  561.  fln$ "*.SBB"
  562.   ┬"Select the Labels Definition","To print with:",18,n%,fln$
  563.   ín% 0 wMainMenu
  564.   ¿ ªfln$
  565.   xLabData
  566.   ¢x% 0 q3
  567.  ╝a$(x%),e$(x%)
  568. c%(x%) x% 1
  569.   ▒x%
  570. P0: 
  571.  z% 1
  572.   ┬"Please choose what field(s)","To sort on:",20,zz%,z%,50,c%,a$
  573.   ízz% 0 wMainMenu
  574.   íz% 1 wPL1
  575.   íz% 4 
  576. z% 
  577. 1 p ┬"Illegal Selection,","Re-Enter!",113,n%: wP0
  578.   ╩ ╦"One Moment... Creating Index..."
  579.  activity$ "One Moment,"  (13)  (13) "Building Index..."
  580.   £1
  581.   │ _ wP1
  582.   ╛ úVirField
  583.   wP2
  584. P1: 
  585.   yP2
  586.   Æ
  587. P2: 
  588.   │ _ wErrtrap
  589.   «VirField,"VirField ; vtx clc rdo ; 50 ; 14 ; 0 ",e$(z% 1)
  590.   ë ú │VirField
  591.   úVirField
  592. PL1: 
  593.   ª ╨ ~
  594.   å ÿ
  595.   wMainMenu
  596.  
  597.   ╜ ** Lab Data holds the info for the Requester
  598.   ╜    20.  More sorts can be added by changing the
  599.   ╜    x% and DIM sizes, and then adding a DATA
  600.   ╜    statement to the end of this with the title,
  601.   ╜    then the actual equation to sort by.
  602.  
  603. LabData: 
  604.   è"Don't Sort.",""
  605.   è"Sort by LastName.","LastName"
  606.   è"Sort by Zip Code.","Zip"
  607.   è"Sort by Zip COde and LastName.","pad$(Zip,10)+LastName"
  608.  
  609. Utilities: 
  610.  
  611.   ╜ ** The Utilities main menu.
  612.  
  613.   ╩ ƒ"Mailing List Utilities"
  614.   £9
  615.   ╩ ╦"Select Utility..."
  616.   Ñ1,"!goto H1"
  617.  helpsel% 5:ret% 9
  618.  
  619. U1: 
  620.  
  621.   ╜ ** detect key entry, etc.
  622.  
  623.  a$ "":utilsel% 0
  624.   ╧ Ñ 
  625.  ▀
  626.   ¥a$:a$  >(a$)
  627.   vFlushBuffer
  628.   ╔ µa$
  629.  µ"S"
  630.  wConvertit
  631.  µ"E"
  632.  wExportit
  633.  µ"B"
  634.  wBackitup
  635.  µ"H","?"
  636.  wH1
  637.  µ"R"
  638.  wRestorebase
  639.  µ"Q", (27)
  640.  wMainMenu
  641.  µ ^
  642.  │utilsel% wConvertit,Exportit,Backitup,Restorebase,MainMenu,H1
  643.   Æ ╔
  644.   wU1
  645.  
  646. Exportit: 
  647.  
  648.   ╜ ** Allow the user to send out the database as ASCII delimited text
  649.  
  650.   ╩ ƒ"Exporting Mail Base"
  651.  activity$ ""
  652.   £1
  653.   ╩ ╦"Exporting..."
  654.   ┬"Name of Export File?","",4,n%,fln$,50
  655.   ín% 0 wUtilities
  656.  activity$ "Exporting Mail Base to File '" fln$ "'..."
  657.   ╬
  658.   Ö"MailBase"
  659.   ù qfln$ ╨ ~ s ( 0(f1$))  ( 0(f2$)), ( 0(r1$))  ( 0(r2$)),"0"
  660.   wUtilities
  661.  
  662. Backitup: 
  663.  
  664.   ╜ ** Save that database from the big bad DOS monster
  665.  
  666.   ╩ ƒ"Back Up Mail Base"
  667.  activity$ ""
  668.   £1
  669.   ╩ ╦"Select File Name..."
  670.   ┬"Backup Database","to Which File?",11,n%,fln$
  671.   ín% 0 wUtilities
  672.   í J(fln$) p ┤ Ö +(fln$, /(fln$) 4): ╛ Ö +(fln$, /(fln$) 4)
  673.  activity$ "Backing up Mail Base to the new database file '" fln$ "'..."
  674.   ╩ ╦"Backing up your mail base..."
  675.   ╬
  676.   Ö"MailBase"
  677.   ╔ t q Öfln$
  678.   wUtilities
  679.  
  680. Restorebase: 
  681.  
  682.   ╜ ** Restore the database back to the MailBase file.
  683.  
  684.   ╩ ƒ"Restore Mail Base"
  685.   ╩ ╦"File to Back up from..."
  686.  activity$ ""
  687.   £1
  688.   ┬"Restore from","Which File?",11,n%,fln$
  689.   ín% 0 wUtilities
  690.   í J(fln$ ".sbf") 0 p ┬"Cannot find database " fln$,"",113,n%: wUtilities 
  691.   ┬"Proceeding with this action will overwrite","all data in the present database. Continue?",148,n%
  692.   ín% 0 wUtilities
  693.   xFieldNameData
  694.  z1% 0
  695.  
  696.   ╜ ** We are making sure that the user is trying to restore a file that is the same definition as the main MAILBASE file.
  697.  
  698.   ┤fln$ ".sbd" ¢ ñ
  699. Rb1: 
  700.   ╝b$
  701.   ñ ca$
  702.   í -(a$,1) ">" pz1% 9
  703.  a$  F( +(a$,15))
  704.   í >(a$)  >(b$) wGetoutofHere
  705.   íz1% pz1% 0: ñ ca$
  706.   íb$ "Misc2" wYeppers
  707.   wRb1
  708. GetoutofHere: 
  709.   å ñ
  710.   ┬"This file is not in the Mail Base","format.  Re-configure and try again.",113,n%
  711.   wUtilities
  712. Yeppers: 
  713.  
  714.   ╜ ** The file is in the same format, so we over-write the MailBase file with the new file
  715.  
  716.   å ñ
  717.  activity$ "Restoring database..."
  718.   ╩ ╦"Restoring database..."
  719.   £1
  720.  cc% 1
  721.   ╛ a Ö"MailBase"
  722.   ófln$ ".sbf" q Ö"MailBase"
  723.  cc% 0
  724.   wUtilities
  725.  
  726. BegStand: 
  727.  activity$ ""
  728.   £1
  729.   ┤ Ö"RuleBase"
  730.   wCI1
  731.  
  732. Convertit: 
  733.  
  734.   ╜ ** this is the infamous standardize routine
  735.  
  736.  activity$ ""
  737.   £9
  738.   ╩ ╦"Are you sure?"
  739.   ╩ ƒ"Standardize Mail Database"
  740.   Äpth$
  741.   ┤ Ö"RuleBase"
  742.   ┬"This process can take a considerable time for "  H( ( A("MailBase"),5,0)) " records,","do you wish to continue?",148,n%
  743.   ín% 0 wUtilities
  744. CI1: 
  745.   ╩ ╦"Standardizing Mail Base..."
  746.  activity$ "Processing Rule Base..."
  747.   £1
  748.  ctx% 1
  749.   ═RuleNum.RuleBase ctx%:ctx% ctx% 1
  750.  
  751.  ctx% 1
  752.   ═RecNum.MailBase ctx%:ctx% ctx% 1
  753.  
  754.   úRuleNum.RuleBase
  755.   £10
  756.  rctotal%  A("MailBase")
  757.  rcleft%  A("MailBase")
  758.  rcnum% 0
  759.  totrul%  A("RuleBase")
  760.  onrul% 0
  761.   vUpdateScreen
  762.   Ö"MailBase"
  763.   úrecnum.mailbase
  764.   ╔ ` Ö"MailBase"
  765.   ╔ ` Ö"RuleBase"
  766. C1: 
  767.   ╜ ** we build the zz$ which is the string of what we are actually looking for
  768.   ╜    the nsp% means that we either don't care if there is a space at the end (0), or that we DO care (1)
  769.   ╜    the wh% is set for look for zz$ anywhere (1), just at the end (2), or only at the beginning (3)
  770.   ╜    the @ is replaced with spaces
  771.   ¥k$
  772.   ík$  (27) p ╔ ╨: ╔ `: wEndStand
  773.   í B("RuleBase") wCend
  774.  onrul% onrul% 1
  775.  rcnum% 0
  776.  rcleft%  A("MailBase")
  777.   vUpdateScreen
  778.  nsp% 0:wh% 1
  779.  z$ LookFor
  780.   í +(z$,1) "*" pz$  ,(z$,2):wh% 2
  781.   í +(z$,1) "^" pz$  ,(z$,2):wh% 3
  782.  zz$ ""
  783.   ¢x% 1 q /(z$)
  784.  í ,(z$,x%,1) "!" p
  785. zz$ zz$ ""
  786.  ^ í ,(z$,x%,1) "@" p
  787. zz$ zz$ " "
  788.  ^
  789. zz$ zz$  ,(z$,x%,1)
  790.  Æ í
  791.   ▒x%
  792.   í ?(z$,"!") pnsp% 1
  793.  ex$ "select where " FieldName.RuleBase " like "  (34) "*"  H( F(zz$)) "*"  (34)
  794.   ûex$
  795.  ex$ ""
  796.   ╔ ` Ö"Mailbase"
  797. C20: 
  798.  
  799.   ╜ ** now we make the a$ equal the contents of the field we are searching, and add a space at the end (for searching purposes)
  800.  
  801.  ex$ "a$=" FieldName.RuleBase
  802.   ûex$
  803.  ex$ ""
  804.  a$ a$ " "
  805.   í B("MailBase") p ╔ ▒ Ö"RuleBase": wC1
  806.  rcnum% Recnum.mailBase
  807.  rcleft% rctotal% rcnum%
  808.   vUpdateScreen
  809.  
  810. CRemake: 
  811.  
  812.   ╜ ** is zz$ in a$?  If yes, then we possibly have a match
  813.  
  814.  zz%  ?( >(a$), >(zz$))
  815.   ízz% 0 p ╔ ▒ Ö"MailBase": wC20
  816.   ínsp% 1   ,(a$,zz%  /(zz$),1) " " p ╔ ▒ Ö"MailBase": wC20
  817.   ízz% 1  wh% 3 p ╔ ▒ Ö"MailBase": wC20
  818.   íwh% 2 p
  819.  ízz%  /(zz$) 4 
  820.  /(a$) p
  821.  ╔ ▒ Ö"MailBase": wC20
  822.  Æ í
  823.   Æ í
  824.   ízz% 
  825. 2 pff$ "" ^ff$  +(a$,zz% 1)
  826.  af$  ,(a$,zz%  /(zz$))
  827.  Ct$ ChangeTo
  828.  pw% 1
  829.   í +(Ct$,1) "*" ppw% 2:Ct$  ,(Ct$,2)
  830.   í +(Ct$,1) "^" ppw% 3:Ct$  ,(Ct$,2)
  831.  ch$ ""
  832.   ¢x% 1 q /(Ct$)
  833.  í ,(Ct$,x%,1) "@" pch$ ch$ " " ^ch$ ch$  ,(Ct$,x%,1)
  834.   ▒x%
  835.   í >( ,(a$,zz%, /(ch$)))  >(ch$) p ╔ ▒ Ö"MailBase": wC20
  836.   í ?(Ct$,"~") pch$ " "
  837.   ípw% 1 pa$ ff$ ch$ af$
  838.   ípw% 2 pa$ ff$ af$ ch$
  839.   ípw% 3 pa$ ch$ ff$ af$
  840.  ex$ FieldName.RuleBase "=a$"
  841.  a$  H( F(a$))
  842.   ûex$
  843.  ex$ ""
  844.   Ö"MailBase"
  845.   ╠,1
  846.   ╔ ▒ Ö"MailBase"
  847.   wC20
  848.  
  849. Cend: 
  850.  
  851.   ╜ ** all done, let's mosy on out of here
  852.  
  853.   Ö"MailBase"
  854.   ╠,2
  855.   å t
  856.  activity$ "Standardization Complete."  (13)
  857.   ísrtn% pactivity$ activity$ "Now Processing Merge File..."  (13)
  858.   ┤ £"Mailit"
  859.   ╧ ¢2
  860. EndStand: 
  861.   ísrtn% p ├
  862.   wUtilities
  863.  
  864. UpdateScreen: 
  865.  
  866.   ╜ ** this updates the screen so the user can see why we are taking fourteen hours away from their favorite mailbase file
  867.  
  868.  onrul$  H( (onrul%,5,0)) " of "  H( (totrul%,5,0)) "."
  869.  rcleft$  H( (rcleft%,6,0))
  870.  rcnum$  H( (rcnum%,6,0))
  871.   írcnum% 0 prcnum$ "Searching..."
  872.   ╬
  873.   ├
  874.  
  875. SetOpts: 
  876.  
  877.   ╜ ** These commands are mostly front end,  All they are doing is asking
  878.   ╜    the user for a series of values.
  879.  
  880.   ╩ ƒ"Set Mail Options"
  881.  bCancel$ "Cancel"
  882.   £7
  883.   ╩ ╦"ESC=Stop  |  M=Modify Rules  |  C=Change Separators"
  884.   ¼1,0,0," "
  885. SO1: 
  886.  optsel% 0:a$ ""
  887.   ╧ Ñ 
  888.  ▀
  889.   íoptsel% 0 p ¥a$:a$  >(a$): vFlushBuffer
  890.   ía$ "M" 
  891. optsel% 1 wOptsRule
  892.   ía$ "C" 
  893. optsel% 2 wOptsSep
  894.   ía$  (27) 
  895. a$ "Q" 
  896. optsel% 4 wMainMenu
  897.   ía$ "H" 
  898. optsel% 5 phelpsel% 7:ret% 9: wH1
  899.   wSO1
  900.  
  901. OptsRule: 
  902.  
  903.   ╜ OK, here we change and/or add all them rules for the rule base
  904.   ╜ the rules are.  WHEN SEARCHING:
  905.   ╜ * - Look for this string at the end of the field
  906.   ╜ ^ - Look for this string at the beginning of the field
  907.   ╜ @ - this is the same as a space
  908.   ╜ ! - do not allow the search field to end in a space
  909.  
  910.   ╜ WHEN REPLACING:
  911.   ╜ * - Put the resultant string at the end of the field
  912.   ╜ ^ - Put the resultant string at the start of the field
  913.   ╜ @ - Just a space
  914.   ╜ ~ - Delete this entirely (put nothing in its place)
  915.  
  916.   ╩ ƒ"Modify Rule Base"
  917.   ╩ ╦"Select field to modify..."
  918.   Ö"MailBase"
  919.   ┬"Select Field","",9,n%,flnm$
  920.   ┤ Ö"RuleBase"
  921.   ín% 0 wSetOpts
  922.  ctx% 1
  923.  flnm$  F( +(flnm$,15))
  924.   ═RuleNum.RuleBase ctx%:ctx% ctx% 1 ╨FieldName.RuleBase flnm$
  925.  
  926.   Ö"RuleBase"
  927.  ex$ "select where FieldName.RuleBase LIKE "  (34) flnm$  (34)
  928.   ûex$
  929.  ex$ ""
  930.  mdf$ "Modifying the " flnm$ " field"
  931.   ┤ £"optsel2"
  932.  cc% 1
  933.   ╔ `
  934. Op: 
  935.  
  936.   ╜ ** this area allows entry into the rule base (and editing, deleting, etc.)
  937.  
  938.   ╩ ╦"ESC=Stop | N=New | D=Delete | E=Edit | M=Modify Other"
  939.  a$ ""
  940.   ╧ Γ 
  941.  Ñ
  942.   ╩ ╦"ESC=Stop | N=New | D=Delete | E=Edit | M=Modify Other"
  943.   ¥a$
  944.   vFlushBuffer
  945.  a$  >(a$)
  946.   ía$ "N" wOp1
  947.   ía$ "M" p å £: wOptsRule
  948.   ía$ "D" wOp2
  949.   ía$ "E" wOp3
  950.   ía$  (27) 
  951. a$ "C" pcc% 0: Γ e: ╔ ╨: ┤ £"Mailit": wMainMenu
  952.   wOp
  953.  
  954. Op1: 
  955.  
  956.   ╜ ** Add new rule
  957.  
  958.  n$ "":ct$ ""
  959.   ┬"Enter Value to Look for in Field " flnm$ "?","",4,n%,n$,15
  960.   ín% 0 wOp
  961.   ü Ö"RuleBase"
  962.  FieldName.RuleBase flnm$
  963.  LookFor.RuleBase n$
  964.   ┬"Change " n$ " to what?","",4,n%,ct$,40
  965.   ín% 0 wOp
  966.  ChangeTo.RuleBase ct$
  967.  RuleNum.RuleBase ctx%
  968.  ctx% ctx% 1
  969.   ╠ Ö"RuleBase"
  970.   wOp
  971.  
  972. Op2: 
  973.  
  974.   ╜ ** Delete a rule
  975.  
  976.   ┬"Delete the Change " LookFor  " to",ChangeTo  " record?",135,n%
  977.   ín% 0 wOp
  978.   ╔ ╛ Ö"RuleBase"
  979.   £1
  980.   wOp
  981.  
  982. Op3: 
  983.  
  984.   ╜ ** Edit a rule
  985.  
  986.   ┬"Change the " LookFor  " to " ChangeTo,"Record?",135,n%
  987.   ín% 0 wOp
  988.  n$ LookFor.RuleBase
  989.   ┬"Alter Look For to ","",4,n%,n$,15
  990.   ín% 0 wOp
  991.  LookFor n$
  992.  n$ ChangeTo
  993.   ┬"Alter Change To Field to ","",4,n%,n$,40
  994.   ín% 0 wOp
  995.  ChangeTo n$
  996.   ╠ Ö"RuleBase"
  997.   ╬
  998.   wOp
  999.  
  1000. OptsSep: 
  1001.  
  1002.   ╜ ** Change the field and record separators
  1003.  
  1004.  bCancel$ "Cancel"
  1005.  fo1$ f1$:fo2$ f2$:ro1$ r1$:ro2$ r2$
  1006.   ╩ ƒ"Change Export Separators"
  1007.   £8
  1008.   ╩ ╦"ESC=Stop  |  F=Fields  |  R=Records"
  1009.  
  1010. OS1: 
  1011.  
  1012.   ╜ ** menu handler
  1013.  
  1014.  optsel% 0:a$ ""
  1015.   ╧ Ñ 
  1016.  ▀
  1017.   íoptsel% 0 p ¥a$:a$  >(a$): vFlushBuffer
  1018.   ía$  (27) 
  1019. a$ "C" 
  1020. optsel% 99 pf1$ fo1$:f2$ fo2$:r1$ ro1$:r2$ ro2$: wMainMenu
  1021.   ía$ "U" 
  1022. optsel%  999 wMainMenu
  1023.   ía$ "F" p ö6,2: wCheckup
  1024.   ía$ "R" p ö8,2: wCheckup
  1025.   wOS1
  1026.  
  1027. Checkup: 
  1028.  
  1029.   ╜ ** here we are checking to make sure the user typed in values that are valid ASCII field delimters
  1030.   ╜    if he didn't, we change them back to what they were before.
  1031.  
  1032.   í 0(f1$) 0   .(f1$) 48 pf1$ fo1$
  1033.   í 0(f2$) 0   .(f2$) 48 pf2$ fo2$
  1034.   í 0(r1$) 0   .(r1$) 48 pr1$ ro1$
  1035.   í 0(r2$) 0   .(r2$) 48 pr2$ ro2$
  1036.   í 0(f1$) 
  1037.  0(f1$) 255 pf1$ fo1$
  1038.   í 0(f2$) 
  1039.  0(f2$) 255 pf2$ fo2$
  1040.   í 0(r1$) 
  1041.  0(r1$) 255 pr1$ ro1$
  1042.   í 0(r2$) 
  1043.  0(r2$) 255 pr2$ ro2$
  1044.   ╬
  1045.   wOS1
  1046.  
  1047. Helpme: 
  1048.  
  1049.   ╜ ** Main entrance to the Help area
  1050.  
  1051.   ╩ ƒ"MailBase Help"
  1052.  ret% 0:helpsel% 0
  1053.  
  1054. HON: 
  1055.  
  1056.   ╜ ** All the help calls from utilities come in here
  1057.  
  1058.   £3
  1059.   ╩ ╦"Select Help Topic"
  1060.   ¼ e
  1061.   íret% wH1
  1062.  
  1063. HNK: 
  1064.  
  1065.   ╜ ** help main menu
  1066.  
  1067.   ╧ Ñ 
  1068.  ▀
  1069.   ¥a$:hl%  ?("AMELUPOQS", >(a$))
  1070.   vFlushBuffer
  1071.   ía$  (27) 
  1072. hl% 8 
  1073. helpsel% 8 wEndHelp
  1074.   íhelpsel% hl% 0 wHNK
  1075.   íhelpsel% 0 phelpsel% hl%
  1076.  
  1077. H1: 
  1078.  
  1079.   ╜ ** actual help area.  displays proper screen
  1080.  
  1081.   ┤ Ö"HelpBase"
  1082.  hl$ "<Esc> - Quit back to Main | Any other key for more Help."
  1083.   íret% phl$ "<Esc> - Quit back to Start | Any other key for more Help."
  1084.   ╩ ╦hl$
  1085.   ╔ ╨Topic  helpsel%
  1086.   ╔ `
  1087.   £4
  1088.   ízr% 0  ret% pzr% helpsel%
  1089.   ╧ Ñ 
  1090.  ▀
  1091.   ¥a$
  1092.   vFlushBuffer
  1093.   ía$  (27) 
  1094.  >(a$) "Q" wEndHelp
  1095.   wHelpme
  1096.  
  1097. EndHelp: 
  1098.  
  1099.   ╜ ** return to the proper area
  1100.  
  1101.   │zr% wAddEnts,MergeEnts,EditEnts,PrintLabs,Utilities,PurgeEnts,SetOpts
  1102.   wMainMenu
  1103.  
  1104. Quitit: 
  1105.  
  1106.   ╜ ** quit routine
  1107.  
  1108.   ┬"Confirm Exit...","",148,n%
  1109.   ín% 0 wMainMenu
  1110.   ┤"MDefault" ¢ ╢
  1111.   { ½
  1112.   å ╢
  1113.   å t
  1114.   ╩ ƒ""
  1115.   Γ │
  1116.   Æ
  1117.  
  1118. FieldNameData: 
  1119.  
  1120.   ╜ this is the data used to make sure the database is in the same format as the mailbase file
  1121.  
  1122.   è"RecNum","VirField","Title","FirstName","LastName","Company","Address1","Address2","City","State","Zip","Country","HomePhone","WorkPhone","FAX","Notes","Entered","Misc1","Misc2"
  1123.  
  1124. FlushBuffer: 
  1125.  
  1126.   ╜ get rid of all those extra typed characters
  1127.  
  1128.   ¥zz1$
  1129.   ízz1$ "" p ├
  1130.   wFlushBuffer
  1131.  
  1132. Errtrap: 
  1133.   ╜ an error has occurred.  The actual error is in ERRNO, and the name of the error can be acquired with the ERR$() command
  1134.   ╜ an error number 11 is a control-c or a Stop button
  1135.   ╜ a RESUME is necessary to clear the Error condition and to resume with the normal program execution
  1136.   ╜ ** cc%=0 --- error occured with program.  Non-expected
  1137.   ╜ ** cc%=1 --- Expected error, return back to next statement (stay in same routine)  - I use this for the end-of-file error that occurs when you use WAIT PANEL
  1138.  
  1139.   í & 10  cc% 1 p ╩ ╦"*** End of File ***": : ╧ ¢.5: y ▒
  1140.   ícc% 1   & 11 pcc% 0: Äpth$: ┤ £"Mailit": yMainMenu
  1141.   í & 11 p Äpth$: ┤ £"Mailit": yMainMenu
  1142.   ícc% 1 p y ▒
  1143.   ╩ ╦"****"  (( &) "****"
  1144.   ╧ ¢1.2
  1145.   Äpth$
  1146.   ┤ £"Mailit"
  1147.   yMainMenu
  1148.  
  1149.