ASULALGO ; IHS/ITSC/LMH -ALGOLRYTHM ALPHA TO NUMERIC ;
;;4.2T2;Supply Accounting Mgmt. System;;JUN 30, 2000
;This routine is used to translate an alphanumeric character to a
;2 digit numeric code. The algolrythm is used to convert codes to
;internal record numbers. Entry points are also available to reverse
;the translation.
TR(Z) ;EP ;TRANSLATE ALPHA
I Z?1N S Y=0_Z Q
I Z?1A G @Z
S Y=-1 Q ;AEF/2970723
A S Y=10 Q
B S Y=11 Q
C S Y=12 Q
D S Y=13 Q
E S Y=14 Q
F S Y=15 Q
G S Y=16 Q
H S Y=17 Q
I S Y=18 Q
J S Y=19 Q
K S Y=20 Q
L S Y=21 Q
M S Y=22 Q
N S Y=23 Q
O S Y=24 Q
P S Y=25 Q
Q S Y=26 Q
R S Y=27 Q
S S Y=28 Q
T S Y=29 Q
U S Y=30 Q
V S Y=31 Q
W S Y=32 Q
X S Y=33 Q
Y S Y=34 Q
Z S Y=35 Q
Q
USR(X) ;EP ;ACCEPT USER CODE IN X
N Z
S Z=$E(X,3) D TR(Z)
I Y<0 Q
S X=$E(X,1,2)_Y
Q
IEN(X) ;EP ;ACCEPT IEN IN X
N Z
S Z=$E(X,5,6) D UT^ASULALGO(.Z) ;AEF/2970721
I Z<0 Q
S X=$E(X,3,4)_Z
Q
UT(Z) ;EP ;
I $E(Z,2)=0 S Z=$E(Z) Q
I Z?2N,+Z>9,+Z<36 G @Z ;AEF/2970722
S Z=-1 Q ;AEF/2970722
10 S Z="A" Q
11 S Z="B" Q
12 S Z="C" Q
13 S Z="D" Q
14 S Z="E" Q
15 S Z="F" Q
16 S Z="G" Q
17 S Z="H" Q
18 S Z="I" Q
19 S Z="J" Q
20 S Z="K" Q
21 S Z="L" Q
22 S Z="M" Q
23 S Z="N" Q
24 S Z="O" Q
25 S Z="P" Q
26 S Z="Q" Q
27 S Z="R" Q
28 S Z="S" Q
29 S Z="T" Q
30 S Z="U" Q
31 S Z="V" Q
32 S Z="W" Q
33 S Z="X" Q
34 S Z="Y" Q
35 S Z="Z" Q
ASULALGO ; IHS/ITSC/LMH -ALGOLRYTHM ALPHA TO NUMERIC ;
+1 ;;4.2T2;Supply Accounting Mgmt. System;;JUN 30, 2000
+2 ;This routine is used to translate an alphanumeric character to a
+3 ;2 digit numeric code. The algolrythm is used to convert codes to
+4 ;internal record numbers. Entry points are also available to reverse
+5 ;the translation.
TR(Z) ;EP ;TRANSLATE ALPHA
+1 IF Z?1N
SET Y=0_Z
QUIT
+2 IF Z?1A
GOTO @Z
+3 ;AEF/2970723
SET Y=-1
QUIT
A SET Y=10
QUIT
B SET Y=11
QUIT
C SET Y=12
QUIT
D SET Y=13
QUIT
E SET Y=14
QUIT
F SET Y=15
QUIT
G SET Y=16
QUIT
H SET Y=17
QUIT
I SET Y=18
QUIT
J SET Y=19
QUIT
K SET Y=20
QUIT
L SET Y=21
QUIT
M SET Y=22
QUIT
N SET Y=23
QUIT
O SET Y=24
QUIT
P SET Y=25
QUIT
Q SET Y=26
QUIT
R SET Y=27
QUIT
S SET Y=28
QUIT
T SET Y=29
QUIT
U SET Y=30
QUIT
V SET Y=31
QUIT
W SET Y=32
QUIT
X SET Y=33
QUIT
Y SET Y=34
QUIT
Z SET Y=35
QUIT
+1 QUIT
USR(X) ;EP ;ACCEPT USER CODE IN X
+1 NEW Z
+2 SET Z=$EXTRACT(X,3)
DO TR(Z)
+3 IF Y<0
QUIT
+4 SET X=$EXTRACT(X,1,2)_Y
+5 QUIT
IEN(X) ;EP ;ACCEPT IEN IN X
+1 NEW Z
+2 ;AEF/2970721
SET Z=$EXTRACT(X,5,6)
DO UT^ASULALGO(.Z)
+3 IF Z<0
QUIT
+4 SET X=$EXTRACT(X,3,4)_Z
+5 QUIT
UT(Z) ;EP ;
+1 IF $EXTRACT(Z,2)=0
SET Z=$EXTRACT(Z)
QUIT
+2 ;AEF/2970722
IF Z?2N
IF +Z>9
IF +Z<36
GOTO @Z
+3 ;AEF/2970722
SET Z=-1
QUIT
10 SET Z="A"
QUIT
11 SET Z="B"
QUIT
12 SET Z="C"
QUIT
13 SET Z="D"
QUIT
14 SET Z="E"
QUIT
15 SET Z="F"
QUIT
16 SET Z="G"
QUIT
17 SET Z="H"
QUIT
18 SET Z="I"
QUIT
19 SET Z="J"
QUIT
20 SET Z="K"
QUIT
21 SET Z="L"
QUIT
22 SET Z="M"
QUIT
23 SET Z="N"
QUIT
24 SET Z="O"
QUIT
25 SET Z="P"
QUIT
26 SET Z="Q"
QUIT
27 SET Z="R"
QUIT
28 SET Z="S"
QUIT
29 SET Z="T"
QUIT
30 SET Z="U"
QUIT
31 SET Z="V"
QUIT
32 SET Z="W"
QUIT
33 SET Z="X"
QUIT
34 SET Z="Y"
QUIT
35 SET Z="Z"
QUIT