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

AICDTOKN.m

Go to the documentation of this file.
AICDTOKN ; IHS/OHPRD/ACC - CONVERT INPUT LINE TO TOKENS ;
 ;;3.51;IHS ICD/CPT lookup & grouper;;MAY 30, 1991
 ; AICDX IS PASSED IN AND SHOULD NOT BE KILLED
 ; AICDWT IS PASSED OUT AND SHOULD NOT BE KILLED
 K AICDWT
 Q:'$D(AICDX)  Q:AICDX?.E1C.E
 S AICDSWB="",AICDST="SKIP",AICDI=0,AICDXLEN=$L(AICDX)
CHLOOP S AICDI=AICDI+1 G:AICDI>AICDXLEN EXIT
 S AICDC=$E(AICDX,AICDI)
 S AICDOST=AICDST
 I AICDOST="SKIP",(AICDC'?1P!("'~"[AICDC&(($E(AICDX,AICDI+1)?1U)!("'~"[$E(AICDX,AICDI+1))))) S AICDST="SCAN",AICDWS=AICDI
 I AICDOST="SCAN",AICDC?1P,"-'~"'[AICDC S AICDEND=0 D ENDWORD S AICDST="SKIP"
 G CHLOOP
EXIT I AICDST="SCAN" S AICDEND=1 D ENDWORD
 K AICDSWB,AICDOST,AICDST,AICDXLEN,AICDC,AICDWF,AICDWS,AICDWD,AICDWD2,AICDWL,AICDEND,AICDI,AICDJ,AICDQ
 Q
ENDWORD S AICDWL=AICDI-AICDWS,AICDWD=$E(AICDX,AICDWS,AICDI-1)
 I AICDWL=1 S AICDSWB=AICDSWB_AICDWD I AICDEND S AICDWD=AICDSWB D STOREWD
 I AICDWL>1 D STOREWD I AICDSWB'="" S AICDWD=AICDSWB,AICDSWB="" D STOREWD
 Q
STOREWD ;
 Q:AICDWD'?.E1U.E
 S AICDJ=$S($E(AICDWD)="'":2,$E(AICDWD,1,2)="~'":3,1:1)
RMQ S AICDJ=$F(AICDWD,"'",AICDJ) I AICDJ S AICDWD=$E(AICDWD,1,AICDJ-2)_$E(AICDWD,AICDJ,255),AICDJ=AICDJ-1 G RMQ
 I AICDWD'["-" S AICDWT(AICDWD)="" Q
 S AICDWD2="" F AICDJ=1:1 S AICDWF=$P(AICDWD,"-",AICDJ) Q:AICDWF=""  Q:$L(AICDWF)>2  S AICDWD2=AICDWD2_AICDWF
 I AICDWF="" S AICDWT(AICDWD2)="" Q
 S AICDWD2=AICDWD F AICDJ=1:1 S AICDWF=$P(AICDWD2,"-",AICDJ) Q:AICDWF=""  S AICDWT(AICDWF)=""
 Q