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

AMQQN.m

Go to the documentation of this file.
AMQQN ; IHS/CMI/THL - NATURAL LANGUAGE INTERPRETER ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ;-----
 I AMQQQSTG="" G EXIT
 S X=AMQQQSTG
 S AMQQNN=1
 S AMQQXX=""
 W !!
 D WAIT^DICD
 W !!
RUN F AMQQNRUN=0,1,2 D @("^AMQQN"_AMQQNRUN) I $D(AMQQFAIL) D FAIL,KILL,KILL1 G EXIT
 D SET
 D KILL
 D AND
 I $D(AMQQFAIL) D FAIL G EXIT
 D EN1^AMQQQ2,KILL1
 S AMQV("OPTION")="LIST"
 S AMQQXX("FORMAT")=1
 D ^AMQQCMPL
EXIT K AMQQONE,AMQQXX,AMQQNTAX,AMQQFAIL,%,%Y,A,B,C,I,J,N,S,Z,C
 Q
 ;
SET S AMQQXX(0)=AMQQNSBJ
 S AMQQNA=1
 I "^MALES^BOYS^MEN^"[(U_AMQQNSBJ_U) S AMQQXX(99.1,1)="3^SEX;11^IS;M" G SET1
 I "^FEMALES^GIRLS^WOMEN"[(U_AMQQNSBJ_U) S AMQQXX(99.1,1)="3^SEX;11^IS;F" G SET1
 I AMQQNSBJ="INFANTS" S AMQQXX(.1,1)="33^AGE;39^LESS THAN;1" G SET1
SET1 I $D(AMQQFAIL) Q
 S AMQQNSVL=$G(AMQQNSVL)
 I $D(AMQQNATT),$D(AMQQNCND),$D(AMQQNVAL)
 E  Q
 I '$G(AMQQCTXS) S AMQQXX(AMQQNA,1)=AMQQNATT_";"_AMQQNCND_";"_AMQQNVAL Q
 S AMQQXX(AMQQNA,1)=$S($G(AMQQNCND)="MTAX":(AMQQNATT_";MTAX;"_AMQQNVAL),1:(AMQQNATT_";MULT"))
 I "MTAX"[$G(AMQQNCND),$G(AMQQNSUB)="" Q
 I $G(AMQQNCND)="" S AMQQXX(AMQQNA,1,1,1)=AMQQNSCD_";"_AMQQNSVL Q
 I $G(AMQQNSUB)="" S AMQQXX(AMQQNA,1,1,1)=AMQQNCND_";"_AMQQNVAL Q
 I AMQQNSTP="O",'$D(AMQQNISF),$D(AMQQONE) S AMQQXX(AMQQNA,1,2,1)=AMQQNSCD_";"_AMQQNSVL,AMQQXX(AMQQNA,1,1,1)=AMQQNCND_";"_AMQQNVAL Q
 S AMQQXX(AMQQNA,1,2,1)=AMQQNCND_";"_AMQQNVAL
 S AMQQXX(AMQQNA,1,1,1)=AMQQNSCD_";"_AMQQNSVL
 Q
 ;
KILL K AMQQNATT,AMQQNCND,AMQQNN,AMQQNRUN,AMQQNSBJ,AMQQNSCD,AMQQNSTP,AMQQNSUB,AMQQNSVL,AMQQNVAL,AMQQQ,AUPNDAYS,AUPNDOB,AUPNDOD,AUPNPAT,AUPNSEX,A,B,I,J,S,X,Y,Z,%,%Y,AMQQCTXS,AMQQLINK
 Q
 ;
KILL1 K AMQQLSQF,AMQQATN,AMQQATNM,AMQQMMCC,AMQQMULT,AMQQQSTG,N,AMQQQ,AMQQYYYY,I,N,X,Y,Z,AMQQCNAM,AMQQXX,AMQQXXND,AMQQYYAT,AMQQNA,AMQQNAP
 Q
 ;
FAIL ;EP;
 I $G(AMQQFAIL)=-1 Q
 I $D(AMQQNSF) K AMQQNSF D KILL Q
 I AMQQFAIL=4 W !!,"I'm unable to identify the subject of the query...try again",!!,*7 G F1
 W !!,"Sorry, I don't understand your query. Check for spelling errors and typos."
 W !,"If this fails, try rewording the query. If you still fail, dont blame me..."
 W !,"After all, I'm only a stupid machine!!",!!,*7
F1 R "<>",%:DTIME E  S AMQQQUIT=""
 D KILL
 Q
 ;
AND F AMQQNAP=1:0 S AMQQNAP=$O(AMQQNAP(AMQQNAP)) Q:'AMQQNAP  S AMQQNA=AMQQNA+1 S X=AMQQNAP(AMQQNAP) D ^AMQQN2,SET1,KILL I $D(AMQQFAIL) Q
 Q
 ;