SSII Programming Standards
 
  1. Adding a Function to the menu system.
  2. Thoroughbred Environment.
  3. Programming Standards.
  4. Public Program Library.




I. Adding a function to support series II (S21, console)
 
  1. Add a function in 2EVC
    1. enter STIM in the function name field and press enter, confirm add.
    2. CH the date, enter the name of a program to execute. Enter a description. Don’t open any files.
  2. Add the function to a menu in 2EVB
    1. enter S00 in the menu name field, CH to change and place STIM on a free line.
    2. OK the changes to the menu.
  3. Define the program; e.g. SAVE "STIM",1024,0,0 command or the *OPSD Utility.
    10 REM STIM
    1000 PRINT ‘CS’, ; REM CLEAR SCREEN
    1010 PRINT @(10,10),"The Decimal Time is ",TIM:"##.00",
    1020 INPUT @(10,20),"Press <cr> to Continue ",*
    9900 RUN"Q0A0"
    9999 END
  4. Go to console mode and write your program. SAVE "STIM"
  5. The simplest return to the menu system is to place RUN"Q0A0" at the end.
  6. The 9999 END statement is a widely used convention of BB3 Programmers. (v3.10i and up uses 65534 END)
  7. The 0010 REM statement holds the program name by convention. The program name comes before the quote mark.




II. Thoroughbred Environment.

Sample .profile – note /u/users/bin is inserted into the PATH by the substitution of the $HOME variable

HOME=/u/users
PATH=/bin:/usr/bin:$HOME/bin:. # set command search path
MAIL=/usr/spool/mail/`logname` # mailbox location
mask 022 # set file creation mask
# set terminal type
# eval `tset -m ansi:ansi -m :\?ansi -e -s -Q`
# eval `tset -m wyse60:wyse60 -m :\?wyse60 -r -s -Q`
export PATH MAIL TERM LOGNAME HOME
cd /usr/lib/basic
exec ./b
*************** now the ‘/usr/lib/basic/b’ script $FID & $bspl variables set here *******
:
ttyparms=`stty -g`
trap "echo 'Arggg... Ive been killed!';stty -cbreak;stty $ttyparms;exit 1" 1 3 4 5 6 7 8 9 10 12 13 14 15
term=`tty` ; devent=`echo $term | cut -d/ -f3 `
terment=`fgrep $devent TERMINAL`
FID=`echo $terment | cut -d= -f2`
FID=`echo "$FID " | cut -d\ -f1`
echo $devent
echo $term
echo $terment
echo $FID
export FID ; umask 0
echo `logname` $term $FID
UFID=$FID ; export UFID
bspl=/tmp/spool$FID ; export bspl ; uu=/usr/spool/uucp ; export uu
bslg=/tmp/mansuplog$FID ; export bslg
wait 1
./basic
rm -f /tmp/spool$FID
./clearlp $FID




III.Programming Standards:

Program line # standards
 
00010   Program Name
00100 00199 Open Files, allocate work files
00210 00299 IOLISTS, print lists
00300 00399 Standard Function Definitions
00400 00999  
01000 07999 Application processing
08000 08999 Standard Routines.
09000 09999 Return to Q0A0, error processing.
 

Entry Routines

1000-1099 – record identification and initialization

1800 – OK / Change/ DELete

1840 – Delete Logic

1860 – Add record

Print Routines

500-999 – sort logic

1700-1799 – top of forms and page headings

1800 –1899 – trailer information.

Update Routines

B1$=$3FF3$ - where 2EVC erase’s batch at end of routine, this return code must be used.

System Common Variables
 
A0$ Temporary
A1$ Temporary
A2$ Range/Selected in reports
A3$ Range/Selected in reports
A4$ Record Maintenance mode with A9 in maintenance routines/
   
   
   
   
   
   
   
 

A5$ Date of transactions - MM-DD-YY

AD5$ Display date of transactions, MM-DD-YY for US, DD-MM-YY for UK.

A6$ System Config - see below

AD6$ System date entry mask, mmddyy for US, ddmmyy for UK

A7$ Program Description for report headings - identical to menu Description

A8$ Batch ID spelled out of C3$ fileset - obsolete under UNIX 2122-7F7F suffixes

A9$ Program Name that was run from Base - e.g. RUN A9$

B0$ Operator long name from OESA

B1$ Exit mode - for secure execution result codes - $3ff3$ - $3fff$

B2$ Company Name

B6$ Function Name - four letter D1VC Key.



B7$ printer mode string - 20 characters




B8$ Company Code

B9$ Company Name

C0$,C1$,...C9$, E0$,E1$,...E9$ - Suffixes for twenty filesets.

D0$,D1$,...D9$, F0$,F1$,...F9$ - Batch Descriptions Corresponding.

A$,A,D$,D,I,J Watch for conflict with For loops and Functions

C$ Exit Indicator

C5,C6 Maximum Display/Print Columns, Rows

A2 Error Retry count

A5 Julian Age

B2 error line number

B3 error number

B4 error 0 branch level indicator

B5 Timeout Delay (Usually 3600 – 60 minutes of 60 seconds)



A6$





EUC0$ European / US Date Delimiter - -=US MMDDYY, .=EUROPE DDMMYY

EUD1 Position 1,2

EUD3 Position 3,2

DXA0$ MM/DD/YY Date Format for internal Representations - Real Calendar

AD5$ MM-DD-YY Date Format for External Display Representations. Batch.

VE0$ Version Identification

VE1 Version Sequence Number



Public Programming Library

 

Data entry from a terminal

P0IC – Unpadded Ascii entry.

P0ID – Date entry and verification, 30 day window limitation

P0IE – Editor unpadded entry.

P0IH – Hexadecimal entry.

P0II – Integer input with mask.

P0I$ - Numeric entry with mask.

P0IET – Edit Text window – item notes, customer notes, etc.

P0IFL – Basic search engine.

P0IRF – Record OK/CH/DEL call routine

P0IRS – Key range, selected call routine for reports.

Data Entry Call Routines

CALL "P0IX",C$,A1$,C2,C3,C4,"PROMPT",B1

CALL "P0IX",C$,A1$,C2,C3,C4,E$,B1

C$ and B1 are system variables which are not defined or referenced by the programmer.

A1$ is the variable into which the inputted data is to be stored.

C2 is the length of the screen input area represented by the following screen symbol >____<.

C3 is the Horizontal coordinate for the input symbol.

C4 is the vertical coordinate for the input symbol.

E$ represents the input prompt found at the lower left hand corner of the screen, (usually line 22).

P0IC and P0IB are used whenever character data is to be entered. The range of characters accepted by these routines is 20(hex) to 7E(hex). This prevents unprintable characters from entering the database.

P0ID is used when current dates are to be entered. The variable C2 is omitted from the call Statement, because by definition, all dates in Support Series II are 6 digits, expanded to 8 with dashes for display, and limited to the range of 01/01/1980 to 12/31/2079. More restrictively, this call routine limits date entry to 11 months and 28 days of the current date. This helps operators prevent data for the wrong year from entering the system.

P0IH will restrict the data to only hexadecimal numbers, 0-9, A-F.

P0I$ will accept only numeric values. The Input variable C2 is replaced with a Business Basic Mask, making manipulation of decimal numbers convenient, e.g. "P0I$",C$,"#####0.00-",C3,C4,"PROMPT",B1. Note that the variable A1 is used instead of A1$, as a numeric variable is the data variable instead of a string variable.

P0IW12 is a window subset truncated for data screens of 12 lines with prompts on line 10.

P0IE is an editing version which allows arrow keys, delete and insert, and includes the system variable B5 at the end of the Enter Parameters.

File allocation, management routines.

P1FE – expand files

P1FZ – file sizes

P1FC – clear data from file.

P1FWRK – Allocate Work File – Usually for report sorts.

Note that this call routine is linked to the SSII Base in that the work file is automatically erased upon returning to Q0A0 from the program. The programmer need not worry about erasing the file. The file is usually allocated to the lowest directory number for large files and the highest directory number for small files.

CALL "P1FWRK",A6$,C$,"DLDZ"+FID(0),"DIRECT",10,128,1000,0

A6$ System Variable. Do not use in application programs

File "DLDZ"+FID(0) – example of a multi-user file name. DLD is the Sales Order System

Database files prefix in the storage hierarchy, and Z is always reserved for workfiles. The

FID(0) is not mandatory, but should be required.

Type DIRECT, SORT, INDEXED, - type of Business Basic file.

Key

Data

# of records

Disk number (no longer in use – always 0)

 

Printer and reports Call routines.

P1SPG – top of page, form feed logic

P1SPC / P1PC – open printer, set xon/xoff – dev arg’s

P1SPB – slave printing.

 

Operator Levels

0 - Inquiry Terminals. Checks for auto log out every 5 minutes

1 - Data Entry Operator - Timeout per 5 minutes

2 - Priveleged Operator - Timeout per 25 Minutes

3 - Programmer, escapes allowed, error trappnig off.

********Error Handling

B6 – current file device number of write – allows auto expansion of full files.

P1FIE – error handling subroutine

MERRI – merge file for error handling subroutine and escape trapping

P1FEI – file expansion subroutine

MER20 – Y2K Date compatibility merge file