Title: OCLC Connexion Macros
1OCLC Connexion Macros
- Using Connexion Commands to Accomplish Cataloging
Tasks
Harvey Joel Hahn June 27, 2005
2Who we are
- Joel Hahn
- Niles Public Library District, Niles, IL
- ltjhahn_at_nileslibrary.orggt
- Harvey Hahn
- Arlington Heights Memorial Library, Arlington
Heights, IL - lthhahm_at_ahml.infogt
3Introduction
- Writing macros is like creating a recipe.
- There are many ingredients to choose from.
- Which ingredients you choose and the order in
which you add them can make a big difference in
the results. - Writing a macro is all about figuring out what
ingredients you have available and how they work
together.
4Working with data
- Four basic tasks
- Find the data
- Get the data to modify
- Change (or examine) the data
- Save the data
5Working with data MARC fields
- Basic format of MARC fields in macros
- tttiiFirst subfield b Second subfield etc.
- To get the tag
- Left( sField, 3 )
- To get the 1st indicator
- Mid( sField, 4, 1 )
- To get the 2nd indicator
- Mid( sField, 5, 1 )
- To get just the variable data
- Mid( sField, 6 )
- The exception is ACJK data Data contains
non-latin script
6Working with data Delimiters
- Delimiter Chr(223)
- "First subfield " Chr(223) "b Second
subfield" - InStr( sField, Chr(223) )
- InStr( sField, Chr(223) "x" )
- Chr(223) appears as ß in other fonts.
- Each diacritic special character has a number
to use with Chr( ). - The codes are listed in the help file.
7Working with fields
- Four basic tasks
- Find the field
- Get the contents of the field
- Change (or examine) the field
- Save the field
8Working with fields Find
- CS.Find
- CS.GetField
- CS.GetFieldLine
9Working with fields Find
- Find all fields matching a given pattern
- nCount 1
- IsField CS.GetField( sTagNum, nCount, sField )
- Do While IsField ltgt FALSE
- If ltinsert command here to i.d. the fieldgt
Then - 'Put commands here to change the
identified field - 'Exit Do (To only find the first
matching field) - End If
- nCount nCount 1
- IsField CS.GetField( sTagNum, nCount,
sField ) - Loop
10Working with fields Get
- CS.GetField( "500", 1, sField )
- CS.GetFieldLine( 10, sField )
- CS.GetFixedField( "Lang", sField )
Working with fields Change
- Use the four basic tasks of working with data
11Working with fields Save
- CS.SetField( 1, sField )
- CS.SetFieldLine( 10, sField )
- CS.SetFixedField( "Lang", "eng" )
12Working with fields Practical Examples
- Create populate a default III 949 field Copy to
paste from Sirsi Workflows - Add a 590 with the cataloger's initials today's
date - Enhance 505 fields
13Working with records
- Four basic tasks
- Find the record
- Get (display) the record
- Change (or examine) the record
- Save the field
14Working with records Find
- CS.Search( sDatabase, sSearchTerm )
Working with records Get
- CS.Search( sDatabase, sSearchTerm )
- CS.GetFirstItem
- CS.GetFirstSelectedItem
- CS.GetListItem( nListNumber)
15Working with records Change
- Use the four basic tasks of working with fields
- nNumErrors CS.Validate( sErrList )
- CS.Update
- CS.Export
- CS.QueryRecordStatus
- CS.SetMyStatus
- CS.SetWorkflowStatus
16Working with records Change
- Working with the OCLC number
- CS.GetFixedField( "OCLC", sOCLCNum )
- CS.QueryRecordStatus( "NUM", sOCLCNum )
17Working with records Save
- CS.SaveOnline
- CS.SaveToLocalFile
- CS.CloseRecord( TRUE )
18Working with records Practical Examples
- Validate, Update, Save, and Close in one step
- Delete all non-LCSH/LCAC subject headings
- Copy the call number from an 050 field to an 090
field - Copy the call number from an 050 to an 090, apply
any of several constant data records depending on
the record format, and add a default III 949 field
19Working with lists
- Choose your starting point
- CS.GetFirstItem
- CS.GetFirstSelectedItem
- CS.GetListItem
- Move on to the next record
- CS.GetNextItem
- CS.GetNextSelectedItem
- CS.GetListItem
- Determine whether youre done
- If a GetNext-type command fails, then there are
no more records to process.
20Working with lists
- Combining those three steps into the basic
pattern of looping through records - Bool CS.GetFirstItem
- (or CS.GetFirstSelected or
CS.GetListItem) - If Bool FALSE Then
- Exit Sub
- End If
- Do
- 'Put commands here to edit each record
- Loop Until CS.GetNextItem FALSE
- (or CS.GetNextSelectedItem)
21Working with lists Practical Examples
- Resave the entire online bibliographic save file
- Copy the call number from an 050 to an 090, apply
any of several constant data records depending on
the record format, and add a default III 949
field for all listed records from your local save
file
22General Connexion commands
- CS.ItemType
- Checking if Connexion is online
- If CS.IsOnline FALSE Then
- Bool CS.Logon("", "", "") 'Use your default
logon - If Bool FALSE Then
- MsgBox "Unable to log on. Exiting"
- Exit Sub
- End If
- End If
- CS.SendKeys
23Working with the Macro Recorder
- One way to find ingredients and how they can be
put together is to record macros. - However, the recorder can only recreate your
exact keystrokes and mouse clicks. - Cant use efficient programming methods like
IfThen and loops - May sometimes make it harder to learn to write
your own macros
24Working with the Macro Recorder Practical
Examples
- Validate, Update, Save, and Close in one step
- Add a default III 949 field
25Copy macros from other sources
- From e-mail webpages
- Create a new macro
- Open it for editing
- Select copy the macro from the e-mail/web
- Paste the macro in the new one you created
- From macrobook files on webpages
- Click the link, save the .mbk file to your
../OCLC/Program/Macros directory - From other computers
- Copy the macrobook from that computers
../OCLC/Program/Macros directory to that
directory on your computer.
26Further resources
- OCLC-CAT mailing list
- OCLCs Connexion macros web page
- http//www.oclc.org/connexion/support/macros.htm
- OML for the Complete Beginner
- http//users.rcn.com/aardy/oml/lessons/index.html
- Joels OML web page
- http//users.rcn.com/aardy/oml/index.html
- Harveys OML web page
- http//www.ahml.info/oml/
27QA