Difference between revisions of "Code4Lib:Community Portal"

From Code4Lib
Jump to: navigation, search
m (Reverted edits by 59.56.174.199 (Talk); changed back to last version by McGauth925)
m (Reverted edits by 88.191.17.209 (Talk); changed back to last version by Wickr)
 
(3 intermediate revisions by 3 users not shown)
(No difference)

Latest revision as of 02:57, 7 July 2009

Amazing! If I were creating a website, with the idea that people could post things to it, I'd have a link or button for 'Post'. but, I'm sure there's a lot that I don't understand. Isn't it amazing, all the things you have to understand, to do the simplest things?

Anyway, this is the 1st part of the source code for an OCLC Connexion cataloging macro. It's 3600+ lines, including lots of whitespace and comments, so it wouldn't all fit. Plus, it seems to get formatted automatically in a completely unhelpful way. If you can get past that, and use this by tailoring it to your library, go for it. yes, I wrote all of it.

=============================================

'NOTE1: IsNumeric doesn't seem to work as advertised. I made a function, IsNumber ' that does.


' MODIFICATIONS/VERSIONS (Better late than never.) '=================================================== ' 5/21/4 - When this program runs, users have already copied the .b# from III, ' and they paste it into the CatME record after CatER ends. CatER ' copies the .b# from the clipboard, puts it into fBNumber, puts it ' into the recs/bin 949 line, and then clears the clipboard.

' 6/2/4 - Changed label printing, to go through View menu. It's a shorter, ' command. Also, if there's no holding library entered for a branch, ' this method makes that clear. With the old method, the label simply ' wouldn't print, if there were not a holding library for that branch.

' 6/18/4 - Fixed infinite loop bug in Sub SixFifties; also set that sub up to warn users ' if there are no 650 0 (2nd indicator = 0) or 650 1 (2nd indicator = 1) in ' a juvenile record

' 6/21/4 - Went back to old label printing method because, for some people, the sendkeys ' timing didn't work, and they had a print dialog box they had to close manually.

' 8/24/4 - Put in a check to make sure fBnumber$, which is read from the clipboard, actually ' holds a bibliographic record number. It has to be about the right length, start ' with a 'b', contain numbers etc. Otherwise it's set to NULL. So now, nobody ' will wind up pasting whatever the last thing they cut & pasted during that day, ' into the recs/bin line. ALSO: a messagebox tells user there's no bib rec number.

' 9/9/4 - This program deletes C:\CatLabel\records.txt, then creates a new version to hold ' the new record. It creates a new file by printing the record to that file. In ' Tools > Options > Record Print, the checkbox that indicates it should go to that ' file MUST be checked. If it's not, the record is printed to the default printer ' instead, and the new file is never created. The change is to verify that that ' file exists, after the new record is printed. If not, user is informed, and ' program ends.


' 9/10/4 - Made doSpellCheck% boolean variable, that starts out FALSE, and is set ' TRUE just before Done: label. Then, spellchecking is called only if ' doSpellCheck% is set TRUE. So spellchecking should only happen if this ' program runs correctly, instead of also running when it doesn't run ' correctly.

' 10/1/4 - In sub SizeCheck, changed the automatic designation of monographs w/ call# ' beginning with M9, where 9 is any number, as oversize, ONLY FOR SPECIAL ' COLLECTIONS. Size of book must be checked for oversize & folio. For all ' other locations, M9 still makes it automatically oversize.

' 10/25/4 - Changed Faculty Publications choice, under OTHER, and as requested by Christina ' to put Archives at top of call number label, instead of Faculty Publications.


' 11/8/4 - Stop NACR from being printed at the bottom of labels, when Other > Special ' Storage is chosen, for location/branch

' 11/19/4 - A message to user, sent when a multivolume set included discs, was in error. ' "|n & 1 disc |u d" becomes "|c & 1 disc |u d"

' 11/22/4 - Installed inputbox at point where user is informed there's no .b# in the ' the clipboard, to put into the record for overlaying. That lets user quit ' program right there if s/he wants to. ' - RELATED: Program only clears the clipboard if program runs normally. ' - Made program read MemoryER.txt right off, so that it would have that information ' in case some problem ends the program, so that it could be written back to ' MemoryER.txt. That write happens after the Done: label ' - Made program provide an option to quit the program, if ff, call#, and 260 dates ' don't match.

' 2/5 - Adapted this program for Connexion ' 2/28/5 - Barcodes now added to Special Collections Materials


' **************************************************************************** ' FUNCTION/SUB PROGRAM DECLARATIONS ' **************************************************************************** declare Sub Checkcall (callno$, callgood%) 'PERFORMS (MINIMAL) CHECK ON CALL NUMBER declare Sub WriteBCode(bcodestrt$) 'CHANGE 1ST PART OF BARCODE declare Sub ChngeInit(init910$, initrec$) 'CHANGE 910 AND RECS/BIN INITIALS declare Sub GetBCEnd(bcode$, notMain%, reader%, bcodestrt$) 'GETS LAST PART OF BARCODE declare Sub CheckSeries 'LOOK FOR SERIES TAGS & CHECK PUNCTUATION declare function CheckDlc (dlc%) declare function CheckPcc (pcc%)

declare Sub GetFxdFlds 'BREAKS OUT FIXED FIELDS declare Sub CheckDates(dateFF1$, dateProblem%) 'COMPARES DATES IN RECORD declare function GetDate (targetLine$) 'EXTRACTS DATES FROM REST OF LINE declare Sub Chk245 (bad245%) 'CHECK, FIX 245 2ND INDICATOR

                     'GET DETAILS OF "OTHER" BRANCH/LOCATION                           

declare Sub Other(st49$, item2$, chksize%, circ$, locate$, endnote$, quit%, paperBrnch$, _

                 callTag$, doBarcode%, status$, choice2%, labelEnd$)
                                'PRINT LABEL INFORMATION

declare Sub PrintLabel(endnote$, labelSize$, numVol%, branch%, st49$, row049%, _

                      labelEnd$, space$, paperBrnch$)                       
                                'READS 300 FIELD FOR BOOK SIZE

declare Sub SizeCheck(ovNote$, locate$, endnote$, stnote$, over%, ovmsg$, let2$, Firstlet$, _

             paperBrnch$)          'debug
                 'CHECK FOR DIALOG BOX CHOICES THAT CONFLICT WITH FASTCATTING

Declare Sub CrossCheck(fastCatter%, chooseAgain%, tag%, branch%, retro%, disk%) Declare Sub CrossJuv(chooseAgain%, tag%, branch%, audn$) 'CHECK JUV CHOICE CONFLICTS Declare Sub CrossDocs(chooseAgain%, branch%, tag%) 'CHECK DOCS CHOICE CONFLICTS Declare Function IsNumber(someNumber$) 'RETURNS 1 IF PASSED VALUE IS NUMERIC Declare Sub SixFifties Declare Sub CheckPrevious Declare Sub CheckCallZ(badZ%) 'Check for call number that starts with Z, and with

                                           '  the following number > 1199

Declare Sub GetPrice(money$) 'Get price of material, for item record Declare Sub GetCallNo(callTag$, TagSubstitute%, GotIt%) 'Gets call#


' **************************************************************************** ' ****************************************************************************


option explicit 'MEANS ALL VARIABLES MUST APPEAR IN A 'DIM' STATEMENT - so if I misspell one,

                'as I use it in the program, this line means program won't recognize it, so
                'an error message will be put on screen.  So this insures that I always use
                'the same spelling.  Numbers and text strings always get put in the correct
                'variable - or at least one with the right spelling.                 
                

' **************************************************************************** ' GLOBAL VARIABLES ' ****************************************************************************

'FOLLOWING GLOBAL VARIABLES DIDN'T WORK, PASSED AS SUB PROGRAM PARAMETERS, SO... Global dtst$, dateFF1$, dateFF2$, ctry$, ills$, cont$, conf$, fest$, indx$, fict$, lang$ Global srce$, audn$, gpub$, biog$, desc$, blvl$, typee$, elvl$, form$, mrec$, TEST% Global fBnumber$, fCallno$

' **************************************************************************** ' START MAIN PROGRAM ' ****************************************************************************

sub main


 'This macro asks the user what tag field has the desired call number, 
 'and which branch the book is to be cataloged for.  It also queries for
 'whether the book is an analytic.  It then edits the record accordingly.
 
 'Because CatMe can be flakey about storing macros, there is a text copy
 'of this program in c:\oclcapps\catme\catERSave.txt  That can be cut and
 'pasted into a new macro, and works fine


 dim cs as object 
 Set CS = CreateObject("Connex.Client")

              
                

' **************************************************************************** ' SET UP STRINGS AND VARIABLES ' ****************************************************************************

        'TELL PROGRAM THE NAMES OF ALL THE VARIABLES THAT WILL BE USED
 dim continue%, found%, do049%, callgood%, callnum$, money$, otherDone%
 dim wholeline$, msgtext$, itemplate1$, itemplate2$, bad245%, price$, GotHoldings% 
 dim itemplate3$, recsbin$, itemline$, nineten$, Firstlet$, do090%, completeBarCode$
 dim item1$, end49$, ovnote$, stnote$, locate$, item2$, dlc%, serTag$
 dim locatermd%, locatemsg$, circ$ , st49$, endnote$, pcc%, volPref$, doSpellCheck%
 dim chksize%, ovmsg$, over%, BCodeEnd$, numVol%, answer%, cmd$, GotIt%
 dim bcode$, init910$, initrec$, analytic%, callnum1$, find49$, fileff$
 dim callnum2$, i%, text$, size$, bool%, linelen%, twolet$, msgtitle$, vbcrlf$
 dim bcodestrt$, filename$, chooseAgain%, fastCatter%, msgtxt$, diskMacro$, foundSize%  
 dim lineLdr$, line008$, recFile$, recLine$, lccn$, char3$, oldlccn$, newlccn$
 dim row049%, branch%, labelsize$, labelEnd$, space$, diskFile$, j%, callTag$
 dim notMain%, BranchLst$, CheckLst$, CallTagLst$, someNumber$, reader%, badZ%
 dim quit%, paperBrnch$, Let2$, retro%, disk%, tag%, level%, doBarcode%, hasA%
 Dim SaveItem1$, diskItem$, volumeNumber$, again%, status$, choice2%, choice2File$
 Dim msgDefault$, inputAnswer$, dateProblem%, found050%, TagSubstitute%, found090%
               

' **************************************************************************** ' GENERAL INITIALIZATIONS ' ****************************************************************************

 chooseAgain% = TRUE  'USED TO SIGNAL INCOMPATIBLE USER CHOICES, EG FASTCAT WITH DOCS
 linelen% = 0                                         'HOLDS LENGTH OF A LINE OF TEXT
 numVol% = 1                   'MOSTLY, THERE'LL BE 1 VOLUME PER BIBLIOGRAPHIC RECORD 
 analytic% = FALSE                         'FLAG SET TO TRUE IF 090 ANALYTIC SELECTED
 locatemsg$ = " should precede Call # on T.p. verso(s)"    'LAST PART OF REMINDER MSG
 locatermd% = TRUE                      'OUTPUT REMINDER MESSAGE IF BRANCH ISN'T MAIN
 chksize% = TRUE       ' SIGNALS TO CHECK BOOK SIZE IF NOT REF, PAM, OR PZ (JUVENILE)
 over% = FALSE                                  'ASSUME BOOK ISN'T OVERSIZE, TO START
 filename$ = "C:\CATLABEL\MEMORYER.TXT"        'HOLDS INFO STORED AFTER PROGRAM STOPS
 diskMacro$ = "New!Disc_floppy"            '= MACRO THAT DOES SOME DISK/C PROCESSING
 foundSize% = FALSE       'IF THIS REMAINS FALSE, MSGBOX TELLS USER SIZE WASN'T FOUND
 vbcrlf$ = chr$(13)                                              ' linefeed character 
 RecFile$ = "c:\CatLabel\records.txt"       'Holds record info, for holdings information
 labelEnd$ = " "          'Variable that Holds note to add to bottom of printed label
 space$ = " "                                                  'Printed label spacing
 diskFile$ = "c:\Catlabel\disk.txt"              'File that holds disk info for label
 notMain% = FALSE 
 doBarcode% = TRUE                               'Default to getting barcode from user
 choice2File$ = "C:\CatLabel\Choice2.txt"
 TEST% = 0                        'Debugging, set to 1 by sub or section being tested
 doSpellCheck% = FALSE                   
                                 
                

' **************************************************************************** ' ITEM LINE COMPONENT INITIALIZATIONS ' **************************************************************************** 'These are pieces of the item line. The pieces get changed and added to, depending 'on user choices, and what the program finds in the record.

 stnote$ = " ßn"                               'HOLDS NOTE INFO EG REF, PAM, CHEM ETC.
 endnote$ = ""                   'HOLDS BRANCH LOCATION IN NOTE COMPONENT OF ITEM LINE
 ovnote$ = ""                                          'HOLDS OVERSIZE PORTION OF NOTE
 price$ = " ßp "
 locate$ = "ßl "                      'WILL HOLD ITEM LOCATION EG MLS, BES, MRS, ETC.
 circ$ = "ßt 0"                          'CIRCULATION - CHANGES TO 1 FOR REF & Special
 st49$ = "049  NHM"                       'HOLDS 049 LINE INFO, CHANGES WITH BRANCH
 item1$ =  "949 1ßg 1 ßc "                              'HOLDS 1ST PART OF ITEM LINE
 item2$ =  " ßz 090 ßa "                        'HOLDS ITEM INFO PRECEDING CALL NUMBER
 callnum$ = ""
 status$ = " ßs p ßi " 
                

' **************************************************************************** ' SET UP DIALOG BOXES ' ****************************************************************************

' -- MAIN DIALOG BOX -- 'This is like a form for the main dialog box, which gets user choices - so it's 'like a model for the actual dialog box. The model, in this program, is named 'userdialog. An actual instance, based on this model, gets defined right after 'the model (aka class) is defined. Object Oriented Programming stuff. 'In this program, the actual instance is named mydialog.

' -- SET CONTENTS OF DROPLISTBOXES --

  BranchLst$ = "Main" & Chr$(9) & "Ref" & Chr$(9) & "Math" & Chr$(9) & "Physics" & _
                  Chr$(9) & "BioSci" & Chr$(9) & "Chem" & Chr$(9) & "Eng" & Chr$(9) & _
                   "Call" & Chr$(9) & "Pam"  & Chr$(9) & "Docs" &  Chr$(9) & "Juv" _
                    &  Chr$(9) & "Other"
                                     
  CheckLst$ = "FastCat" & Chr$(9) & "Monograph" & Chr$(9) & "TopCat"
        
  CallTagLst$ = "050" & Chr$(9) & "090" & Chr$(9) & "090 Analytic" & Chr$(9) & "086"
  
  '               *******************************************   
  

' -- MAIN DIALOG BOX CLASS --

  Begin Dialog UserDialog 200, 20, 100, 270, "      Options"
      
      CheckBox 5, 106, 65, 14,  "Disks?",            .checkdis
      CheckBox 5, 126, 75, 14,  "Multi Volumes?",    .checkVol
      CheckBox 5, 146, 75, 14,  "Retrocon?",         .checkRet       'REMEMBERED
      
      CheckBox 5, 166, 80, 14,  "Change initials?",  .checkInit
      CheckBox 5, 186, 80, 14,  "Change barcode?",   .checkBar
      CheckBox 5, 206, 80, 14,  "Barcode Reader?",   .checkReader    'REMEMBERED
      
      Text 5, 3, 64, 7, "     Check Level"
      droplistbox 5, 11, 64, 45, CheckLst$, .checkLevel
      
      Text 5, 34, 64, 7, "       Call # Tag"
      droplistbox 5, 42, 60, 65, CallTagLst$, .Tag
      
      Text 4, 65, 69, 10, "Branch/Location"
      droplistbox 5, 73, 50, 130, BranchLst$, .branch 
                 
      OKButton  28, 230, 35, 14
      CancelButton  28, 250, 35, 14
      
      Text 70, 254, 30, 10, "2/28/5"                       'DATE  - FOR VERSION CONTROL
     
  End Dialog
                       
  Dim mydialog as UserDialog   'MYDIALOG IS AN instance OF CLASS = USERDIALOG
  

' *************************************************************************** ' ***************************************************************************

' -- QUERY DIALOG BOX -- ' AS ABOVE, FIRST THE CLASS, THEN THE OBJECT IS CREATED

  Begin Dialog YesNodial 130, 80, "CONTINUE?"
      ButtonGroup.BG1         
          pushbutton 16, 22, 67, 12, "Yes   (ENTER)",  .opt1         
          pushbutton 16, 60, 67, 12, "No", .opt2               
  End Dialog
  
  Dim YesNo as YesNodial  'YESNO IS A DIALOG BOX, BASED ON THE MODEL YESNODIAL
  
 

' *************************************************************************** ' *************************************************************************** ' START PROCESSING ' *************************************************************************** ' ***************************************************************************


 'doSpellCheck% = FALSE                               'NO SPELL CHECK IN CONNEXION 2/17/5


' GET PREVIOUS CHOICES FROM MEMORY FILES 'This program saves some user choices to a separate file. C:\OCLCAPPS\CATME\MEMORYER.TXT 'So here, the program is reading 'that file to get those choices, so that the user doesn't have to input them everytime, unless 'there is a change. The first time this program runs, there is no file holding user choices, 'so messages that indicate that are put in the 910 and item lines.

'There is now a second dialog box to make choices. If user chooses location "Other" in '1st dialog box, a second one pops up, to find which other branch is desired. Now, that 'will be remembered in C:\CATLABEL\CHOICE2.TXT


  On Error Resume Next
  open filename$ for input as #4
  
  if Err=53 then                    'ERROR 53 MEANS NO FILE FOUND
       mydialog.checkRet = 0
       mydialog.Tag = 0
       mydialog.checkLevel = 0
       mydialog.checkReader = 0
       init910$ = "NEED 910 INITIALS"
       initrec$ = "NEED RECS/BIN INITIALS"
       bcodestrt$ = "????"
       msgbox("Program couldn't find file holding previous choices." & vbcrlf _
              & "ADVICE: click on CHANGE INITIALS and CHANGE BARCODE in main " & vbcrlf _
              & "dialog box, and fill in those fields as requested.")
  else
       input #4, init910$, initrec$, bcodestrt$, mydialog.checkLevel, _
               mydialog.Tag, mydialog.checkRet, mydialog.checkReader
       if init910$ = "" OR initrec$ = "" then
           msgbox "Problem reading 910 and/or recs-bin initials from file." & vbcrlf _
              & "ADVICE: click on CHANGE INITIALS in main " & vbcrlf _
              & "dialog box, and fill in those fields as requested."
       End If
       If mydialog.checkReader = 0 AND bcodestrt$ = "" then
           msgbox "Program found no part of BARCODE in file." & vbcrlf _
              & "That will be a problem, unless you are using" & vbcrlf _
              & "a barcode reader.  If not, you may want to check on" & vbcrlf _
              & "Change Barcode, in main dialog box, and enter 1st part of barcode."
       
       End If   
       close #4                                  'DONE WITH THAT FILE, SO CLOSE IT
  End If
  
                      'GET LAST USER CHOICE OF "OTHER" LOCATION/BRANCH
  On Error Resume Next
  open choice2File$ for input as #4   
  if Err=53 then                    'ERROR 53 MEANS NO FILE FOUND
      choice2% = 0
  else
       input #4, choice2%   
       close #4                                  'DONE WITH THAT FILE, SO CLOSE IT
  End If
  


' *************************************************************************** ' *************************************************************************** ' SET DEFAULT TAG CHOICE

'NOTE: This program looks for an 050 tag. If there is one, it will check for ' the usual (minimal) indications that there is actually a call number there. If there ' is, then mydialog.Tag, in the Options dialog box, will default to show 050. ' If none of this is true, then the ' same thing will happen with the 090 tag. If that doesn't work, only then will the ' choice made the previous time the program was run, found in MEMORYER.TXT, appear ' as the tag choice in the Options dialog box

  fCallno$ = ""
  callTag$ = "050"   
  Call GetCallNo(callTag$, TagSubstitute%, GotIt%)
  
  if GotIt% = True then
     if TagSubstitute% <> 50 then mydialog.Tag = TagSubstitute%
  else
     callTag$ = "090"
     Call GetCallNo(callTag$, TagSubstitute%, GotIt%) 
     if GotIt% = True then if TagSubstitute% <> 50 then mydialog.Tag = TagSubstitute%
  End If   


' *************************************************************************** ' ***************************************************************************



 '  Check clipboard for .b# (eg .b12345432)                 change on 8/24/4
 '                                                          change on 11/22/4
 
 '   if fBnumber$ doesn't start with a b, OR it's more than 10 characters long.
 '   OR the 3rd & 7 characters aren't numbers, then it's something else the user
 '   cut and pasted, and it should be set to NULL, before it's pasted into the
 '   recs/bin line.  Inform user, provide opportunity to quit program.  
 
 
  msgtext$ = "If you want this program to enter the overlay " _
           & "Bib. number into the record, then quit here and copy that number " _
           & "into the clipboard.  Then run this program again." & chr$(13) _
           & "    Q - - - - - Quit program" & chr$(13) _
           & "    C - - - - - Continue program"
             
  msgtitle$ = "Quit or Continue?"
  msgDefault$ = "C"              
  inputAnswer$ = "ZZZ" 
   
 
 fBnumber$ = lcase(Clipboard.GetText())    ' change on 5/21/4 
 
 if mid$(fBnumber$, 1, 1) <> "b" OR  _
    len(fBnumber$) <> 9 OR _
    mid$(fBnumber$, 3, 1) > "9" OR  _
    mid$(fBnumber$, 3, 1) < "0" OR  _
    mid$(fBnumber$, 7, 1) > "9" OR  _
    mid$(fBnumber$, 7, 1) < "0" then
       fBnumber$ = ""
       Do while inputAnswer$ <> "Q" AND inputAnswer$ <> "C"  AND inputAnswer$ <> ""    
           inputAnswer$ = UCase(InputBox$ (msgtext$, msgTitle$, MsgDefault$))
       Loop
       If inputAnswer$ = "Q" Or inputAnswer$ = "" Then Goto Done               
 End If
 

' =========================================================================== ' ===========================================================================


' PRINT RECORD TO FILE, THIS IS DONE TO USE VB TO LOOK FOR HOLDINGS ' INDICATIONS.

  on error resume next    'IF THERE IS NO FILE TO DELETE, THEN GO ON TO NEXT STATEMENT
  kill RecFile$                            'DELETE FILE HOLDING OLD RECORD INFORMATION 
  CS.GetActiveRecord                   'VERIFIES THAT WINDOW CONTAINS AN ACTIVE RECORD
  bool = CS.Print                        'PRINT RECORD INFO TO C:\CatLabel\records.txt
                                         'This requires a CatMe option/setting, set in 
                                               '        Tools - Options - Record Print
                                      'that printing goes to a file, and NOT a printer.
                                      
  '        Change on 9/9/4                                             
  '      At this point, C:\CatLabel\records.txt should exist again, if the option to
  '      print to a file instead of to a printer (described above) is checked.  If not
  '      then C:\CatLabel\records.txt wasn't created anew, so it doesn't exist.  Tell the
  '      user & end the program.                
  if Dir$(RecFile$) = "" then 
     msgbox "PROBLEM: Connexion may not be set (Tools > Options > Printing) to print " _
            & " records to C:\CatLabel\records.txt.  Program ending."
     Goto Done
  End If
  

' *************************************************************************** ' ***************************************************************************

 '                       --  GET FIXED FIELD INFO --
 'For unknown reasons the sendKeys command doesn't work when this program is run from
 'shortcut keys ( eg ctrl+shift+F4), but runs fine when run from a "user tool" in the tool bar.
 'It also runs if I go find the macro/program from the tools menu and run it from there.
 '                   Very strange.
 
 Call GetFxdFlds                                  'IE, FIND OUT WHAT'S IN THE FIXED FIELDS
 
 

' *************************************************************************** ' ***************************************************************************

 '                   END PROGRAM IF JUV BOOK WITH 'd' 
 if audn$ = "d" then
    msgbox "Audn: = d - indicates JUV book -- UNUSED at UNH.  Please give book to Kathryn"
    goto Done
 end if

' *************************************************************************** ' ***************************************************************************


     'REMOVE PREVIOUS 949-ITEM, 910-INITIALS, 949-RECSBIN LINES, IF ANY
   Call CheckPrevious
    
 

' *************************************************************************** ' *************************************************************************** ' *************************************************************************** ' *************************************************************************** ' PUT OUT MAIN DIALOG BOX AND GET CURRENT CHOICES

  do while chooseAgain% = TRUE                 'LOOP UNTIL NO CONFLICTS IN CHOICES  
         On Error Resume Next
         Dialog mydialog             'THIS PUTS THE MAIN DIALOG BOX ON THE SCREEN   
         If Err=102 then              ' ERROR 102 MEANS CANCEL BUTTON WAS SELECTED
            goto Done
         End If
         
         level% = mydialog.checklevel          'DON'T KNOW HOW TO PASS THESE OBJECT                   
         branch% = mydialog.branch             '     PROPERTIES TO A SUB PROGRAM, SO    
         retro% = mydialog.checkRet            '     PUT THEM IN VARIABLES THAT I CAN
         disk% = mydialog.checkdis             '     PASS.
         tag% = mydialog.Tag
         reader% = mydialog.checkReader      
         chooseAgain% = FALSE 
         
         if mydialog.checkLevel = 0 then fastCatter% = TRUE                     'FASTCAT          
         '                   CHECK FOR CHOICE CONFLICTS
         
         If mydialog.checkRet = 1 AND mydialog.Tag = 2 then   'BOTH ANALYTIC AND RETRO CHOSEN
             msgbox "Monographs must be handled as either analytic OR retrocon." & _
                    chr$(13) & _
                    "If both are true, then it should be treated as retrocon."
             tag% = 1
             chooseAgain% = True
         end if
  
         Call CrossCheck(level%, chooseAgain%, tag%, branch%, retro%, disk%)
         Call CrossDocs(chooseAgain%, branch%, tag%)
         Call CrossJuv(chooseAgain%, tag%, branch%, audn$)
                  
         mydialog.branch = branch%
         mydialog.checkRet = retro%                   
         mydialog.checkdis = disk%                   
         mydialog.Tag = tag%           
  loop                                            'ON   while chooseAgain% = TRUE
 

' *************************************************************************** ' ***************************************************************************


' CHANGE BARCODE IF REQUESTED 'This subprogram call allows user to change the beginning of the barcode. The actual 'code appears below this main program section, so this invokes it, causing it to run. 'NOTE: If the user has the Barcode Reader checkbox checked, then the program will later ' ask for thw whole barcode to be entered. IF not, it is assumed that the user will ' be entering the barcode without a barcode reader. To minimize typing, the program ' attempts to keep track of all but the last 4 digits of the barcode. For each ' sheet of barcodes, only the last 4 digits of each barcode vary. The idea is, only ' those last 4 digits need to be entered. As the sheet changes, the user can enter ' the part of the barcode that changes with a new sheet, which is digits 7-10. So the ' user doesn't need to enter those digits for EVERY book.

  if mydialog.checkBar = 1 then
     call WriteBCode(bcodestrt$)                           'CALL TO FUNCTION
  end if
  
 

' *************************************************************************** ' ***************************************************************************

' CHANGE INITIALS IF REQUESTED

  if mydialog.checkInit = 1 then
      call ChngeInit(init910$, initrec$) 
  end if           
  

' *************************************************************************** ' ***************************************************************************

'HOLDINGS  - The way to check holdings is to print the record to a file.  To print to a file,
' a checkbox in Tools-Options-Record Print, entitled "Output to text file:" must be checked,
' and a filename entered in the corresponding space.  So this program will kill the previous
' file, which would be for a previous record, and then cause the record to print.  Then the
' file that the record is printed to is checked for "Held by NHM".  if that's NOT 
' present, then the record is chcked for the obverse, "No holdings in NHM".  If neither one
'of those phrases is found in the record, then the program can't determine the holdings status.
'NOTE: Both CatME and Connexion have built-in functions that check holdings, but only if the
'      user is online to OCLC.  This method checks holdings whether or not the user is online.

  GotHoldings% = FALSE 
  open recFile$ for input as #3
     
  do while Not EOF(3)
      Line Input #3, recLIne$
      recLIne$ = lcase(recLIne$)
      
      if instr(recLine$, "held by nhm") > 0 then
           if mydialog.checkLevel < 2 then                    'IE MONOGRAPH OR FASTCAT CHECKS
              msgbox("HELD BY NHM - Program ending")
              close #3
              goto Done
           else
              msgbox  "This record is HELD BY NHM"             'TOPCATTERS GET TO DECIDE ABOUT QUITTING
              Dialog YesNo
              if YesNo.BG1 = 1 then                           'USER CHOOSES TO ABORT PROGRAM
                 close #3
                 goto Done
              end if
           end if
           GotHoldings% = TRUE
           Exit Do
       End If
       
       if instr(recLine$, "no holdings in nhm") > 0 then
           GotHoldings% = TRUE
           Exit Do
       End if                 
  loop
     
  close #3
  
  if GotHoldings% = FALSE then
     msgbox("Program can't determine if book/record is already held." & vbcrlf _
            & "Please check holdings visually.")
  end if

' *************************************************************************** ' ***************************************************************************

' IF FASTCAT, CHECK FOR CONTINUATION

  If fastCatter% = True then          'FASTCATTER
     If lcase(dtst$) = "m" Then         
        msgbox  "Fixed Field, DtSt: = m" & chr$(13) & _
                "This book is most likely a continuation, and should be bumped."
        Goto Done
     End If
     If dateFF2$ = "9999" Then         
        msgbox  "Fixed Field, second date in Dates: = 9999" & chr$(13) & _
                "This book is most likely a continuation, and should be bumped."
        Goto Done
     End If
  End If

' *************************************************************************** ' ***************************************************************************


' CHECK 245 2ND INDICATOR (WARNING OR END PROGRAM IF NO 245 TAG FOUND)

 call Chk245 (bad245%)
 
 if bad245% = TRUE then                                  ' PROGRAM COULDN'T FIND 245 TAG
 
    if mydialog.checkLevel < 2 then
       msgbox ("Program couldn't find 245 line. Program ending")
       goto Done
    else
       msgbox ("Program couldn't find 245 line.")        
       Dialog YesNo
       if YesNo.BG1 = 1 then goto Done              'TOPCAATTER CHOOSES TO END PROGRAM
    end if                              'ON if mydialog.checks < 2
 end if                         'ON if bad245% = TRUE
 

' *************************************************************************** ' ***************************************************************************

'             ENCODING LEVEL CHECK - Fixed field ELvl: must be ether blank or 4,
'                                    for fastcatters
 if fastCatter% = TRUE then  
     if elvl$ <> " " AND elvl$ <> "4"  then             
         msgbox ("Ecoding Level (Elvl:) is neither blank nor 4" _
                  & vbcrlf _
                  & vbcrlf _
                  & "            Program ending")
         goto Done
     end if         
 end if      'ON if fastCatter% = TRUE

 

' *************************************************************************** ' ***************************************************************************

' CHECK BLvl: WARN USER OR END PROGRAM, DEPENDING ON WHO USER IS

 if blvl$ <> "m" then
     if mydialog.checklevel < 2 then     
        msgbox  "BLvl does NOT = m  ??? This is NOT a monograph? " _
                & chr$(13) _ 
                & "Please see Kathryn or Christina."
        goto Done
     else
        if blvl$ = "s" then
            msgbox  ("BLvl does NOT = m  ??? This is NOT a monograph? ")
            Dialog YesNo
            if YesNo.BG1 = 1 then goto Done              'TOPCATTER CHOOSES TO ABORT PROGRAM
        else
           msgbox  ("Program can find neither s nor m in Blvl field. " _
                    & vbcrlf _
                    & "Please check visually")
           Dialog YesNo
           if YesNo.BG1 = 1 then goto Done               'TOPCATTER CHOOSES TO ABORT PROGRAM
        end if 
     end if
 end if 
 

' *************************************************************************** ' ***************************************************************************

' ACT ON TAG SELECTION

 select case mydialog.tag           'MYDIALOG.TAG HOLDS CALL # TAG SELECTION             
        case 0 
              callTag$ = "050"               'IE LOOK FOR CALL # IN 050 TAG
        case 1
              callTag$ = "090"               'IE LOOK FOR CALL # IN 090 TAG
              do090% = TRUE                            
        case 2               
              analytic% = TRUE     'DON'T CARE WHERE CALL # IS, FOR ANALYTICS
        case 3
              callTag$ = "086"                'IE LOOK FOR CALL # IN 086 TAG
  end select
 

' *************************************************************************** ' ***************************************************************************

'CHANGE VARIOUS FIELDS, DEPENDING ON WHICH BRANCH IS CHOSEN 
 select case mydialog.branch
        case 0                                      'MAIN BRANCH
               st49$ = st49$ & "M"         'WILL BE USED TO ADD M TO NHM IN 049 FIELD
               locate$    = locate$ + "mls"                     'ITEM RECORD LOCATION
               locatermd% = FALSE                               'NO T.P. REMINDER MSG                               
        case 1                                      'REFERENCE
               st49$     = st49$ & "R"
               endnote = " Ref"
               locate$    = locate$ + "mrs"                
               circ$ = "ßt 1"                              'REF BOOKS DON'T CIRCULATE
               chksize%  = FALSE          'DON'T CHECK BOOK SIZE - NO OVERSIZE IN REF
        case 2
               st49$     = st49$ & "."              'MATH
               endnote = " Math"
               locate$    = locate$ + "bes"
               notMain% = TRUE                       'DO PUT OUT VERSO REMINDERS, ETC
        case 3                                  '
               st49$     = st49$ & "P"
               endnote = " Physics"                 'PHYSICS
               locate$    = locate$ + "bps"
               notMain% = TRUE
        case 4                                      'BIOLOGICAL SCIENCES
               st49$     = st49$ & "B"
               endnote = " BioSci"
               locate$    = locate$ + "bbs"
               notMain% = TRUE
        case 5                                      'CHEMISTRY
               st49$     = st49$ & "C"
               endnote = " Chem"
               locate$    = locate$ + "bcs"
               notMain% = TRUE
        case 6                                       'ENGINEERING
               st49$     = st49$ & "E"
               endnote = " Eng"
               locate$    = locate$ + "bes"
               notMain% = TRUE
        case 7                                       'CALL
               st49$     = st49$ & "6"
               endnote = " Call"
               locate$    = locate$ + "mlcs"
        case 8                                        'PAM  (DOES THIS STILL EXIST??)
               st49$     = st49$ & "Z"
               endnote = " Pam"
               locate$    = locate$ + "mlhs"
               chksize%  = FALSE                                    'NO OVERSIZE IN PAM
        case 9                                      'GOV DOCS
               st49$     = st49$ & "D"
               locate$    = locate$ + "mdus"
               item2$ =  " ßz 086 ßa "              'USE 086 INSTEAD OF 090 IN ITEM LINE
               chksize%  = FALSE                           ' ??????? NO OVERSIZE IN DOCS   'debug 
        case 10                                     'JUVENILE
               st49$     = st49$ & "M"
               endnote$ = " Juv"
               locate$    = locate$ & "mlsk"
               chksize%  = FALSE                                 'NO OVERSIZE IN JUV                                                  'NO OVERSIZE IN JUV 
        case 11         '
                 call Other(st49$, item2$, chksize%, circ$, locate$, endnote$, quit%, _
                             paperBrnch$, callTag$, doBarcode%, status$, choice2%, labelEnd$)                  
                 If quit% = True then
                    msgbox "User ending program."
                    goto Done
                 End If 
               
  end select 
  
  

' *************************************************************************** ' ***************************************************************************

  locatemsg$ = endnote$ + locatemsg$    'THIS MESSAGE IS COMPLETE NOW.  IT REMINDS USER
                                        'WHICH BRANCH, IF ANY, SHOULD PRECEDE CALL # ON VERSO
                                        
  '                  ALLOW FOR DOCS, WHICH, HAVING NO LABEL, HAS NO endnote$ 
  '                         (OR ANY NOTE COMP0NENT.)
  if mydialog.branch = 9 then locatemsg$ = "Docs" + locatemsg$
   
  stnote$ = stnote$ + endnote$