Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ABSPOSAD

ABSPOSAD.m

Go to the documentation of this file.
  1. ABSPOSAD ; IHS/FCS/DRS - JWS ; [ 09/12/2002 10:05 AM ]
  1. ;;1.0;PHARMACY POINT OF SALE;**3**;JUN 21, 2001;Build 38
  1. ;---------------------------------------------------------------------
  1. Q
  1. ;
  1. ;---------------------------------------------------------------------
  1. ;Longitudinal Redundancy Checker routines
  1. ;
  1. ;
  1. ;Parameters: STRING - STRING of characters (eg: message to be sent
  1. ; to or received from host)
  1. ;
  1. ;Returns: LRC - CHARacter representing the cumlative XOR of
  1. ; each character in the STRING
  1. ;---------------------------------------------------------------------
  1. LRC(STRING) ;EP -
  1. N LRC,CHAR,INDEX,LEN
  1. ;
  1. ;Loop through STRING and calculate LRC by doing a cumlative XOR
  1. S LRC=$C(0),LEN=$L(STRING)
  1. F INDEX=1:1:LEN D
  1. .S CHAR=$E(STRING,INDEX)
  1. .S LRC=$ZBOOLEAN(LRC,CHAR,6) ;- for MSM System /GTI
  1. .;S LRC=$ZCRC($C(LRC)_CHAR,1)
  1. Q LRC ;- for MSM System /GTI
  1. ;Q $C(LRC)
  1. ;---------------------------------------------------------------------
  1. ;Test if LRC character received from host for a message is correct
  1. ;
  1. ;Parameters: GETMSG - Message received from host
  1. ; LRC - LRC character received from host
  1. ;
  1. ;Returns: 1 - LRC is correct
  1. ; 0 - LRC is not correct
  1. ;---------------------------------------------------------------------
  1. TESTLRC(GETMSG,LRC) ;EP - from ABSPOSAM
  1. N XLRC
  1. S XLRC=$$LRC(GETMSG)
  1. Q $S(LRC=XLRC:1,1:0)