- ABSPOSAD ; IHS/FCS/DRS - JWS ; [ 09/12/2002 10:05 AM ]
- ;;1.0;PHARMACY POINT OF SALE;**3**;JUN 21, 2001;Build 38
- ;---------------------------------------------------------------------
- Q
- ;
- ;---------------------------------------------------------------------
- ;Longitudinal Redundancy Checker routines
- ;
- ;
- ;Parameters: STRING - STRING of characters (eg: message to be sent
- ; to or received from host)
- ;
- ;Returns: LRC - CHARacter representing the cumlative XOR of
- ; each character in the STRING
- ;---------------------------------------------------------------------
- LRC(STRING) ;EP -
- N LRC,CHAR,INDEX,LEN
- ;
- ;Loop through STRING and calculate LRC by doing a cumlative XOR
- S LRC=$C(0),LEN=$L(STRING)
- F INDEX=1:1:LEN D
- .S CHAR=$E(STRING,INDEX)
- .S LRC=$ZBOOLEAN(LRC,CHAR,6) ;- for MSM System /GTI
- .;S LRC=$ZCRC($C(LRC)_CHAR,1)
- Q LRC ;- for MSM System /GTI
- ;Q $C(LRC)
- ;---------------------------------------------------------------------
- ;Test if LRC character received from host for a message is correct
- ;
- ;Parameters: GETMSG - Message received from host
- ; LRC - LRC character received from host
- ;
- ;Returns: 1 - LRC is correct
- ; 0 - LRC is not correct
- ;---------------------------------------------------------------------
- TESTLRC(GETMSG,LRC) ;EP - from ABSPOSAM
- N XLRC
- S XLRC=$$LRC(GETMSG)
- Q $S(LRC=XLRC:1,1:0)
- ABSPOSAD ; IHS/FCS/DRS - JWS ; [ 09/12/2002 10:05 AM ]
- +1 ;;1.0;PHARMACY POINT OF SALE;**3**;JUN 21, 2001;Build 38
- +2 ;---------------------------------------------------------------------
- +3 QUIT
- +4 ;
- +5 ;---------------------------------------------------------------------
- +6 ;Longitudinal Redundancy Checker routines
- +7 ;
- +8 ;
- +9 ;Parameters: STRING - STRING of characters (eg: message to be sent
- +10 ; to or received from host)
- +11 ;
- +12 ;Returns: LRC - CHARacter representing the cumlative XOR of
- +13 ; each character in the STRING
- +14 ;---------------------------------------------------------------------
- LRC(STRING) ;EP -
- +1 NEW LRC,CHAR,INDEX,LEN
- +2 ;
- +3 ;Loop through STRING and calculate LRC by doing a cumlative XOR
- +4 SET LRC=$CHAR(0)
- SET LEN=$LENGTH(STRING)
- +5 FOR INDEX=1:1:LEN
- Begin DoDot:1
- +6 SET CHAR=$EXTRACT(STRING,INDEX)
- +7 ;- for MSM System /GTI
- SET LRC=$ZBOOLEAN(LRC,CHAR,6)
- +8 ;S LRC=$ZCRC($C(LRC)_CHAR,1)
- End DoDot:1
- +9 ;- for MSM System /GTI
- QUIT LRC
- +10 ;Q $C(LRC)
- +11 ;---------------------------------------------------------------------
- +12 ;Test if LRC character received from host for a message is correct
- +13 ;
- +14 ;Parameters: GETMSG - Message received from host
- +15 ; LRC - LRC character received from host
- +16 ;
- +17 ;Returns: 1 - LRC is correct
- +18 ; 0 - LRC is not correct
- +19 ;---------------------------------------------------------------------
- TESTLRC(GETMSG,LRC) ;EP - from ABSPOSAM
- +1 NEW XLRC
- +2 SET XLRC=$$LRC(GETMSG)
- +3 QUIT $SELECT(LRC=XLRC:1,1:0)