Bakken Software Services

Specializing in the Pick / MultiValue Database & Environments

Home

Consulting

Education

Education Overview

Education - Schedule

Introduction to Pick / MV

Database Retrieval - Fund

Database Retrieval - Adv

Basic Programming

Enrollment

RPL

Tips & Tricks

Join Our Mailing List

Contact Us

Tips & Tricks - Pick Basic INCLUDE Statement
Here's a technique that will not only speed development of your application programs, it will also provide consistency
throughout your programs, while documenting the file structure at the same time.
 
Create a program file specifically for code which will dimension file arrays and equate variable names to the individual fields or attributes within a record. This code will be 'included' in the application programs when they are compiled. The following is an example of code which dimensions the CUSTOMER file and equates variable names to the individual fields within a record. It exists in a program file called FILE.DEF

Example:

 

FILE.DEF           CUSTOMER

 

001

*  DIMENSION AND DEFINE CUSTOMER FILE

002

DIM CUSTOMER.REC(10)

003

EQUATE CUST.NAME TO CUSTOMER.REC(1)

004

EQUATE CUST.ATTN TO CUSTOMER.REC(2)

005

EQUATE CUST.STREET TO CUSTOMER.REC(3)

006

EQUATE CUST.CITY TO CUSTOMER.REC(4)

007

EQUATE CUST.STATE TO CUSTOMER.REC(5)

008

EQUATE CUST.ZIP TO CUSTOMER.REC(6)

009

EQUATE CUST.PHONE TO CUSTOMER.REC(7)

010

EQUATE CUST.FAX TO CUSTOMER.REC(8)

011

EQUATE CUST.OPEN.INV TO CUSTOMER.REC(9)

012

EQUATE CUST.AR.BAL TO CUSTOMER.REC(10)


   
This code is then 'included' in the individual application programs which reference the CUSTOMER file. An example is shown in the CUST.MNT program below.
 
BP      CUST.MNT
 
001 PROGRAM CUST.MNT
002 *  CUSTOMER MAINTENANCE
003 *  KPB   08/24/01
004 *
005 INCLUDE  BP   STND.VAR
006 INCLUDE   FILE.DEF  CUSTOMER
007 *
008 *  BUILD SCREEN VARIABLE FOR DISPLAY OF FIELD HEADINGS
009 *
010 SCR = @(-1):@(3,3):"CUSTOMER CODE":@(1,5):"1.NAME":@(1,6):"2.ADDRESS"
011 SCR = SCR:@(1,7):"3.CITY":@(1,8):"4.STATE":@(1,9):"5.ZIPCODE":@(1,10):"6.TELEPHONE"
012 SCR = SCR:@(1,11):"7.FAX"
013 *
014 50 *
015 *
016 *  DISPLAY SCREEN
017 *
018 CRT  SCR
019 *
020 *  ENTER CUSTOMER CODE
021 *
022 CRT  @(30,3):
023 INPUT   CUSTOMER.KEY
024 *
025 *  DETERMINE IF THIS IS A NEW OR EXISTING CUSTOMER
026 *
027 MATREADU   CUSTOMER.REC  FROM  CUSTOMER.FILE,  CUSTOMER.KEY  THEN
028           CRT @(30,5):CUST.NAME:@(30,6):CUST.ADDRESS:@(30,7):CUST.CITY
029           CRT @(30,8):CUST.STATE:@(30,9):CUST.ZIP:@(30,10):CUST.PHONE
030           CRT @(30,11):CUST.FAX:
031 END ELSE
032           GOSUB 100;*  ENTER NAME
033           GOSUB 200;*  ENTER ADDRESS
034           GOSUB 300;*  ENTER CITY
035           GOSUB 400;*  ENTER STATE
036           GOSUB 500;*  ENTER ZIPCODE
037           GOSUB 600;*  ENTER TELEPHONE#
038           GOSUB 700;*  ENTER FAX#
039 END
040 *
041 *  ENTER CUSTOMER NAME
042 *
043 100 *
          REMAINDER OF THE PROGRAM GOES HERE

When this program is compiled the code from  FILE.DEF  CUSTOMER will be
inserted into the CUST.MNT program at line six. This allows for consistent
variable names to be used within an application (the prefix of CUST. was
used to allow differentiating between different files within the same program).
 
When additional information is added to the structure of the CUSTOMER file,
only one section of code will need to be altered. For example, if in the future
an email address is to be added to the structure of the CUSTOMER file. All that
will need to be done is the changing of the DIM statement in the 'included' code
and an addition of the appropriate EQUATE statement. All the programs which
reference the 'included' code will need to be recompiled.
   
 

Look for additional tips regarding concise and simple coding for maintenance programs. coming soon!

Bakken Software Services ... The Obvious Pick
 1-800-PICK-911

Sitemap