#!/usr/local/bin/perl
# For : RF ENGINEERING - Craig
# FRAUD - LuEllen - 714-***-****
# TECHNICAL SUPPORT - Mary
# Author: Craig Steffler 714-***-****
# ******@**.********.***
# REVISION HISTORY
# DATE BY VER DESCRIPTION
# 19-Sep-95 cws 1.0 Original
# 12-Oct-95 cws 1.1 Changed TERM INIT heading to ORIG FINAL as requested
# 29-Mar-96 cws 1.2 Made cosmetic change in usage routine
# 26-Nov-96 cws 1.3 Added usrlog and removed references to perlenv
# 26-Jun-97 cws 1.4 Upgraded to include functions from cdlsb, cdlcsn,
# and cdlcfc, and added the ability to the Analog to
# do a DAS search first then wait a few minutes and
# do a DOT1 search
# 26-Aug-97 cws 1.5 Rearranged Analog Searches to use PMSys database
# instead of DAS and rearranged output due to field
# changes in databases for Analog.
# 01-Sep-97 cws 1.6 Included numerous new options: custom analog, prompting
#
# 16-Oct-97 cws 1.7 Changed from server "spock" to server "kirk" and
# adjusted fields to handle fieldnames that changed
# mainly due to CLLI fields being removed. Also
# deactivated the standard DOT1 searching
# 06-Dec-97 cws 1.8 Changed from server "kirk" to server "spock" and
# adjusted fields to handle field name arrangement
# changes and also corrected AMA CFC from decimal to
# hex to conform with original standard output
# 13-Jan-98 cws 1.9 Made AMA CFC option available to help engineers
$VER = "1.9";
$PROG = "CSSB";
# # # # # # # # PENDING # # # # # # # # # # # # # # # # # # # # # # #
# MIS to provide some kind of SQL/Informix script ability to check the tables
# in the database and then determine the oldest date for each table and then
# put that date into a $csn/lib file that can be referenced to determine if
# the user needs to be prompted if they'd like it pulled from archive and log
# them to help MIS justify space requirement for future expansion.
# NOTE: run query using the syntax:
# select tabname from sysmaster:systabnames
#
# Need expanded option that gives a Motorola-like search output
# Part of it should allow for an indexed search of PPX files
# using the EMX and SEQ_NUM to speed the search up and that once
# a call record is found that it can end the search at that point
# ie: "while ( $FOUNDIT)"
# Another part should be an option that includes the EMX & SEQ_NUM
# on all searches to help with expanded searches.
#
# Need custom options for AMA tables. ALMOST THERE
#
# Need a prompted version for custom searches and regulars
# Options s/b for: which database, Brief description, Detailed description
# for the tables then the same for the fields later on.
#
# Should have option that would allow email to a specified user when finished
# and options for alphapaging or paging to numeric pager with 2772 for CSSB
#
# Need to include option of having a .cssbrc setup file that would contain
# mobile numbers, email address if different from LOGNAME, path for storing
# output files, custom options
#
# Should have ability in prompted version to track errors and after 3 failures
# ask the user what they're trying to get and then send email get assistance
#
# Need ability to have list of stations and area that tells which are in use
# and then rlogin to an available station to run query and then exit when done
#
# INCLUDE SAMPLE OUTPUT WITH SOURCE CODE + ANY MEMOS REQUESTS IN DOCUMENTATION
# CHECK FOR ERROR RETURNS FROM ALL SYSTEM CALLS
#
# CSSB
# CSSB is short for Craig Steffler's Search Batch. It displays AMA and/or CDL
# call data for selected records. It uses SQL database queries to provide the
# quickest response and conserve system resources. The only downside currently
# is that the database server is greatly under powered. Additionally the bin
# features is ignored as it tends to take too long to be useful. This program
# is intended for RF Engineering, Technical Support and Fraud, but can be used
# by others if they put it their setup file.
##
# RUNNING CSSB
# CSSB has several formats. They are:
# Dialed Digits
# cssb -d 970***-******* 6115300
# Cell Site
# cssb -c 970***-***-***-***
# Call Final Class (CFC)
# cssb -f 971005 6f 378
# Custom Search for a specific field and give entire record
# cssb -Dsa 971126 2 3
# Custom Search for 2 fields but give only the initial bts and first MAHO Candidate
# cssb -Dsd 971***-**-*-**-*-** 95
# Custom Search for 2 fields but use LOGICAL OR
# cssb -Dsdo 971***-**-*-**-*-** 95
# Custom Search for 3 fields and give entire record
# cssb -Dsta 971***-**-*-**-*-** 8
# Custom Search for 3 fields but give only the initial bts and first MAHO Candidate
# cssb -Dst 971***-**-*-**-*-** 8 24 95
# OUTPUT
# There are no report files generated daily.
# PRINTED OUTPUT
# cssb does not generate any printed reports. To generate a printed report of the output the user simply has to pipe " " the output to the printer
# Example: cssb . . . lpr -PHQ1
# MAINTENANCE
# REPORT GENERATION
# None
# SCHEDULED REPORT GENERATION
# None
# MESSAGES
# None
# INPUT
# There are 4 sources of input:
# $NMS/YYMMDD.a1 All other cell and sector stats.
# $NMS/YYMMDD.a3 Bouncing busy hour info
# TMM table Directed retries and VCC fail info
# SEE ALSO
# DESCRIPTION
# More detailed description of what the program does and why. Special features.
# LOCATION
# Source: /home/craigs/Projects/Powerband/cssb
# Production: $CSN/celldata/cssb
# ADMINISTRATION
# CONFIGURATION
# User-settable constants (see DEFINED CONSTANTS below):
# $LRFLOSS Threshold for RF Loss Assign in %
# INSTALLATION
# cssb has been tested on SUN SPARC workstations under SUN OS 4.1.3
# System requirements:
# Perl, sh, pl, and /usr/5bin/pr
# Also requires:
# /usr/local/csn/reports/lib/spenv
# ENVIRONMENT
# No hardcoded paths are included other than the one to spenv.
# INTERNALS
# The input is checked for completeness. If any ... are missing ...
# The code is divided into cssb sections:
# 1. cssb
# INPUT FORMATS
# The cssb formats are noted below. cssb
# OUTPUT FORMATS
# 1 cssb
#
# IMPORTS
# Set the current environment
$spenv = "/usr/local/csn/reports/lib/spenv";
open(FILE, $spenv) die "Can't find $spenv: $!\n";
while { eval; print $@; }
close(FILE);
# Trap the following signals (* means core is dumped):
$SIG{'HUP'} = 'trap'; # 1 Hangup
$SIG{'INT'} = 'trap'; # 2 Interrupt ^C
$SIG{'QUIT'} = 'trap'; # 3 Quit
$SIG{'ABRT'} = 'trap'; # 6* Abort (generated by abort(3) routine)
$SIG{'SYS'} = 'trap'; # 12* Bad argument to system call
$SIG{'ALRM'} = 'trap'; # 14 Alarm clock
$SIG{'TERM'} = 'trap'; # 15 Software termination signal
# DEFINED CONSTANTS
# Sizes:
$DAY = 24 * 60 * 60; # Seconds per day
$WAIT = 4;
$WAIT1 = 15;
$WAIT2 = 5;
$THRESH = 4;
@EXPDEFAULT = ("-e E eA eD Ae De AE DE EA ED");
$CDLLINES = 48;
%CDLNUM = (1,0,2,49,3,97);
%CDLSTART = (1,0,2,31,3,61,4,91,5,121);
%CDLFINISH = (1,30,2,60,3,90,4,120,5,143);
$AMA0LINES = 20;
%AMA0NUM = (1,0,2,21,3,42);
%AMA0START = (1,1,2,32);
%AMA0FINISH = (1,31,2,62);
$AMA1LINES = 8;
%AMA1NUM = (1,0,2,9);
%AMA1START = (1,0);
%AMA1FINISH = (1,16);
$DOT1LINES = 13;
%DOT1NUM = (1,0,2,14,3,28);
%DOT1START = (1,0,2,0,3,0);
%DOT1FINISH = (1,0,2,0,3,0);
$PPXLINES = 20;
%PPXNUM = (1,0,2,21,3,42);
%PPXSTART = (1,0,2,32);
%PPXFINISH = (1,31,2,63);
$NOTE1 = "Today's DAS data will be available tomorrow morning. \n";
$NOTE2 = "A DOT1 Search will run in the background and email you when ";
$NOTE2 .= "finished, \nhowever, it will take quite some time. \n";
$NOTE3 = "If you left out the area code watch out for other area codes. \n";
# AMA format
$headformat1 = "%6s %8s %4s %3s %11s %11s %11s %11s\n";
$headformat2 = "%6s %8s %4s %3s %2s %2s %4s %4s %2s %2s %4s %4s %11s %11s\n";
$bodyformat1 = "%6s %8s %4d %3s %2s %2d %4d %4d %2d %2d %4d %4d %11s %11s\n";
$bodyformat2 = "%6s %8s %4d %3s LAND TO MOBILE NA %2d %4d %3d %11s %11s\n";
# Digital Format
$headformat1d = "%6s %8s %4s %3s %11s %11s %11s %11s\n";
$headformat2d = "%6s %8s %4s %3s %2s %4s %3s %2s %4s %3s %11s %11s\n";
$bodyformat1d = "%6s %8s %4d %3s %2d %4d %3d %2d %4d %3d %11s %11s\n";
# MCC format
$headformat1m = "%6s %8s %4s %3s %13s %14s %10s %10s\n";
$headformat2m = "%6s %8s %4s %3s %2s %4s %2s %2s %2s %4s %3s %2s ";
$headformat2m .= "%10s %10s\n";
$bodyformat1m = "%6s %8s %4d %3s %2d %4d %2d %2d %2d %4d %3d %2d ";
$bodyformat1m .= "%10s %10s\n";
$bodyformat2m = " %21s %2d %4d %2d %2d %2s\n";
# Debug
$trace1 = 0; # Trace section 1
# GLOBAL VARIABLES
# Flags:
$FOUNDIT = 1;
$headings = $DEFAULT = $nodatafound = 1;
$first = $second = $third = $fourth = 1; # flags to step thru entries
$fifth = $sixth = $seventh = 1; # flags to step thru entries
# MAIN PROGRAM
# Check to see if "-p" prompting is requested as for Workspace Menu Option
# Test to see if already running
$flagfile = "/tmp/cssb.flag";
$cssbrc = "$HOME/.cssbrc";
$CSSBRC if (-e $cssbrc);
# Send usage info on CSSB to log
$tmp = `date +%y%m%d`; chop $tmp;
system("echo $DOUBLEQUOTE$PROG,$VER,$tmp,$LOGNAME,$HOSTNAME,$ARGV[0]$DOUBLEQUOTE >>$USRLOG");
$currentdate = $tmp;
# Get arguments from the command line
&usage("No args") if ($#ARGV
# Remainder of arguments dealt with inside each routine
# Start up
print STDERR "$PROG ($VER) Pid $$. Starting at ", `date`;
chdir "$HOME";
# Test for Solaris
$solaris = 1 if (index(`uname -r`,"5 0);
$firstentry = $ARGV[0];
# 1. DETERMINE WHAT OPTION
# Determine what options were selected and then set flags and if used then
# zero out default
if (index($firstentry 0)
{
if ($firstentry =~ aAbBcCdDeEfFkKnNoOpPsStT]/)
{
$AFLAG = 1 if ($firstentry =~ /a/); # All fields for custom
$ANALOG = 1 if ($firstentry =~ /A Analog search
$BFLAG = 1 if ($firstentry =~ /b/); #
$BFLAG = 1 if ($firstentry =~ /B/);
$CFLAG = 1 if ($firstentry =~ /c/); # Cell Site search
$CFLAG = 1 if ($firstentry =~ /C/);
$DFLAG = 1 if ($firstentry =~ /d/); # Double custom or dialed digits
$DIGITAL = 1 if ($firstentry =~ /D/); # Digital search
$EFLAG = 1 if ($firstentry =~ /e/); # Expanded search
$EFLAG = 1 if ($firstentry =~ /E/);
$FFLAG = 1 if ($firstentry =~ /f/); # CFC search
$FFLAG = 1 if ($firstentry =~ /F/);
$KFLAG = 1 if ($firstentry =~ /k/); #
$KFLAG = 1 if ($firstentry =~ /K/);
$NFLAG = 1 if ($firstentry =~ /n/); # Sequence Number search
$NFLAG = 1 if ($firstentry =~ /N/);
$OFLAG = 1 if ($firstentry =~ /o/); # Logical OR search
$OFLAG = 1 if ($firstentry =~ /O/);
$PFLAG = 1 if ($firstentry =~ /p/); # Prompting
$PFLAG = 1 if ($firstentry =~ /P/);
$SFLAG = 1 if ($firstentry =~ /s/); # Single or more custom
$SFLAG = 1 if ($firstentry =~ /S/);
$TFLAG = 1 if ($firstentry =~ /t/); # Triple Search
$TFLAG = 1 if ($firstentry =~ /T/);
$UFLAG = 1 if ($firstentry =~ /u/); # AMA0 Search
$UFLAG = 1 if ($firstentry =~ /U/);
$VFLAG = 1 if ($firstentry =~ /v/); # AMA1 Search
$VFLAG = 1 if ($firstentry =~ /V/);
$WFLAG = 1 if ($firstentry =~ /w/); # DOT1 Search
$WFLAG = 1 if ($firstentry =~ /W/);
$XFLAG = 1 if ($firstentry =~ /x/); # PPX Search
$XFLAG = 1 if ($firstentry =~ /X/);
$DEFAULT = 0; # If none were used the default is used
}
# Redefine the command-line for Non-default options
for ($lcv1=1;$lcv1
{
$CMDLINE .= "$ARGV[$lcv1
}
chop $CMDLINE;
(@CMDLINE) = split CMDLINE);
}
# 2. SELECT DEFAULT OPTION
if ($DEFAULT)
{
foreach $entry (@ARGV)
{
if ($first)
{
$first = 0;
$MOBILE = $entry;
}
else
{
$DATE = $entry; &datetest;
# if ($DATE
$headings = 1;
&stdanalog if DIGITAL)); # Run analog queries
$headings = 1;
&stddigital if ANALOG)); # Run digital query
}
}
}
# 3. SELECT DIALED DIGITS
if ($DFLAG && !($SFLAG))
{
foreach $entry (@CMDLINE)
{
if ($first)
{
$first = 0;
$DATE = $entry; &datetest;
}
else
{
$DIGITS = $entry;
$headings = 1;
&analogdialed if DIGITAL)); # Run analog queries
$headings = 1;
&digitaldialed if ANALOG)); # Run digital query
}
}
}
# 4. SELECT CELL OPTION
if ($CFLAG)
{
foreach $entry (@CMDLINE)
{
if ($first)
{
$first = 0;
$DATE = $entry; &datetest;
}
else
{
$CELL = $entry;
#$headings = 1;
#&analogcell if DIGITAL)); # Run analog queries
$headings = 1;
&digitalcell if ANALOG)); # Run digital query
}
}
}
# 5. SELECT CFC OPTION
if ($FFLAG)
{
foreach $entry (@CMDLINE)
{
if ($first)
{
$first = 0;
$DATE = $entry; &datetest;
}
else
{
if ($second)
{
$second = 0;
$CFC = $entry;
}
else
{
$CELL = $entry;
$headings = 1;
&analogcfc if DIGITAL)); # Run analog queries
$headings = 1;
&digitalcfc if ANALOG)); # Run digital query
}
}
}
}
# 6. SELECT EXPANDED DEFAULT
if ($EFLAG)
{
foreach $type (@EXPDEFAULT) { if ($ARGV[0] eq $type) { $expdefault = 1; } }
if ($expdefault)
{
$EXPAND = 1;
foreach $entry (@CMDLINE)
{
if ($first)
{
$first = 0;
$DATE = $entry; &datetest;
}
else
{
$MOBILE = $entry;
$headings = 1;
&stdanalog if DIGITAL)); # Run analog queries
$headings = 1;
&stddigital if ANALOG)); # Run digital query
}
}
}
}
# 7. SPECIAL COMPLEX QUERIES
if ($SFLAG)
{
if ANALOG $DIGITAL)) { &usage("Didn't specify Analog OR Digital"); }
if ($DIGITAL)
{
open(CDLTABLE,$CDLTABLE) die "Can't open $CDLTABLE. $!\n";
while {
chop;
($SEQ,$NAME) = split(/\t/,$_);
$CDLF{$SEQ} = $NAME;
}
close(CDLTABLE);
}
else
{
if ($UFLAG)
{
open(AMA0TABLE,$AMA0TABLE) die "Can't open $AMA0TABLE. $!\n";
while {
chop;
($SEQ,$NAME) = split(/\t/,$_);
$AMA0F{$SEQ} = $NAME;
}
close(AMA0TABLE);
}
if ($VFLAG)
{
open(AMA1TABLE,$AMA1TABLE) die "Can't open $AMA1TABLE. $!\n";
while {
chop;
($SEQ,$NAME) = split(/\t/,$_);
$AMA1F{$SEQ} = $NAME;
}
close(AMA1TABLE);
}
if ($WFLAG)
{
open(DOT1TABLE,$DOT1TABLE) die "Can't open $DOT1TABLE. $!\n";
while {
chop;
($SEQ,$NAME) = split(/\t/,$_);
$DOT1F{$SEQ} = $NAME;
}
close(DOT1TABLE);
}
if ($XFLAG)
{
open(PPXTABLE,$PPXTABLE) die "Can't open $PPXTABLE. $!\n";
while {
chop;
($SEQ,$NAME) = split(/\t/,$_);
$PPXF{$SEQ} = $NAME;
}
close(PPXTABLE);
}
}
# First the Double Search then the Triple Search and finally the Single Search
# 7a. DOUBLE SEARCH QUERY
if ($DFLAG) # Start Double Field Search
{
foreach $entry (@CMDLINE)
{
if ($first) { $first = 0; $DATE = $entry; &datetest; }
else
{
if ($second) { $second = 0; $SEARCH1 = $entry; }
else
{
if ($third) { $third = 0; $CRITERIA1 = $entry; }
else
{
if ($fourth) { $fourth = 0; $SEARCH2 = $entry; }
else
{
if ($fifth) { $fifth = 0; $CRITERIA2 = $entry; }
else { $OUTFIELD[$ctr++] = $entry; } # end of fifth and last
} # end of fourth
} # end of third
} # end of second
} # end of first
} # end of foreach
if ($DIGITAL) { &digitaldouble; }
else { &analogdouble; }
}
else
{
# 7b. TRIPLE SEARCH QUERY
if ($TFLAG)
{
foreach $entry (@CMDLINE)
{
if ($first) { $first = 0; $DATE = $entry; &datetest; }
else
{
if ($second) { $second = 0; $SEARCH1 = $entry; }
else
{
if ($third) { $third = 0; $CRITERIA1 = $entry; }
else
{
if ($fourth) { $fourth = 0; $SEARCH2 = $entry; }
else
{
if ($fifth) { $fifth = 0; $CRITERIA2 = $entry; }
else
{
if ($sixth) { $sixth = 0; $SEARCH3 = $entry; }
else
{
if ($seventh) { $seventh = 0; $CRITERIA3 = $entry; }
else { $OUTFIELD[$ctr++] = $entry; }
# end of seventh and last
} # end of sixth
} # end of fifth
} # end of fourth
} # end of third
} # end of second
} # end of first
} # end of foreach
if ($DIGITAL) { &digitaltriple; }
else { &analogtriple; }
}
# 7c. SINGLE SEARCH QUERY
else # Single Field Search
{
foreach $entry (@CMDLINE)
{
if ($first) { $first = 0; $DATE = $entry; &datetest; }
else
{
if ($second) { $second = 0; $SEARCH1 = $entry; }
else
{
if ($third) { $third = 0; $CRITERIA1 = $entry; }
else { $OUTFIELD[$ctr++] = $entry; } # end of third and last
} # end of second
} # end of first
} # end of foreach for single
if ($DIGITAL) { &digitalsingle; }
else { &analogsingle; }
} # end of triple
} # end of double
}
# 10. FINISH UP AND EXIT
system("rm $HOME/.cssb
#system("rm /tmp/cssb
system("rm /tmp/cssb.flag") if (-e $flagfile);
print STDERR "Finished at ", `date`;
# LOCAL FUNCTIONS
#
# analogcell - Pull the Analog Cell Queries
#
# INPUTS Cell & Date
# OUTPUTS Sends to DATAOUTFILEs that are processed further
# RETURNS Returns to Section 3 of Main Program
#
sub analogcell
{
# Temporary Warning until MIS can put the index by cell into the database.
$cmd = "Sorry, but the Analog search by cell option is not available.\n";
$cmd .= "However, it should be available very soon.\n";
print STDERR $cmd;
$SCRIPTFILE = "$HOME/.cssb scr.$CELL";
$DATAOUTFILE = ".cssb CELL";
$RLOGFILE = "$HOME/.cssb rloga.$CELL";
open(SCRIPTFILE SCRIPTFILE");
&makeanacell;
sleep 1;
system("chmod 700 $SCRIPTFILE");
sleep 1;
&makerlogfile;
system("$RLOGFILE");
$DATAOUTFILE = "$HOME/.cssb CELL";
$DATAOUTFILE = "/tmp/cssb CELL";
sleep 1;
&showanalog;
}
#
# analogcfc - Pull the Analog CFC Queries
#
# INPUTS CFC, Cell & Date
# OUTPUTS Sends to DATAOUTFILEs that are processed further
# RETURNS Returns to Section 3 of Main Program
#
sub analogcfc
{
# Temporary Warning until MIS can put the index by cell into the database.
# $cmd = "Sorry, but the Analog search by cfc option is not available.\n";
# $cmd .= "However, it should be available very soon.\n";
# print STDERR $cmd;
$SCRIPTFILE = "/tmp/cssb scr.$CFC";
$DATAOUTFILE = "cssb CFC";
$SCRIPTFILE = "$HOME/.cssb.$$a.scr.$CFC";
$DATAOUTFILE = ".cssb.$$a.$CFC";
$RLOGFILE = "$HOME/.cssb rloga.$CFC";
open(SCRIPTFILE SCRIPTFILE");
&makeanacfc;
sleep 1;
system("chmod 700 $SCRIPTFILE");
sleep 1;
&makerlogfile;
system("$RLOGFILE");
$DATAOUTFILE = "$HOME/.cssb.$$a.$CFC";
#$DATAOUTFILE = "/tmp/cssb.$$a.$CFC";
sleep 1;
&showanalog;
}
#
# analogdialed - Pull the Analog Dialed Digits Queries
#
# INPUTS Dialed Digits and Dates
# OUTPUTS Sends to DATAOUTFILEs that are processed further
# RETURNS Returns to Section 3 of Main Program
#
sub analogdialed
{
# open(DOT1 tmp/dot1.scr
# print DOT1 bin/csh\nsleep 120\n";
if ($DATE == $currentdate)
{
# print $NOTE1;
# print $NOTE3;
# print DOT1 "grep $DIGITS $DOT1FILES/$DATE";
# print DOT1 "* >/tmp/dot1 n";
}
else
{
$SCRIPTFILE = "/tmp/cssb scr.$DIGITS";
$DATAOUTFILE = "cssb DIGITS";
$SCRIPTFILE = "$HOME/.cssb scr.$DIGITS";
$DATAOUTFILE = ".cssb DIGITS";
$RLOGFILE = "$HOME/.cssb rloga.$DIGITS";
open(SCRIPTFILE SCRIPTFILE");
&makeanadialed;
sleep 1;
system("chmod 700 $SCRIPTFILE");
sleep 1;
&makerlogfile;
system("$RLOGFILE");
$DATAOUTFILE = "/tmp/cssb DIGITS";
$DATAOUTFILE = "$HOME/.cssb DIGITS";
sleep 1;
&showanalog;
# print DOT1 "zcat $DOT1FILES/$DATE";
# print DOT1 "*Z grep $DIGITS >/tmp/dot1 n";
}
# print $NOTE2;
# print DOT1 "$CSSBDOT1 /tmp/dot1.$$ ";
# print DOT1 "mail -s \"Search Batch\" $LOGNAME\n";
# print DOT1 "rm dot1.scr n";
# close(DOT1);
# system("chmod 744 /tmp/dot1.scr
# system("/tmp/dot1.scr.$$
}
#
# analogdouble - Does SQL Query on 2 fields
#
# INPUTS Date, Fields to search and values for each
# OUTPUTS Sends to a vertical bar delimited file in the users home directory
# RETURNS Returns to Section 7 of Main Program
#
sub analogdouble
{
$DOUBLE = "$CRITERIA1.$CRITERIA2";
$SCRIPTFILE = "$HOME/.cssb scr.$DOUBLE";
$DATAOUTFILE = ".cssb DOUBLE";
$WORKFILE = "$HOME/.cssb HOST";
$RLOGFILE = "$HOME/.cssb rloga.$DOUBLE";
open(SCRIPTFILE SCRIPTFILE");
if ($UFLAG $VFLAG)
{
&makeanadouble;
sleep 1;
system("chmod 700 $SCRIPTFILE");
sleep 1;
&makerlogfile;
system("$RLOGFILE");
sleep 1;
# &monitordigital($DOUBLE);
$DATAOUTFILE = "$HOME/.cssb DOUBLE";
}
else
{
if ($WFLAG)
{
@files = `ls $DOT1FILES/$DATE*`;
if ((index($files[0],"Z")>0) (index($#files,"Z")>0))
{
@files = `ls $DOT1FILES/$DATE*Z`;
system("touch $WORKFILE.hold");
foreach $file (@files)
{
chop $file;
system("zcat $WORKFILE.work");
if ($OFLAG) { $cmd = "$CSSBPULL -2o $WORKFILE.work $WORKFILE.work.1"; }
else { $cmd = "$CSSBPULL -2 $WORKFILE.work $WORKFILE.work.1"; }
$cmd .= "$SEARCH1 $CRITERIA1 $SEARCH2 $CRITERIA2";
system($cmd);
system("cat $WORKFILE.work.1 >>$WORKFILE.hold");
}
}
else
{
system("touch $WORKFILE.hold");
foreach $file (@files)
{
chop $file;
if ($OFLAG) { $cmd = "$CSSBPULL -2o $file $WORKFILE.work.1"; }
else { $cmd = "$CSSBPULL -2 $file $WORKFILE.work.1"; }
$cmd .= "$SEARCH1 $CRITERIA1 $SEARCH2 $CRITERIA2";
system($cmd);
system("cat $WORKFILE.work.1 >>$WORKFILE.hold");
}
}
}
else
{
@files = `ls $PPXFILES/$DATE*`;
if ((index($files[0],"Z")>0) (index($#files,"Z")>0))
{
@files = `ls $PPXFILES/$DATE*Z`;
system("touch $WORKFILE.hold");
foreach $file (@files)
{
chop $file;
system("zcat $WORKFILE.work");
if ($OFLAG) { $cmd = "$CSSBPULL -2o $WORKFILE.work $WORKFILE.work.1"; }
else { $cmd = "$CSSBPULL -2 $WORKFILE.work $WORKFILE.work.1"; }
$cmd .= "$SEARCH1 $CRITERIA1 $SEARCH2 $CRITERIA2";
system($cmd);
system("cat $WORKFILE.work.1 >>$WORKFILE.hold");
}
}
else
{
system("touch $WORKFILE.hold");
foreach $file (@files)
{
chop $file;
if ($OFLAG) { $cmd = "$CSSBPULL -2o $file $WORKFILE.work.1"; }
else { $cmd = "$CSSBPULL -2 $file $WORKFILE.work.1"; }
$cmd .= "$SEARCH1 $CRITERIA1 $SEARCH2 $CRITERIA2";
system($cmd);
system("cat $WORKFILE.work.1 >>$WORKFILE.hold");
}
}
}
$DATAOUTFILE = "$WORKFILE.hold";
}
$OUTFILE = "$HOME/cssb.$DATE.$DOUBLE";
&pullanafields;
}
#
# analogsingle - Does SQL Query on a specific field
#
# INPUTS Date, Field to search and value to search for
# OUTPUTS Sends to a vertical bar delimited file in the users home directory
# RETURNS Returns to Section 7 of Main Program
#
sub analogsingle
{
$SINGLE = "$CRITERIA1";
$SCRIPTFILE = "$HOME/.cssb scr.$SINGLE";
$DATAOUTFILE = ".cssb SINGLE";
$WORKFILE = "$HOME/.cssb HOST";
$RLOGFILE = "$HOME/.cssb rloga.$SINGLE";
open(SCRIPTFILE SCRIPTFILE");
if ($UFLAG $VFLAG)
{
&makeanasingle;
sleep 1;
system("chmod 700 $SCRIPTFILE");
sleep 1;
&makerlogfile;
system("$RLOGFILE");
sleep 1;
# &monitordigital($SINGLE);
$DATAOUTFILE = "$HOME/.cssb SINGLE";
$OUTFILE = "$HOME/cssb.$DATE.$SINGLE";
}
else
{
if ($WFLAG)
{
@files = `ls $DOT1FILES/$DATE*`;
if ((index($files[0],"Z")>0) (index($#files,"Z")>0))
{
@files = `ls $DOT1FILES/$DATE*Z`;
system("touch $WORKFILE.hold");
foreach $file (@files)
{
chop $file;
system("zcat $WORKFILE.work");
$cmd = "$CSSBPULL -1 $WORKFILE.work $WORKFILE.work.1";
$cmd .= "$SEARCH1 $CRITERIA1";
system($cmd);
system("cat $WORKFILE.work.1 >>$WORKFILE.hold");
}
}
else
{
system("touch $WORKFILE.hold");
foreach $file (@files)
{
chop $file;
$cmd = "$CSSBPULL -1 $file $WORKFILE.work.1";
$cmd .= "$SEARCH1 $CRITERIA1";
system($cmd);
system("cat $WORKFILE.work.1 >>$WORKFILE.hold");
}
}
}
else
{
@files = `ls $PPXFILES/$DATE*`;
if ((index($files[0],"Z")>0) (index($#files,"Z")>0))
{
@files = `ls $PPXFILES/$DATE*Z`;
system("touch $WORKFILE.hold");
foreach $file (@files)
{
chop $file;
system("zcat $WORKFILE.work");
$cmd = "$CSSBPULL -1 $WORKFILE.work $WORKFILE.work.1";
$cmd .= "$SEARCH1 $CRITERIA1";
system($cmd);
system("cat $WORKFILE.work.1 >>$WORKFILE.hold");
}
}
else
{
system("touch $WORKFILE.hold");
foreach $file (@files)
{
chop $file;
$cmd = "$CSSBPULL -1 $file $WORKFILE.work.1";
$cmd .= "$SEARCH1 $CRITERIA1";
system($cmd);
system("cat $WORKFILE.work.1 >>$WORKFILE.hold");
}
}
}
$DATAOUTFILE = "$WORKFILE.hold";
}
$OUTFILE = "$HOME/cssb.$DATE.$SINGLE";
&pullanafields;
}
#
# analogtriple - Does SQL Query on 3 fields
#
# INPUTS Date, Fields to search and values for each
# OUTPUTS Sends to a vertical bar delimited file in the users home directory
# RETURNS Returns to Section 7 of Main Program
#
sub analogtriple
{
$TRIPLE = "$CRITERIA1.$CRITERIA2.$CRITERIA3";
$SCRIPTFILE = "$HOME/.cssb scr.$TRIPLE";
$DATAOUTFILE = ".cssb TRIPLE";
$WORKFILE = "$HOME/.cssb HOST";
$RLOGFILE = "$HOME/.cssb rloga.$TRIPLE";
open(SCRIPTFILE SCRIPTFILE");
if ($UFLAG $VFLAG)
{
&makeanatriple;
sleep 1;
system("chmod 700 $SCRIPTFILE");
sleep 1;
&makerlogfile;
system("$RLOGFILE");
sleep 1;
# &monitordigital($TRIPLE);
$DATAOUTFILE = "$HOME/.cssb TRIPLE";
$OUTFILE = "$HOME/cssb.$DATE.$TRIPLE";
}
else
{
if ($WFLAG)
{
@files = `ls $DOT1FILES/$DATE*`;
if ((index($files[0],"Z")>0) (index($#files,"Z")>0))
{
@files = `ls $DOT1FILES/$DATE*Z`;
system("touch $WORKFILE.hold");
foreach $file (@files)
{
chop $file;
system("zcat $WORKFILE.work");
if ($OFLAG) { $cmd = "$CSSBPULL -3o $WORKFILE.work $WORKFILE.work.1"; }
else { $cmd = "$CSSBPULL -3 $WORKFILE.work $WORKFILE.work.1"; }
$cmd .= "$SEARCH1 $CRITERIA1 $SEARCH2 $CRITERIA2 $SEARCH3 $CRITERIA3";
system($cmd);
system("cat $WORKFILE.work.1 >>$WORKFILE.hold");
}
}
else
{
system("touch $WORKFILE.hold");
foreach $file (@files)
{
chop $file;
if ($OFLAG) { $cmd = "$CSSBPULL -3o $file $WORKFILE.work.1"; }
else { $cmd = "$CSSBPULL -3 $file $WORKFILE.work.1"; }
$cmd .= "$SEARCH1 $CRITERIA1 $SEARCH2 $CRITERIA2 $SEARCH3 $CRITERIA3";
system($cmd);
system("cat $WORKFILE.work.1 >>$WORKFILE.hold");
}
}
}
else
{
@files = `ls $PPXFILES/$DATE*`;
if ((index($files[0],"Z")>0) (index($#files,"Z")>0))
{
@files = `ls $PPXFILES/$DATE*Z`;
system("touch $WORKFILE.hold");
foreach $file (@files)
{
chop $file;
system("zcat $WORKFILE.work");
if ($OFLAG) { $cmd = "$CSSBPULL -3o $WORKFILE.work $WORKFILE.work.1"; }
else { $cmd = "$CSSBPULL -3 $WORKFILE.work $WORKFILE.work.1"; }
$cmd .= "$SEARCH1 $CRITERIA1 $SEARCH2 $CRITERIA2 $SEARCH3 $CRITERIA3";
system($cmd);
system("cat $WORKFILE.work.1 >>$WORKFILE.hold");
}
}
else
{
system("touch $WORKFILE.hold");
foreach $file (@files)
{
chop $file;
if ($OFLAG) { $cmd = "$CSSBPULL -3o $file $WORKFILE.work.1"; }
else { $cmd = "$CSSBPULL -3 $file $WORKFILE.work.1"; }
$cmd .= "$SEARCH1 $CRITERIA1 $SEARCH2 $CRITERIA2 $SEARCH3 $CRITERIA3";
system($cmd);
system("cat $WORKFILE.work.1 >>$WORKFILE.hold");
}
}
}
$DATAOUTFILE = "$WORKFILE.hold";
}
$OUTFILE = "$HOME/cssb.$DATE.$TRIPLE";
&pullanafields;
}
#
# archivereq - Catch signals and handle them gracefully
#
# INPUTS The number of the signal sent to this process
# OUTPUTS Send message to user
# RETURNS Never returns
#
sub archivereq
{
local($table) = @_;
print STDERR "The date you requested $DATE is older than what is in the ";
print STDERR "