SDFORM ;IOFO BAY PINES/ESW - FORMAT MESSAGES ;09/02/2004 2:10 PM [5/19/05 8:24am]
;;5.3;Scheduling;**327**;Aug 13, 1993
;This routine may be called to format a text up to four columns.
;The returned value may be asigned to an array element used in
;a message creation
;================================================
FORM(FIRST,FN,SECOND,SN,THIRD,TN,FOURTH,FRN) ;
;
;FIRST,SECOND,THIRD,FOURTH - names of variables containing text values or text strings
; to be included in a formatted message
;FN,SN,TN - numbers assigned for a text and spaces up to the next column
;
;Output: formatted text
;
N FS,SS,TS,FNS,SNS,TNS
S:'$D(THIRD) THIRD=""
S:'$D(FOURTH) FOURTH=""
S:'$D(TN) TN=""
S:'$D(SN) SN=""
S:'$D(FRN) FRN=""
S FNS=FN-$L(FIRST) S:FNS'>0 FNS=1,FIRST=$E(FIRST,1,$L(FIRST)-1) S $P(FS," ",FNS)=""
S SNS=SN-$L(SECOND) S:SNS'>0 SNS=1,SECOND=$E(SECOND,1,$L(SECOND)-1) S $P(SS," ",SNS)=""
S TNS=TN-$L(THIRD) S:TNS'>0 TNS=1,THIRD=$E(THIRD,1,$L(THIRD)-1) S $P(TS," ",TNS)=""
Q FIRST_FS_SECOND_SS_THIRD_TS_FOURTH
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDFORM 1085 printed Dec 13, 2024@02:57:58 Page 2
SDFORM ;IOFO BAY PINES/ESW - FORMAT MESSAGES ;09/02/2004 2:10 PM [5/19/05 8:24am]
+1 ;;5.3;Scheduling;**327**;Aug 13, 1993
+2 ;This routine may be called to format a text up to four columns.
+3 ;The returned value may be asigned to an array element used in
+4 ;a message creation
+5 ;================================================
FORM(FIRST,FN,SECOND,SN,THIRD,TN,FOURTH,FRN) ;
+1 ;
+2 ;FIRST,SECOND,THIRD,FOURTH - names of variables containing text values or text strings
+3 ; to be included in a formatted message
+4 ;FN,SN,TN - numbers assigned for a text and spaces up to the next column
+5 ;
+6 ;Output: formatted text
+7 ;
+8 NEW FS,SS,TS,FNS,SNS,TNS
+9 if '$DATA(THIRD)
SET THIRD=""
+10 if '$DATA(FOURTH)
SET FOURTH=""
+11 if '$DATA(TN)
SET TN=""
+12 if '$DATA(SN)
SET SN=""
+13 if '$DATA(FRN)
SET FRN=""
+14 SET FNS=FN-$LENGTH(FIRST)
if FNS'>0
SET FNS=1
SET FIRST=$EXTRACT(FIRST,1,$LENGTH(FIRST)-1)
SET $PIECE(FS," ",FNS)=""
+15 SET SNS=SN-$LENGTH(SECOND)
if SNS'>0
SET SNS=1
SET SECOND=$EXTRACT(SECOND,1,$LENGTH(SECOND)-1)
SET $PIECE(SS," ",SNS)=""
+16 SET TNS=TN-$LENGTH(THIRD)
if TNS'>0
SET TNS=1
SET THIRD=$EXTRACT(THIRD,1,$LENGTH(THIRD)-1)
SET $PIECE(TS," ",TNS)=""
+17 QUIT FIRST_FS_SECOND_SS_THIRD_TS_FOURTH