SlideShare a Scribd company logo
Automating a Vendor File Load Process with Perl and Shell Scripting Roy Zimmer Western Michigan University
We needed to get Promptcat approval files, from OCLC’s ftp site.
We needed to get Promptcat approval files, from OCLC’s ftp site. Historically, we’ve done file retrieval and processing via shell scripting, with some supporting Perl software.
We needed to get Promptcat approval files, from OCLC’s ftp site. Historically, we’ve done file retrieval and processing via shell scripting, with some supporting Perl software. In this case, we started out mostly manual, with some programmatic support.
We needed to get Promptcat approval files, from OCLC’s ftp site. Historically, we’ve done file retrieval and processing via shell scripting, with some supporting Perl software. In this case, we started out mostly manual, with some programmatic support. We kind of snuck up on the final method of retrieval and processing.
The ftp site has quite a few files, including a number of different types: LBL, RPT, APPR, FIRM…
Let’s use a representative sample for this presentation…
Out of this large number of files, only one or a few will be of interest. For example, take the files for May 7.
Out of this large number of files, only one or a few will be of interest. In this case, the files for May 7. How do we pick them out?
This is where Perl comes to the rescue. With Perl, you can do many things.
Code details, main program, ftp stuff ftppcatappr.pl Required when using ftp within Perl
Site password is stored here. Code details, main program, ftp stuff ftppcatappr.pl Required when using ftp within Perl
Site password is stored here. Code details, main program, ftp stuff ftppcatappr.pl Required when using ftp within Perl - Site URL   - Username    - directory where files are  - transfer mode
Code details, main program, ftp stuff ftppcatappr.pl Self-explanatory Required when using ftp within Perl Site password is stored here. - Site URL   - Username    - directory where files are  - transfer mode
Site password is stored in a file. Code details, main program, ftp stuff ftppcatappr.pl
Site password is stored in a file. Setting up for FTP Code details, main program, ftp stuff ftppcatappr.pl
Retrieve ftp site file listing into a variable as an array of directory entries. Code details, main program, ftp stuff ftppcatappr.pl
Set each line up to be split on the space character and then do so. Code details, main program, ftp stuff Retrieve ftp site file listing into a variable as an array of directory entries. ftppcatappr.pl
Set each line up to be split on the space character and then do so. The last piece in each line will be the filename. Split this into pieces based on the period. Code details, main program, ftp stuff Retrieve ftp site file listing into a variable as an array of directory entries. ftppcatappr.pl
Set each line up to be split on the space character and then do so. The last piece in each line will be the filename. Split this into pieces based on the period. Look for the one(s) that correspond(s) with yesterday’s date and keep those. Code details, main program, ftp stuff Retrieve ftp site file listing into a variable as an array of directory entries. ftppcatappr.pl
Want the files to be processed in order Code details, main program, ftp stuff ftppcatappr.pl
Code details, main program, processing each file ftppcatappr.pl Get the files
Code details, main program, processing each file Records will need some editing… (Thanks to Birong Ho, our systems librarian, for originally supplying this editing code.) Get the records ftppcatappr.pl
Records will need some editing… “grab” the fields of interest Get the records Code details, main program, processing each file ftppcatappr.pl
Records will need some editing… Some fields are deleted… Code details, main program, processing each file ftppcatappr.pl
Records will need some editing… …and others are edited. More edits than this are performed; the basic syntax is the same for each of them. Code details, main program, processing each file ftppcatappr.pl
File will need some splitting… Split each file up based on the invoice number found in field 980 |f Code details, main program, processing each file
File will need some splitting… Split each file up based on the invoice number found in field 980 |f The next program takes care of this… I did say we snuck up on this, didn’t I? Code details, main program, processing each file
File will need some splitting…split each file up based on the invoice number found in field 980 |f Rather than using the familiar LF, the MARC format uses a different EOL character. Code details, helper program, processing each file oclc980.pl
File will need some splitting…split each file up based on the invoice number found in field 980 |f This section reads each MARC record, looking for the 980 field. Code details, helper program, processing each file oclc980.pl
File will need some splitting…split each file up based on the invoice number found in field 980 |f Get the subfields into an array. Code details, helper program, processing each file oclc980.pl
File will need some splitting…split each file up based on the invoice number found in field 980 |f Get the subfields into an array. Code details, helper program, processing each file Look for subfield f and  read it to get the invoice number. oclc980.pl
File will need some splitting…split each file up based on the invoice number found in field 980 |f Get the subfields into an array. Code details, helper program, processing each file Look for subfield f and  read it to get the invoice number. Determine if it’s a new or “existing” invoice number. This also lets us count records for each invoice. oclc980.pl
File will need some splitting…split each file up based on the invoice number found in field 980 |f Get the subfields into an array. Code details, helper program, processing each file Look for subfield f and  read it to get the invoice number. Determine if it’s a new or “existing” invoice number. This also lets us count records for each invoice. Use  append  mode to open, write a record, and close the file for each invoice number. oclc980.pl
There are usually several files after splitting the file being processed. Each one must be further processed and loaded into Voyager. This is controlled via a small shell script. Code details, helper program, processing each invoice file
There are usually several files after splitting the file being processed. Each one must be further processed and loaded into Voyager. This is controlled via a small shell script. It calls another shell script for preprocessing and bulk loading of each of the invoice files. Code details, helper program, processing each invoice file (Thanks to Keith Kelley, director of systems, for creating this script.) importall.sh
Code details, helper program, importing each invoice file $1 is the default first parameter to the script. Let’s use a more descriptive variable. prodimport.script
Code details, helper program, importing each invoice file $1 is the default first parameter to the script. Let’s use a more descriptive variable. Let’s also drop the filename extension, so that we can “reuse” the filename. prodimport.script
Code details, helper program, importing each invoice file $1 is the default first parameter to the script. Let’s use a more descriptive variable. Let’s also drop the filename extension, so that we can “reuse” the filename. Get ready for the prebulk processing. prodimport.script
Code details, helper program, importing each invoice file prodimport.script 1 st  use of file referenced by $1, so that use is OK
Code details, helper program, importing each invoice file Start with some final edits… prodimport.script
Code details, helper program, importing each invoice file Start with some final edits… We’ll use marcedit.pl to replace the contents of field 981 |a, as illustrated: There are 59 such edits possible. prodimport.script
Code details, helper program, importing each invoice file Start with some final edits… Prep for bulkimport, too prodimport.script
Code details, helper program, importing each invoice file Start with some final edits… Prep for bulkimport, too Self-explanatory prodimport.script
Code details, helper program, importing each invoice file Prebulk output is bulkimport input. Perform the bulkimport prodimport.script
Code details, helper program, importing each invoice file Prebulk output is bulkimport input. Perform the bulkimport The final step for each file is to do some cleanup and moving files to the loaded directory. prodimport.script
Password maintenance The ftp site requires us to change our password every 90 days. We wanted all this to run hands-off, so that had to be automated, also. The password gets changed every two months.
Password maintenance,  getpromptcatpw.ksh
Password maintenance,  getpromptcatpw.ksh
Password maintenance,  pwgen.pl Want an 8-character password
Password maintenance,  pwgen.pl Want an 8-character password Password length defaults to 10
Password maintenance,  pwgen.pl Want an 8-character password Password length defaults to 10 Password consists of these characters
Password maintenance,  pwgen.pl Want an 8-character password Password length defaults to 10 Password consists of these characters Seed the random number generator
Password maintenance,  pwgen.pl Want an 8-character password Password length defaults to 10 Password consists of these characters Seed the random number generator Generate the password
Review Run ftppcatappr.pl Login to OCLC ftp site for promptcat Find desired files and retrieve them Do process each file remove unwanted 6xx, 938, 948 fields edit some 856 fields run oclc980.pl do process each record in the current file look at the 980 |f  (contains the invoice number) if it contains invoice NNN, (create and) put this record in file NNN.marc, etc. end do run importall.sh do process each file created by oclc980.pl run prodimport.script use marcedit.pl to process 981 |a replacements (59 possible edits) prebulk bulk import wait 1.5 minutes before continuing end do move all interim .marc, .preimp, and .imp files to /loaded End do Move all RCD* files to /loaded
Review Run ftppcatappr.pl Login to OCLC ftp site for promptcat Find desired files and retrieve them Do process each file remove unwanted 6xx, 938, 948 fields edit some 856 fields run oclc980.pl do process each record in the current file look at the 980 |f  (contains the invoice number) if it contains invoice NNN, (create and) put this record in file NNN.marc, etc. end do run importall.sh do process each file created by oclc980.pl run prodimport.script use marcedit.pl to process 981 |a replacements (59 possible edits) prebulk bulk import wait 1.5 minutes before continuing end do move all interim .marc, .preimp, and .imp files to /loaded End do Move all RCD* files to /loaded
The files listed below are available at http://homepages.wmich.edu/~zimmer/files/eugm2008 fileload.ppt this presentation ftppcatappr.pl gets the files and controls the processing oclc980.pl splits retrieved files based on invoice number pwgen.pl generates a password importall.sh ensures that each “split file” for a particular retrieved file is processed prodimport.ksh does the actual processing of each file getpromptpw.ksh handles all the details of a password change Resources except for marcedit.pl enables batch editing of MARC files which is at  http://homepages.wmich.edu/~zimmer/marc_index.html
CPAN http://cpan.org FTP  http://search.cpan.org/~gbarr/libnet-1.22/Net/FTP.pm I’m not sure if the FTP module is supplied on Voyager boxes or not. If you don’t have it, go to the above URL. It also has good documentation on this module. Resources
Thank you for listening. Roy Zimmer [email_address] Picture © 2008 by Roy Zimmer
Ad

More Related Content

What's hot (16)

Improving the Solr Update Chain
Improving the Solr Update ChainImproving the Solr Update Chain
Improving the Solr Update Chain
Cominvent AS
 
C 檔案輸入與輸出
C 檔案輸入與輸出C 檔案輸入與輸出
C 檔案輸入與輸出
PingLun Liao
 
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Robert Nelson
 
Fluentd meetup at Slideshare
Fluentd meetup at SlideshareFluentd meetup at Slideshare
Fluentd meetup at Slideshare
Sadayuki Furuhashi
 
Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...
Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...
Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...
Puppet
 
Exploitation Crash Course
Exploitation Crash CourseExploitation Crash Course
Exploitation Crash Course
UTD Computer Security Group
 
Overloading Perl OPs using XS
Overloading Perl OPs using XSOverloading Perl OPs using XS
Overloading Perl OPs using XS
ℕicolas ℝ.
 
Key topics when migrating from FAST to Solr, EuroCon 2010
Key topics when migrating from FAST to Solr, EuroCon 2010Key topics when migrating from FAST to Solr, EuroCon 2010
Key topics when migrating from FAST to Solr, EuroCon 2010
Cominvent AS
 
4- Web design introduction
4- Web design introduction4- Web design introduction
4- Web design introduction
webhostingguy
 
IO Streams, Files and Directories
IO Streams, Files and DirectoriesIO Streams, Files and Directories
IO Streams, Files and Directories
Krasimir Berov (Красимир Беров)
 
Dhcpv6 Tutorial Overview, DHCP for Ipv6 ,RFC 3315 - IETF
Dhcpv6 Tutorial Overview, DHCP for Ipv6 ,RFC 3315 - IETFDhcpv6 Tutorial Overview, DHCP for Ipv6 ,RFC 3315 - IETF
Dhcpv6 Tutorial Overview, DHCP for Ipv6 ,RFC 3315 - IETF
zarigatongy
 
Clonewise - Automatically Detecting Package Clones and Inferring Security Vu...
Clonewise  - Automatically Detecting Package Clones and Inferring Security Vu...Clonewise  - Automatically Detecting Package Clones and Inferring Security Vu...
Clonewise - Automatically Detecting Package Clones and Inferring Security Vu...
Silvio Cesare
 
extending-php
extending-phpextending-php
extending-php
tutorialsruby
 
Symfony Performance
Symfony PerformanceSymfony Performance
Symfony Performance
Paul Thrasher
 
PE Packers Used in Malicious Software - Part 1
PE Packers Used in Malicious Software - Part 1PE Packers Used in Malicious Software - Part 1
PE Packers Used in Malicious Software - Part 1
amiable_indian
 
P4 2018 io_functions
P4 2018 io_functionsP4 2018 io_functions
P4 2018 io_functions
Prof. Wim Van Criekinge
 
Improving the Solr Update Chain
Improving the Solr Update ChainImproving the Solr Update Chain
Improving the Solr Update Chain
Cominvent AS
 
C 檔案輸入與輸出
C 檔案輸入與輸出C 檔案輸入與輸出
C 檔案輸入與輸出
PingLun Liao
 
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Robert Nelson
 
Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...
Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...
Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...
Puppet
 
Overloading Perl OPs using XS
Overloading Perl OPs using XSOverloading Perl OPs using XS
Overloading Perl OPs using XS
ℕicolas ℝ.
 
Key topics when migrating from FAST to Solr, EuroCon 2010
Key topics when migrating from FAST to Solr, EuroCon 2010Key topics when migrating from FAST to Solr, EuroCon 2010
Key topics when migrating from FAST to Solr, EuroCon 2010
Cominvent AS
 
4- Web design introduction
4- Web design introduction4- Web design introduction
4- Web design introduction
webhostingguy
 
Dhcpv6 Tutorial Overview, DHCP for Ipv6 ,RFC 3315 - IETF
Dhcpv6 Tutorial Overview, DHCP for Ipv6 ,RFC 3315 - IETFDhcpv6 Tutorial Overview, DHCP for Ipv6 ,RFC 3315 - IETF
Dhcpv6 Tutorial Overview, DHCP for Ipv6 ,RFC 3315 - IETF
zarigatongy
 
Clonewise - Automatically Detecting Package Clones and Inferring Security Vu...
Clonewise  - Automatically Detecting Package Clones and Inferring Security Vu...Clonewise  - Automatically Detecting Package Clones and Inferring Security Vu...
Clonewise - Automatically Detecting Package Clones and Inferring Security Vu...
Silvio Cesare
 
PE Packers Used in Malicious Software - Part 1
PE Packers Used in Malicious Software - Part 1PE Packers Used in Malicious Software - Part 1
PE Packers Used in Malicious Software - Part 1
amiable_indian
 

Viewers also liked (8)

Benchmarking your AP process - how do we stack up?
Benchmarking your AP process - how do we stack up?Benchmarking your AP process - how do we stack up?
Benchmarking your AP process - how do we stack up?
OnlineCompliance Panel
 
Bpm npc key performance
Bpm npc key performanceBpm npc key performance
Bpm npc key performance
Tony Astro - Veteran Counselor & Entrepreneur
 
WF/BPM Survey Results - 2008
WF/BPM Survey Results - 2008WF/BPM Survey Results - 2008
WF/BPM Survey Results - 2008
Susan Keohan
 
Reviewing Your Accounts Payable Processes
Reviewing Your Accounts Payable ProcessesReviewing Your Accounts Payable Processes
Reviewing Your Accounts Payable Processes
New England Document Systems
 
Fostering the Evolution of Network Based Cloud Service Providers.
Fostering the Evolution of Network Based Cloud Service Providers.Fostering the Evolution of Network Based Cloud Service Providers.
Fostering the Evolution of Network Based Cloud Service Providers.
Cisco Service Provider
 
Report: Improving the Procure-to-Pay Process - A Transformational Approach
Report: Improving the Procure-to-Pay Process - A Transformational ApproachReport: Improving the Procure-to-Pay Process - A Transformational Approach
Report: Improving the Procure-to-Pay Process - A Transformational Approach
Datamatics Global Services Limited
 
Improve Billing Process and Performance with Deltek Vision
Improve Billing Process and Performance with Deltek VisionImprove Billing Process and Performance with Deltek Vision
Improve Billing Process and Performance with Deltek Vision
BCS ProSoft
 
SLA KPI Report Linkedin Version - August 2016
SLA KPI Report  Linkedin Version - August 2016SLA KPI Report  Linkedin Version - August 2016
SLA KPI Report Linkedin Version - August 2016
Don Moore
 
Benchmarking your AP process - how do we stack up?
Benchmarking your AP process - how do we stack up?Benchmarking your AP process - how do we stack up?
Benchmarking your AP process - how do we stack up?
OnlineCompliance Panel
 
WF/BPM Survey Results - 2008
WF/BPM Survey Results - 2008WF/BPM Survey Results - 2008
WF/BPM Survey Results - 2008
Susan Keohan
 
Fostering the Evolution of Network Based Cloud Service Providers.
Fostering the Evolution of Network Based Cloud Service Providers.Fostering the Evolution of Network Based Cloud Service Providers.
Fostering the Evolution of Network Based Cloud Service Providers.
Cisco Service Provider
 
Report: Improving the Procure-to-Pay Process - A Transformational Approach
Report: Improving the Procure-to-Pay Process - A Transformational ApproachReport: Improving the Procure-to-Pay Process - A Transformational Approach
Report: Improving the Procure-to-Pay Process - A Transformational Approach
Datamatics Global Services Limited
 
Improve Billing Process and Performance with Deltek Vision
Improve Billing Process and Performance with Deltek VisionImprove Billing Process and Performance with Deltek Vision
Improve Billing Process and Performance with Deltek Vision
BCS ProSoft
 
SLA KPI Report Linkedin Version - August 2016
SLA KPI Report  Linkedin Version - August 2016SLA KPI Report  Linkedin Version - August 2016
SLA KPI Report Linkedin Version - August 2016
Don Moore
 
Ad

Similar to Automating a Vendor File Load Process with Perl and Shell Scripting (20)

005. FILE HANDLING.pdf
005. FILE HANDLING.pdf005. FILE HANDLING.pdf
005. FILE HANDLING.pdf
noormuhammad101340
 
Spotfire Integration & Dynamic Output creation
Spotfire Integration & Dynamic Output creationSpotfire Integration & Dynamic Output creation
Spotfire Integration & Dynamic Output creation
Ambareesh Kulkarni
 
Python Requirements File How to Create Python requirements.txt
Python Requirements File How to Create Python requirements.txtPython Requirements File How to Create Python requirements.txt
Python Requirements File How to Create Python requirements.txt
Inexture Solutions
 
Intro To C++ - Class #21: Files
Intro To C++ - Class #21: FilesIntro To C++ - Class #21: Files
Intro To C++ - Class #21: Files
Blue Elephant Consulting
 
Dive into Fluentd plugin v0.12
Dive into Fluentd plugin v0.12Dive into Fluentd plugin v0.12
Dive into Fluentd plugin v0.12
N Masahiro
 
How to do file-handling - in C language
How to do file-handling -  in C languageHow to do file-handling -  in C language
How to do file-handling - in C language
SwatiAtulJoshi
 
Chap14 File Handling in C language(ICS12).pdf
Chap14 File Handling in C language(ICS12).pdfChap14 File Handling in C language(ICS12).pdf
Chap14 File Handling in C language(ICS12).pdf
UmairHassan488014
 
Source Code Management systems
Source Code Management systemsSource Code Management systems
Source Code Management systems
xSawyer
 
Getting up to speed with Kafka Connect: from the basics to the latest feature...
Getting up to speed with Kafka Connect: from the basics to the latest feature...Getting up to speed with Kafka Connect: from the basics to the latest feature...
Getting up to speed with Kafka Connect: from the basics to the latest feature...
HostedbyConfluent
 
White Paper: Scaling Servers and Storage for Film Assets
White Paper: Scaling Servers and Storage for Film AssetsWhite Paper: Scaling Servers and Storage for Film Assets
White Paper: Scaling Servers and Storage for Film Assets
Perforce
 
PyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MorePyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and More
Matt Harrison
 
Website releases made easy with the PEAR installer, OSCON 2009
Website releases made easy with the PEAR installer, OSCON 2009Website releases made easy with the PEAR installer, OSCON 2009
Website releases made easy with the PEAR installer, OSCON 2009
Helgi Þormar Þorbjörnsson
 
Rapid Prototyping Chatter with a PHP/Hack Canvas App on Heroku
Rapid Prototyping Chatter with a PHP/Hack Canvas App on HerokuRapid Prototyping Chatter with a PHP/Hack Canvas App on Heroku
Rapid Prototyping Chatter with a PHP/Hack Canvas App on Heroku
Salesforce Developers
 
1B-Introduction_to_python.ppt
1B-Introduction_to_python.ppt1B-Introduction_to_python.ppt
1B-Introduction_to_python.ppt
AmritMarwaha1
 
Useful Python Libraries for Network Engineers - PyOhio 2018
Useful Python Libraries for Network Engineers - PyOhio 2018Useful Python Libraries for Network Engineers - PyOhio 2018
Useful Python Libraries for Network Engineers - PyOhio 2018
Hank Preston
 
object oriented programming in PHP & Functions
object oriented programming in PHP & Functionsobject oriented programming in PHP & Functions
object oriented programming in PHP & Functions
BackiyalakshmiVenkat
 
Php advance
Php advancePhp advance
Php advance
Rattanjeet Singh
 
Writing and using php streams and sockets tek11
Writing and using php streams and sockets   tek11Writing and using php streams and sockets   tek11
Writing and using php streams and sockets tek11
Elizabeth Smith
 
Static analysis saved my code tonight
Static analysis saved my code tonightStatic analysis saved my code tonight
Static analysis saved my code tonight
Damien Seguy
 
TechDays 2010 Portugal - Scaling your data tier with app fabric 16x9
TechDays 2010 Portugal - Scaling your data tier with app fabric 16x9TechDays 2010 Portugal - Scaling your data tier with app fabric 16x9
TechDays 2010 Portugal - Scaling your data tier with app fabric 16x9
Nuno Godinho
 
Spotfire Integration & Dynamic Output creation
Spotfire Integration & Dynamic Output creationSpotfire Integration & Dynamic Output creation
Spotfire Integration & Dynamic Output creation
Ambareesh Kulkarni
 
Python Requirements File How to Create Python requirements.txt
Python Requirements File How to Create Python requirements.txtPython Requirements File How to Create Python requirements.txt
Python Requirements File How to Create Python requirements.txt
Inexture Solutions
 
Dive into Fluentd plugin v0.12
Dive into Fluentd plugin v0.12Dive into Fluentd plugin v0.12
Dive into Fluentd plugin v0.12
N Masahiro
 
How to do file-handling - in C language
How to do file-handling -  in C languageHow to do file-handling -  in C language
How to do file-handling - in C language
SwatiAtulJoshi
 
Chap14 File Handling in C language(ICS12).pdf
Chap14 File Handling in C language(ICS12).pdfChap14 File Handling in C language(ICS12).pdf
Chap14 File Handling in C language(ICS12).pdf
UmairHassan488014
 
Source Code Management systems
Source Code Management systemsSource Code Management systems
Source Code Management systems
xSawyer
 
Getting up to speed with Kafka Connect: from the basics to the latest feature...
Getting up to speed with Kafka Connect: from the basics to the latest feature...Getting up to speed with Kafka Connect: from the basics to the latest feature...
Getting up to speed with Kafka Connect: from the basics to the latest feature...
HostedbyConfluent
 
White Paper: Scaling Servers and Storage for Film Assets
White Paper: Scaling Servers and Storage for Film AssetsWhite Paper: Scaling Servers and Storage for Film Assets
White Paper: Scaling Servers and Storage for Film Assets
Perforce
 
PyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MorePyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and More
Matt Harrison
 
Website releases made easy with the PEAR installer, OSCON 2009
Website releases made easy with the PEAR installer, OSCON 2009Website releases made easy with the PEAR installer, OSCON 2009
Website releases made easy with the PEAR installer, OSCON 2009
Helgi Þormar Þorbjörnsson
 
Rapid Prototyping Chatter with a PHP/Hack Canvas App on Heroku
Rapid Prototyping Chatter with a PHP/Hack Canvas App on HerokuRapid Prototyping Chatter with a PHP/Hack Canvas App on Heroku
Rapid Prototyping Chatter with a PHP/Hack Canvas App on Heroku
Salesforce Developers
 
1B-Introduction_to_python.ppt
1B-Introduction_to_python.ppt1B-Introduction_to_python.ppt
1B-Introduction_to_python.ppt
AmritMarwaha1
 
Useful Python Libraries for Network Engineers - PyOhio 2018
Useful Python Libraries for Network Engineers - PyOhio 2018Useful Python Libraries for Network Engineers - PyOhio 2018
Useful Python Libraries for Network Engineers - PyOhio 2018
Hank Preston
 
object oriented programming in PHP & Functions
object oriented programming in PHP & Functionsobject oriented programming in PHP & Functions
object oriented programming in PHP & Functions
BackiyalakshmiVenkat
 
Writing and using php streams and sockets tek11
Writing and using php streams and sockets   tek11Writing and using php streams and sockets   tek11
Writing and using php streams and sockets tek11
Elizabeth Smith
 
Static analysis saved my code tonight
Static analysis saved my code tonightStatic analysis saved my code tonight
Static analysis saved my code tonight
Damien Seguy
 
TechDays 2010 Portugal - Scaling your data tier with app fabric 16x9
TechDays 2010 Portugal - Scaling your data tier with app fabric 16x9TechDays 2010 Portugal - Scaling your data tier with app fabric 16x9
TechDays 2010 Portugal - Scaling your data tier with app fabric 16x9
Nuno Godinho
 
Ad

More from Roy Zimmer (11)

Orientation Session for (New) Presenters and Moderators
Orientation Session for (New) Presenters and ModeratorsOrientation Session for (New) Presenters and Moderators
Orientation Session for (New) Presenters and Moderators
Roy Zimmer
 
Taking Your Customers to the Cleaners: Historical Patron Data Cleanup and Rou...
Taking Your Customers to the Cleaners: Historical Patron Data Cleanup and Rou...Taking Your Customers to the Cleaners: Historical Patron Data Cleanup and Rou...
Taking Your Customers to the Cleaners: Historical Patron Data Cleanup and Rou...
Roy Zimmer
 
Perl DBI Scripting with the ILS
Perl DBI Scripting with the ILSPerl DBI Scripting with the ILS
Perl DBI Scripting with the ILS
Roy Zimmer
 
You Can Do It! Start Using Perl to Handle Your Voyager Needs
You Can Do It! Start Using Perl to Handle Your Voyager NeedsYou Can Do It! Start Using Perl to Handle Your Voyager Needs
You Can Do It! Start Using Perl to Handle Your Voyager Needs
Roy Zimmer
 
Voyager Meets MeLCat: MC'ing the Introductions
Voyager Meets MeLCat: MC'ing the IntroductionsVoyager Meets MeLCat: MC'ing the Introductions
Voyager Meets MeLCat: MC'ing the Introductions
Roy Zimmer
 
Plunging Into Perl While Avoiding the Deep End (mostly)
Plunging Into Perl While Avoiding the Deep End (mostly)Plunging Into Perl While Avoiding the Deep End (mostly)
Plunging Into Perl While Avoiding the Deep End (mostly)
Roy Zimmer
 
Marcive Documents: Catching Up and Keeping Up
Marcive Documents: Catching Up and Keeping UpMarcive Documents: Catching Up and Keeping Up
Marcive Documents: Catching Up and Keeping Up
Roy Zimmer
 
Implementing a Backup Catalog… on a Student Budget
Implementing a Backup Catalog… on a Student BudgetImplementing a Backup Catalog… on a Student Budget
Implementing a Backup Catalog… on a Student Budget
Roy Zimmer
 
A Strand of Perls: Some Home Grown Utilities
A Strand of Perls: Some Home Grown UtilitiesA Strand of Perls: Some Home Grown Utilities
A Strand of Perls: Some Home Grown Utilities
Roy Zimmer
 
Another Way to Attack the BLOB: Server-side Access via PL/SQL and Perl
Another Way to Attack the BLOB: Server-side Access via PL/SQL and PerlAnother Way to Attack the BLOB: Server-side Access via PL/SQL and Perl
Another Way to Attack the BLOB: Server-side Access via PL/SQL and Perl
Roy Zimmer
 
Batchhow
BatchhowBatchhow
Batchhow
Roy Zimmer
 
Orientation Session for (New) Presenters and Moderators
Orientation Session for (New) Presenters and ModeratorsOrientation Session for (New) Presenters and Moderators
Orientation Session for (New) Presenters and Moderators
Roy Zimmer
 
Taking Your Customers to the Cleaners: Historical Patron Data Cleanup and Rou...
Taking Your Customers to the Cleaners: Historical Patron Data Cleanup and Rou...Taking Your Customers to the Cleaners: Historical Patron Data Cleanup and Rou...
Taking Your Customers to the Cleaners: Historical Patron Data Cleanup and Rou...
Roy Zimmer
 
Perl DBI Scripting with the ILS
Perl DBI Scripting with the ILSPerl DBI Scripting with the ILS
Perl DBI Scripting with the ILS
Roy Zimmer
 
You Can Do It! Start Using Perl to Handle Your Voyager Needs
You Can Do It! Start Using Perl to Handle Your Voyager NeedsYou Can Do It! Start Using Perl to Handle Your Voyager Needs
You Can Do It! Start Using Perl to Handle Your Voyager Needs
Roy Zimmer
 
Voyager Meets MeLCat: MC'ing the Introductions
Voyager Meets MeLCat: MC'ing the IntroductionsVoyager Meets MeLCat: MC'ing the Introductions
Voyager Meets MeLCat: MC'ing the Introductions
Roy Zimmer
 
Plunging Into Perl While Avoiding the Deep End (mostly)
Plunging Into Perl While Avoiding the Deep End (mostly)Plunging Into Perl While Avoiding the Deep End (mostly)
Plunging Into Perl While Avoiding the Deep End (mostly)
Roy Zimmer
 
Marcive Documents: Catching Up and Keeping Up
Marcive Documents: Catching Up and Keeping UpMarcive Documents: Catching Up and Keeping Up
Marcive Documents: Catching Up and Keeping Up
Roy Zimmer
 
Implementing a Backup Catalog… on a Student Budget
Implementing a Backup Catalog… on a Student BudgetImplementing a Backup Catalog… on a Student Budget
Implementing a Backup Catalog… on a Student Budget
Roy Zimmer
 
A Strand of Perls: Some Home Grown Utilities
A Strand of Perls: Some Home Grown UtilitiesA Strand of Perls: Some Home Grown Utilities
A Strand of Perls: Some Home Grown Utilities
Roy Zimmer
 
Another Way to Attack the BLOB: Server-side Access via PL/SQL and Perl
Another Way to Attack the BLOB: Server-side Access via PL/SQL and PerlAnother Way to Attack the BLOB: Server-side Access via PL/SQL and Perl
Another Way to Attack the BLOB: Server-side Access via PL/SQL and Perl
Roy Zimmer
 

Recently uploaded (20)

Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 

Automating a Vendor File Load Process with Perl and Shell Scripting

  • 1. Automating a Vendor File Load Process with Perl and Shell Scripting Roy Zimmer Western Michigan University
  • 2. We needed to get Promptcat approval files, from OCLC’s ftp site.
  • 3. We needed to get Promptcat approval files, from OCLC’s ftp site. Historically, we’ve done file retrieval and processing via shell scripting, with some supporting Perl software.
  • 4. We needed to get Promptcat approval files, from OCLC’s ftp site. Historically, we’ve done file retrieval and processing via shell scripting, with some supporting Perl software. In this case, we started out mostly manual, with some programmatic support.
  • 5. We needed to get Promptcat approval files, from OCLC’s ftp site. Historically, we’ve done file retrieval and processing via shell scripting, with some supporting Perl software. In this case, we started out mostly manual, with some programmatic support. We kind of snuck up on the final method of retrieval and processing.
  • 6. The ftp site has quite a few files, including a number of different types: LBL, RPT, APPR, FIRM…
  • 7. Let’s use a representative sample for this presentation…
  • 8. Out of this large number of files, only one or a few will be of interest. For example, take the files for May 7.
  • 9. Out of this large number of files, only one or a few will be of interest. In this case, the files for May 7. How do we pick them out?
  • 10. This is where Perl comes to the rescue. With Perl, you can do many things.
  • 11. Code details, main program, ftp stuff ftppcatappr.pl Required when using ftp within Perl
  • 12. Site password is stored here. Code details, main program, ftp stuff ftppcatappr.pl Required when using ftp within Perl
  • 13. Site password is stored here. Code details, main program, ftp stuff ftppcatappr.pl Required when using ftp within Perl - Site URL - Username - directory where files are - transfer mode
  • 14. Code details, main program, ftp stuff ftppcatappr.pl Self-explanatory Required when using ftp within Perl Site password is stored here. - Site URL - Username - directory where files are - transfer mode
  • 15. Site password is stored in a file. Code details, main program, ftp stuff ftppcatappr.pl
  • 16. Site password is stored in a file. Setting up for FTP Code details, main program, ftp stuff ftppcatappr.pl
  • 17. Retrieve ftp site file listing into a variable as an array of directory entries. Code details, main program, ftp stuff ftppcatappr.pl
  • 18. Set each line up to be split on the space character and then do so. Code details, main program, ftp stuff Retrieve ftp site file listing into a variable as an array of directory entries. ftppcatappr.pl
  • 19. Set each line up to be split on the space character and then do so. The last piece in each line will be the filename. Split this into pieces based on the period. Code details, main program, ftp stuff Retrieve ftp site file listing into a variable as an array of directory entries. ftppcatappr.pl
  • 20. Set each line up to be split on the space character and then do so. The last piece in each line will be the filename. Split this into pieces based on the period. Look for the one(s) that correspond(s) with yesterday’s date and keep those. Code details, main program, ftp stuff Retrieve ftp site file listing into a variable as an array of directory entries. ftppcatappr.pl
  • 21. Want the files to be processed in order Code details, main program, ftp stuff ftppcatappr.pl
  • 22. Code details, main program, processing each file ftppcatappr.pl Get the files
  • 23. Code details, main program, processing each file Records will need some editing… (Thanks to Birong Ho, our systems librarian, for originally supplying this editing code.) Get the records ftppcatappr.pl
  • 24. Records will need some editing… “grab” the fields of interest Get the records Code details, main program, processing each file ftppcatappr.pl
  • 25. Records will need some editing… Some fields are deleted… Code details, main program, processing each file ftppcatappr.pl
  • 26. Records will need some editing… …and others are edited. More edits than this are performed; the basic syntax is the same for each of them. Code details, main program, processing each file ftppcatappr.pl
  • 27. File will need some splitting… Split each file up based on the invoice number found in field 980 |f Code details, main program, processing each file
  • 28. File will need some splitting… Split each file up based on the invoice number found in field 980 |f The next program takes care of this… I did say we snuck up on this, didn’t I? Code details, main program, processing each file
  • 29. File will need some splitting…split each file up based on the invoice number found in field 980 |f Rather than using the familiar LF, the MARC format uses a different EOL character. Code details, helper program, processing each file oclc980.pl
  • 30. File will need some splitting…split each file up based on the invoice number found in field 980 |f This section reads each MARC record, looking for the 980 field. Code details, helper program, processing each file oclc980.pl
  • 31. File will need some splitting…split each file up based on the invoice number found in field 980 |f Get the subfields into an array. Code details, helper program, processing each file oclc980.pl
  • 32. File will need some splitting…split each file up based on the invoice number found in field 980 |f Get the subfields into an array. Code details, helper program, processing each file Look for subfield f and read it to get the invoice number. oclc980.pl
  • 33. File will need some splitting…split each file up based on the invoice number found in field 980 |f Get the subfields into an array. Code details, helper program, processing each file Look for subfield f and read it to get the invoice number. Determine if it’s a new or “existing” invoice number. This also lets us count records for each invoice. oclc980.pl
  • 34. File will need some splitting…split each file up based on the invoice number found in field 980 |f Get the subfields into an array. Code details, helper program, processing each file Look for subfield f and read it to get the invoice number. Determine if it’s a new or “existing” invoice number. This also lets us count records for each invoice. Use append mode to open, write a record, and close the file for each invoice number. oclc980.pl
  • 35. There are usually several files after splitting the file being processed. Each one must be further processed and loaded into Voyager. This is controlled via a small shell script. Code details, helper program, processing each invoice file
  • 36. There are usually several files after splitting the file being processed. Each one must be further processed and loaded into Voyager. This is controlled via a small shell script. It calls another shell script for preprocessing and bulk loading of each of the invoice files. Code details, helper program, processing each invoice file (Thanks to Keith Kelley, director of systems, for creating this script.) importall.sh
  • 37. Code details, helper program, importing each invoice file $1 is the default first parameter to the script. Let’s use a more descriptive variable. prodimport.script
  • 38. Code details, helper program, importing each invoice file $1 is the default first parameter to the script. Let’s use a more descriptive variable. Let’s also drop the filename extension, so that we can “reuse” the filename. prodimport.script
  • 39. Code details, helper program, importing each invoice file $1 is the default first parameter to the script. Let’s use a more descriptive variable. Let’s also drop the filename extension, so that we can “reuse” the filename. Get ready for the prebulk processing. prodimport.script
  • 40. Code details, helper program, importing each invoice file prodimport.script 1 st use of file referenced by $1, so that use is OK
  • 41. Code details, helper program, importing each invoice file Start with some final edits… prodimport.script
  • 42. Code details, helper program, importing each invoice file Start with some final edits… We’ll use marcedit.pl to replace the contents of field 981 |a, as illustrated: There are 59 such edits possible. prodimport.script
  • 43. Code details, helper program, importing each invoice file Start with some final edits… Prep for bulkimport, too prodimport.script
  • 44. Code details, helper program, importing each invoice file Start with some final edits… Prep for bulkimport, too Self-explanatory prodimport.script
  • 45. Code details, helper program, importing each invoice file Prebulk output is bulkimport input. Perform the bulkimport prodimport.script
  • 46. Code details, helper program, importing each invoice file Prebulk output is bulkimport input. Perform the bulkimport The final step for each file is to do some cleanup and moving files to the loaded directory. prodimport.script
  • 47. Password maintenance The ftp site requires us to change our password every 90 days. We wanted all this to run hands-off, so that had to be automated, also. The password gets changed every two months.
  • 48. Password maintenance, getpromptcatpw.ksh
  • 49. Password maintenance, getpromptcatpw.ksh
  • 50. Password maintenance, pwgen.pl Want an 8-character password
  • 51. Password maintenance, pwgen.pl Want an 8-character password Password length defaults to 10
  • 52. Password maintenance, pwgen.pl Want an 8-character password Password length defaults to 10 Password consists of these characters
  • 53. Password maintenance, pwgen.pl Want an 8-character password Password length defaults to 10 Password consists of these characters Seed the random number generator
  • 54. Password maintenance, pwgen.pl Want an 8-character password Password length defaults to 10 Password consists of these characters Seed the random number generator Generate the password
  • 55. Review Run ftppcatappr.pl Login to OCLC ftp site for promptcat Find desired files and retrieve them Do process each file remove unwanted 6xx, 938, 948 fields edit some 856 fields run oclc980.pl do process each record in the current file look at the 980 |f (contains the invoice number) if it contains invoice NNN, (create and) put this record in file NNN.marc, etc. end do run importall.sh do process each file created by oclc980.pl run prodimport.script use marcedit.pl to process 981 |a replacements (59 possible edits) prebulk bulk import wait 1.5 minutes before continuing end do move all interim .marc, .preimp, and .imp files to /loaded End do Move all RCD* files to /loaded
  • 56. Review Run ftppcatappr.pl Login to OCLC ftp site for promptcat Find desired files and retrieve them Do process each file remove unwanted 6xx, 938, 948 fields edit some 856 fields run oclc980.pl do process each record in the current file look at the 980 |f (contains the invoice number) if it contains invoice NNN, (create and) put this record in file NNN.marc, etc. end do run importall.sh do process each file created by oclc980.pl run prodimport.script use marcedit.pl to process 981 |a replacements (59 possible edits) prebulk bulk import wait 1.5 minutes before continuing end do move all interim .marc, .preimp, and .imp files to /loaded End do Move all RCD* files to /loaded
  • 57. The files listed below are available at http://homepages.wmich.edu/~zimmer/files/eugm2008 fileload.ppt this presentation ftppcatappr.pl gets the files and controls the processing oclc980.pl splits retrieved files based on invoice number pwgen.pl generates a password importall.sh ensures that each “split file” for a particular retrieved file is processed prodimport.ksh does the actual processing of each file getpromptpw.ksh handles all the details of a password change Resources except for marcedit.pl enables batch editing of MARC files which is at http://homepages.wmich.edu/~zimmer/marc_index.html
  • 58. CPAN http://cpan.org FTP http://search.cpan.org/~gbarr/libnet-1.22/Net/FTP.pm I’m not sure if the FTP module is supplied on Voyager boxes or not. If you don’t have it, go to the above URL. It also has good documentation on this module. Resources
  • 59. Thank you for listening. Roy Zimmer [email_address] Picture © 2008 by Roy Zimmer