December 2004

The LawsonGuru Letter is a free periodic newsletter containing provocative commentary about issues important to the Lawson Software community.  The LawsonGuru Letter is published by-and is solely the opinion of-John Henley of Decision Analytics.  Visit Decision Analytics at  For subscription information, see the bottom of this message.
The LawsonGuru Letter is not affiliated with Lawson Software.

We're going to take a break from our reporting series this month, as Keri White returns to the Guest Spot (for the fourth time!). Keri will share with you a post-processing technique that I have worked on with her and a number of other Lawson clients. Ready to write your own Guest Spot? Send me an email at

In this issue:

1. Guest Spot: Leveraging Scripts for Post-Job Processing
2. Cube Farm: You'll laugh, but wish it hadn't been written
3. First Look: Lawson Receiving & Delivery (RAD)
4. Worthwhile Reading
5. Lawson Tips & Tricks

1. Guest Spot: Leveraging Scripts for Post-Job Processing
By Keri White

Custom scripts are very handy and versatile tools to use for post-job file-processing purposes. You can write scripts to archive, email, transmit files to and from FTP servers, and send files to other servers for a third party application to use. In order to "call" a custom script, the Lawson program that utilizes it upon completion must be modified slightly. It is recommended that if you need to modify a Lawson program that you make a copy of it and make the modifications to the copy.

Calling a script is just another example of calling an OS command. For an example of calling OS commands from Lawson COBOL programs, see Tip #3 in the September 2004 issue of the LawsonGuru Letter (

Integrating a Script into a Lawson COBOL Program

In order to use a script, the following needs to be added to the Working Storage (WS) and the Procedure Description (PD) of the program. Note that, in this case, the script is called as the last action before the program ends.


05 FILLER PIC X(06) VALUE "sh -c ".
05 FILLER PIC X(01) VALUE x"22".
05 FILLER PIC X(27) VALUE "<path & filename of script> ".
05 FILLER PIC X(01) VALUE x"22".
05 FILLER PIC X(01) VALUE x"22".
05 FILLER PIC X(01) VALUE x"00".


* -- This is the file you want to transmit

* -- This is the product line the file was created in

The above code to modify program working storage and procedure description can be used for each example in this article.

Here is an example of a script that archives and emails files:

if [ "$1" = "-?" ] || [ "$1" = "-h" ] || [ "$1" = "" ] || [ "$2" = "" ]
echo "Usage: ProductLine PosPayFileName"
echo ""
exit 1

#set variables for upper/lower case product lines
PL_UC=`echo $1 | tr '[:lower:]' '[:upper:]'`
PL_LC=`echo $1 | tr '[:upper:]' '[:lower:]'`

## Create Archive directory if it doesn't exist
if [ ! -d "$LAWDIR/$PL_LC/work/PositivePay" ]
mkdir $LAWDIR/$PL_LC/work/PositivePay
if [ ! -d "$LAWDIR/$PL_LC/work/PositivePay/Archive" ]
mkdir $LAWDIR/$PL_LC/work/PositivePay/Archive
if [ "$2" != "" ]
# convert file to fixed-length 52-byte records
cnvexp -f $2 52 > tmp1.$$
# copy to archive directory
cp tmp1.$$ $LAWDIR/$PL_LC/work/PositivePay/Archive/`date '+%Y%m%d_%H%M%S'`.`basename $2`
echo "File copied to: $LAWDIR/$PL_LC/work/PositivePay/Archive/`date ` +%Y%m%d_%H%M%S'`.`basename $2`"
ATTACHNAME=`basename $2`
for RECIPIENT in `cat $GENDIR/custom/`
echo "From:" > tmp3.$$
echo "To: $RECIPIENT" >> tmp3.$$
echo "Subject: Payroll Positive Pay" >> tmp3.$$
echo "MIME-Version: 1.0" >> tmp3.$$
echo "Content-Type: text/plain;" >> tmp3.$$
echo " name=$ATTACHNAME" >> tmp3.$$
echo "Content-Transfer-Encoding: quoted-printable" >> tmp3.$$
echo "Content-Description: $ATTACHNAME" >> tmp3.$$
echo "Content-Disposition: attachment;" >> tmp3.$$
echo " filename=$ATTACHNAME" >> tmp3.$$
cat tmp1.$$ >> tmp3.$$
/usr/lib/sendmail -v -f $RECIPIENT < tmp3.$$
# remove temp files
rm tmp1.$$
rm tmp3.$$
echo "Processing Complete"
echo ""
exit 0

In the above example, the positive pay file that is created for the Payroll run needs to be emailed to the bank. The steps are:

  1. PATH variables are set
  2. Directory structure is verified
  3. The file is converted, using the Lawson cnvexp utility, to fixed-length records.
  4. The file is copied to an Archive directory and the date and time are attached to the file name.
  5. The file is emailed to a recipient list, which is stored in a separate file on the same server. The recipient list simply contains the email addresses listed one after another.

Scripting for FTP Transmission

An alternative to emailing a file is to transmit it to another server or receive it from another server via FTP (File Transfer Protocol). To do this, you would add a line to the post-processing script to call an FTP script:

# FTP transmit (diff script based on prod line)
/<source path>/<FTP script name>_$PL_LC.ftp

The FTP script would be a separate script containing the FTP connection information, which looks like this:

HOST='<IP Address of target FTP server>'
USER='<user name>'
FILE='<path and filename on source server>'

quote USER $USER
cd <path on target server>
lcd <path on source server>
put [append][get] <filename>
exit 0

Scripting for Printing

Another example of post-processing is that you can transmit files directly to a printer. We use a third-party application (Formscape) to print our checks, direct deposit stubs, requisitions, purchase orders, delivery tickets, and remittance advices. Virtual printers are setup on the server to execute the appropriate Formscape project for printing. Adding the following code sends the file to a printer on an alternate server:

# send to printer
lpr -P<server name>:<printer name> <file name>


The extra step in automation provided by post-processing scripts greatly enhances the program's usability and reliability. The automatic archiving of files keeps a clean and complete history. End-users don't require access to an FTP tool. Distributing files via email ensures that all responsible parties have the necessary information to complete their task. Ultimately, the scripts greatly reduce the chance for human error in repetitive processes.


2. Cube Farm: You'll laugh, but wish it hadn't been written

If you are a fan of Dilbert or movies like Office Space, Cube Farm will be right up your alley. The twist? This one's all about Lawson. Yes, Lawson, the software company you've come to know and love. 

[Read More...]

3. First Look: Lawson Receiving & Delivery (RAD)

Where does your package go after it's "received"?? Well, that's an often-asked question in many organizations.

Think about the chain of events that occurs when you receive an order. After the order comes to your loading dock, where does it go?

Well, Lawson's new Receiving and Delivery Tracking (RAD) solution may be able to give you the answer to these questions.
Last month ( we started taking a look at the new Lawson products-acquired from Apexion Technologies-that make up Lawson's Mobile Supply Chain Suite:

? Mobile Par & Cycle Count (MPC)
? Receiving and Delivery Tracking (RAD)
? Surgical Instrument Management (SIM)

Why use RAD?

  • Allow requesters to track deliveries at any time from their computers
  • Accurately track and deliver non-purchase order packages
  • Efficiently manage complex, multi-step delivery routes
  • Achieve accountability throughout your receiving and delivery processes
  • Capture signatures and recipient information on mobile handhelds

Key RAD Features


Package Receiving


  • Enables dock logging and validation of carrier manifests
  • Uses carrier-provided barcodes and tracking numbers for faster processing
  • Printed barcode labels can be applied to track boxes without carrier labels
  • Interfaces with Lawson PO Receiving
  • Records non-purchase order deliveries with wireless handhelds that scan barcodes and allow data entry via a simple user interface


Delivery Management

  • Support for complex, multi-step delivery routes
  • Creates, prints and processes manifests
  • Prints delivery tickets and labels
  • Delivery Verification
    • Records recipient information and signatures on handheld devices
    • Tracks delivery performance, including attempted deliveries and any observed damage to items
  • Self-Service Tracking
    • Allows requesters to track deliveries from their computers
    • Displays the current status of the receiving and delivery process and location of the package
    • Data may be transmitted immediately (in a fully wireless environment) or when the user returns to a wireless area (in a partially wireless setting), or when the handheld is cradled (in a non-wireless environment)

Stock Issues and Returns

  • Enables wireless issues and returns, using a simple scan of the item barcode or bin label

Activity Tracking and Reporting

  • Tracks operator activities, including actions performed and duration of tasks
  • Provides comprehensive productivity reporting
  • Can be integrated with Lawson Reporting Suite

Mobile Technology Platform

  • Uses the Microsoft Windows CE/Pocket PC operating system

  • Symbol 8846 - Pocket PC

  • Dolphin 7400 - Windows CE

  • Wireless (802.11b) technology, supporting 128-bit encryption

  • Supports multiple transmission modes, including real-time wireless, intermittent wireless and cradle-based synching

  • Handhelds can be used for any Windows-CE application-they aren't dedicated to Lawson

  • Lawson 8.0.3 Environment & 8.0.3 Applications

The Bottom Line


Think of Lawson's RAD as your own internal version of the ubiquitous UPS delivery truck. Now you can have your own way to account for receipts and internal deliveries.


"So much of what we call management consists in making it difficult for people to work."
- Peter Drucker

4. Worthwhile Reading

If You Build It, Will They Come?
KPI digital dashboards might just be the next priority for CIOs. But how many CEOs really want all that real-time data anyway?
CIO Magazine, September 15, 2004

Bending Toward E-Spending
Supplier-relationship management software can streamline the way an organization buys products and services, by replacing inefficient paper trails and letting it take advantage of price breaks in companywide supplier contracts.
Baseline Magazine, August 2004,1397,1630453,00.asp

Risk's Rewards
Are you on board with enterprise risk management? You had better be. It's the future of how businesses will be run.
CIO Magazine, November 1, 2004

Hard Times
Why finance executives are overworked and under stress.
CFO Magazine, November 2004


5. Lawson Tips & Tricks
Share your tips. Send them to

Use GL45 to Move Journal Entries to Different Fiscal Period

This tips falls into the category of "hopefully you'll never need to use it, but it's nice to know it's there".

A little-known feature of GL45 can be used to move journal entries (except for intercompany entries and/or the reversals of auto-reversing entries) to different fiscal periods. You can use this feature to move transactions (and the resulting balances) to a different fiscal period if you've ever posted something with the wrong posting date.

Although it can be a painstakingly slow process, it does properly process and correctly moves all of the transactions and balances correctly.

I have also used this technique (combined with some other steps) to rebuild the transactions and balances for incorrectly set-up fiscal calendars.

The first step is that the entries you are going to move have to be in an 'Unreleased' status:

Change the posting date, and select the Change action:

When the transaction has been moved, you will see a status message that confirms that the transaction has been moved to a different year and period:

When you inquire on the new year/period, you'll see that your entry has been moved:

The LawsonGuru Letter is a free periodic newsletter providing provocative commentary on issues important to the Lawson Software community. The LawsonGuru Letter is published by--and is solely the opinion of--John Henley of Decision Analytics. Visit Decision Analytics at

To subscribe, visit

© Copyright 2004, Decision Analytics. All rights reserved. Please share The LawsonGuru Letter in whole or in part as long as copyright and attribution are always included.

Decision Analytics is an independent consultancy, focusing on Lawson technical projects, and specializing in customization/modification, data conversion, and integration/interfaces. Please visit for more information.

Decision Analytics. Integrating Lawson with the Real World.