Mumps Class 18

From VistApedia
Revision as of 05:55, 9 April 2012 by NeilArmstrong (talk | contribs) (Added glossary link to Record~)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Using username "sam".
sam@172.16.16.142's password:
Access denied
sam@172.16.16.142's password:
Linux sam-desktop 2.6.32-30-generic #59-Ubuntu SMP Tue Mar 1 21:30:21 UTC 2011 i686 GNU/Linux
Ubuntu 10.04.2 LTS

Welcome to Ubuntu!
 * Documentation:  https://help.ubuntu.com/

0 packages can be updated.
0 updates are security updates.

Last login: Sun Mar 20 10:28:46 2011 from 172.16.16.56
sam@sam-desktop:~$ cd pocn-moh/
sam@sam-desktop:~/pocn-moh$ . run_utf8
sam@sam-desktop:~/pocn-moh$ mumps -dikr
%GTM-E-CLIERR, Unrecognized option : DIKR
sam@sam-desktop:~/pocn-moh$ mumps -dir

GTM>; Using Devices;

GTM>; Communicating using GT.M to the outside world

GTM>; Open & Use & Close

GTM>; Open - Opens a Device

GTM>; Use - Makes the Device the one you write and read from

GTM>; Close - self-explanator

GTM>; Close - self-explanatory

GTM>; Open - O; Use - U; Close - C

GTM>O "/tmp/sam.txt"

GTM>W $IO
/dev/pts/3
GTM>W $PRINCIPLE
%GTM-E-INVSVN, Invalid special variable name

GTM>W $PRINCIPAL
/dev/pts/3
GTM>; $IO - Device I am writing to

GTM>; $Principal - Device I started GT.M with.

GTM>U "/tmp/sam.txt"

GTM>W "$IO is ",$IO,!

GTM>W "$P is ",$P,!

GTM>C "/tmp/sam.txt"

GTM>w $io
/dev/pts/3
GTM>W $P
/dev/pts/3
GTM>ZSY "cat /tmp/sam.txt"
$IO is /tmp/sam.txt
$P is /dev/pts/3

GTM>h
sam@sam-desktop:~/pocn-moh$ cd
sam@sam-desktop:~$ ls
1281251308247.xls
astropubkey.asc
AUPNLK_investigation.txt
Desktop
Documents
Downloads
examples.desktop
fm-projection
GF3.mp3
Music
mysql-dfsg-5.1-5.1.41
mysql-dfsg-5.1-5.1.41-1
ovtemp
paps-0.6.8
paps_0.6.8-2.diff.gz
paps_0.6.8-2.dsc
paps_0.6.8.orig.tar.gz
patches
Pictures
pocn-moh
Public
rpms201011
swdev
swdev-prod-platinum_online_all_mumps.mbk_2010151220002.tgz
Templates
TMGGRC1.m
TMGGRC2.m
TMGGRC3.m
Videos
vistadev-prod-platinum_online_all_mumps.mbk_2009341121729.tgz
sam@sam-desktop:~$ cat TMGGRC1.m
TMGGRC1 ;TMG/kst-Work with Growth Chart Data ;10/5/10 ; 3/13/11 11:48am
                ;;"1.0;TMG-LIB;**1**;10/5/10;Build 21
        ;
        ;"Code FOR working with pediatric growth chart data.
        ;"NOTE: Data is stored in custom file 22713
        ;"      TMGFIX3 loaded in this data
        ;"
        ;"Kevin Toppenberg MD
        ;"(C) 10/5/10
        ;"Released under: GNU General Public License (GPL)
        ;
        ;"=======================================================================
        ;" RPC -- Public Functions.
        ;"=======================================================================
        ;"LENPCTL(AGEYR,GENDER,LEN,NONULL)    -- Return percentile of length FOR age
        ;"HCPCTL(AGEYR,GENDER,HC,NONULL)      -- Return percentile of head circumference for age
        ;"WTPCTL(AGEYR,GENDER,WT,NONULL)      -- Return percentile of weight for age
        ;"BMIPCTL(AGEYR,GENDER,BMI,NONULL)    -- Return percentile of BMI FOR age
        ;"WTLENPCT(AGEYR,GENDER,WT,LEN,NONULL) - Return percentile of WT, LEN combo
        ;"WHOHAPCTL(AGEYR,GENDER,LEN,NONULL)  -- Return percentile of WHO height FOR age
        ;"WHOHCPCTL(AGEYR,GENDER,HC,NONULL)   -- Return percentile of WHO head circumference for age
        ;"WHOWAPCTL(AGEYR,GENDER,WT,NONULL)   -- Return percentile of WHO weight for age
        ;"WHOBAPCTL(AGEYR,GENDER,BMI,NONULL)  -- Return percentile of WHO BMI FOR age
        ;"WHOWLPCT(AGEYR,GENDER,WT,LEN,NONULL) - Return percentile of WHO WT, LEN combo
        ;"WHOWSPCT(AGEYR,GENDER,WT,LEN,NONULL) - Return percentile of WHO WT,Stature combo
        ;"---
        ;"LENREF(MODE,GENDER,ARRAY,RLINES)    -- Return array with data for %tile curves
        ;"HCREF(MODE,GENDER,ARRAY,RLINES)     -- Return array with data for %tile curves
        ;"WTREF(MODE,GENDER,ARRAY,RLINES)     -- Return array with data for %tile curves
        ;"BMIREF(MODE,GENDER,ARRAY,RLINES)    -- Return array with data for %tile curves
        ;"WTLENREF(MODE,GENDER,ARRAY,RLINES)  -- Return array with data for %tile curves
        ;"WHOBMIREF(MODE,GENDER,ARRAY,RLINES) -- Return array with data for %tile curves
        ;"WHOHAREF(MODE,GENDER,ARRAY,RLINES)  -- Return array with data for %tile curves
        ;"WHOWAREF(MODE,GENDER,ARRAY,RLINES)  -- Return array with data for %tile curves
        ;"WHOHCREF(MODE,GENDER,ARRAY,RLINES)  -- Return array with data for %tile curves
        ;"WHOWLREF(MODE,GENDER,ARRAY,RLINES)  -- Return array with data for %tile curves
        ;"WHOWSREF(MODE,GENDER,ARRAY,RLINES)  -- Return array with data for %tile curves
        ;"=======================================================================
        ;"PRIVATE API FUNCTIONS
        ;"=======================================================================
        ;"COMMON(GRAPH,YVAL,XVAL,GENDER,NONULL) -- common lookup for all graphs
        ;"GETLMS(CHART,MONTHS,GENDER,L,M,S) --return the LMS values for a given chart
        ;"LMS2Z(X,L,M,S) --convert Input value X, and L,M,S SET  into a Z score
        ;"LMSZ2Y(L,M,S,Z) --convert a LMS pair + Z score into a value (e.g. weight for Z=-1.645)
        ;"LMSP2Y(L,M,S,P) --convert  LMS pair + %tile --> value (e.g. weight for 5th %tile)
        ;"Z2PCTL(Z)-- Convert a Z score into a Percentile
        ;"PCTL2Z(P) -- Convert a percentile to an approximated Z-score
        ;"SETSUFFIX(NUM) --Return a suffix, e.g. 1-->'st %tile', 2--> '2nd %tile' etc.
        ;"
        ;"=======================================================================
        ;
LENPCTL(AGEYR,GENDER,LEN,NONULL)        ;
               ;"Purpose: Return percentile of length for age
               ;"Input: AGEYR: age in *Years*
               ;"       GENDER: should be M or F
               ;"       LEN: stature or recumbent length in *Cm*
               ;"       NONNULL: OPTIONAL, default=0.  If 1 then 'N/A' is returned instead of ''
               ;"Results: e.g. 54th %tile, or "" IF invalid.  If NONNULL=1, then return 'N/A'
               NEW GRAPH,RESULT
               IF (+$GET(AGEYR)*12)<24 SET GRAPH="LENGTH BY AGE -- INFANT"
               ELSE  SET GRAPH="STATURE BY AGE"
               NEW MONTHS SET MONTHS=+$GET(AGEYR)*12
               SET RESULT=$$COMMON(GRAPH,.LEN,.MONTHS,.GENDER,.NONULL) ;
               QUIT RESULT
               ;
HCPCTL(AGEYR,GENDER,HC,NONULL)  ;
               ;"Purpose: Return percentile of head circumference for age
               ;"Input: AGEYR: age in *Years*
               ;"       GENDER: should be M or F
               ;"       HC: Head circumference in *Cm*
               ;"       NONNULL: OPTIONAL, default=0.  If 1 then 'N/A' is returned instead of ''
               ;"Results: e.g. 54th %tile, or "" IF invalid.  If NONNULL=1, then return 'N/A'
               NEW MONTHS SET MONTHS=+$GET(AGEYR)*12
               NEW RESULT
               SET RESULT=$$COMMON("HEAD CIRC BY AGE -- INFANT",.HC,.MONTHS,.GENDER,.NONULL) ;
               QUIT RESULT
               ;
WTPCTL(AGEYR,GENDER,WT,NONULL)  ;
               ;"Purpose: Return percentile of weight for age
               ;"Input: AGEYR: age in *Years*
               ;"       GENDER: should be M or F
               ;"       WT: weight in *Kg*
               ;"       NONNULL: OPTIONAL, default=0.  If 1 then 'N/A' is returned instead of ''
               ;"Results: e.g. 54th %tile, or "" IF invalid.  If NONNULL=1, then return 'N/A'
               NEW GRAPH,RESULT
               IF (+$GET(AGEYR)*12)<24 SET GRAPH="WEIGHT BY AGE -- INFANT"
               ELSE  SET GRAPH="WEIGHT BY AGE"
               NEW MONTHS SET MONTHS=+$GET(AGEYR)*12
               SET RESULT=$$COMMON(GRAPH,.WT,.MONTHS,.GENDER,.NONULL) ;
               QUIT RESULT
               ;
BMIPCTL(AGEYR,GENDER,BMI,NONULL)        ;
               ;"Purpose: Return percentile of BMI FOR age
               ;"Input: AGEYR: age in *Years*
               ;"       GENDER: should be M or F
               ;"       BMI: weight in Kg/M**2
               ;"       NONNULL: OPTIONAL, default=0.  If 1 then 'N/A' is returned instead of ''
               NEW MONTHS SET MONTHS=+$GET(AGEYR)*12
               NEW RESULT
               SET RESULT=$$COMMON("BMI BY AGE",.BMI,.MONTHS,.GENDER,.NONULL) ;
               QUIT RESULT
               ;
WTLENPCT(AGEYR,GENDER,WT,LEN,NONULL)    ;
               ;"Purpose: Return percentile of WT, LEN combo
               ;"Input: AGEYR: age in *Years*
               ;"       GENDER: should be M or F
               ;"       WT: weight in Kg
               ;"       LEN: stature or recumbent length in *Cm*
               ;"       NONNULL: OPTIONAL, default=0.  If 1 then 'N/A' is returned instead of ''
               ;"Results: e.g. 54th %tile, or "" IF invalid.  If NONNULL=1, then return 'N/A'
               NEW GRAPH,RESULT
               IF ((+$GET(AGEYR)*12)<12)!(LEN<77)  DO
               . SET GRAPH="WEIGHT FOR LENGTH -- INFANT"
               ELSE  DO
               . SET GRAPH="WEIGHT FOR STATURE"
               SET RESULT=$$COMMON(GRAPH,.WT,.LEN,.GENDER,.NONULL) ;
               QUIT RESULT
               ;
WHOHAPCTL(AGEYR,GENDER,LEN,NONULL)        ;
               ;"Purpose: Return percentile of WHO length for age
               ;"Input: AGEYR: age in *Years*
               ;"       GENDER: should be M or F
               ;"       LEN: stature or recumbent length in *Cm*
               ;"       NONNULL: OPTIONAL, default=0.  If 1 then 'N/A' is returned instead of ''
               ;"Results: e.g. 54th %tile, or "" IF invalid.  If NONNULL=1, then return 'N/A'
               NEW RESULT
               NEW MONTHS SET MONTHS=+$GET(AGEYR)*12
               SET RESULT=$$COMMON("WHO-HEIGHT BY AGE",.LEN,.MONTHS,.GENDER,.NONULL) ;
               QUIT RESULT
               ;
WHOHCPCTL(AGEYR,GENDER,HC,NONULL)         ;
        ;"Purpose: Return percentile of WHO head circumference for age
               ;"Input: AGEYR: age in *Years*
               ;"       GENDER: should be M or F
               ;"       HC: Head circumference in *Cm*
               ;"       NONNULL: OPTIONAL, default=0.  If 1 then 'N/A' is returned instead of ''
               ;"Results: e.g. 54th %tile, or "" IF invalid.  If NONNULL=1, then return 'N/A'
               NEW MONTHS SET MONTHS=+$GET(AGEYR)*12
               NEW RESULT
               SET RESULT=$$COMMON("WHO-HEAD CIRC BY AGE",.HC,.MONTHS,.GENDER,.NONULL) ;
               QUIT RESULT
               ;
WHOWAPCTL(AGEYR,GENDER,WT,NONULL)         ;
               ;"Purpose: Return percentile of WHO weight for age
               ;"Input: AGEYR: age in *Years*
               ;"       GENDER: should be M or F
               ;"       WT: weight in *Kg*
               ;"       NONNULL: OPTIONAL, default=0.  If 1 then 'N/A' is returned instead of ''
               ;"Results: e.g. 54th %tile, or "" IF invalid.  If NONNULL=1, then return 'N/A'
               NEW RESULT
               NEW MONTHS SET MONTHS=+$GET(AGEYR)*12
               SET RESULT=$$COMMON("WHO-WEIGHT BY AGE",.WT,.MONTHS,.GENDER,.NONULL) ;
               QUIT RESULT
               ;
WHOBAPCTL(AGEYR,GENDER,BMI,NONULL)       ;
               ;"Purpose: Return percentile of WHO BMI FOR age
               ;"Input: AGEYR: age in *Years*
               ;"       GENDER: should be M or F
               ;"       BMI: weight in Kg/M**2
               ;"       NONNULL: OPTIONAL, default=0.  If 1 then 'N/A' is returned instead of ''
               NEW MONTHS SET MONTHS=+$GET(AGEYR)*12
               NEW RESULT
               SET RESULT=$$COMMON("WHO-BMI BY AGE",.BMI,.MONTHS,.GENDER,.NONULL) ;
               QUIT RESULT
               ;
WHOWLPCTL(AGEYR,GENDER,WT,LEN,NONULL)    ;
        ;"Purpose: Return percentile of WHO WT, LEN combo
               ;"Input: AGEYR: age in *Years*
               ;"       GENDER: should be M or F
               ;"       WT: weight in Kg
               ;"       LEN: stature or recumbent length in *Cm*
               ;"       NONNULL: OPTIONAL, default=0.  If 1 then 'N/A' is returned instead of ''
               ;"Results: e.g. 54th %tile, or "" IF invalid.  If NONNULL=1, then return 'N/A'
               NEW RESULT
               SET RESULT=$$COMMON("WHO-WEIGHT FOR LENGTH",.WT,.LEN,.GENDER,.NONULL) ;
               QUIT RESULT
               ;
WHOWSPCT(AGEYR,GENDER,WT,LEN,NONULL)     ;
        ;"Purpose: Return percentile of WHO WT, STATURE combo
               ;"Input: AGEYR: age in *Years*
               ;"       GENDER: should be M or F
               ;"       WT: weight in Kg
               ;"       LEN: stature or recumbent length in *Cm*
               ;"       NONNULL: OPTIONAL, default=0.  If 1 then 'N/A' is returned instead of ''
               ;"Results: e.g. 54th %tile, or "" IF invalid.  If NONNULL=1, then return 'N/A'
               NEW RESULT
               SET RESULT=$$COMMON("WHO-WEIGHT FOR STATURE",.WT,.LEN,.GENDER,.NONULL) ;
               QUIT RESULT
               ;
COMMON(GRAPH,YVAL,XVAL,GENDER,NONULL)   ;
               ;"Purpose: common lookup for all graphs
               ;"Input: GRAPH -- The name of the graph to lookup.
               ;"       YVAL -- the value to lookup on the graph
               ;"       XVAL: Will be: Months or Length
               ;"       GENDER: should be M or F
               ;"       NONNULL: OPTIONAL, default=0.  If 1 then 'N/A' is returned instead of ''
               ;"Results: e.g. 54th %tile, or "" IF invalid.  If NONNULL=1, then return 'N/A'
               ;
               NEW DIC,X,Y,L,M,S
               SET NONULL=$GET(NONULL)
               NEW RESULT SET RESULT=$SELECT(+NONULL'=0:"N/A",1:"")  ;"default
               IF +$GET(XVAL)=0 GOTO COMQT
               SET GENDER=$EXTRACT($$UP^XLFSTR(GENDER),1)
               IF (GENDER'="M")&(GENDER'="F") GOTO COMQT
               SET YVAL=+$GET(YVAL) IF YVAL=0 GOTO COMQT
               SET DIC=22713,DIC(0)="M",X=$GET(GRAPH)
               DO ^DIC
               IF +Y'>0 GOTO COMQT
               ;"IF GRAPH="WHO-WEIGHT FOR LENGTH" SET XVAL=XVAL\1    ;"ELH TEST
               IF +$$GETLMS(Y,XVAL,GENDER,.L,.M,.S)<0 GOTO COMQT
               NEW Z SET Z=$$LMS2Z(YVAL,L,M,S)
               NEW W SET W=$$Z2PCTL(Z)\1
               IF W=-1 SET RESULT="Invalid value" GOTO COMQT
           SET RESULT=$$SETSUFFIX(W)
               ;
COMQT     QUIT RESULT
               ;
LENREF(MODE,GENDER,ARRAY,RLINES)         ;
               ;"Purpose: Return array filled with data for percentile curves
               ;"Input: MODE -- 1 if for age range 0-36 months, 2 if age 2-20 yrs
               ;"       GENDER -- M OR F
               ;"       ARRAY -- PASS BY REFERENCE.  AN OUT PARAMETER.  PRIOR VALUES KILLED.
               ;"           ARRAY(%tile,Age)=x^y
               ;"       RLINES -- OPTIONAL.  Default='5,10,25,50,75,95' Listing of which lines to get
               ;"Result: none
               NEW GRAPH
               IF +$GET(MODE)=1 SET GRAPH="LENGTH BY AGE -- INFANT"
               ELSE  SET GRAPH="STATURE BY AGE"
               DO COMMONREF(MODE,GENDER,GRAPH,.ARRAY,.RLINES) ;
               QUIT
               ;
HCREF(MODE,GENDER,ARRAY,RLINES) ;
               ;"Purpose: Return array filled with data for percentile curves
               ;"Input: Same as for LENREF (see above)
               DO COMMONREF(MODE,GENDER,"HEAD CIRC BY AGE -- INFANT",.ARRAY) ;
               QUIT
               ;
WTREF(MODE,GENDER,ARRAY,RLINES) ;
               ;"Purpose: Return array filled with data for percentile curves
               ;"Input: Same as for LENREF (see above)
               NEW GRAPH
               IF +$GET(MODE)=1 SET GRAPH="WEIGHT BY AGE -- INFANT"
               ELSE  SET GRAPH="WEIGHT BY AGE"
               DO COMMONREF(MODE,GENDER,GRAPH,.ARRAY,.RLINES) ;
               QUIT
               ;
BMIREF(MODE,GENDER,ARRAY,RLINES)        ;
               ;"Purpose: Return array filled with data for percentile curves
               ;"Input: Same as for LENREF (see above)
               DO COMMONREF(MODE,GENDER,"BMI BY AGE",.ARRAY,.RLINES) ;
               QUIT
               ;
WTLENREF(MODE,GENDER,ARRAY,RLINES)      ;
               ;"Purpose: Return array filled with data for percentile curves
               ;"Input: MODE -- 1 if for age range 0-36 months, 2 if age 2-20 yrs
               ;"       GENDER -- M OR F
               ;"       ARRAY -- PASS BY REFERENCE.  AN OUT PARAMETER.  PRIOR VALUES KILLED.
               ;"           ARRAY(%tile,x)=x^y  ;x=LengthOrStature
               ;"       RLINES -- OPTIONAL.  Default='5,10,25,50,75,95' Listing of which lines to get
               NEW GRAPH
               IF +$GET(MODE)=1 SET GRAPH="WEIGHT FOR LENGTH -- INFANT"
               ELSE  SET GRAPH="WEIGHT FOR STATURE"
               DO COMMONREF(MODE,GENDER,GRAPH,.ARRAY,.RLINES) ;
               QUIT
               ;
WHOBMIREF(MODE,GENDER,ARRAY,RLINES)      ;
        ;"Purpose: Return array filled with data for percentile curves
               ;"Input: MODE -- 1 if for age range 0-36 months, 2 if age 2-20 yrs, 3 if age range 0-60 months
        DO COMMONREF(MODE,GENDER,"WHO-BMI BY AGE",.ARRAY,.RLINES) ;
               QUIT
        ;
WHOHAREF(MODE,GENDER,ARRAY,RLINES)        ;
        ;"Purpose: Return array filled with data for percentile curves
               ;"Input: Same as for WHOBMIREF (see above)
        DO COMMONREF(MODE,GENDER,"WHO-HEIGHT BY AGE ",.ARRAY,.RLINES) ;
               QUIT
        ;
WHOWAREF(MODE,GENDER,ARRAY,RLINES)        ;
        ;"Purpose: Return array filled with data for percentile curves
               ;"Input: Same as for WHOBMIREF (see above)
        DO COMMONREF(MODE,GENDER,"WHO-WEIGHT BY AGE",.ARRAY,.RLINES) ;
               QUIT
        ;
WHOHCREF(MODE,GENDER,ARRAY,RLINES)        ;
        ;"Purpose: Return array filled with data for percentile curves
               ;"Input: Same as for WHOBMIREF (see above)
        DO COMMONREF(MODE,GENDER,"WHO-HEAD CIRC BY AGE",.ARRAY,.RLINES) ;
               QUIT
        ;
WHOWLREF(MODE,GENDER,ARRAY,RLINES)        ;
        ;"Purpose: Return array filled with data for percentile curves
               ;"Input: Same as for WHOBMIREF (see above)
        DO COMMONREF(MODE,GENDER,"WHO-WEIGHT FOR LENGTH",.ARRAY,.RLINES) ;
               QUIT
        ;
WHOWSREF(MODE,GENDER,ARRAY,RLINES)        ;
        ;"Purpose: Return array filled with data for percentile curves
               ;"Input: Same as for WHOBMIREF (see above)
        DO COMMONREF(MODE,GENDER,"WHO-WEIGHT FOR STATURE",.ARRAY,.RLINES) ;
               QUIT
        ;
COMMONREF(MODE,GENDER,GRAPH,ARRAY,RLINES)       ;
               ;"Purpose: Return array filled with data for percentile curves
               ;"Input: MODE -- 1 if for age range 0-36 months, 2 if age 2-20 yrs, 3 if age range 0-60 months
        ;"               4 age range 0-24 months, 5 age range 24-60 months, 6 age range 0-6 months,
        ;"               7 age range 6-24 months, 8 age range 0-13 months
               ;"       GENDER -- M OR F
               ;"       GRAPH -- Name of graph
               ;"       ARRAY -- PASS BY REFERENCE.  AN OUT PARAMETER.  PRIOR VALUES KILLED.
               ;"           ARRAY(%tile,x)=x^y
               ;"       RLINES -- OPTIONAL.  Default='5,10,25,50,75,95' Listing of which %tile lines to get
               ;"Result: none
               NEW DIC,X,Y,L,M,S
               KILL ARRAY
               SET GENDER=$EXTRACT($$UP^XLFSTR(GENDER),1)
               IF (GENDER'="M")&(GENDER'="F") GOTO CMRFQT
               SET DIC=22713,DIC(0)="M",X=$GET(GRAPH)
               DO ^DIC
               IF +Y'>0 GOTO CMRFQT
               NEW IEN SET IEN=+Y
               NEW X0,XINC,XMAX
               IF (GRAPH="WEIGHT FOR LENGTH -- INFANT") DO
               . SET X0=80,XINC=5,XMAX=140  ;"X axis here is LENGTH, and Y = Weight
               . ;"SET X0=45,XINC=10,XMAX=105  ;"X axis here is LENGTH, and Y = Weight
               ELSE  IF (GRAPH="WEIGHT FOR STATURE") DO
               . SET X0=75,XINC=5,XMAX=125  ;"X axis here is STATURE, and Y = Weight
               ELSE  IF (GRAPH="WHO-WEIGHT FOR LENGTH") DO
               . SET X0=65,XINC=5,XMAX=130
               ELSE  DO
               . IF MODE=1 SET X0=0,XINC=1,XMAX=36
               . ELSE  IF MODE=2 SET X0=24,XINC=12,XMAX=240
        . ELSE  IF MODE=3 SET X0=0,XINC=2,XMAX=60
        . ELSE  IF MODE=4 SET X0=0,XINC=1,XMAX=24
        . ELSE  IF MODE=5 SET X0=24,XINC=2,XMAX=60
        . ELSE  IF MODE=6 SET X0=0,XINC=1,XMAX=6
        . ELSE  IF MODE=7 SET X0=6,XINC=2,XMAX=24
        . ELSE  SET X0=0,XINC=1,XMAX=3
               SET RLINES=$GET(RLINES,"5,10,25,50,75,95")
               SET X=X0
               NEW ZARRAY,Z
               NEW ABORT SET ABORT=0
               FOR  DO  SET X=X+XINC QUIT:(X>XMAX)!ABORT
               . IF +$$GETLMS(IEN,X,GENDER,.L,.M,.S)<0 SET ABORT=1 QUIT
               . NEW P,PCTLNUM
               . FOR PCTLNUM=1:1:$LENGTH(RLINES,",")  DO
               . . SET P=+$PIECE(RLINES,",",PCTLNUM) QUIT:(P'>0)
               . . IF $GET(ZARRAY(P))="" SET ZARRAY(P)=$$PCTL2Z(P)
               . . SET Z=ZARRAY(P)
               . . NEW VAL SET VAL=$$LMSZ2Y(L,M,S,Z)
               . . SET VAL=+$JUSTIFY(VAL,0,2)
               . . SET ARRAY(P,X)=X_"^"_VAL
               ;
CMRFQT   QUIT
               ;
        ;"====================================================================
        ;"====================================================================
GETLMS(CHART,MONTHS,GENDER,L,M,S)       ;
               ;"Purpose: return the LMS values for a given chart
               ;"Input: CHART --Name of the chart to reference, OR, IEN^Name of chart to use.
               ;"       MONTHS -- The age to use for lookup in the chart
               ;"       GENDER -- MUST be "M" or "F" FOR male or female
               ;"       L, M, S -- PASS BY REFERENCE, OUT Parameters.  Prior values killed
               ;"Results: 1 IF successful, -1^Message IF error (Message is optional)
               ;"Output:  L,M,S are filled with data IF valid
               NEW RESULT SET RESULT=0
               NEW IEN SET IEN=+$GET(CHART)
               IF IEN'>0 DO
               . NEW DIC,X,Y
               . SET DIC=22713,DIC(0)="M"
               . SET X=$GET(CHART)
               . DO ^DIC
               . SET IEN=+Y
               IF IEN'>0 DO  GOTO GLMSDN
               . SET RESULT="-1^Unable to find chart: '"_$GET(CHART)_"'"
               SET GENDER=$GET(GENDER)
               IF (GENDER'="M")&(GENDER'="F") DO  GOTO GLMSDN
               . SET RESULT="-1^Invalid GENDER. Should be 'M' or 'F'.  Got: '"_GENDER_"'"
               SET MONTHS=$GET(MONTHS)
               IF +MONTHS'=MONTHS DO  GOTO GLMSDN
               . SET RESULT="-1^Invalid AGE.  Should be numeric value.  Got: '"_MONTHS_"'"
               KILL L,M,S
               NEW MO1,MO2
               IF (CHART="13")!(CHART["13^WHO") DO  ;"WHO-WEIGHT FOR LENGTH
               . NEW N SET N=$JUSTIFY(MONTHS,0,1)
               . NEW D SET D=$PIECE(N,".",2)
               . SET N=$PIECE(N,".",1)
               . IF D'<0.5 DO
               . . SET MO1=N_".5"
               . . SET MO2=MONTHS\1+1
               . ELSE  DO
               . . SET MO1=MONTHS\1
               . . SET MO2=MO1+0.5
               ELSE  DO
               . SET MO1=(MONTHS\1)-.01
               . IF MO1<0 DO
               . . SET MO1=0
               . . SET MO2=0.99
               . ELSE  SET MO2=MO1+1
               ;
               IF MO1=23.99 DO
               . IF (CHART="1")!(CHART="5")!(CHART="4")!(CHART["1^BMI")!(CHART["5^WEIGHT")!(CHART["4^STATURE") SET MO1=24
               NEW L1,L2,M1,M2,S1,S2
               ;
               IF $$GEXCTLMS(IEN,MO1,GENDER,.L1,.M1,.S1)=0 DO  GOTO GLMSDN
               . SET RESULT="-1^Unable to find LMS data for lower end of age range."
               IF $$GEXCTLMS(IEN,MO2,GENDER,.L2,.M2,.S2)=0 DO  GOTO GLMSDN
               . SET RESULT="-1^Unable to find LMS data for upper end of age range."
               ;
               DO INTRPLMS(MONTHS,MO1,MO2,L1,M1,S1,L2,M2,S2,.L,.M,.S)
               ;
               ;"Get correct Age interval
               ;"IF $DATA(^TMG(22713,IEN,"D","B",MONTHS))=0 DO  GOTO:(+RESULT=-1) GLMSDN
               ;". NEW MONTHS2 SET MONTHS2=$ORDER(^TMG(22713,IEN,"D","B",MONTHS))  ;"convert e.g. 31.2 --> 31.99
               ;". IF CHART'["13^WHO" DO  ;"WHO-WEIGHT FOR LENGTH
               ;". . IF (MONTHS\1)'=(MONTHS2\1) SET MONTHS2=""  ;"Ensure e.g. 31.2 doesn't goto 40.99
               ;". IF MONTHS2="" DO  QUIT
               ;". . SET RESULT="-1^Unable to find age interfal FOR AGE:  Got: '"_MONTHS_"'"
               ;". SET MONTHS=MONTHS2
               ;"NEW DONE SET DONE=0
               ;"NEW I SET I=0
               ;"FOR  SET I=$ORDER(^TMG(22713,IEN,"D","B",MONTHS,I)) QUIT:(+I'>0)!DONE  DO
               ;". NEW NODE SET NODE=$GET(^TMG(22713,IEN,"D",I,0)) QUIT:NODE=""
               ;". IF $PIECE(NODE,"^",2)'=GENDER QUIT
               ;". SET DONE=1,RESULT=1
               ;". SET L=$PIECE(NODE,"^",3)
               ;". SET M=$PIECE(NODE,"^",4)
               ;". SET S=$PIECE(NODE,"^",5)
GLMSDN   QUIT RESULT
               ;
GEXCTLMS(CHART,MONTHS,GENDER,L,M,S)      ;
               ;"Purpose: return the LMS values for a given chart -- ROUNDING AGE TO EXACT INTERVAL
               ;"Note: input validation not done in this function.  Private API
               ;"Input: CHART -- IEN of the chart to reference
               ;"       MONTHS -- The age to use for lookup in the chart -- ROUNDED TO EXACT INTERVAL
               ;"          It is expected that this month will EXACTLY match the intervals in the data
               ;"       GENDER -- MUST be "M" or "F" FOR male or female
               ;"       L, M, S -- PASS BY REFERENCE, OUT Parameters.  Prior values killed
               ;"Results: 1 IF successful, 0 otherwise
               ;"Output:  L,M,S are filled with data IF valid
               KILL L,M,S
               NEW DONE SET DONE=0
               NEW I SET I=0
               IF $EXTRACT(MONTHS,1)="." SET MONTHS="0"_MONTHS
               FOR  SET I=$ORDER(^TMG(22713,IEN,"D","B",MONTHS,I)) QUIT:(+I'>0)!DONE  DO
               . NEW NODE SET NODE=$GET(^TMG(22713,IEN,"D",I,0)) QUIT:NODE=""
               . IF $PIECE(NODE,"^",2)'=GENDER QUIT
               . SET DONE=1,RESULT=1
               . SET L=$PIECE(NODE,"^",3)
               . SET M=$PIECE(NODE,"^",4)
               . SET S=$PIECE(NODE,"^",5)
               QUIT ($DATA(L)'=0)
               ;
INTRPLMS(MONTHS,MO1,MO2,L1,M1,S1,L2,M2,S2,L,M,S)        ;
               ;"Purpose: to return an interpolated LMS based on input values
               ;"Input: MONTHS -- the patient's actual age
               ;"       MO1,M02 -- the patient's age rounded to lower and upper ends of age range
               ;"       L1,M1,S2 -- the LMS values for the lower end of the age range
               ;"       L2,M2,S2 -- the LMS values for the upper end of the age range
               ;"       L,M,S -- PASS BY REFERENCE.  This is the output values
               SET L=$$INTERPLT(MONTHS,MO1,MO2,L1,L2)
               SET M=$$INTERPLT(MONTHS,MO1,MO2,M1,M2)
               SET S=$$INTERPLT(MONTHS,MO1,MO2,S1,S2)
               QUIT
               ;
INTERPLT(X,X1,X2,Y1,Y2)  ;
               ;"Purpose: Return an interpolated value
               ;"Input: X - the measured value
               ;"       X1,X2 -- the lower and upper known x values
               ;"       Y1,Y2 -- the lower and upper known y values
               ;"Results: returns the interpolated value
               NEW SLOPE SET SLOPE=(Y2-Y1)/(X2-X1)
               NEW B SET B=Y1-(SLOPE*X1)
               NEW RESULT SET RESULT=(SLOPE*X)+B
               QUIT RESULT
               ;
LMS2Z(X,L,M,S)  ;
               ;"Purpose: convert Input Patient measurement value X, and L,M,S SET  into a Z score
               ;"Input: X -- This is the value of the patient measurement, units should
               ;"            be the same as specified in INPUT UNITS field FOR [[record~|Record]]
               ;"      L,M,S -- These are Values as may be obtained by GETLMS()
               ;"Results: Outputs the Z score
               ;"
               ;"formula used is Z = [((X/M)**L) - 1] / LS  where L <> 0
               ;"             or Z = ln(X/M)/S  where L=0
               NEW RESULT SET RESULT=0
               SET L=+$GET(L),M=+$GET(M),S=+$GET(S),X=+$GET(X)
               IF L=0 DO
               . NEW T
               . SET T=X/M
               . SET T=$$LN^XLFMTH(T)
               . SET RESULT=T/S
               ELSE  DO
               . NEW T
               . SET T=X/M
               . SET T=(T**L)-1
               . SET RESULT=T/(L*S)
               QUIT RESULT
               ;
LMSZ2Y(L,M,S,Z) ;
               ;"Purpose: To convert a LMS pair + Z score into a value (e.g. weight FOR 5th %tile, Z=-1.645)
               ;"Input: L,M,S -- LMS pair that describes normal distribution
               ;"         Z -- The z-score corelating to the desired %tile
               ;"Results: Returns value requested
               ;"Formula used: X= M (1 +LSZ)**(1/L) IF L<>0  or X = M exp(SZ) IF L=0
               ;
               NEW RESULT SET RESULT=0
               SET L=+$GET(L),M=+$GET(M),S=+$GET(S),X=+$GET(X),Z=+$GET(Z)
               NEW T
               IF L=0 DO
               . SET T=$$EXP^XLFMTH(S*Z)
               ELSE  DO
               . SET T=((L*S*Z)+1)**(1/L)
               SET RESULT=M*T
               QUIT RESULT
               ;
LMSP2Y(L,M,S,P) ;
               ;"Purpose: To convert a LMS pair + Percentil into a value (e.g. weight FOR 5th %tile)
               ;"Input: L,M,S -- LMS pair that describes normal distribution
               ;"         P -- Percentile of desired value.  0-100
               ;"Results: Returns value requested, or -1 IF error
               NEW RESULT SET RESULT=-1
               NEW Z SET Z=$$PCTL2Z(+$GET(P))
               IF Z="E" GOTO LP2XDN
               SET RESULT=$$LMSZ2Y(.L,.M,.S,Z)
LP2XDN   QUIT RESULT
               ;
Z2PCTL(Z)       ;
               ;"Purpose: To convert a Z score into a Percentile
               ;"Input: Z : zscore
               ;"Output: the Percentile, or -1 if invalid
               ;"NOTE: Code from Cameron Schlehuber
               ;
           NEW $ETRAP SET $ETRAP="G ERRZ2PTL^TMGGRC1"
           NEW TMGERR SET TMGERR=0
           SET Z=+$GET(Z)
               NEW ABZ SET ABZ=$$ABS^XLFMTH(Z)
           ; Overflow error can happen here. TMGERR set to 1 if error occurs
               NEW P
               SET P=1-((1/$$SQRT^XLFMTH(2*3.14159265))*$$EXP^XLFMTH(-(ABZ**2)/2)*(0.4361836*(1/(1+(0.33267*ABZ)))-(0.1201676*((1/(1+(0.33267*ABZ)))**2))+(0.937298*((1/(1+(0.33267*ABZ)))**3))))
               IF TMGERR QUIT -1  ; Error happened.
           IF Z>0 SET P=P*100
               ELSE  SET P=100-(P*100)
               ;" SET P=P\1  ;"truncate decimal portion
               QUIT P
               ;
ERRZ2PTL    ; Process Error from Z2Percenticle function.
            S $ETRAP="D ^%ZTER H"
            I $ECODE[",M92," SET $ECODE="",TMGERR=1 QUIT:$QUIT "" QUIT  ; Process Numeric Overflow error
            E  QUIT:$QUIT "" QUIT  ; Otherwise, let default error handler do its work
PCTL2Z(P)       ;
               ;"Purpose: To Convert a percentile to an approximated Z-score
               ;"Input: P : Percentile (should be 0-100)
               ;"Code from function critz found at http://www.fourmilab.ch/rpkp/experiments/analysis/zCalc.js
               ;"   notes state that code was in public domain
               ;"Results: returns percentile, or "E" IF error
               ;
               NEW RESULT SET RESULT="E"
               NEW ZEPSILON SET ZEPSILON=0.000001  ;"Accuracy of Z approximation
               NEW MINZ SET MINZ=-6
               NEW MAXZ SET MAXZ=6
               NEW ZVAL SET ZVAL=0
               NEW PVAL
               SET P=+$GET(P)/100
               IF (P<0)!(P>1) GOTO PC2ZDN
               FOR  QUIT:((MAXZ-MINZ)'>ZEPSILON)  DO
               . SET PVAL=$$Z2PCTL(ZVAL)/100
               . IF PVAL>P SET MAXZ=ZVAL
               . ELSE  SET MINZ=ZVAL
               . SET ZVAL=(MAXZ+MINZ)*0.5
               SET RESULT=ZVAL
PC2ZDN   QUIT RESULT
               ;
SETSUFFIX(NUM)  ;
               ;"Purpose: Return a suffix, e.g. 1-->"st %tile", 2--> "2nd %tile" etc.
               ;"Input: NUM -- integer >0
               SET NUM=+$GET(NUM)
               NEW ENDNUM SET ENDNUM=$E(NUM,$L(NUM))+1 SET:(ENDNUM>5) ENDNUM=5
               QUIT NUM_$PIECE("th^st^nd^rd^th","^",ENDNUM)_" %tile"
               ;
        ;"=======================================================================
        ;"=======================================================================
TEST    ;
               NEW DIC,X,Y,Age,Gender
               SET DIC=22713,DIC(0)="MAEQ"
               DO ^DIC
               IF +Y'>0 QUIT
               write !
               write "The age range FOR this graph is: ",$$GET1^DIQ(22713,+Y,.06),!
               write "Please input ",$$GET1^DIQ(22713,+Y,.02)," (in ",$$GET1^DIQ(22713,+Y,.03),"): "
               read Age:60
               write !
               IF Age="^" QUIT
               write "Please enter patient value FOR ",$$GET1^DIQ(22713,+Y,.04)," (in ",$$GET1^DIQ(22713,+Y,.05),"): "
               read X:60,!
               IF X="^" QUIT
               read "Please Enter GENDER (must be 'M' or 'F'): ",Gender:60,!
               IF (Gender'="M")&(Gender'="F") write "??",! QUIT
               NEW L,M,S
               NEW TEMP SET TEMP=$$GETLMS(Y,Age,Gender,.L,.M,.S)
               IF +TEMP<0 write $P(TEMP,"^",2),! QUIT
               write "L=",L,!
               write "M=",M,!
               write "S=",S,!
               NEW Z SET Z=$$LMS2Z(X,L,M,S)
               write "That Z score is: ",Z,!
               write "%tile=",$$Z2PCTL(Z)\1,!
               write "For this input, we have the following normal values:",!
               NEW pctl
               FOR pctl=3,5,10,25,50,75,85,90,95,97 do
               . write pctl,"th: ",$$LMSP2Y(L,M,S,pctl),!
               QUIT
               ;

sam@sam-desktop:~$
sam@sam-desktop:~$ ls
1281251308247.xls
astropubkey.asc
AUPNLK_investigation.txt
Desktop
Documents
Downloads
examples.desktop
fm-projection
GF3.mp3
Music
mysql-dfsg-5.1-5.1.41
mysql-dfsg-5.1-5.1.41-1
ovtemp
paps-0.6.8
paps_0.6.8-2.diff.gz
paps_0.6.8-2.dsc
paps_0.6.8.orig.tar.gz
patches
Pictures
pocn-moh
Public
rpms201011
swdev
swdev-prod-platinum_online_all_mumps.mbk_2010151220002.tgz
Templates
TMGGRC1.m
TMGGRC2.m
TMGGRC3.m
Videos
vistadev-prod-platinum_online_all_mumps.mbk_2009341121729.tgz
sam@sam-desktop:~$ cd /tmp/
sam@sam-desktop:/tmp$ ls
fis-gtm               keyring-XLFo0U  pulse-PKdhtXMmr18n  ssh-qnykOl3605
gedit.sam.3636843392  orbit-gdm       pulse-YmsbHF1V23X7
gtm_mutex00000F83     orbit-sam       sam.txt
sam@sam-desktop:/tmp$ vim toread.txt
sam@sam-desktop:/tmp$ cd -
/home/sam
sam@sam-desktop:~$ cd pocn-moh/
sam@sam-desktop:~/pocn-moh$ mumps -dir

GTM>O "/tmp/toread.txt"

GTM>U "/tmp/toread.txt"

GTM>FOR  READ X QUIT:$ZEOF S Y(X)=""
%GTM-E-QUITARGUSE, Quit cannot take an argument in this context
        FOR  READ X QUIT:$ZEOF S Y(X)=""
                               ^-----

GTM>FOR  READ X QUIT:$ZEOF  S Y(X)=""

GTM>C "/tmp/toread.txt"

GTM>zwrite Y
Y("Line 1")=""
Y("Line 2")=""
Y("Line 3")=""
Y("Line 4")=""

GTM>; if writing to a file, you can add the following flags:

GTM>; (newversion): deletes the file and starts over

GTM>; (append); add to the end of the file.

GTM>O "/tmp/sam.txt":(append)

GTM>U "/tmp/sam.txt"

GTM>w "hello",!

GTM>w "hello again",!

GTM>C "/tmp/sam.txt"

GTM>zsy "cat /tmp/sam.txt"
$IO is /tmp/sam.txt
$P is /dev/pts/3
hello
hello again

GTM>O "/tmp/sam.txt":(newversion)

GTM>U "/tmp/sam.txt"

GTM>W "HELLO"

GTM>c "/tmp/sam.txt"

GTM>rec zsy

GTM>zsy "cat /tmp/sam.txt"
HELLO

GTM>O "/tmp/sam.txt"

GTM>U "/tmp/sam.txt"

GTM>W "HELLO AGAIN"
%GTM-E-NOTTOEOFONPUT, Not positioned to EOF on write (sequential organization only)

GTM>W !,"HELLO AGAIN"
%GTM-E-NOTTOEOFONPUT, Not positioned to EOF on write (sequential organization only)

GTM>U "/tmp/sam.txt":(truncate)

GTM>W !,"HELLO AGAIN"

GTM>c "/tmp/sam.txt"

GTM>rec zsy

GTM>zsy "cat /tmp/sam.txt"

HELLO AGAIN

GTM>open "/home/vista/.vim"
%SYSTEM-E-ENO2, No such file or directory

GTM>open "/home/vista/.vim"::5
%SYSTEM-E-ENO2, No such file or directory

GTM>; You can put the descriptors in a variable

GTM>S F="/tmp/sam.txt"

GTM>O F U F:(TRUNCATE) W "HELLO",!,"HELLO AGAIN",!,"HELLO 3" C F

GTM>rec zsy

GTM>zsy "cat /tmp/sam.txt"
HELLO
HELLO AGAIN
HELLO 3

GTM>; O F:(newversion)

GTM>; O F:(readonly)

GTM>; O F:(exception="g BADOPEN")

GTM>; U F:(width=132)

GTM>; O F:(append)

GTM>; C F:(delete)

GTM>O "/dev/pts/4"

GTM>U "/dev/pts/4"

GTM>W "Mickey mouse device",!

GTM>W "Isn't this so damn cool!!!",!

GTM>; Opening another terminal

GTM>C "/dev/pts/4"

GTM>; Null device

GTM>; /dev/null

GTM>set dev="/dev/null"

GTM>u dev
%GTM-E-IONOTOPEN, Attempt to USE an I/O device which has not been opened

GTM>o dev

GTM>u dev

GTM>w "this goes no where"

GTM>c dev

GTM>zed "XWBTCPM"

GTM>; Escape processing from the current device

GTM>; if a user presses, Ctrl-V, or F11, or Up or Down buttons, how to check
 that?

GTM>U $P:(escape)

GTM>R X S ESC=$ZB

GTM>W X

GTM>W ESC
V
GTM>R X S ESC=$ZB

GTM>R *X S ESC=$ZB

GTM>W X
27
GTM>W ESC
T
GTM>R *X S ESC=$ZB

GTM>W X
27
GTM>W ESC
GTM>W ESC
GTM>R *X S ESC=$ZB

GTM>W X
27
GTM>W ESC

GTM>R *X S ESC=$ZB

GTM>W X
2
GTM>W ESC

GTM>H
sam@sam-desktop:~/pocn-moh$ mumps -dir

GTM>H
sam@sam-desktop:~/pocn-moh$ export TERM="ansi"
sam@sam-desktop:~/pocn-moh$ mumps -dir

GTM>U $P:(ESCAPE)

GTM>R *X S ESC=$ZB

GTM>W X
27
GTM>W ESC

GTM>U $P:(NOECHO)

GTM>R X

GTM>W X
SDFGJKERTYUKIDFGHJK
GTM>ZWRITE ^%ZOSF
^%ZOSF("$INC")=0
^%ZOSF("ACTJ")="S Y=$$ACTJ^%ZOSV()"
^%ZOSF("AVJ")="S Y=$$AVJ^%ZOSV()"
^%ZOSF("BRK")="U $I:(CENABLE)"
^%ZOSF("DEL")="D DEL^%ZOSV2(X) ;N %RD,%OD S %RD=$P($S($ZRO[""("":$P($P($ZRO,
          ""("",2),"")""),1:$ZRO),"" "")_""/"",%OD=$S($ZRO[""("":$P($ZRO,""(
          "",1)_""/"",1:%RD) ZSYSTEM ""rm -f ""_%RD_X_"".m"" ZSYSTEM ""rm -f
           ""_%OD_X_"".o"""
^%ZOSF("EOFF")="U $I:(NOECHO)"
^%ZOSF("EON")="U $I:(ECHO)"
^%ZOSF("EOT")="S Y=$ZA\1024#2 ; <====="
^%ZOSF("ERRTN")="^%ZTER"
^%ZOSF("ETRP")="Q"
^%ZOSF("GD")="G ^%GD"
^%ZOSF("HASHLIST")="LEGACY|| MD5 SHA1 RIPEMD160 SHA256 SHA384 SHA512 SHA224
          ||/usr/bin/||GT.M (Unix)^19GNU/Linux||"
^%ZOSF("JOBPARAM")="G JOBPAR^%ZOSV"
^%ZOSF("LABOFF")="U IO:(NOECHO) ; <====="
^%ZOSF("LOAD")="D LOAD^%ZOSV2(X) ;S %N=0 F XCNP=XCNP+1:1 S %N=%N+1,%=$T(+%N^
          @X) Q:$L(%)=0  S @(DIF_XCNP_"",0)"")=%"
^%ZOSF("LPC")="S Y="""" ; <====="
^%ZOSF("MAGTAPE")="S %MT(""BS"")=""*1"",%MT(""FS"")=""*2"",%MT(""WTM"")=""*3
          "",%MT(""WB"")=""*4"",%MT(""REW"")=""*5"",%MT(""RB"")=""*6"",%MT("
          "REL"")=""*7"",%MT(""WHL"")=""*8"",%MT(""WEL"")=""*9"" ; <====="
^%ZOSF("MAXSIZ")="Q"
^%ZOSF("MGR")="EHR,EHR"
^%ZOSF("MTBOT")="S Y=$ZA\32#2 ; <====="
^%ZOSF("MTERR")="S Y=$ZA\32768#2 ; <====="
^%ZOSF("MTONLINE")="S Y=$ZA\64#2 ; <====="
^%ZOSF("MTWPROT")="S Y=$ZA\4#2 ; <====="
^%ZOSF("NBRK")="U $I:(NOCENABLE)"
^%ZOSF("NO-PASSALL")="U $I:(ESCAPE:TERMINATOR="""":NOPASTHRU)"
^%ZOSF("NO-TYPE-AHEAD")="U $I:(NOTYPEAHEAD)"
^%ZOSF("OS")="GT.M (Unix)^19"
^%ZOSF("PASSALL")="U $I:(NOESCAPE:NOTERMINATOR:PASTHRU)"
^%ZOSF("PRIINQ")="S Y=$$PRIINQ^%ZOSV()"
^%ZOSF("PRIORITY")="Q  ;G PRIORITY^%ZOSV"
^%ZOSF("PROD")="EHR,EHR"
^%ZOSF("PROGMODE")="S Y=$$PROGMODE^%ZOSV()"
^%ZOSF("RD")="G ^%RD"
^%ZOSF("RESJOB")="Q:'$D(DUZ)  Q:'$D(^XUSEC(""XUMGR"",+DUZ))  N XQZ S XQZ=""^
          FORCEX[MGR]"" D DO^%XUCI ; <====="
^%ZOSF("RM")="U $I:WIDTH=$S(X<256:X,1:0)"
^%ZOSF("RSEL")="K ^UTILITY($J) D ^%RSEL S X="""" X ""F  S X=$O(%ZR(X)) Q:X="
          """""""  S ^UTILITY($J,X)="""""""""" K %ZR"
^%ZOSF("RSUM")="S Y=0 F %=1,3:1 S %1=$T(+%^@X),%3=$F(%1,"" "") Q:'%3  S %3=$
          S($E(%1,%3)'="";"":$L(%1),$E(%1,%3+1)="";"":$L(%1),1:%3-2) F %2=1:
          1:%3 S Y=$A(%1,%2)*%2+Y"
^%ZOSF("RSUM1")="N %,%1,%2,%3 S Y=0 F %=1,3:1 S %1=$T(+%^@X),%3=$F(%1,"" "")
           Q:'%3  S %3=$S($E(%1,%3)'="";"":$L(%1),$E(%1,%3+1)="";"":$L(%1),1
          :%3-2) F %2=1:1:%3 S Y=$A(%1,%2)*(%2+%)+Y"
^%ZOSF("SAVE")="D SAVE^%ZOSV2(X) ;N %I,%F S %I=$I,%F=$P($S($ZRO[""("":$P($P(
          $ZRO,""("",2),"")""),1:$ZRO),"" "")_""/""_X_"".m"" O %F:(NEWVERSIO
          N) U %F X ""F  S XCN=$O(@(DIE_XCN_"""")"""")) Q:+XCN'=XCN  S %=@(D
          IE_XCN_"""",0)"""") Q:$E(%,1)=""""$""""  I $E(%)'="""";"""" W %,!"
          " C %F U %I"
^%ZOSF("SIZE")="S Y=0 F I=1:1 S %=$T(+I) Q:%=""""  S Y=Y+$L(%)+2 ; <====="
^%ZOSF("SS")="D ^ZSY"
^%ZOSF("TEST")="I X]"""",$T(^@X)]"""""
^%ZOSF("TMK")="S Y=$ZA\16384#2"
^%ZOSF("TMP")="/tmp/"
^%ZOSF("TRAP")="$ZT=""G ""_X"
^%ZOSF("TRMOFF")="U $I:(TERMINATOR="""")"
^%ZOSF("TRMON")="U $I:(TERMINATOR=$C(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1
          6,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,127))"
^%ZOSF("TRMRD")="S Y=$A($ZB)"
^%ZOSF("TYPE-AHEAD")="U $I:(TYPEAHEAD)"
^%ZOSF("UCI")="S Y=^%ZOSF(""PROD"")"
^%ZOSF("UCICHECK")="S Y=1"
^%ZOSF("UPPERCASE")="S Y=$TR(X,""abcdefghijklmnopqrstuvwxyz"",""ABCDEFGHIJKL
          MNOPQRSTUVWXYZ"")"
^%ZOSF("VOL")="EHR"
^%ZOSF("XY")="S $X=DX,$Y=DY ; <====="
^%ZOSF("ZD")="S Y=$$HTE^XLFDT(X,2) I $L($P(Y,""/""))=1 S Y=0_Y"

GTM>%GTM-I-CTRLC, CTRL_C encountered

GTM>%GTM-I-CTRLC, CTRL_C encountered

GTM>%GTM-I-CTRLC, CTRL_C encountered

GTM>%GTM-I-CTRLC, CTRL_C encountered

GTM>U $P:(NOCENABLE)

GTM>U $P:(CENABLE)
%GTM-E-SPOREOL, Either a space or an end-of-line was expected but not found
        U $P:(CENABLE).
                      ^-----

GTM>U $P:(CENABLE)

GTM>%GTM-I-CTRLC, CTRL_C encountered

GTM>%GTM-I-CTRLC, CTRL_C encountered

GTM>%GTM-I-CTRLC, CTRL_C encountered

GTM>H
%GTM-E-SPOREOL, Either a space or an end-of-line was expected but not found
        H.
         ^-----

GTM>H
sam@sam-desktop:~/pocn-moh$ export TERM="linux"
sam@sam-desktop:~/pocn-moh$ gtm
%GTM-E-NONUTF8LOCALE, Locale has character encoding (ANSI_X3.4-1968) which is not compatible with UTF-8 character set
%GTM-E-NONUTF8LOCALE, Locale has character encoding (ANSI_X3.4-1968) which is not compatible with UTF-8 character set
%GTM-E-NONUTF8LOCALE, Locale has character encoding (ANSI_X3.4-1968) which is not compatible with UTF-8 character set
sam@sam-desktop:~/pocn-moh$ mumps -dir

GTM>O dev="/dev/null
%GTM-E-SPOREOL, Either a space or an end-of-line was expected but not found
        O dev="/dev/null
                        ^-----

GTM>h
sam@sam-desktop:~/pocn-moh$ export TERM="xterm"
sam@sam-desktop:~/pocn-moh$ mumps -dir

GTM>s
%GTM-E-SPOREOL, Either a space or an end-of-line was expected but not found
        s
         ^-----

GTM>

GTM>r x

GTM>r y

GTM>w y

GTM>u $p:(escape)

GTM>r *x

GTM>w x
27
GTM>w $zb
P
GTM>r x

GTM>w x

GTM>set dev="/dev/null"

GTM>o dev u dev

GTM>w "this isn't going anywhere at all!!!"

GTM>c dev

GTM>set dev="/dev/pts/4"

GTM>o dev u dev

GTM>w "Hello",!

GTM>w "how are you?",!

GTM>c dev

GTM>%GTM-I-CTRLC, CTRL_C encountered

GTM>%GTM-I-CTRLC, CTRL_C encountered

GTM>%GTM-I-CTRLC, CTRL_C encountered

GTM>u $p:(nocenable)

GTM>
[1]+  Stopped                 mumps -dir
sam@sam-desktop:~/pocn-moh$ fg %1
mumps -dir

%GTM-E-CMD, Command expected but not found
        ..
        ^-----

GTM>u $p:(cenable)

GTM>zwrite ^DD(:)
^DD("$O")="S Y=""%"" F %=0:0 S Y=$O(@Y) Q:Y=""""  S %=$D(@Y) S:%#2 @(X_""Y)=
          ""_Y) I %>9 S %X=Y_""("",%Y=X_""Y,"" D %XY^%RCR"
^DD("DD")="S Y=$$FMTE^DILIBF(Y,""5U"")"
^DD("DILOCKTM")=3
^DD("KWIC")="^AND^THE^THEN^FOR^FROM^OTHER^THAN^WITH^THEIR^SOME^THIS^and^the^
          then^for^from^other^than^with^their^some^this"
^DD("OS")=19
^DD("ROU")=15000
^DD("SITE")="MOH - Amman, Jordan"
^DD("VERSION")="22.0"

GTM>zwrite ^%ZOSF
^%ZOSF("$INC")=0
^%ZOSF("ACTJ")="S Y=$$ACTJ^%ZOSV()"
^%ZOSF("AVJ")="S Y=$$AVJ^%ZOSV()"
^%ZOSF("BRK")="U $I:(CENABLE)"
^%ZOSF("DEL")="D DEL^%ZOSV2(X) ;N %RD,%OD S %RD=$P($S($ZRO[""("":$P($P($ZRO,
          ""("",2),"")""),1:$ZRO),"" "")_""/"",%OD=$S($ZRO[""("":$P($ZRO,""(
          "",1)_""/"",1:%RD) ZSYSTEM ""rm -f ""_%RD_X_"".m"" ZSYSTEM ""rm -f
           ""_%OD_X_"".o"""
^%ZOSF("EOFF")="U $I:(NOECHO)"
^%ZOSF("EON")="U $I:(ECHO)"
^%ZOSF("EOT")="S Y=$ZA\1024#2 ; <====="
^%ZOSF("ERRTN")="^%ZTER"
^%ZOSF("ETRP")="Q"
^%ZOSF("GD")="G ^%GD"
^%ZOSF("HASHLIST")="LEGACY|| MD5 SHA1 RIPEMD160 SHA256 SHA384 SHA512 SHA224
          ||/usr/bin/||GT.M (Unix)^19GNU/Linux||"
^%ZOSF("JOBPARAM")="G JOBPAR^%ZOSV"
^%ZOSF("LABOFF")="U IO:(NOECHO) ; <====="
^%ZOSF("LOAD")="D LOAD^%ZOSV2(X) ;S %N=0 F XCNP=XCNP+1:1 S %N=%N+1,%=$T(+%N^
          @X) Q:$L(%)=0  S @(DIF_XCNP_"",0)"")=%"
^%ZOSF("LPC")="S Y="""" ; <====="
^%ZOSF("MAGTAPE")="S %MT(""BS"")=""*1"",%MT(""FS"")=""*2"",%MT(""WTM"")=""*3
          "",%MT(""WB"")=""*4"",%MT(""REW"")=""*5"",%MT(""RB"")=""*6"",%MT("
          "REL"")=""*7"",%MT(""WHL"")=""*8"",%MT(""WEL"")=""*9"" ; <====="
^%ZOSF("MAXSIZ")="Q"
^%ZOSF("MGR")="EHR,EHR"
^%ZOSF("MTBOT")="S Y=$ZA\32#2 ; <====="
^%ZOSF("MTERR")="S Y=$ZA\32768#2 ; <====="
^%ZOSF("MTONLINE")="S Y=$ZA\64#2 ; <====="
^%ZOSF("MTWPROT")="S Y=$ZA\4#2 ; <====="
^%ZOSF("NBRK")="U $I:(NOCENABLE)"
^%ZOSF("NO-PASSALL")="U $I:(ESCAPE:TERMINATOR="""":NOPASTHRU)"
^%ZOSF("NO-TYPE-AHEAD")="U $I:(NOTYPEAHEAD)"
^%ZOSF("OS")="GT.M (Unix)^19"
^%ZOSF("PASSALL")="U $I:(NOESCAPE:NOTERMINATOR:PASTHRU)"
^%ZOSF("PRIINQ")="S Y=$$PRIINQ^%ZOSV()"
^%ZOSF("PRIORITY")="Q  ;G PRIORITY^%ZOSV"
^%ZOSF("PROD")="EHR,EHR"
^%ZOSF("PROGMODE")="S Y=$$PROGMODE^%ZOSV()"
^%ZOSF("RD")="G ^%RD"
^%ZOSF("RESJOB")="Q:'$D(DUZ)  Q:'$D(^XUSEC(""XUMGR"",+DUZ))  N XQZ S XQZ=""^
          FORCEX[MGR]"" D DO^%XUCI ; <====="
^%ZOSF("RM")="U $I:WIDTH=$S(X<256:X,1:0)"
^%ZOSF("RSEL")="K ^UTILITY($J) D ^%RSEL S X="""" X ""F  S X=$O(%ZR(X)) Q:X="
          """""""  S ^UTILITY($J,X)="""""""""" K %ZR"
^%ZOSF("RSUM")="S Y=0 F %=1,3:1 S %1=$T(+%^@X),%3=$F(%1,"" "") Q:'%3  S %3=$
          S($E(%1,%3)'="";"":$L(%1),$E(%1,%3+1)="";"":$L(%1),1:%3-2) F %2=1:
          1:%3 S Y=$A(%1,%2)*%2+Y"
^%ZOSF("RSUM1")="N %,%1,%2,%3 S Y=0 F %=1,3:1 S %1=$T(+%^@X),%3=$F(%1,"" "")
           Q:'%3  S %3=$S($E(%1,%3)'="";"":$L(%1),$E(%1,%3+1)="";"":$L(%1),1
          :%3-2) F %2=1:1:%3 S Y=$A(%1,%2)*(%2+%)+Y"
^%ZOSF("SAVE")="D SAVE^%ZOSV2(X) ;N %I,%F S %I=$I,%F=$P($S($ZRO[""("":$P($P(
          $ZRO,""("",2),"")""),1:$ZRO),"" "")_""/""_X_"".m"" O %F:(NEWVERSIO
          N) U %F X ""F  S XCN=$O(@(DIE_XCN_"""")"""")) Q:+XCN'=XCN  S %=@(D
          IE_XCN_"""",0)"""") Q:$E(%,1)=""""$""""  I $E(%)'="""";"""" W %,!"
          " C %F U %I"
^%ZOSF("SIZE")="S Y=0 F I=1:1 S %=$T(+I) Q:%=""""  S Y=Y+$L(%)+2 ; <====="
^%ZOSF("SS")="D ^ZSY"
^%ZOSF("TEST")="I X]"""",$T(^@X)]"""""
^%ZOSF("TMK")="S Y=$ZA\16384#2"
^%ZOSF("TMP")="/tmp/"
^%ZOSF("TRAP")="$ZT=""G ""_X"
^%ZOSF("TRMOFF")="U $I:(TERMINATOR="""")"
^%ZOSF("TRMON")="U $I:(TERMINATOR=$C(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1
          6,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,127))"
^%ZOSF("TRMRD")="S Y=$A($ZB)"
^%ZOSF("TYPE-AHEAD")="U $I:(TYPEAHEAD)"
^%ZOSF("UCI")="S Y=^%ZOSF(""PROD"")"
^%ZOSF("UCICHECK")="S Y=1"
^%ZOSF("UPPERCASE")="S Y=$TR(X,""abcdefghijklmnopqrstuvwxyz"",""ABCDEFGHIJKL
          MNOPQRSTUVWXYZ"")"
^%ZOSF("VOL")="EHR"
^%ZOSF("XY")="S $X=DX,$Y=DY ; <====="
^%ZOSF("ZD")="S Y=$$HTE^XLFDT(X,2) I $L($P(Y,""/""))=1 S Y=0_Y"

GTM>u $p:(width=132:wrap)

GTM>u $p:(length=50:width=132:wrap)

GTM>u $p:(length=30:width=132:wrap)

GTM>; TCP connections from Mumps - (connecting to the internet)

GTM>; Simplest example - open ssh port

GTM>O "tcpclient":(connect="127.0.0.1:22:TCP":attach="client"):5:"SOCKET"

GTM>u "tcpclient"

GTM>R X

GTM>c "tcpclient"

GTM>W X
SSH-2.0-OpenSSH_5.3p1 Debian-3ubuntu5

GTM> "tcpclient":(connect="towel.blinkenlights.nl:23:TCP":attach="client")ST
%GTM-E-CMD, Command expected but not found
         "tcpclient":(connect="towel.blinkenlights.nl:23:TCP":attach="client"):5:SOCKET
         ^-----

GTM> "tcpclient":(connect="towel.blinkenlights.nl:23:TCP":attach="client"):5:"SOCKET"
%GTM-E-CMD, Command expected but not found
         "tcpclient":(connect="towel.blinkenlights.nl:23:TCP":attach="client"):5:"SOCKET"
         ^-----

GTM> "tcpclient":(connect="towel.blinkenlights.nl:23:TCP":attach="client"):5:"SOCKET"
%GTM-E-CMD, Command expected but not found
         "tcpclient":(connect="towel.blinkenlights.nl:23:TCP":attach="client"):5:"SOCKET"
         ^-----

GTM>O "tcpclient":(connect="towel.blinkenlights.nl:23:TCP":attach="client"):5:"SOCKET"
GTM>U "tcpclient"

GTM>F  R X U $P W X,! U "tcpclient" Q:X=""






                                           /~\
                                          |oo )
                                   .              .           . .
                                          _\=/_
                          ___            /
 _  \
                         /() \          //|/.\|\\
                       _|____   _____
_|_        \\ \_/  ||                          __|
                      | | === | |        \|\ /| ||
                    |====__ _________ |(O)|===|__
       |_|  O  |_|        # _ _/  #
                       ||  O  ||          | | |
            .                <>
                      ||__*__||          | | |
                      |~ \___/ ~|         []|[]
                               .             .
                      /=\ /=\ /=\         | | |
      ________________[_]_[_]_[_]________/_]_[
_\_________________________
%GTM-I-CTRLC, CTRL_C encountered
%GTM-W-NOTPRINCIO, Output currently directed to device tcpclient

GTM>U $P

GTM>zshow "D"
/dev/null CLOSED
/dev/pts/3 OPEN TERMINAL NOPAST NOREADS TYPE WIDTH=132 LENG=30
/dev/pts/4 CLOSED
tcpclient OPEN SOCKET TOTAL=1 CURRENT=0
        SOCKET[0]=client DESC=6 CONNECTED ACTIVE  NOTRAP  REMOTE=94.142.241.111@23
                ZDELAY  ZBFSIZE=1024 ZIBFSIZE=87380 NODELIMITER

GTM>c "tcpclient"

GTM>zshow "D"
/dev/null CLOSED
/dev/pts/3 OPEN TERMINAL NOPAST NOREADS TYPE WIDTH=132 LENG=30
/dev/pts/4 CLOSED
tcpclient CLOSED

GTM>zp ^KBANSTAR
KBANSTAR ; 3/22/11 3:12pm
 ;;
STARWARS
 O "sam":(connect="towel.blinkenlights.nl:23:TCP":attach="client"):5:"SOCKET"
 U "sam"
 FOR  D  Q:X=""
 . R X
 . U $P
 . W X,!
 . U "sam"
 C "sam"
 QUIT
PYTHON
 S D="d"
 O D:(connect="diveintopython3.org:80:TCP":attach="client"):20:"SOCKET"
 U D
 ; Send Headers
 W "GET / HTTP/1.1",$C(13,10)
 W "Host: diveintopython3.org",$C(13,10)
 W "Accept: */*",$C(13,10)
 W $C(13,10),!
 ; Receive Headers
 N HEADER
 FOR  DO  QUIT:X=""
 . U D:(DELIMITER=$C(13,10))
 . READ X
 . QUIT:X=""
 . S HEADER($P(X,":"))=$$TRIM^XLFSTR($P(X,":",2))
 U D:(NODELIMITER)
 R X#HEADER("Content-Length")
 C D
 QUIT
MUMPS
 S D="d"
 O D:(connect="127.0.0.1:9250:TCP":attach="client"):5:"SOCKET"
 U D
 W "[XWB]10304",$C(10),"TCPConnect50012172.16.16.88f00010f0012servicedesk1f",$C(4),!
 U D:(DELIMITER=$C(4))
 R X
 W "[XWB]10304",$C(5),"#BYE#",$C(4),!
 C D
 QUIT

GTM>D PYTHON^KBANSTAR

GTM>ZWRITE HEADER
%GTM-E-UNDEF, Undefined local variable: HEADER

GTM>ZED
%GTM-E-ZEDFILSPEC, Illegal ZEDIT file specification:

GTM>ZED "KBANSTAR"

GTM>zl

GTM>D PYTHON^KBANSTAR

GTM>zwrite HEADER
HEADER("Accept-Ranges")="bytes"
HEADER("Connection")="close"
HEADER("Content-Length")=6685
HEADER("Content-Type")="text/html"
HEADER("Date")="Wed, 23 Mar 2011 08"
HEADER("ETag")="""1a1d-51ecd640"""
HEADER("HTTP/1.1 200 OK")=""
HEADER("Last-Modified")="Thu, 17 Feb 2011 22"
HEADER("Server")="Apache"
HEADER("Vary")="Accept-Encoding"

GTM>W X
<!DOCTYPE html>
<!-- readable source @ http://hg.diveintopython3.org/hgweb.cgi/file/tip/index.html -->
<meta charset=utf-8><title>Dive
 Into Python 3</title><link rel=alternate type=application/atom+xml href=http://hg.diveintopython3.org/atom-log><style>body{font:med
ium/1.75 'Gill Sans','Gill Sans MT',Corbel,Helvetica,'Nimbus Sans L',sans-serif;word-spacing:.1em}pre,kbd,samp,code{font:small/2.154
 Consolas,'Andale Mono',Monaco,'Liberation Mono','Bitstream Vera Sans Mono','DejaVu Sans Mono',monospace;word-spacing:0}.baa{font:ob
lique 105% Constantia,Baskerville,Palatino,'Palatino Linotype','URW Palladio L',serif}abbr{font-variant:small-caps;text-transform:lo
wercase;letter-spacing:.1em}.c{line-height:2.154}p,ol{margin:1.75em 0;font-size:medium}html{background:#fff;color:#222}body{margin:1
.75em 28px}.c{clear:both;text-align:center}.c{margin:2.154em 0}form div{float:right}a{text-decoration:none;border-bottom:1px dotted}
a:hover{border-bottom:1px solid}a:link{color:steelblue}a:visited{color:#b44582}.c a{color:inherit}pre{padding-left:2.154em;border-le
ft:1px solid #ddd}.c{font-size:small}ol,p,h1,h2{clear:left}pre a{padding:.4375em 0}.p{color:#667}code,samp{line-height:inherit!impor
tant}pre a,pre a:hover{border:0}h1,h2{font-family:"Book Antiqua",Palatino,Georgia,serif}h1,h2{font-variant:small-caps}h1,h2{letter-s
pacing:-1px}h1{font-size:xx-large;line-height:1.3125}h2{font-size:x-large;line-height:1.167;margin:1.167em 0}h1{border-bottom:4px do
uble;width:100%;margin:1.49em 0;counter-reset:h2}h1:before{content:"Chapter " counter(h1) ". "}h2:before{counter-increment:h2;conten
t:counter(h1) "." counter(h2) ". "}h2{counter-reset:h3}h1:before,h2:before{content:''}#a,#b,#c,#d{list-style:none;margin:0 0 0 -1.7e
m}#a:before{content:'A. \00a0 \00a0'}#b:before{content:'B. \00a0 \00a0'}#c:before{content:'C. \00a0 \00a0'}#d:before{content:'D. \00
a0 \00a0'}@media screen and (max-device-width:480px){body,.c,span,.c,p,ol{font:normal 12px/18px sans-serif}pre,kbd,samp,code{font:no
rmal 12px/18px monospace}.baa{font:normal 14px/18px serif}abbr{font-variant:normal;text-transform:none;letter-spacing:0}.c,p,ol,h2{m
argin:1.75em 0}html{color:#000}body{margin:4px 2px 0 2px}a{text-decoration:underline;border-bottom:0}pre a{text-decoration:none}h1,h
2,pre{padding:0;border:0;letter-spacing:0}h1{margin:0}h1{font:normal 18px/18px serif}h2{font:normal 16px/18px serif}h1:before{conten
t:""}form,form+p{display:none}}@media print{body{font-size:12pt}pre,kbd,samp,code{font-size:10pt;line-height:2.1}span{font-size:12pt
}.baa{font-size:13pt}p,ol{font-size:12pt}html,body{background:#fff;margin:0;padding:0}a{text-decoration:none;border-bottom:1px dotte
d}html,a:link,a:visited{color:#000}pre{border:0}.c{font-size:10pt;line-height:2.1}h1{font-size:24pt}h2{font-size:18pt}form,form+p{di
splay:none!important}}</style><script>_gaq=[['_setAccount','UA-7434570-3'],['_trackPageview']];(function(){var g=document.createElem
ent('script');g.src='//www.google-analytics.com/ga.js';g.setAttribute('async','true');document.documentElement.firstChild.appendChil
d(g);})();</script><meta name=viewport content='initial-scale=1.0'><form action=http://www.google.com/cse><div><input type=hidden na
me=cx value=014021643941856155761:l5eihuescdw><input type=hidden name=ie value=UTF-8><input type=search name=q size=25 placeholder="
powered by Google™"> <input type=submit name=sa value=Search></div></form><p>You are here:  <span title="Ce n'est pas
 un point" style='cursor:default'>•</span><h1>Dive Into Python 3</h1><p><cite>Dive Into Python 3</cite> covers Python 3 and its diff
erences from Python 2. Compared to <cite><a href=http://diveintopython.org/>Dive Into Python</a></cite>, it’s about 20% revised and
80% new material. The book is now complete, but <a href=about.html>feedback is always welcome</a>.<h2>Table of Contents (<a href=tab
le-of-contents.html>expand</a>)</h2><p style="float:right;width:245px;text-align:center;margin:0 0 0 1.75em"><a style="border:0" hre
f="http://www.amazon.com/gp/product/1430224150?ie=UTF8&tag=diveintomark-20&creativeASIN=1430224150" title="Affiliate link =
I earn an extra buck"><em>Also available on dead trees!</em><br><img src="i/cover.jpg" alt="Dive Into Python 3" width=245 height=300
></a><ol start=-1><li><a href=whats-new.html>What’s New in “Dive Into Python 3”</a><li><a href=installing-python.html>Installing Pyt
hon</a><li><a href=your-first-python-program.html>Your First Python Program</a><li><a href=native-datatypes.html>Native Datatypes</a
><li><a href=comprehensions.html>Comprehensions</a><li><a href=strings.html>Strings</a><li><a href=regular-expressions.html>Regular
Expressions</a><li><a href=generators.html>Closures <i class=baa>&</i> Generators</a><li><a href=iterators.html>Classes <i class
=baa>&</i> Iterators</a><li><a href=advanced-iterators.html>Advanced Iterators</a><li><a href=unit-testing.html>Unit Testing</a>
<li><a href=refactoring.html>Refactoring</a><li><a href=files.html>Files</a><li><a href=xml.html>XML</a><li><a href=serializing.html
>Serializing Python Objects</a><li><a href=http-web-services.html>HTTP Web Services</a><li><a href=case-study-porting-chardet-to-pyt
hon-3.html>Case Study: Porting <code>chardet</code> to Python 3</a><li><a href=packaging.html>Packaging Python Libraries</a><li id=a
><a href=porting-code-to-python-3-with-2to3.html>Porting Code to Python 3 with <code>2to3</code></a><li id=b><a href=special-method-
names.html>Special Method Names</a><li id=c><a href=where-to-go-from-here.html>Where to Go From Here</a><li id=d><a href=troubleshoo
ting.html>Troubleshooting</a></ol><p>The book is freely licensed under the <a rel=license href=http://creativecommons.org/licenses/b
y-sa/3.0/>Creative Commons Attribution Share-Alike</a> license. You can download it as <a href=d/diveintopython3-html-latest.zip><ab
br>HTML</abbr></a> or <a href=d/diveintopython3-pdf-latest.zip><abbr>PDF</abbr></a>. Über-geeks can also clone the Mercurial reposit
ory:<pre><samp class=p>you@localhost:~$ </samp><kbd>hg clone <a href=http://hg.diveintopython3.org/>http://hg.diveintopython3.org/</
a> diveintopython3</kbd>

© 2001–10 <a href=about.html>Mark Pilgrim</a><p class=c>Translations: <a href=http://code.g

oogle.com/p/inmersionenpython3/ lang=es hreflang=es>en español</a>, <a href=http://gpiancastelli.altervista.org/dip3-it/ lang=it hre flang=it>in italiano</a>, <a href="http://ru.wikisource.org/wiki/%D0%9F%D0%BE%D0%B3%D1%80%D1%83%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5_%D0%B2 _Python_3_(%D0%9F%D0%B8%D0%BB%D0%B3%D1%80%D0%B8%D0%BC)" lang=ru hreflang=ru>на русском языке</a>, <a href=http://www.diveintopython3 .ir/ lang=fa hreflang=fa dir=rtl>به پارسی</a> GTM>

GTM>zed

GTM>O "ftp":(connect="ftp.microsoft.com:21:TCP":attach="client"):20:"SOCKET"

GTM>R X %GTM-I-CTRLC, CTRL_C encountered

GTM>U "ftp"

GTM>R X

GTM>U $P W X 220 Microsoft FTP Service

GTM>U "ftp"

GTM>R X %GTM-I-CTRLC, CTRL_C encountered %GTM-W-NOTPRINCIO, Output currently directed to device ftp

GTM>W "USER anonymous",!

GTM>R X:0

GTM>U $P W X

GTM>U "ftp"

GTM>R X %GTM-I-CTRLC, CTRL_C encountered %GTM-W-NOTPRINCIO, Output currently directed to device ftp

GTM>R X:0

GTM>U $P

GTM>W X

GTM>U $P

GTM>W $DEVICE

GTM>C "ftp"

GTM>O "ftp":(connect="ftp.microsoft.com:21:TCP":attach="client"):20:"SOCKET"

GTM>u "ftp"

GTM>r x1:1

GTM>W "USER anonymous",!

GTM>r x2:1

GTM>w "PASS lksdjfkds",!

GTM>r x3:1

GTM>c "ftp"

GTM>zwrite D="d" HEADER("Accept-Ranges")="bytes" HEADER("Connection")="close" HEADER("Content-Length")=6685 HEADER("Content-Type")="text/html" HEADER("Date")="Wed, 23 Mar 2011 08" HEADER("ETag")="""1a1d-51ecd640""" HEADER("HTTP/1.1 200 OK")="" HEADER("Last-Modified")="Thu, 17 Feb 2011 22" HEADER("Server")="Apache" HEADER("Vary")="Accept-Encoding" X="" dev="/dev/pts/4" x="" x1="220 Microsoft FTP Service"_$C(13,10) x2="" x3="" y=""

GTM>u "ftp" %GTM-E-IONOTOPEN, Attempt to USE an I/O device which has not been opened

GTM>O "ftp":(connect="ftp.microsoft.com:21:TCP":attach="client"):20:"SOCKET"

GTM>u "ftp"

GTM>r x:1

GTM>w "anonymous"

GTM>r x:1

GTM>u $p

GTM>w x

GTM>u "ftp"

GTM>w x

GTM>h sam@sam-desktop:~/pocn-moh$ mumps -dir

GTM>zed "KBANSTAR"

GTM>D MUMPS^KBANSTAR

        O D:(connect="ftp.microsoft.com:21:TCP":attach="client":20:"SOCKET"
                                                                ^-----
               At column 58, line 34, source module /home/sam/pocn-moh/routines/KBANSTAR.m

%GTM-E-DEVPARUNK, Deviceparameter unknown

GTM>W X accept GTM>ZED

GTM>

</pre>