Host File Handling

From VistApedia
Revision as of 20:49, 25 February 2005 by 64.122.26.12 (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Host Files (also called Host Operating System Files) are generally stored on the disk outside of the MUMPS system.

Reading from Host Files into MUMPS data arrays

From User:Greg Woodhouse

I'll look into it more as soon as I get a chance. In the meantime, here is some code I wrote to append strings to build large arrays by sequentially appending substrings. This is the format used by th VistA HL7 package to represent long strings and it is NOT the same as the format of WP fields, but the same idea can be used here.


APPEND(PRCBUF,PRCSTR,PRCLIM)    ;
        N HASCHD,LAST,VAL,L1,L2,L3
        S:+$G(PRCLIM)'>0 PRCLIM=245 ;default
        S HASCHD=$S($D(@PRCBUF)'<10:1,1:0)
        I HASCHD S LAST=$O(@PRCBUF@(" "),-1)
        S L1=$S(HASCHD:$L($NA(@PRCBUF@(LAST))),1:$L(PRCBUF))
        S L2=$L(PRCSTR)
        I HASCHD S VAL=$G(@PRCBUF@(LAST))
        I 'HASCHD S VAL=$G(@PRCBUF)
        S L3=$L(VAL)
        I L1+L2+L3<PRCLIM D
        .S:'HASCHD @PRCBUF=VAL_PRCSTR
        .S:HASCHD @PRCBUF@(LAST)=VAL_PRCSTR
        I L1+L2+L3'<PRCLIM D
        .S LAST=$S(HASCHD:LAST+1,1:1)
        .S @PRCBUF@(LAST)=PRCSTR
        Q