|
PCIRL,
the Intermec scanner language had only a few statments to it. To produce a robust, serious program took some
ingenuity. For instance, no FOR...NEXT loop, so if you
examine this
section, you will see that to simulate the loop, we
increment numeric register D#7, examine that character in the
string and until null return to .NEXT else fall through to
.COMP. Kept you thinking, this language.
|
:* program to capture *
:* afk flagged pos *
:* ray 10/99 *
.TOP
OA(250,50) :open a, (#recs,recsize)
OB(22,28) :open b, flag file
OE(1,20) :file to hold id
DB(0)=""
DB(1)="Broken Trav. Guide"
DB(2)="Trav. Shuttle Stop"
DB(3)="Bad Module"
DB(4)="Bad Heat"
DB(5)="Uniten"
DB(6)="Push Rod Guide"
DB(7)="Roll Out Switch"
DB(8)="Tube Tray Switch"
DB(9)="Quality Control"
DB(10)="Take-Up"
DB(11)="Base Plate"
DB(12)="Wrap Drive Roll"
DB(13)="W-1 Guide"
DB(14)="Air Jet"
DB(15)="Belly Band Guide"
DB(16)="Cradle Cylinder"
DB(17)="No Oil Roller"
DB(18)="String Up Arm"
DB(19)="End Cap Cylinder"
DB(20)="Venturi"
DB(21)="Yoke"
D#1=0 :rec ctr
HA=0 :empty a, in case redo
S.FULL :chk all loaded
.TOP3
HE=0 :rec position
D$0=""
P"AFK FLAG" :display title screen
P"SCAN UTILITY"
P" VER. 1.0"
P"ENTER ID # "
A
G$0="CLEARALL".RDO:secret clear opt
G$0="".TOP3
D#3=0
D#3=[$0] :get len
G#3>6 .TOP3 :le 6 or redo
D$0="@"+$0 :so we know what it is
RE :log id in file e
D$0=""
B00
P"\e[2J"
.CHOICE
D$0=""
P"\e[2J1. Input Data"
P"2. Transmit "
P"Enter Choice:"
A :take any input, for now
G$0="E".TOP3 :back
S$0="1" .DATE :start input
G$0="2" .XMIT2 :transmit data
G.CHOICE :else redo
.START
D$0="" :init vars
D$1="" :fbuffer
D$2="" :str_cmp
D$3="" :temp_str
D#0=0 :status reg, do not use!
D#2=0 :recs_xmitted
D#3=0 :length_ctr
D#4=0 :temp_holder
D#5=0 :date
D#6=0 :attempt ctr in .xmit2
D#7=0 :str_ctr
D#8=0 :num_flag
D#9=0 :xmit_err_ctr
G#1>=200.WARN :test for max recs
.DATE
B00
D$0=""
P"\e[2JEnter Date as"
P" MMDDYY "
A :get date input
G$0="E".CHOICE
D#3=[$0] :get len
G#3>6 .ERR :gt 6 redo
G#3<6 .ERR :lt 6 redo
S.VALNUM :ensure all #
G#8<>1.ERR :must return 1
D$2="" :str_cmp
D$2=$0M2,1 :month
G$2>"12".ERR
G$2="00".ERR
D$2="" :str_cmp
D$2=$0M2,3 :day
G$2>"31".ERR
G$2="00".ERR
D$2="" :str_cmp
D$2=$0M2,5 :year
G$2>"99".ERR
G$2<"00".ERR
G.MACHNUM
.ERR
P\e[2J"ERROR!"
P" "
P" "
B11111
W1
G.DATE
.MACHNUM
B00
C#5=$0
.MACHNB
D$0=""
P"\e[2JENTER MACH # "
A
G$0="E".CHOICE
G$0<"1".ERR2 :no decimal
D#3=0
D#3=[$0] :get len
G#3>2 .ERR2 :le 6
G$0="0".ERR2 :no zero machine
S.VALNUM :ensure all #
G#8<>1.ERR2 :must return 1
C#4=$0 :convert to #
G#4>48.ERR2
G$0="2".POSLOW :machines # 1-48
G$0="4".POSLOW :some need poslow
G$0="6".POSLOW :val, some poshi
G$0="8".POSLOW : ""
G$0="10".POSLOW : ""
G$0="12".POSLOW
G$0="14".POSLOW
G$0="16".POSLOW
G$0="18".POSLOW
G$0="20".POSLOW
G$0="24".POSLOW
G$0="25".POSLOW
G$0="28".POSLOW
G$0="29".POSLOW
G$0="32".POSLOW
G$0="33".POSLOW
G$0="36".POSLOW
G$0="37".POSLOW
G$0="40".POSLOW
G$0="41".POSLOW
G$0="44".POSLOW
G$0="45".POSLOW
G$0="48".POSLOW
G.POSHI
.ERR2
P"ERROR!"
P" "
P"INVALID MACH# "
P$0
B11111
W1
G.MACHNB
.POSLOW
B00
I$0"," :field sep
D$1=$0 :fbuffer=mach#
.POSLOW1
D$0=""
P"\e[2J"
D$0="MACHINE # "+$1
P$0 :print fbuffer
D$0=""
P"ENTER POS# (1-108) "
P" "
A
G$0="E".CHOICE
G$0="0".ERR3
S.VALNUM :ensure all #
G#8<>1.ERR3 :must return 1
C#4=$0 :convert to #
G#4>108.ERR3 :to test
G.FLAG
.POSHI
B00
I$0"," :field sep
D$1=$1+$0 :add date+mach#
.POSHI1
D$0=""
P"\e[2J"
D$0="MACHINE # "+$1
P$0 :print fbuffer
D$0=""
P"ENTER POS# (109-216) "
P" "
A
G$0="E".CHOICE
D#3=0
D#3=[$0] :get len
G#3<=2.ERR4 :no le 2
S.VALNUM :ensure all #
G#8<>1.ERR4 :must return 1
C#4=$0 :convert to #
G#4<109.ERR4 :to test
G#4>216.ERR4
G.FLAG
.ERR3
P"ERROR!"
P"INVALID POS# "
P$0
P"RANGE 1-108"
B11111
W1
G.POSLOW1
.ERR4
P"ERROR!"
P"INVALID POS# "
P$0
P"RANGE 109-216"
B11111
W1
G.POSHI1
.FLAG
B00
I$0"," :field sep
D$1=$1+$0 :fbuffer=fbuffer+pos#
.FLAG2
D$0=""
P"\e[2JENTER FLAG #"
P"FOR MACH/POS:"
P$1
P" "
A
G$0="E".CHOICE
G$0="0".ERR5
C#4=$0 :convert to #
G#4>21.ERR5
S.VALNUM :ensure all #
G#8<>1.ERR5 :must return 1
D$3=$0 :temp_str=flag
.VERIFY
D$0=""
D$0="MACH/POS "+$1
P$0
D$0=""
D$0="FLAG: "+$3 :show them what
P$0 :they selected
D$0="" :from file b
C#4=$3
PB(#4)
P"Selected <Y>/N "
A
G$0="".OKFLAG
G$0="E".CHOICE
G$0="Y".OKFLAG
G$0="N".FLAG2
G.VERIFY
.OKFLAG
D$0=""
B00
I$0"," :field sep
D$1=$1+$3 :fbuffer=fbuffer+flag
G.ADD :file record
.ERR5
P"ERROR!"
P"INVALID FLAG "
P$0
P"RANGE 1-21"
B11111
W1
G.FLAG2
.ADD
D#1=#1+1 :incr ctrs
C$3=#1
D$2="" :str_cmp
D$2=$1 :hold fbuffer temp
D$1=$3+"." :fbuffer=temp_str+.
D$1=$1+$2 :fbuffer+=+temp_str
D$1=$1+$0 :fbuffer+=temp_str
D$0=$1 :add fbuffer to file
TA
RA :add to file a
B0100
D$1="" :fbuffer=''
D$2="" :str_cmp
G#1>=250.WARN :test for max recs
S#1>200.WARN1 :tell them it's filling
P"--------------------"
D$0=""
G.MACHNB :next scan
.XMIT2 :transmit menu
D$0=""
P"\e[2J"
P"1) Transmit File"
P"2) Exit"
P"Enter Option -->> "
A
G$0="1".XMITS
G$0="2".CHOICE
B11111
G.XMIT2
.XMITS
P"\e[2J"
P"TRANSMITTING"
W5
.BEGIN
D$0=""
YMP;5000
G#0=1.FAIL2 :ok xmit rtns 0
G#0>0.BEGIN
D$0=""
D$0="BEGIN"
XMP,$0;1000
G#0=1.FAIL2
G#0>0.BEGIN
W1
D$0=""
C$0=#5
D$0=$0+E(0)
G[$0]>0.XOK2
D$0=""
D$0="@NTRAKKER"
.XOK2
D$2="" :give the host
C$2=#1 :ctr ttls
D$2="!"+$2 :sep with !
D$0=$0+$2
XMP,$0;6000
W1
G#0=1.FAIL2
D$0=""
D#9=0
H#3=A
G#3<0.SNDE2
D#2=0
.TOPFA2
D#2=#2+1
.YY2
D$0=""
D#4=0
D#4=#2-1
D$0=A(#4)
D$2=$0M20,1
P$2
XMP,$0;1000
D#6=0 :rec try ctr
G#0=1.FAIL2
G#0>0.BXT2
.RERX
D$0="TX"
XMP,$0;1000
G#0=1.FAIL2
D$0=""
YMP;5000
G#0=1.FAIL2
D$2=$0M3,1 :first 3
G$2="ACK".TB2 :got it msg
D#6=#6+1 :else keep track
G#6>10.FAIL2 :until 10
G.RERX :redo
.BXT2
D#9=#9+1
G#9<6.YY2
G.FAIL2
.TB2
D#9=0
G#2<=#3.TOPFA2
D#9=0
.SNDE2
D$0="OUT"
XMP,$0;1000
D#6=0 :try ctr
G#0=1.FAIL2
G#0>0.SNDE2
.YM2
D$0=""
YMP;5000
G#0=1.FAIL2 :timeout
D$2=$0M3,1 :first 3 char
G$2="ACK".YM2 :keep waiting
G$2="ALL".TT2 :finish msg
D#6=#6+1 :else keep track
G#6>10.FAIL2 :until 10
G.YM2 :redo
D#9=#9+1
G#9<4.YM2
G#9<6.SNDE2
.FAIL2
P"TRANSMIT FAILED!"
B11111111
W5
D#9=0
D$0=""
G.CHOICE
Q
.TT2
P"TRANSMIT COMPLETE"
B1010
W5
P"\e[2J"
P"'YES' to Clear or"
P" Any Key=Resume "
D$0=""
A
W5
G$0<>"YES".XMIT2
HA=0
D#1=0
D#9=0
D$0=""
G.CHOICE
.CNT
P"RECORDS RECORDED:"
C$0=#1
P$0
P" OF 200 MAX"
W5 :just advisory
D$0=""
P"\e[2J"
G.CHOICE
.WARN
D$0=""
P"\e[2J" :force xmit
P"MEMORY FULL!" :when full
P"MUST UPLOAD!"
W10
B1111
G.XMIT2
.WARN1 :tell them
P"\e[2J" :it's almost
P"MEMORY FILLING!":full
P"PLEASE UPLOAD"
P"SOON!"
W5
Q
.RDO :clears all
P"\e[2J"
P"ALL DATA"
P"CLEARED "
P" "
B1100
W3
D$0=""
G.TOP
.FULL
P"\e[2J"
P"Initialization"
P"Complete"
W3
Q
.VALNUM
D#3=0 :holds len
D$3="" :hold curr char
D#7=1 :pos counter
D#8=0 :0=bad,1=ok
D#3=[$0] :get len of input
.NEXT
D$3=$0M1,#7 :extract char
G$3="".COMP :"", finished
G$3<"0".NUMFAIL
G$3>"9".NUMFAIL
D#7=#7+1 :go find
G.NEXT :next char
.COMP
D#8=1 :str all num!
Q
.NUMFAIL
Q :return
|
TOP
|