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

INHMGD5.m

Go to the documentation of this file.
  1. INHMGD5 ;CAR; 7 Jul 97 10:42;HL7 MESSAGING - USER INPUT TO SENSITIVITY ANALYSIS
  1. ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
  1. ;COPYRIGHT 1991-2000 SAIC
  1. ;
  1. ; MODULE NAME:
  1. ; HL7 Messaging - User Input to Sensitivity Analysis (INHMGD5).
  1. ;
  1. SENSINP(INSENS) ;User input module for Sens field/file
  1. ; Purpose:
  1. ; This module is used to query the user for Field and File
  1. ; names or numbers to be looked up and reported on by the
  1. ; Sensitivity Analysis routine.
  1. ; Input:
  1. ; INSENS = Used merely as a flag on input
  1. ; Output:
  1. ; INSENS = An array to hold the requested File and Field numbers
  1. ; the format is: INSENS(FILE#,FIELD#)=""
  1. ; DUOUT = Normally doesn't exist, use $G(DUOUT) when checking
  1. ; Contains 1 when user "^" out of query, or 2 when user
  1. ; "timed-out" and 3 when user "^^" out of query.
  1. ;
  1. ;D ^UTSRD("query: ;;;;default;;;;;;;;;DUOUT",1) ;new format
  1. ;
  1. N DIC,INJ,INL,INF,INFIL,INFOLD,INFLD,INFLDT,INHLP,INDONE
  1. K DIC
  1. ;
  1. S INHLP=" " ;add "^ D ...." to execute code
  1. S INHLP(1)="Enter the CHCS/Fileman Field:File as numbers or names"
  1. S INHLP(2)="Use a comma (,) to separate multiple Field:File requests"
  1. S INHLP(3)="If you omit the file name/number entirely, you will be"
  1. S INHLP(4)="asked for the first one, the rest will assume the same"
  1. S INHLP(5)="file#, until you supply another one."
  1. S (INFIL,INFOLD)=0
  1. F D Q:X=""!$G(DUOUT)
  1. .W ! D UTSRD("Enter CHCS Field:File[,Field:File,...]: ",.INHLP)
  1. .Q:X=""!$G(DUOUT) ;terminates repeated entries
  1. .;save the text, since we'll be using X:
  1. .S INL=X
  1. .;validate each entry (separated by ","):
  1. .F INJ=1:1:$L(INL,",") D I $G(DUOUT) K:$G(DUOUT)'=3 DUOUT Q
  1. ..;extract field & file name/number and go into verify loop
  1. ..S INF=$P(INL,",",INJ) Q:'$L(INF)
  1. ..S INFLD=$P(INF,":"),INFIL=$P(INF,":",2),INDONE=0
  1. ..S INDONE=0 F D Q:INDONE!$G(DUOUT) ;loop till it's right or ^quit
  1. ...D I $G(DUOUT) K:$G(DUOUT)'=3 DUOUT Q
  1. ....S INF=INFIL,INFIL=0
  1. ....I '$L(INF),INFOLD S INFIL=INFOLD Q ;use file# from last time
  1. ....I INF,$D(^DIC(+INF,0))!$D(^DD(+INF,0)) S (INFOLD,INFIL)=INF Q
  1. ....I $L(INF) D
  1. .....;may have a file NAME, do quiet lookup for number
  1. .....K DIC S DIC="^DIC(",DIC(0)="FMZ",X=INF D ^DIC
  1. .....I Y>0 S (INFIL,INFOLD)=+Y ;found it
  1. ...;-----------------------------
  1. ...;now, validate the field name:
  1. ...I $L(INFLD),INFIL D Q:Y>0
  1. ....;make sure this is the name of a field; quiet lookup
  1. ....K DIC S X=INFLD,DIC="^DD("_INFIL_",",DIC(0)="FMZ"
  1. ....D ^DIC
  1. ....;report success
  1. ....I Y>0 S INFLD=+Y D S INDONE=1 Q
  1. .....S INFLDT=Y(0,0)
  1. .....S INFILT=$P($G(^DIC(INFIL,0)),U)
  1. .....I INFILT="" S INFILT=$P($G(^DD(INFIL,0)),U)
  1. .....W !,?5,"Found Field#: "_INFLD_", ("_INFLDT_") in file#: "_INFIL_" "_$S($D(^DIC(INFIL,0)):$P(^(0),U),1:$P($G(^DD(INFIL,0)),U))
  1. .....S INSENS(INFIL,INFLD)=""
  1. ...;lookup didn't work, re-ask the user for file and field
  1. ...W !,?5,"Could NOT find Entry# "_INJ_", Field/File: "_INFLD_":"_INFIL
  1. ...K DIC S DIC="^DIC(",DIC(0)="AEMQZ"
  1. ...I INFIL,$D(^DIC(+INFIL,0)) S DIC("B")=+INFIL
  1. ...S DIC("A")="Re-enter CHCS File (?? for list) or ^out: "
  1. ...D ^DIC
  1. ...I Y>0 D
  1. ....S (INFIL,INFOLD)=+Y
  1. ....;see if user wants sub-file
  1. ....K DIC S DIC="^DD("_+Y_",",DIC(0)="AEMQZ"
  1. ....S DIC("S")="I $P(^(0),U,2)"
  1. ....S DIC("A")="Select SUB-FILE: "
  1. ....D ^DIC I Y>0 S (INFIL,INFOLD)=+$P(Y(0),U,2)
  1. ...Q:$G(DUOUT)
  1. ...K DIC S DIC="^DD("_INFIL_",",DIC(0)="ACEQMZ"
  1. ...S DIC("A")="Re-enter Field (?? for list) or ^out: "
  1. ...I INFIL,INFLD,$D(^DD(INFIL,INFLD,0)) S DIC("B")=+INFLD
  1. ...D ^DIC I Y>0 S INFLD=+Y
  1. Q
  1. ;
  1. UTSRD(DIR,DIRH) ;adds arrayed help(for ?) and options(for ??) to D ^UTSRD(p1,p2)
  1. ; Inputs
  1. ; DIR = $p;1 is prompt, $p;5 is default, auto sets $p;14 to DUOUT
  1. ; DIRH = "^ code to list options,...?", DIRH(1)..DIRH(n) = help text
  1. ;
  1. ;set up DUOUT as variable to receive exit status from reader
  1. S $P(DIR,";",14)="DUOUT"
  1. ;set up request to ^UTSRD to return any help, ? or ?? requests.
  1. F D ^UTSRD(DIR,1) Q:X'["?"!$G(DUOUT) D
  1. .;check if request is to execute some code (??) or (?) for help text.
  1. .I $E(X,1,3)["??",$D(DIRH)#2,$E(DIRH)="^" D Q
  1. ..X $E(DIRH,2,999)
  1. .;else, write any documentation; ?? falls through to ? if no code to X
  1. .N INJ S INJ=0 F S INJ=$O(DIRH(INJ)) Q:'INJ W !,DIRH(INJ)
  1. .W !
  1. Q
  1. ;