Lawson Admin ScriptsSubmitted by Dave Amen of NetAsp.Foreground Compile ScriptSave the following script into a standard scripts directory that is shared by all technical users. Call it komp: #!/bin/sh if [ $# != 1 ] then echo " " echo " Usage: $0 program_name" echo " " exit 100 fi pwd > /tmp/kompfile.txt field1=`cut -d/ -f3 /tmp/kompfile.txt` field2=`cut -d/ -f4 /tmp/kompfile.txt` field3=`echo ${field2} | cut -c1-2` rm /tmp/kompfile.txt echo "Compiling Program "$1 sleep 1 loccmp -c $field1 $field3 $1 acct=`echo $1 | tr '[a-z]' '[A-Z]' ` if [ -f $acct.err ] then more $acct.err else echo "Compile Complete with no errors for Program "$1 exit 1 fi To run the script, and compile an application in the foreground, cd to where the application resides and then run: komp ap160 When the session returns from the compile, it will display either error messages or a message indicating that program compiled with no errors (prevents having to continually check with qstatus and then go searching for a file holding errors). Finding programs affected by a PDLIBThis dbdump command produces a listing, by product line, of all programs and the libraries contained within them. First, pipe this into a file as follows (this takes a few seconds to run and can create a file 1 or 2 megs in size): dbdump gen pgmlib > gendump Once you have created that file, you can grep subprograms out of it (first, limit it to a single product line, then go after the PDLIB): grep TEST gendump | grep PRUEPAY | lashow The results look like this:
Here is a variation (display all programs that use by a library routine): rngdbdump gen PGMLIB -k prodline syscode | grep library program Amazing Oracle SQL command - MINUSHow often do you want to see what changed in a table, or which records are missing from a table? The MINUS command will determine the differences between columns in two tables. This query finds orphan AP Distribution records (those that are missing a parent invoice record): select invoice from apdistrib This query will find records in the GL Master table that were never used by existing transactions: select company, acct_unit, account, sub_account from glmaster minus select company, acct_unit, account, sub_account from gltran ; Easy file backup prior to making changes (Unix)This script creates a backup copy of a Unix file with the date and time as part of the backup file name. #! /bin/sh Here's what you get when you run this script: $ cpy prodline.countsThe backup file prodline.counts.200007122138 was created Monitor the progress of an Oracle importThis checks strategically placed tables in the HR/Payroll system to determine how far an Oracle import has progressed at any time during the import. It does this by displaying non-zero counts from all tables that have been successfully loaded at the time this "Progress" script is run. sqlplus oracleid/password < Summing a column of numbers on UnixHere is a handy script for getting the total from a column of numbers (saves having to upload it to Excel and parse it out). It uses a short awk script to do the summing. The example takes the values in positions 72 to 80 of the file and accumulates them. # This script adds the total dollar amount on the TSA file and displays it. Macro - Formatting Lawson reports in WordThe following macro will reformat a Lawson report so it breaks pages well and doesn't wrap when using them in Word. It sets the margins and font size so that reports can be viewed, printed, annotated, e-mailed, etc. in Micorsoft Word documents: Sub Format_Lawson_Report() ' ' Lawson Macro ' Macro recorded 04/29/99 by David C. Amen ' Selection.WholeStory Selection.Font.Name = "Courier New" Selection.Font.Size = 8 With ActiveDocument.PageSetup .LineNumbering.Active = False .Orientation = wdOrientLandscape .TopMargin = InchesToPoints(0.3) .BottomMargin = InchesToPoints(0.2) .LeftMargin = InchesToPoints(1) .RightMargin = InchesToPoints(1) .Gutter = InchesToPoints(0) .HeaderDistance = InchesToPoints(0.5) .FooterDistance = InchesToPoints(0.5) .PageWidth = InchesToPoints(11) .PageHeight = InchesToPoints(8.5) .FirstPageTray = wdPrinterDefaultBin .OtherPagesTray = wdPrinterDefaultBin .SectionStart = wdSectionNewPage .OddAndEvenPagesHeaderFooter = False .DifferentFirstPageHeaderFooter = False .VerticalAlignment = wdAlignVerticalTop .SuppressEndnotes = False .MirrorMargins = False End With End Sub Back   Home |