RAMAGU11 ;HCIOFO/SG - ORDERS/EXAMS API (DEBUG UTILITIES) ; 1/31/08 9:34am
;;5.0;Radiology/Nuclear Medicine;**90**;Mar 16, 1998;Build 20
;
Q
;
;***** WRITES VARIABLES AND THEIR VALUES
;
; ZZVLST List of variables separated by commas
;
; [FLAGS] Flags that control execution (can be combined):
;
; 1 Each variable on a new line
; S Skip a line before the output
;
VARS(ZZVLST,FLAGS) ;
N ZZBUF,ZZI,ZZVAR
S FLAGS=$G(FLAGS),ZZBUF=""
D:FLAGS["S" W("","!")
F ZZI=1:1 S ZZVAR=$$TRIM^XLFSTR($P(ZZVLST,",",ZZI)) Q:ZZVAR="" D
. I FLAGS'["1" S:ZZI>1 ZZBUF=ZZBUF_" "
. S ZZBUF=ZZBUF_ZZVAR_"="
. I '($D(@ZZVAR)#10) S ZZBUF=ZZBUF_"<UNDEF>"
. E I +@ZZVAR=@ZZVAR S ZZBUF=ZZBUF_@ZZVAR
. E S ZZBUF=ZZBUF_""""_@ZZVAR_""""
. I FLAGS["1" D W(ZZBUF,"!",IOM-10) S ZZBUF=""
D:FLAGS'["1" W(ZZBUF,"!",IOM-10)
Q
;
;***** WRITES A LONG STRING
;
; STR Text
;
; [FORMAT] Format characters for the WRITE command. By default
; ('$D(FORMAT)), "!" is assumed.
;
; [RM] Right margin for the output. By default
; ($G(RM)'>0), the (IOM-1) value is assumed.
;
W(STR,FORMAT,RM) ;
N MAXWD
S:'$D(FORMAT) FORMAT="!"
S MAXWD=$S($G(RM)>0:RM,1:(IOM-1))-$P(FORMAT,"?",2)
;--- Write the first segment
D PAGE^RAUTL22()
W:FORMAT'="" @FORMAT W $E(STR,1,MAXWD)
;--- Write remaining segments
S FORMAT="!"_$TR(FORMAT,"!")
F S $E(STR,1,MAXWD)="" Q:STR="" D
. D PAGE^RAUTL22()
. W @FORMAT,$E(STR,1,MAXWD)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRAMAGU11 1565 printed Dec 13, 2024@02:37:08 Page 2
RAMAGU11 ;HCIOFO/SG - ORDERS/EXAMS API (DEBUG UTILITIES) ; 1/31/08 9:34am
+1 ;;5.0;Radiology/Nuclear Medicine;**90**;Mar 16, 1998;Build 20
+2 ;
+3 QUIT
+4 ;
+5 ;***** WRITES VARIABLES AND THEIR VALUES
+6 ;
+7 ; ZZVLST List of variables separated by commas
+8 ;
+9 ; [FLAGS] Flags that control execution (can be combined):
+10 ;
+11 ; 1 Each variable on a new line
+12 ; S Skip a line before the output
+13 ;
VARS(ZZVLST,FLAGS) ;
+1 NEW ZZBUF,ZZI,ZZVAR
+2 SET FLAGS=$GET(FLAGS)
SET ZZBUF=""
+3 if FLAGS["S"
DO W("","!")
+4 FOR ZZI=1:1
SET ZZVAR=$$TRIM^XLFSTR($PIECE(ZZVLST,",",ZZI))
if ZZVAR=""
QUIT
Begin DoDot:1
+5 IF FLAGS'["1"
if ZZI>1
SET ZZBUF=ZZBUF_" "
+6 SET ZZBUF=ZZBUF_ZZVAR_"="
+7 IF '($DATA(@ZZVAR)#10)
SET ZZBUF=ZZBUF_"<UNDEF>"
+8 IF '$TEST
IF +@ZZVAR=@ZZVAR
SET ZZBUF=ZZBUF_@ZZVAR
+9 IF '$TEST
SET ZZBUF=ZZBUF_""""_@ZZVAR_""""
+10 IF FLAGS["1"
DO W(ZZBUF,"!",IOM-10)
SET ZZBUF=""
End DoDot:1
+11 if FLAGS'["1"
DO W(ZZBUF,"!",IOM-10)
+12 QUIT
+13 ;
+14 ;***** WRITES A LONG STRING
+15 ;
+16 ; STR Text
+17 ;
+18 ; [FORMAT] Format characters for the WRITE command. By default
+19 ; ('$D(FORMAT)), "!" is assumed.
+20 ;
+21 ; [RM] Right margin for the output. By default
+22 ; ($G(RM)'>0), the (IOM-1) value is assumed.
+23 ;
W(STR,FORMAT,RM) ;
+1 NEW MAXWD
+2 if '$DATA(FORMAT)
SET FORMAT="!"
+3 SET MAXWD=$SELECT($GET(RM)>0:RM,1:(IOM-1))-$PIECE(FORMAT,"?",2)
+4 ;--- Write the first segment
+5 DO PAGE^RAUTL22()
+6 if FORMAT'=""
WRITE @FORMAT
WRITE $EXTRACT(STR,1,MAXWD)
+7 ;--- Write remaining segments
+8 SET FORMAT="!"_$TRANSLATE(FORMAT,"!")
+9 FOR
SET $EXTRACT(STR,1,MAXWD)=""
if STR=""
QUIT
Begin DoDot:1
+10 DO PAGE^RAUTL22()
+11 WRITE @FORMAT,$EXTRACT(STR,1,MAXWD)
End DoDot:1
+12 QUIT