#!/usr/local/bin/perl # For : RF ENGINEERING - Craig # FRAUD - LuEllen - 714-223-2477 # TECHNICAL SUPPORT - Mary # Author: Craig Steffler 714-222-8583 # craigs@la.airtouch.com # 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 970902 6115392 6115300 # Cell Site # cssb -c 970905 221 263 294 # 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 971017 28 3 28 5 24 95 # Custom Search for 2 fields but use LOGICAL OR # cssb -Dsdo 971017 28 3 28 5 24 95 # Custom Search for 3 fields and give entire record # cssb -Dsta 971126 28 3 28 5 28 8 # Custom Search for 3 fields but give only the initial bts and first MAHO Candidate # cssb -Dst 971017 28 3 28 5 28 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 < 0); # 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<=$#ARGV;$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 < $AMA0MIN) { &archivereq("0"); } $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 <$file >$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 <$file >$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 <$file >$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 <$file >$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 <$file >$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 <$file >$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 "database. \nWould you like to request that it be pulled from "; print STDERR "archive (y for yes) "; exit(1); } # -------------------------------------------------------------------------- # datetest - This catches bad date formats if any # # INPUTS The date provided by the user # OUTPUTS Send message to user if invalid # RETURNS Returns only if valid # -------------------------------------------------------------------------- sub datetest { # $work = $DATE; $warning = "***** Warning ***** $DATE is too long. "; # $warning .= "Will try shortening it. \n"; $warning .= "Try shortening it. \n"; $archive = "The Date you selected is not in the database. "; $archive .= "Email $SPADM if you'd \n"; $archive .= "like to have it pulled from the Archives. \n"; # if (length($DATE)>6) # { # print $warning; $work = substr($DATE,0,6); # } # &usage("Bad Date, Was not ALL numbers") if (!($work+0)); # &usage("Bad Date") if ($date !~ /^\d\d\d\d\d\d/); # ($yr,$mo,$dy) = $date =~ /^(\d\d)(\d\d)(\d\d)/; #&usage("$archive") if ($DATE < $DBLIMITOLD); } # -------------------------------------------------------------------------- # digitalcell - Prints data from query to screen # # INPUTS The output file produced by query # OUTPUTS Send formatted report to screen for user # RETURNS Never returns # -------------------------------------------------------------------------- sub digitalcell { $SCRIPTFILE = "/tmp/cssb.$$.scr.$CELL"; $DATAOUTFILE = "cssb.$$.$CELL"; $SCRIPTFILE = "$HOME/.cssb.$$.scr.$CELL"; $DATAOUTFILE = ".cssb.$$.$CELL"; $RLOGFILE = "$HOME/.cssb.$$.rlogd.$MOBILE"; open(SCRIPTFILE,">$SCRIPTFILE"); &makedigcell; sleep 1; system("chmod 700 $SCRIPTFILE"); sleep 1; &makerlogfile; system("$RLOGFILE"); sleep 1; # &monitordigital($CELL); $DATAOUTFILE = "/tmp/cssb.$$.$CELL"; $DATAOUTFILE = "$HOME/.cssb.$$.$CELL"; sleep 1; &showdigital; } # -------------------------------------------------------------------------- # digitalcfc - Pull the Digital CFC Queries # # INPUTS CFC, Cell & Date # OUTPUTS Sends to DATAOUTFILEs that are processed further # RETURNS Returns to Section 3 of Main Program # -------------------------------------------------------------------------- sub digitalcfc { $SCRIPTFILE = "/tmp/cssb.$$.scr.$CFC"; $DATAOUTFILE = "cssb.$$.$CFC"; $SCRIPTFILE = "$HOME/.cssb.$$.scr.$CFC"; $DATAOUTFILE = ".cssb.$$.$CFC"; $RLOGFILE = "$HOME/.cssb.$$.rlogd.$CFC"; open(SCRIPTFILE,">$SCRIPTFILE"); &makedigcfc; sleep 1; system("chmod 700 $SCRIPTFILE"); sleep 1; &makerlogfile; system("$RLOGFILE"); $DATAOUTFILE = "/tmp/cssb.$$.$CFC"; $DATAOUTFILE = "$HOME/.cssb.$$.$CFC"; sleep 1; &showdigital; } # -------------------------------------------------------------------------- # digitaldialed - Prints data from query to screen # # INPUTS The output file produced by query # OUTPUTS Send formatted report to screen for user # RETURNS Never returns # -------------------------------------------------------------------------- sub digitaldialed { $SCRIPTFILE = "/tmp/cssb.$$.scr.$DIGITS"; $DATAOUTFILE = "cssb.$$.$DIGITS"; $SCRIPTFILE = "$HOME/.cssb.$$.scr.$DIGITS"; $DATAOUTFILE = ".cssb.$$.$DIGITS"; $RLOGFILE = "$HOME/.cssb.$$.rlogd.$DIGITS"; open(SCRIPTFILE,">$SCRIPTFILE"); &makedigdialed; sleep 1; system("chmod 700 $SCRIPTFILE"); sleep 1; &makerlogfile; system("$RLOGFILE"); sleep 1; # &monitordigital($DIGITS); $DATAOUTFILE = "/tmp/cssb.$$.$DIGITS"; $DATAOUTFILE = "$HOME/.cssb.$$.$DIGITS"; sleep 1; &showdigital; } # -------------------------------------------------------------------------- # digitaldouble - 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 digitaldouble { $DOUBLE = "$CRITERIA1.$CRITERIA2"; $SCRIPTFILE = "$HOME/.cssb.$$.scr.$DOUBLE"; $DATAOUTFILE = ".cssb.$$.$DOUBLE"; $RLOGFILE = "$HOME/.cssb.$$.rlogd.$DOUBLE"; open(SCRIPTFILE,">$SCRIPTFILE"); &makedigdouble; sleep 1; system("chmod 700 $SCRIPTFILE"); sleep 1; &makerlogfile; system("$RLOGFILE"); sleep 1; # &monitordigital($DOUBLE); $DATAOUTFILE = "$HOME/.cssb.$$.$DOUBLE"; $OUTFILE = "$HOME/cssb.$DATE.$DOUBLE"; &pulldigfields; } # -------------------------------------------------------------------------- # digitalsingle - 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 digitalsingle { $SINGLE = "$CRITERIA1"; $SCRIPTFILE = "$HOME/.cssb.$$.scr.$SINGLE"; $DATAOUTFILE = ".cssb.$$.$SINGLE"; $RLOGFILE = "$HOME/.cssb.$$.rlogd.$SINGLE"; open(SCRIPTFILE,">$SCRIPTFILE"); &makedigsingle; sleep 1; system("chmod 700 $SCRIPTFILE"); sleep 1; &makerlogfile; system("$RLOGFILE"); sleep 1; # &monitordigital($SINGLE); $DATAOUTFILE = "$HOME/.cssb.$$.$SINGLE"; $OUTFILE = "$HOME/cssb.$DATE.$SINGLE"; &pulldigfields; } # -------------------------------------------------------------------------- # digitaltriple - 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 digitaltriple { $TRIPLE = "$CRITERIA1.$CRITERIA2.$CRITERIA3"; $SCRIPTFILE = "$HOME/.cssb.$$.scr.$TRIPLE"; $DATAOUTFILE = ".cssb.$$.$TRIPLE"; $RLOGFILE = "$HOME/.cssb.$$.rlogd.$TRIPLE"; open(SCRIPTFILE,">$SCRIPTFILE"); &makedigdouble; sleep 1; system("chmod 700 $SCRIPTFILE"); sleep 1; &makerlogfile; system("$RLOGFILE"); sleep 1; # &monitortriple($TRIPLE); $DATAOUTFILE = "$HOME/.cssb.$$.$TRIPLE"; $OUTFILE = "$HOME/cssb.$DATE.$TRIPLE"; &pulldigfields; } # -------------------------------------------------------------------------- # makeanacell - Makes a script that runs an SQL query on AMA Data # # INPUTS Cell and Date of search # OUTPUTS Prints to a file in the /tmp directory # RETURNS Returns to analogcell routine # -------------------------------------------------------------------------- sub makeanacell { # &prefixDAS; &prefixPMSys; print SCRIPTFILE "SELECT *\n"; print SCRIPTFILE "FROM\n"; print SCRIPTFILE "ama0_$DATE\n"; print SCRIPTFILE "WHERE\n"; print SCRIPTFILE "ama0_$DATE.oigroup = '$CELL';\n"; # print SCRIPTFILE " OR \(ama0_$DATE.tmobileid = '$MOBILE'\);\n"; print SCRIPTFILE "EOF\n\n"; print SCRIPTFILE "\#\n\# echo\;echo Database query complete...\n"; close(SCRIPTFILE); } # -------------------------------------------------------------------------- # makeanacfc - Makes a script that runs an SQL query on AMA Data # # INPUTS CFC, Cell, and Date of search # OUTPUTS Prints to a file in the /tmp directory # RETURNS Returns to analogcfc routine # -------------------------------------------------------------------------- sub makeanacfc { # &prefixDAS; &prefixPMSys; print SCRIPTFILE "SELECT *\n"; print SCRIPTFILE "FROM\n"; print SCRIPTFILE "ama0_$DATE\n"; print SCRIPTFILE "WHERE\n"; print SCRIPTFILE "ama0_$DATE.cfc = '$CFC';\n"; print SCRIPTFILE " AND \(ama0_$DATE.oigroup = '$CELL'\);\n"; print SCRIPTFILE "EOF\n\n"; print SCRIPTFILE "\#\n\# echo\;echo Database query complete...\n"; close(SCRIPTFILE); } # -------------------------------------------------------------------------- # makeanadialed - Makes a script that runs an SQL query on AMA Data # # INPUTS Dialed Digits and Date of search # OUTPUTS Prints to a file in the /tmp directory # RETURNS Returns to analogdialed routine # -------------------------------------------------------------------------- sub makeanadialed { # &prefixDAS; &prefixPMSys; print SCRIPTFILE "SELECT *\n"; print SCRIPTFILE "FROM\n"; print SCRIPTFILE "ama0_$DATE\n"; print SCRIPTFILE "WHERE\n"; print SCRIPTFILE "ama0_$DATE.dialed = '$DIGITS';\n"; # print SCRIPTFILE " OR \(ama0_$DATE.tmobileid = '$MOBILE'\);\n"; print SCRIPTFILE "EOF\n\n"; print SCRIPTFILE "\#\n\# echo\;echo Database query complete...\n"; close(SCRIPTFILE); } # -------------------------------------------------------------------------- # makeanamobile - Makes a script that runs an SQL query on AMA Data # # INPUTS Mobile number and Date of search # OUTPUTS Prints to a file in the /tmp directory # RETURNS Returns to stdanalog routine # -------------------------------------------------------------------------- sub makeanamobile { # &prefixDAS; &prefixPMSys; print SCRIPTFILE "SELECT *\n"; print SCRIPTFILE "FROM\n"; print SCRIPTFILE "ama0_$DATE\n"; print SCRIPTFILE "WHERE\n"; print SCRIPTFILE "\(ama0_$DATE.omobileid = '$MOBILE'\)\n"; print SCRIPTFILE " OR \(ama0_$DATE.tmobileid = '$MOBILE'\);\n"; print SCRIPTFILE "EOF\n\n"; print SCRIPTFILE "\#\n\# echo\;echo Database query complete...\n"; close(SCRIPTFILE); } # -------------------------------------------------------------------------- # makeanadouble - Makes a script that runs an SQL query on CDL Data # # INPUTS Cell and Date of search # OUTPUTS Prints to a file in the /tmp directory # RETURNS Returns to digitalcell routine # -------------------------------------------------------------------------- sub makeanadouble { &prefixPMSys; print SCRIPTFILE "SELECT *\n"; print SCRIPTFILE "FROM\n"; if ($UFLAG) { print SCRIPTFILE "ama0_$DATE\n"; } if ($VFLAG) { print SCRIPTFILE "ama1_$DATE\n"; } print SCRIPTFILE "WHERE\n"; if ($UFLAG) { print SCRIPTFILE "\(ama0_$DATE.$AMA0F{$SEARCH1} = '$CRITERIA1'\)\n"; if ($OFLAG) { print SCRIPTFILE " OR \(ama0_$DATE.$AMA0F{$SEARCH2} = '$CRITERIA2'\);\n"; } else { print SCRIPTFILE " AND \(ama0_$DATE.$AMA0F{$SEARCH2} = '$CRITERIA2'\);\n"; } } if ($VFLAG) { print SCRIPTFILE "\(ama1_$DATE.$AMA1F{$SEARCH1} = '$CRITERIA1'\)\n"; if ($OFLAG) { print SCRIPTFILE " OR \(ama1_$DATE.$AMA1F{$SEARCH2} = '$CRITERIA2'\);\n"; } else { print SCRIPTFILE " AND \(ama1_$DATE.$AMA1F{$SEARCH2} = '$CRITERIA2'\);\n"; } } print SCRIPTFILE "EOF\n\n"; print SCRIPTFILE "\#\n\# echo\;echo Database query complete...\n"; close(SCRIPTFILE); } # -------------------------------------------------------------------------- # makeanasingle - Makes a script that runs an SQL query on CDL Data # # INPUTS Cell and Date of search # OUTPUTS Prints to a file in the /tmp directory # RETURNS Returns to digitalcell routine # -------------------------------------------------------------------------- sub makeanasingle { &prefixPMSys; print SCRIPTFILE "SELECT *\n"; print SCRIPTFILE "FROM\n"; if ($UFLAG) { print SCRIPTFILE "ama0_$DATE\n"; } if ($VFLAG) { print SCRIPTFILE "ama1_$DATE\n"; } print SCRIPTFILE "WHERE\n"; if ($UFLAG) { print SCRIPTFILE "ama0_$DATE.$AMA0F{$SEARCH1} = '$CRITERIA1'\n"; } if ($VFLAG) { print SCRIPTFILE "ama1_$DATE.$AMA1F{$SEARCH1} = '$CRITERIA1'\n"; } print SCRIPTFILE "EOF\n\n"; print SCRIPTFILE "\#\n\# echo\;echo Database query complete...\n"; close(SCRIPTFILE); } # -------------------------------------------------------------------------- # makeanatriple - Makes a script that runs an SQL query on CDL Data # # INPUTS Cell and Date of search # OUTPUTS Prints to a file in the /tmp directory # RETURNS Returns to digitalcell routine # -------------------------------------------------------------------------- sub makeanatriple { &prefixPMSys; print SCRIPTFILE "SELECT *\n"; print SCRIPTFILE "FROM\n"; print SCRIPTFILE "cdl_$DATE\n"; print SCRIPTFILE "WHERE\n"; print SCRIPTFILE "\(\(cdl_$DATE.$CDLF{$SEARCH1} = '$CRITERIA1'\)\n"; if ($OFLAG) { print SCRIPTFILE " OR \(cdl_$DATE.$CDLF{$SEARCH2} = '$CRITERIA2'\);\n"; print SCRIPTFILE " OR \(cdl_$DATE.$CDLF{$SEARCH3} = '$CRITERIA3'\)\);\n"; } else { print SCRIPTFILE " AND \(cdl_$DATE.$CDLF{$SEARCH2} = '$CRITERIA2'\);\n"; print SCRIPTFILE " AND \(cdl_$DATE.$CDLF{$SEARCH3} = '$CRITERIA3'\)\);\n"; } print SCRIPTFILE "EOF\n\n"; print SCRIPTFILE "\#\n\# echo\;echo Database query complete...\n"; close(SCRIPTFILE); } # -------------------------------------------------------------------------- # makedigcell - Makes a script that runs an SQL query on CDL Data # # INPUTS Cell and Date of search # OUTPUTS Prints to a file in the /tmp directory # RETURNS Returns to digitalcell routine # -------------------------------------------------------------------------- sub makedigcell { &prefixPMSys; print SCRIPTFILE "SELECT *\n"; print SCRIPTFILE "FROM\n"; print SCRIPTFILE "cdl_$DATE\n"; print SCRIPTFILE "WHERE\n"; print SCRIPTFILE "\(cdl_$DATE.init_rf_cbts = '$CELL'\)\n"; print SCRIPTFILE " OR \(cdl_$DATE.init_rf_cbts = '$CELL'\);\n"; print SCRIPTFILE "EOF\n\n"; print SCRIPTFILE "\#\n\# echo\;echo Database query complete...\n"; close(SCRIPTFILE); } # -------------------------------------------------------------------------- # makedigcfc - Makes a script that runs an SQL query on CDL Data # # INPUTS CFC, Cell, and Date of search # OUTPUTS Prints to a file in the /tmp directory # RETURNS Returns to digitalcfc routine # -------------------------------------------------------------------------- sub makedigcfc { &prefixPMSys; print SCRIPTFILE "SELECT *\n"; print SCRIPTFILE "FROM\n"; print SCRIPTFILE "cdl_$DATE\n"; print SCRIPTFILE "WHERE\n"; print SCRIPTFILE "\(cdl_$DATE.cfc = '$CFC'\)\n"; print SCRIPTFILE " AND \(cdl_$DATE.init_rf_cbts = '$CELL'\);\n"; print SCRIPTFILE "EOF\n\n"; print SCRIPTFILE "\#\n\# echo\;echo Database query complete...\n"; close(SCRIPTFILE); } # -------------------------------------------------------------------------- # makedigdialed - Makes a script that runs an SQL query on CDL Data # # INPUTS Dialed Digits and Date of search # OUTPUTS Prints to a file in the /tmp directory # RETURNS Returns to digitaldialed routine # -------------------------------------------------------------------------- sub makedigdialed { &prefixPMSys; print SCRIPTFILE "SELECT *\n"; print SCRIPTFILE "FROM\n"; print SCRIPTFILE "cdl_$DATE\n"; print SCRIPTFILE "WHERE\n"; print SCRIPTFILE "cdl_$DATE.dialed = '$DIGITS';\n"; print SCRIPTFILE "EOF\n\n"; print SCRIPTFILE "\#\n\# echo\;echo Database query complete...\n"; close(SCRIPTFILE); } # -------------------------------------------------------------------------- # makedigdouble - Makes a script that runs an SQL query on CDL Data # # INPUTS Cell and Date of search # OUTPUTS Prints to a file in the /tmp directory # RETURNS Returns to digitalcell routine # -------------------------------------------------------------------------- sub makedigdouble { &prefixPMSys; print SCRIPTFILE "SELECT *\n"; print SCRIPTFILE "FROM\n"; print SCRIPTFILE "cdl_$DATE\n"; print SCRIPTFILE "WHERE\n"; print SCRIPTFILE "\(cdl_$DATE.$CDLF{$SEARCH1} = '$CRITERIA1'\)\n"; if ($OFLAG) { print SCRIPTFILE " OR \(cdl_$DATE.$CDLF{$SEARCH2} = '$CRITERIA2'\);\n"; } else { print SCRIPTFILE " AND \(cdl_$DATE.$CDLF{$SEARCH2} = '$CRITERIA2'\);\n"; } print SCRIPTFILE "EOF\n\n"; print SCRIPTFILE "\#\n\# echo\;echo Database query complete...\n"; close(SCRIPTFILE); } # -------------------------------------------------------------------------- # makedigsingle - Makes a script that runs an SQL query on CDL Data # # INPUTS Cell and Date of search # OUTPUTS Prints to a file in the /tmp directory # RETURNS Returns to digitalcell routine # -------------------------------------------------------------------------- sub makedigsingle { &prefixPMSys; print SCRIPTFILE "SELECT *\n"; print SCRIPTFILE "FROM\n"; print SCRIPTFILE "cdl_$DATE\n"; print SCRIPTFILE "WHERE\n"; print SCRIPTFILE "cdl_$DATE.$CDLF{$SEARCH1} = '$CRITERIA1'\n"; print SCRIPTFILE "EOF\n\n"; print SCRIPTFILE "\#\n\# echo\;echo Database query complete...\n"; close(SCRIPTFILE); } # -------------------------------------------------------------------------- # makedigtriple - Makes a script that runs an SQL query on CDL Data # # INPUTS Cell and Date of search # OUTPUTS Prints to a file in the /tmp directory # RETURNS Returns to digitalcell routine # -------------------------------------------------------------------------- sub makedigtriple { &prefixPMSys; print SCRIPTFILE "SELECT *\n"; print SCRIPTFILE "FROM\n"; print SCRIPTFILE "cdl_$DATE\n"; print SCRIPTFILE "WHERE\n"; print SCRIPTFILE "\(\(cdl_$DATE.$CDLF{$SEARCH1} = '$CRITERIA1'\)\n"; if ($OFLAG) { print SCRIPTFILE " OR \(cdl_$DATE.$CDLF{$SEARCH2} = '$CRITERIA2'\);\n"; print SCRIPTFILE " OR \(cdl_$DATE.$CDLF{$SEARCH3} = '$CRITERIA3'\)\);\n"; } else { print SCRIPTFILE " AND \(cdl_$DATE.$CDLF{$SEARCH2} = '$CRITERIA2'\);\n"; print SCRIPTFILE " AND \(cdl_$DATE.$CDLF{$SEARCH3} = '$CRITERIA3'\)\);\n"; } print SCRIPTFILE "EOF\n\n"; print SCRIPTFILE "\#\n\# echo\;echo Database query complete...\n"; close(SCRIPTFILE); } # -------------------------------------------------------------------------- # makedigmobile - Makes a script that runs an SQL query on AMA Data # # INPUTS Mobile number and Date of search # OUTPUTS Prints to a file in the /tmp directory # RETURNS Returns to stddigital routine # -------------------------------------------------------------------------- sub makedigmobile { &prefixPMSys; print SCRIPTFILE "SELECT *\n"; print SCRIPTFILE "FROM\n"; print SCRIPTFILE "cdl_$DATE\n"; print SCRIPTFILE "WHERE\n"; print SCRIPTFILE "\(cdl_$DATE.mid = '$MOBILE'\)\n"; print SCRIPTFILE " OR \(cdl_$DATE.dialed = '$MOBILE'\);\n"; print SCRIPTFILE "EOF\n\n"; print SCRIPTFILE "\#\n\# echo\;echo Database query complete...\n"; close(SCRIPTFILE); } # -------------------------------------------------------------------------- # makerlogfile - Makes an expect script that runs the SQL query on a remote # # INPUTS Mobile number and Date of search # OUTPUTS Prints to a file in the /tmp directory # RETURNS Returns to stddigital routine # -------------------------------------------------------------------------- sub makerlogfile { open(RLOGFILE,">$RLOGFILE") || die "Can't create RLOG file.\n"; print RLOGFILE "\#\!"; print RLOGFILE "/usr/local/bin/expect --\n"; print RLOGFILE "log_user 0\n"; print RLOGFILE "set timeout 1200\n"; print RLOGFILE "spawn rlogin arlo\n"; $cmd = "send $DOUBLEQUOTE"; $cmd .= "set prompt=\\$DOUBLEQUOTE"; $cmd .= "`hostname`:\\$DOUBLEQUOTE\\r$DOUBLEQUOTE\n"; print RLOGFILE $cmd; $cmd = "expect $DOUBLEQUOTE"; $cmd .= "arlo:$DOUBLEQUOTE\n"; print RLOGFILE $cmd; print RLOGFILE "send $DOUBLEQUOTE$SCRIPTFILE\\r$DOUBLEQUOTE\n"; print RLOGFILE $cmd; print RLOGFILE "log_user 1\n"; print RLOGFILE "exit\n"; close(RLOGFILE); system("chmod 700 $RLOGFILE"); } # -------------------------------------------------------------------------- # pullanafields - Pulls fields from Analog Query # # 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 pullanafields { open(DATAFILE,"$DATAOUTFILE"); while () { chop; $line[$lcv++] = $_; } $total = $lcv; if ($AFLAG) { # ALL if (!$VFLAG) { # U, W, & X foreach $file (1,2) { # Print The Headings Line open(OUTFILE,">$OUTFILE.$file"); if ($UFLAG) { print OUTFILE "$AMA0F{15},$AMA0F{0},"; for ($lcv = $AMA0START{$file}; $lcv < $AMA0FINISH{$file}; $lcv++) { print OUTFILE "$AMA0F{$lcv},"; } } if ($WFLAG) { print OUTFILE "$DOT1F{1},$DOT1F{0},"; for ($lcv = $DOT1START{$file}; $lcv < $DOT1FINISH{$file}; $lcv++) { print OUTFILE "$DOT1F{$lcv},"; } } if ($XFLAG) { print OUTFILE "$PPXF{2},$PPXF{55},"; for ($lcv = $PPXSTART{$file}; $lcv < $PPXFINISH{$file}; $lcv++) { print OUTFILE "$PPXF{$lcv},"; } } print OUTFILE "\n"; # Print the Actual Data for ($lcv = 0; $lcv < $total; $lcv++) { (@FIELD) = split(/\|/,$line[$lcv]); print OUTFILE "$FIELD[1],$FIELD[0],"; if ($UFLAG) { for ($ama0 = $AMA0START{$file}; $ama0 < $AMA0FINISH{$file}; $ama0++) { print OUTFILE "$FIELD[$ama0],"; } } if ($WFLAG) { for ($dot1 = $DOT1START{$file}; $dot1 < $DOT1FINISH{$file}; $dot1++) { print OUTFILE "$FIELD[$dot1],"; } } if ($XFLAG) { for ($ppx = $PPXSTART{$file}; $ppx < $PPXFINISH{$file}; $ppx++) { print OUTFILE "$FIELD[$ppx],"; } } print OUTFILE "\n"; close(OUTFILE); } } } else { # V open(OUTFILE,">$OUTFILE"); for ($lcv = $AMA1START{1}; $lcv < $AMA1FINISH{1}; $lcv++) { print OUTFILE "$AMA1F{$lcv},"; } print OUTFILE "\n"; for ($lcv = 0; $lcv < $total; $lcv++) { print OUTFILE "$line[$lcv]"; } close(OUTFILE); } } else { # NOT ALL if (!$VFLAG) { $totaloutfields = $ctr; open(OUTFILE,">$OUTFILE"); for ($lcv2 = 0; $lcv2 < $totaloutfields; $lcv2++) { if ($UFLAG) { print OUTFILE "$AMA0F{$OUTFIELD[$lcv2]},"; } if ($WFLAG) { print OUTFILE "$DOT1F{$OUTFIELD[$lcv2]},"; } if ($XFLAG) { print OUTFILE "$PPXF{$OUTFIELD[$lcv2]},"; } } print OUTFILE "\n"; for ($ctr = 1; $ctr < $total; $ctr++) { (@FIELD) = split(/\|/,$line[$ctr]); for ($lcv3 = 0; $lcv3 < $totaloutfields; $lcv3++) { print OUTFILE "$FIELD[$OUTFIELD[$lcv3]],"; } print OUTFILE "\n"; } close(OUTFILE); } else { $totaloutfields = $ctr; open(OUTFILE,">$OUTFILE"); for ($lcv2 = 0; $lcv2 < $totaloutfields; $lcv2++) { print OUTFILE "$AMA1F{$OUTFIELD[$lcv2]},"; } print OUTFILE "\n"; for ($ctr = 1; $ctr < $total; $ctr++) { (@FIELD) = split(/\|/,$line[$ctr]); for ($lcv3 = 0; $lcv3 < $totaloutfields; $lcv3++) { print OUTFILE "$FIELD[$OUTFIELD[$lcv3]],"; } print OUTFILE "\n"; } close(OUTFILE); } } } # -------------------------------------------------------------------------- # pulldigfields - Pulls fields from Digital Query # # 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 pulldigfields { open(DATAFILE,"$DATAOUTFILE"); while () { chop; $line[$lcv++] = $_; } $total = $lcv; if ($AFLAG) { foreach $file (1,2,3,4,5) { open(OUTFILE,">$OUTFILE.$file"); print OUTFILE "$CDLF{0},$CDLF{4},"; for ($lcv = $CDLSTART{$file}; $lcv < $CDLFINISH{$file}; $lcv++) { print OUTFILE "$CDLF{$lcv},"; } print OUTFILE "\n"; for ($lcv = 0; $lcv < $total; $lcv++) { (@FIELD) = split(/\|/,$line[$lcv]); print OUTFILE "$FIELD[0],$FIELD[4],"; for ($cdl = $CDLSTART{$file}; $cdl <= $CDLFINISH{$file}; $cdl++) { print OUTFILE "$FIELD[$cdl],"; } print OUTFILE "\n"; } close(OUTFILE); } } else { $totaloutfields = $ctr; open(OUTFILE,">$OUTFILE"); for ($lcv2 = 0; $lcv2 < $totaloutfields; $lcv2++) { print OUTFILE "$CDLF{$OUTFIELD[$lcv2]},"; } print OUTFILE "\n"; for ($ctr = 1; $ctr < $total; $ctr++) { (@FIELD) = split(/\|/,$line[$ctr]); for ($lcv3 = 0; $lcv3 < $totaloutfields; $lcv3++) { print OUTFILE "$FIELD[$OUTFIELD[$lcv3]],"; } print OUTFILE "\n"; } } close(OUTFILE); } # -------------------------------------------------------------------------- # prefixPMSys - Prints PMSys stuff that goes before the SQL statements # # INPUTS None # OUTPUTS None # RETURNS Returns to calling make... routine # -------------------------------------------------------------------------- sub prefixPMSys { print SCRIPTFILE "\#\!"; print SCRIPTFILE "/bin/csh\n"; print SCRIPTFILE "\# This script uses the PMSys Informix Database on the "; print SCRIPTFILE "host $PMSys_HOST\n"; print SCRIPTFILE "\# It is produced on the fly by the \$csn/celldata/cssb"; print SCRIPTFILE " script.\n\n"; print SCRIPTFILE "setenv INFORMIXDIR /usr/informix\n"; $cmd = "setenv INFORMIXSERVER $PMSys_HOST"; $cmd .= "_tcp\n"; print SCRIPTFILE $cmd; print SCRIPTFILE "setenv DBPATH //$PMSys_HOST\n"; print SCRIPTFILE "setenv DBNAME pmsys\n"; print SCRIPTFILE "set OUTFILE1 \= $DATAOUTFILE\n\n"; print SCRIPTFILE "\# echo Initiating PMSys Database query... \n"; print SCRIPTFILE "\# echo Query output will be placed in the file"; print SCRIPTFILE " /tmp/$DATAOUTFILE\n\n"; print SCRIPTFILE "\$INFORMIXDIR/bin/dbaccess - </dev/null\n"; # print SCRIPTFILE "database pmsys\;\n\n"; # print SCRIPTFILE "unload to \$\{OUTFILE1\}\n"; } # -------------------------------------------------------------------------- # showanalog - Prints data from query to screen # # INPUTS The output file produced by query # OUTPUTS Send formatted report to screen for user # RETURNS Never returns # -------------------------------------------------------------------------- sub showanalog { open(DATAOUTFILE,$DATAOUTFILE) || die "No results were available for what you requested.\n"; if ($headings) { print "AMA CALL DETAIL RECORDS\n"; printf($headformat1,"","","","HEX"," ORIG INIT ","ORIG FINAL ", " MOBILE "," DIALED "); printf($headformat2," DATE "," START ","DURA","CFC","DR","SW","CELL", "MBR","HO","SW","CELL","MBR"," NUMBER "," DIGITS "); printf($headformat2,"------","--------","----","---","--","--","----", "---","--","--","----","---","----------","----------"); $headings = 0; } while () { $aline[$ctr++] = $_; } $totals = $ctr; close(DATAOUTFILE); for ($ctr = 0; $ctr < $totals; $ctr++) { (@FIELD) = split(/\|/,$aline[$ctr]); $work = substr($FIELD[12],length($FIELD[12])-8,8); ($h,$m,$s) = split(/:/,$work); $dura = ($h * 3600) + ($m * 60) + $s; $dateout = "$DATE"; ($hold,$starttime) = split(/ /,$FIELD[10]); $cfc = sprintf("%x",$FIELD[2]); if ($FIELD[1] == 0) { if ($FIELD[51] eq "R") { $dialout = " Restricted"; } else { $dialout = $FIELD[52]; } $dir = "L-M"; printf($bodyformat2,$dateout,$starttime,$dura,$cfc, $EMX2SWITCH{$FIELD[35]},$FIELD[36],$FIELD[37],$FIELD[41], $dialout); } else { printf($bodyformat1,$dateout,$starttime,$dura,$cfc,$dir, $EMX2SWITCH{$FIELD[15]},$FIELD[16],$FIELD[17],$FIELD[14], $EMX2SWITCH{$FIELD[18]},$FIELD[19], $FIELD[20],$FIELD[8],$FIELD[41]); } } } # -------------------------------------------------------------------------- # showdigital - Prints data from query to screen # # INPUTS The output file produced by query # OUTPUTS Send formatted report to screen for user # RETURNS Never returns # -------------------------------------------------------------------------- sub showdigital { open(DATAFILE,"$DATAOUTFILE") || die "The date you requested is not currently available. (showdig)\n"; while () { (@DATAOUT) = split(/\|/,$_); if ($headings) { print "\n\nCBSC/OMCR CALL DETAIL LOGS\n"; if ($EXPAND) { printf($headformat1m,"","","","DEC"," ORIG INIT ","ORIG FINAL ", " MOBILE "," DIALED "); printf($headformat2m," DATE "," START ","DURA","CFC","SW","CELL", "MC","EL","SW","CELL","MC","EL"," NUMBER "," DIGITS "); printf($headformat2m,"------","--------","----","---","--","----", "--","--","--","----","--","--","----------","----------"); } else { printf($headformat1d,"","","","DEC"," ORIG INIT ","ORIG FINAL ", " MOBILE "," DIALED "); printf($headformat2d," DATE "," START ","DURA","CFC","SW","CELL", "SEC","SW","CELL","SEC"," NUMBER "," DIGITS "); printf($headformat2d,"------","--------","----","---","--","----", "---","--","----","---","----------","----------"); } $headings = 0; } $ctr = 0; $nodatafound = 0; ($startdate,$starttime) = split(/ /,$DATAOUT[14]); ($enddate,$endtime) = split(/ /,$DATAOUT[27]); ($sh,$sm,$ss) = split(/:/,$starttime); ($eh,$em,$es) = split(/:/,$endtime); $began = ($sh * 3600) + ($sm * 60) + $ss; $finished = ($eh * 3600) + ($em * 60) + $es; $duration = $finished - $began; if ($duration <0) { $duration = $duration + 86400; } if ($EXPAND) { printf($bodyformat1m,$DATE,$starttime,$duration, $DATAOUT[26],$DATAOUT[6],$DATAOUT[31],$DATAOUT[33], $DATAOUT[34],$DATAOUT[6],$DATAOUT[81],$DATAOUT[84], $DATAOUT[85],$DATAOUT[9],$DATAOUT[13]); printf($bodyformat2m,"LAST CONN2/LAST EVENT",$DATAOUT[6],$DATAOUT[65], $DATAOUT[68],$DATAOUT[69],$DATAOUT[22]); printf($bodyformat2m," LAST CONN3",$DATAOUT[6], $DATAOUT[49],$DATAOUT[52],$DATAOUT[53],""); } else { printf($bodyformat1d,$DATE,$starttime,$duration,$DATAOUT[26], $DATAOUT[6],$DATAOUT[31],$DATAOUT[32],$DATAOUT[6], $DATAOUT[81],$DATAOUT[82],$DATAOUT[9],$DATAOUT[13]); } } } # -------------------------------------------------------------------------- # stdanalog - Pull the Standard Analog Queries # # INPUTS Mobile number and Date # OUTPUTS Sends to DATAOUTFILEs that are processed further # RETURNS Returns to Section 2 of Main Program # -------------------------------------------------------------------------- sub stdanalog { $SCRIPTFILE = "/tmp/cssb.$$a.scr.$MOBILE"; $DATAOUTFILE = "cssb.$$a.$MOBILE"; $SCRIPTFILE = "$HOME/.cssb.$$a.scr.$MOBILE"; $DATAOUTFILE = ".cssb.$$a.$MOBILE"; $RLOGFILE = "$HOME/.cssb.$$.rloga.$MOBILE"; open(SCRIPTFILE,">$SCRIPTFILE"); &makeanamobile; sleep 1; system("chmod 700 $SCRIPTFILE"); sleep 1; &makerlogfile; system("$RLOGFILE"); sleep 1; $DATAOUTFILE = "/tmp/cssb.$$a.$MOBILE"; $DATAOUTFILE = "$HOME/.cssb.$$a.$MOBILE"; sleep 1; &showanalog; } # -------------------------------------------------------------------------- # stddigital - Pull the Standard Digital Queries # # INPUTS Mobile number and Date # OUTPUTS Sends to DATAOUTFILEs that are processed further # RETURNS Returns to Section 2 of Main Program # -------------------------------------------------------------------------- sub stddigital { $SCRIPTFILE = "/tmp/cssb.$$d.scr.$MOBILE"; $DATAOUTFILE = "cssb.$$d.$MOBILE"; $SCRIPTFILE = "$HOME/.cssb.$$d.scr.$MOBILE"; $DATAOUTFILE = ".cssb.$$d.$MOBILE"; $RLOGFILE = "$HOME/.cssb.$$.rlogd.$MOBILE"; open(SCRIPTFILE,">$SCRIPTFILE"); &makedigmobile; sleep 1; system("chmod 700 $SCRIPTFILE"); sleep 1; &makerlogfile; system("$RLOGFILE"); sleep 1; # &monitordigital($MOBILE); $DATAOUTFILE = "/tmp/cssb.$$d.$MOBILE"; $DATAOUTFILE = "$HOME/.cssb.$$d.$MOBILE"; sleep 1; &showdigital; } # -------------------------------------------------------------------------- # trap - 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 trap { local($sig) = @_; print STDERR "SIG$sig received by $PROG. Shutting down.\n"; system("rm $HOME/.cssb.$$.*"); #system("rm /tmp/cssb.flag"); exit(1); } # -------------------------------------------------------------------------- # usage - Print usage message # # INPUTS Error message string. # OUTPUTS Sends message to stderr # RETURNS Never returns # -------------------------------------------------------------------------- sub usage { print STDERR <<"EOF"; $PROG ($VER) - Craig Steffler's Search Batch (like sb & sb1 but faster) Usage: $PROG [-ADedcfsaotuvwx] mobile_number yymmdd where: yy 97 to 99 mm 01 to 12 dd 01 to 31 mobile_number any 10-digit mobile (originating and/or terminating) A Analog Calls Only (Must be used on Custom Search Options) D Digital Calls Only (Must be used on Custom Search Options) e Expanded Output (Can be used on all BUT Custom Searches) u AMA 0 Table Search v AMA 1 Table Search w DOT1 File Search x PPX File Search [] Optional ... Can use value multiple times NOTE: Analog Calls first reference DAS Database then a DOT1 Query is run in the background and sent via email when done. d Dialed Digits $PROG -d yymmdd digits [digits...] c Cell Site specific (Only available on Digital Calls) $PROG -c yymmdd cell_number [cell_number...] cell_number 1 to 511 (Currently gives all switches, Sorry) f Call Final Class specific (Only available on Digital Calls) cfc_value 00 to ff (HEX) for Analog and 01 to 255 (DEC) for Digital $PROG -f yymmdd cfc_value cell_number [cell_number...] Custom Search Options: a Gives you ALL available fields [then field_no._out is not needed] s Search by a specific field for a specific value $PROG -s yymmdd field_number criteria field_no._out [field_no._out...] d Search by 2 fields (Field Choice 1 AND Field Choice 2) $PROG -sd yymmdd field1 criteria1 field2 criteria2 field_no._out [field_no._out...] o Use the logical OR (Field Choice 1 OR Field Choice 2) t Search by 3 fields $PROG -st yymmdd field1 criteria1 field2 criteria2 field3 criteria3 [field_no._out...] EXAMPLE 1: $PROG 7142931234 970219 DEFAULT (you can use multiple dates) EXAMPLE 2: $PROG -e 970219 7142931234 (you can use multiple mobile numbers) EOF print STDERR "Failed: $_[0] \n"; if ($prompted) { print "\n\nWhen finished press the to exit\n"; $exit = ; } exit 1; } # -------------------------------------------------------------------------- # warning - Alerts user if the program is already running # # INPUTS None # OUTPUTS Send message to user # RETURNS Never returns # -------------------------------------------------------------------------- sub warning { # This routine to be removed when Solaris/SUN-OS/Informix problem resolved print STDERR "$PROG is already running and can't continue. Shutting down.\n"; system("rm $HOME/.cssb.$$.*"); system("rm /tmp/cssb.flag"); exit(1); } # 34567890123456789012345678901234567890123456789012345678901234567890123456 # cssb ---------------------------------------------------------------------