FSCQD ;SLC/STAFF-NOIS Query Description ;4/22/94 11:56
;;1.1;NOIS;;Sep 06, 1998
;
DESC(DESCNT,CRITERIA) ; from FSCLMPMQ, FSCQB
N STEP,FCOND,NDESC
I 'DEFINE,DESC(0)'[" (MODIFIED)" S DESC(0)=DESC(0)_" (MODIFIED)"
S DESCNT=DESCNT+1,DESC=" "_$P(CRITERIA(0),U)_" where:"
S STEP=0 F S STEP=$O(CRITERIA(STEP)) Q:STEP="" D
.S FCOND=0 F S FCOND=$O(CRITERIA(STEP,FCOND)) Q:FCOND="" D
..S NDESC=CRITERIA(STEP,FCOND,1)_$S($L(CRITERIA(STEP,FCOND,1)):" ",1:"")_CRITERIA(STEP,FCOND,0)
..I $L(NDESC)+$L(DESC)+2<$G(IOM,80) S DESC=DESC_" "_NDESC Q
..S DESC(DESCNT)=DESC,DESC=NDESC,DESCNT=DESCNT+1
S DESC(DESCNT)=DESC
I DEFINE S LDCNT=LDCNT+1 M @LISTDEF@(LDCNT)=CRITERIA
Q
CRITERIA(CRITERIA) ; from FSCQB
N STEP,FCOND,NEWLINE,LINE,NEWDESC,CNT
S CNT=0,LINE="The last complete criteria was:"
S STEP=0 F S STEP=$O(CRITERIA(STEP)) Q:STEP="" D
.S FCOND=0 F S FCOND=$O(CRITERIA(STEP,FCOND)) Q:FCOND="" D
..S NEWLINE=CRITERIA(STEP,FCOND,1)_$S($L(CRITERIA(STEP,FCOND,1)):" ",1:"")_CRITERIA(STEP,FCOND,0)
..I $L(NEWLINE)+$L(LINE)+2<$G(IOM,80) S LINE=LINE_" "_NEWLINE Q
..S NEWDESC(CNT)=LINE,LINE=NEWLINE,CNT=CNT+1
S NEWDESC(CNT)=LINE
S CNT="" F S CNT=$O(NEWDESC(CNT)) Q:CNT="" D
.W !,NEWDESC(CNT)
Q
HELP ; executed from FSCQU and DIR
N CNT
I $O(CRITERIA(0)) D CRITERIA(.CRITERIA)
I $L($G(ANDOR))!$L($G(FIELD)) D
.W !,"You are now entering:",!,$S($L($G(ANDOR)):ANDOR_" ",1:""),$S($L(FIELD):$P(FIELD,U,3)_" ",1:""),$S($L(COND):$P(COND,U,5)_" ",1:""),$S($L(VALUE):$P(VALUE,U,2)_" ",1:"")
S CNT=0 F S CNT=$O(DIR("?",CNT)) Q:CNT<1 W !,DIR("?",CNT)
W !,"Enter '^' to exit, '??' for additional help."
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFSCQD 1649 printed Dec 13, 2024@02:18:55 Page 2
FSCQD ;SLC/STAFF-NOIS Query Description ;4/22/94 11:56
+1 ;;1.1;NOIS;;Sep 06, 1998
+2 ;
DESC(DESCNT,CRITERIA) ; from FSCLMPMQ, FSCQB
+1 NEW STEP,FCOND,NDESC
+2 IF 'DEFINE
IF DESC(0)'[" (MODIFIED)"
SET DESC(0)=DESC(0)_" (MODIFIED)"
+3 SET DESCNT=DESCNT+1
SET DESC=" "_$PIECE(CRITERIA(0),U)_" where:"
+4 SET STEP=0
FOR
SET STEP=$ORDER(CRITERIA(STEP))
if STEP=""
QUIT
Begin DoDot:1
+5 SET FCOND=0
FOR
SET FCOND=$ORDER(CRITERIA(STEP,FCOND))
if FCOND=""
QUIT
Begin DoDot:2
+6 SET NDESC=CRITERIA(STEP,FCOND,1)_$SELECT($LENGTH(CRITERIA(STEP,FCOND,1)):" ",1:"")_CRITERIA(STEP,FCOND,0)
+7 IF $LENGTH(NDESC)+$LENGTH(DESC)+2<$GET(IOM,80)
SET DESC=DESC_" "_NDESC
QUIT
+8 SET DESC(DESCNT)=DESC
SET DESC=NDESC
SET DESCNT=DESCNT+1
End DoDot:2
End DoDot:1
+9 SET DESC(DESCNT)=DESC
+10 IF DEFINE
SET LDCNT=LDCNT+1
MERGE @LISTDEF@(LDCNT)=CRITERIA
+11 QUIT
CRITERIA(CRITERIA) ; from FSCQB
+1 NEW STEP,FCOND,NEWLINE,LINE,NEWDESC,CNT
+2 SET CNT=0
SET LINE="The last complete criteria was:"
+3 SET STEP=0
FOR
SET STEP=$ORDER(CRITERIA(STEP))
if STEP=""
QUIT
Begin DoDot:1
+4 SET FCOND=0
FOR
SET FCOND=$ORDER(CRITERIA(STEP,FCOND))
if FCOND=""
QUIT
Begin DoDot:2
+5 SET NEWLINE=CRITERIA(STEP,FCOND,1)_$SELECT($LENGTH(CRITERIA(STEP,FCOND,1)):" ",1:"")_CRITERIA(STEP,FCOND,0)
+6 IF $LENGTH(NEWLINE)+$LENGTH(LINE)+2<$GET(IOM,80)
SET LINE=LINE_" "_NEWLINE
QUIT
+7 SET NEWDESC(CNT)=LINE
SET LINE=NEWLINE
SET CNT=CNT+1
End DoDot:2
End DoDot:1
+8 SET NEWDESC(CNT)=LINE
+9 SET CNT=""
FOR
SET CNT=$ORDER(NEWDESC(CNT))
if CNT=""
QUIT
Begin DoDot:1
+10 WRITE !,NEWDESC(CNT)
End DoDot:1
+11 QUIT
HELP ; executed from FSCQU and DIR
+1 NEW CNT
+2 IF $ORDER(CRITERIA(0))
DO CRITERIA(.CRITERIA)
+3 IF $LENGTH($GET(ANDOR))!$LENGTH($GET(FIELD))
Begin DoDot:1
+4 WRITE !,"You are now entering:",!,$SELECT($LENGTH($GET(ANDOR)):ANDOR_" ",1:""),$SELECT($LENGTH(FIELD):$PIECE(FIELD,U,3)_" ",1:""),$SELECT($LENGTH(COND):$PIECE(COND,U,5)_" ",1:""),$SELECT($LENGTH(VALUE):$PIECE(VALUE,U,2)_" ",1:"")
End DoDot:1
+5 SET CNT=0
FOR
SET CNT=$ORDER(DIR("?",CNT))
if CNT<1
QUIT
WRITE !,DIR("?",CNT)
+6 WRITE !,"Enter '^' to exit, '??' for additional help."
+7 QUIT