Skip to content

Instantly share code, notes, and snippets.

@pgwillia
Last active December 19, 2018 20:30
Show Gist options
  • Save pgwillia/9f24bd40bc1c61e98a613e1fa974b8f7 to your computer and use it in GitHub Desktop.
Save pgwillia/9f24bd40bc1c61e98a613e1fa974b8f7 to your computer and use it in GitHub Desktop.
Jim's scripts for Symphony extract to Solr [Jul 9, 2018, 3:06 PM]
#!/u/sirsi/Unicorn/Bin/perl
system("echo \" \"");
system("echo Find Call Number Shadow Status");
@callShad = `cat sorted_adds | selcallnum -iC -oK2`;
open(SHAD,">allShadowed");
open(NSHAD,">noShadowCall");
$ckeyPrev = 0;
$firstLine = "y";
foreach $callShad (@callShad)
{
chomp($callShad);
next if $callShad eq "";
($ckey,$seq,$shad) = split/\|/,$callShad;
if ($ckey == $ckeyPrev || $firstLine eq "y")
{
push (@grp,$callShad);
$firstLine = "n";
}
else
{
$allShadowed = "y";
foreach $line (@grp)
{
chomp($line);
next if $line eq "";
($ckey2,$seq2,$shad2) = split/\|/,$line;
if ($shad2 == 0)
{
$allShadowed = "n";
}
}
@grp = "";
push (@grp,$callShad);
if ($allShadowed eq "y")
{
print SHAD "$ckey2\n";
}
else
{
print NSHAD "$ckey2\n";
}
}
$ckeyPrev = $ckey;
}
$allShadowed = "y";
foreach $line (@grp)
{
chomp($line);
next if $line eq "";
($ckey2,$seq2,$shad2) = split/\|/,$line;
if ($shad2 == 0)
{
$allShadowed = "n";
}
}
if ($allShadowed eq "y")
{
print SHAD "$ckey2\n";
}
else
{
print NSHAD "$ckey2\n";
}
close(NSHAD);
####################################
system("echo \" \"");
system("echo Find Items, Locations, Shadow Status");
@itemShad = `cat noShadowCall | selitem -iC -oK2lm`;
open(NSHADI,">noShadowCallItem");
$ckeyPrev = 0;
$firstLine = "y";
foreach $itemShad (@itemShad)
{
chomp($itemShad);
next if $itemShad eq "";
($ckey,$seq,$copy,$shad,$homeLoc,$currentLoc) = split/\|/,$itemShad;
if ($ckey == $ckeyPrev || $firstLine eq "y")
{
push (@grp,$itemShad);
$firstLine = "n";
}
else
{
$allShadowed = "y";
foreach $line (@grp)
{
chomp($line);
next if $line eq "";
($ckey2,$seq2,$copy2,$shad2,$homeLoc2,$currentLoc2) = split/\|/,$line;
if (($line !~ /UNKNOWN/ &&
$line !~ /MISSING/ &&
$line !~ /LOST/ &&
$line !~ /DISCARD/ &&
$line !~ /LOST-PAID/ &&
$line !~ /LONGOVRDUE/ &&
$line !~ /CANC_ORDER/ &&
$line !~ /ON_THE_FLY/ &&
$line !~ /LOST-ASSUM/ &&
$line !~ /LOST-CLAIM/ &&
$line !~ /INSHIPPING/ &&
$line !~ /STOR_DARK/) &&
($shad2 != 1))
{
$allShadowed = "n";
}
}
@grp = "";
push (@grp,$itemShad);
if ($allShadowed eq "y")
{
print SHAD "$ckey2\n";
}
else
{
print NSHADI "$ckey2\n";
}
}
$ckeyPrev = $ckey;
}
$allShadowed = "y";
foreach $line (@grp)
{
chomp($line);
next if $line eq "";
($ckey2,$seq2,$copy2,$shad2,$homeLoc2,$currentLoc2) = split/\|/,$line;
if (($line !~ /UNKNOWN/ &&
$line !~ /MISSING/ &&
$line !~ /LOST/ &&
$line !~ /DISCARD/ &&
$line !~ /LOST-PAID/ &&
$line !~ /LONGOVRDUE/ &&
$line !~ /CANC_ORDER/ &&
$line !~ /ON_THE_FLY/ &&
$line !~ /LOST-ASSUM/ &&
$line !~ /LOST-CLAIM/ &&
$line !~ /INSHIPPING/ &&
$line !~ /STOR_DARK/) &&
($shad2 != 1))
{
$allShadowed = "n";
}
}
if ($allShadowed eq "y")
{
print SHAD "$ckey2\n";
}
else
{
print NSHADI "$ckey2\n";
}
close(NSHADI);
system("cat allShadowed |catalogdump -oF -h -t926 >allShadowed.dump");
$countDisTitles = `grep -c . allShadowed`;
print "\nTitles Set to Discard = $countDisTitles\n";
open(IN,"allShadowed.dump");
open(DISC,">discardedTitlesSet.txt");
while($line=<IN>)
{
chomp($line);
if ($line =~ /^\.000/)
{
$status = substr($line,13,1,d);
}
print DISC "$line\n";
}
close(IN);
close(DISC);
#!/u/sirsi/Unicorn/Bin/perl
system("echo Find Callnumbers and Call Shadow Status of goodTitles.");
open(CALL,"cat ckey940 | selcallnum -iC -oK2S |");
open(SHAD,">allShadowed");
open(NSHAD,">noShadowCall");
$ckeyPrev = 0;
$firstLine = "y";
while ($callShad=<CALL>)
{
chomp($callShad);
next if $callShad eq "";
($ckey,$seq,$shad,$t940) = split/\|/,$callShad;
if ($ckey == $ckeyPrev || $firstLine eq "y")
{
push (@grp,$callShad);
$firstLine = "n";
}
else
{
$allShadowed = "y";
foreach $line (@grp)
{
chomp($line);
next if $line eq "";
($ckey2,$seq2,$shad2,$t940_2) = split/\|/,$line;
if ($shad2 == 0)
{
$allShadowed = "n";
}
}
@grp = "";
push (@grp,$callShad);
if ($allShadowed eq "y")
{
print SHAD "$ckey2\n";
}
else
{
print NSHAD "$ckey2|$t940_2|\n";
}
}
$ckeyPrev = $ckey;
}
close(CALL);
$allShadowed = "y";
foreach $line (@grp)
{
chomp($line);
next if $line eq "";
($ckey2,$seq2,$shad2,$t940_2) = split/\|/,$line;
if ($shad2 == 0)
{
$allShadowed = "n";
}
}
if ($allShadowed eq "y")
{
print SHAD "$ckey2\n";
}
else
{
print NSHAD "$ckey2|$t940_2|\n";
}
close(NSHAD);
## Items #################
system("echo \" \"");
system("echo Find Items, Shadow Status, Locations, Libraries, Category 2.");
open(ITM,"cat noShadowCall | selitem -iC -oK2lmygS |");
open(NSHADI,">noShadowCallItem");
$ckeyPrev = 0;
$firstLine = "y";
while ($itemShad=<ITM>)
{
chomp($itemShad);
next if $itemShad eq "";
($ckey,$seq,$copy,$shad,$homeLoc,$currentLoc,$lib,$cat2,$t940) = split/\|/,$itemShad;
if ($ckey == $ckeyPrev || $firstLine eq "y")
{
push (@grp,$itemShad);
$firstLine = "n";
}
else
{
$allShadowed = "y";
foreach $line (@grp)
{
chomp($line);
next if $line eq "";
($ckey2,$seq2,$copy2,$shad2,$homeLoc2,$currentLoc2,$lib2,$cat2_2,$t940_2) = split/\|/,$line;
if ($line !~ /UNKNOWN/ &&
$line !~ /MISSING/ &&
$line !~ /LOST/ &&
$line !~ /DISCARD/ &&
$line !~ /LOST-PAID/ &&
$line !~ /LONGOVRDUE/ &&
$line !~ /CANC_ORDER/ &&
$line !~ /ON_THE_FLY/ &&
$line !~ /LOST-ASSUM/ &&
$line !~ /LOST-CLAIM/ &&
$line !~ /INSHIPPING/ &&
$line !~ /STOR_DARK/ &&
$line !~ /IN_PROCESS/ &&
$line !~ /ON-ORDER/ &&
$line !~ /UNKNOWN/ &&
$line !~ /UATECHSERV/ &&
$shad2 != 1)
{
$allShadowed = "n";
}
}
@grp = "";
push (@grp,$itemShad);
if ($allShadowed eq "y")
{
print SHAD "$ckey2\n";
}
else
{
print NSHADI "$ckey2|$t940_2|\n";
}
}
$ckeyPrev = $ckey;
}
$allShadowed = "y";
foreach $line (@grp)
{
chomp($line);
next if $line eq "";
($ckey2,$seq2,$copy2,$shad2,$homeLoc2,$currentLoc2,$lib2,$cat2,$t940_2) = split/\|/,$line;
if ($line !~ /UNKNOWN/ &&
$line !~ /MISSING/ &&
$line !~ /LOST/ &&
$line !~ /DISCARD/ &&
$line !~ /LOST-PAID/ &&
$line !~ /LONGOVRDUE/ &&
$line !~ /CANC_ORDER/ &&
$line !~ /ON_THE_FLY/ &&
$line !~ /LOST-ASSUM/ &&
$line !~ /LOST-CLAIM/ &&
$line !~ /INSHIPPING/ &&
$line !~ /STOR_DARK/ &&
$line !~ /IN_PROCESS/ &&
$line !~ /ON-ORDER/ &&
$line !~ /UNKNOWN/ &&
$line !~ /UATECHSERV/ &&
$shad2 != 1)
{
$allShadowed = "n";
}
}
if ($allShadowed eq "y")
{
print SHAD "$ckey2\n";
}
else
{
print NSHADI "$ckey2|$t940_2|\n";
}
close(NSHADI);
close(SHAD);
close(ITM);
$countSkippedTitles = `grep -c . allShadowed`;
print "\nTitles Skipped = $countSkippedTitles\n";
$countTitles2Send = `grep -c . noShadowCallItem`;
print "Titles2Send = $countTitles2Send\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment