DGPTAPA4 ;ALB/MTC - PTF ARCHIVE HEADER ; 12-04-92
 ;;5.3;Registration;;Aug 13, 1993
 ;
 ;
MKHEAD ;-- write header
 N SEQ,OSEQ,REF,TXT
 S OSEQ=$G(^DGP(45.62,DGTMP,100,0)) Q:OSEQ']""
 S SEQ=$P(OSEQ,U,3),REF="^DGP(45.62,"_DGTMP_",100)",SEQ=SEQ+1
 F I=1:1 S TXT=$P($T(HEADTXT+I),";;",2) Q:TXT="END"  S @REF@(SEQ,0)="$"_TXT,SEQ=SEQ+1
 ;-- update
 S $P(^DGP(45.62,DGTMP,100,0),U,3,4)=SEQ_U_SEQ
 Q
 ;
HEADTXT ;-- This is the header text describing the format of the records.
 ;;Each archived PTF record may contain the following records in the
 ;;Archive File. These records correspond to the <101>, <401>, <501>
 ;;and <701> screens in PTF. Each field in the record is delimited
 ;;by a "^". All records begin with the original PTF record number
 ;;followed by the record type. For example:
 ;; <PTF #>^"501"^...
 ;; <PTF #>^"401"^...
 ;; All comments contained in the Archive file will have a "$" in the
 ;;first column.
 ;; All records are terminated by a <CR><LF>.
 ;;The following description will describe the "pieces" of each record
 ;;archived. A piece is a section deliminated by a "^".
 ;;The <101> and <701> data will be contained in the following record:
 ;; Piece #     Data
 ;;   1         PTF Record number
 ;;   2         Patient Name
 ;;   3         Admission Date
 ;;   4         Discharge Date
 ;;   5         Discharge Specialty
 ;;   6         Type of Disposition
 ;;   7         Discharge Status
 ;;   8         Outpatient Treatment
 ;;   9         ASIH Days
 ;;  10         C&P Status
 ;;  11         VA Auspices
 ;;  12         Income
 ;;  13-22      ICD Codes
 ;;  23         Suicide Indicator
 ;;  24         Legionnaire's Disease Indicator
 ;;  25         Substance Abuse
 ;;  26         Psychiatry Classification Severity
 ;;  27         Current Functional Assessment
 ;;  28         Highest Level Psych Classification
 ;;The <401> record will be contained in the following record format.
 ;;These records may not be present for the episode of care described
 ;;by this PTF record. In addition, for each <401> there may be an
 ;;associated <401P>.
 ;;<401> Record.
 ;; Piece #     Data
 ;;   1         PTF Record Number
 ;;   2         "401"
 ;;   3         Sequence Number (for multiple <401>s)
 ;;   4         Surgery Date
 ;;   5         Surgical Specialty
 ;;   6         Category of Chief Surgeon
 ;;   7         Category of First Assistant
 ;;   8         Principal Anesthetic
 ;;   9         Source of Payment
 ;;  10-14      ICD Codes
 ;;  15         Kidney Source
 ;;<401P> Record.
 ;; Piece #     Data
 ;;   1         PTF Record Number
 ;;   2         "401P"
 ;;   3         Sequence Number (will match a <401> record)
 ;;   4-9       Procedure Codes
 ;;There will be at least one <501> record for the episode of care
 ;;described by this PTF record.
 ;;<501> Record.
 ;; Piece #     Data
 ;;   1         PTF Record Number
 ;;   2         "501"
 ;;   3         Sequence Number
 ;;   4         Movement Date
 ;;   5         Treated for SC Condition
 ;;   6         Leave Days
 ;;   7         Pass Days
 ;;   8         Losing Specialty
 ;;   9-18      ICD Codes
 ;;  19         Suicide Indicator
 ;;  20         Legionnaire's Disease Indicator
 ;;  21         Substance Abuse
 ;;  22         Psychiatry Classification Severity
 ;;  23         Current Functional Assessment
 ;;  24         Highest Level Psych Classification
 ;;The <535> record is present only for ward specialty movements
 ;;for the patient if a transfer from one ward to another resulted
 ;;in a specialty change.
 ;;<535> Record.
 ;; Piece #     Data
 ;;   1         PTF Record Number
 ;;   2         "535"
 ;;   3         Sequence Number
 ;;   4         Movement Date
 ;;   5         Losing Ward Specialty
 ;;   6         Leave Days
 ;;   7         Pass Days
 ;;   8         Losing Ward
 ;;The <601> will not be present for all episodes of care.
 ;;<601> Record.
 ;; Piece #     Data
 ;;   1         PTF Record Number
 ;;   2         "601"
 ;;   3         Sequence Number
 ;;   4         Procedure Date
 ;;   5         Specialty
 ;;   6         Dialysis Type
 ;;   7         Number of Treatments
 ;;   8-12      Procedure Codes
 ;;END
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGPTAPA4   4248     printed  Sep 23, 2025@20:27:33                                                                                                                                                                                                    Page 2
DGPTAPA4  ;ALB/MTC - PTF ARCHIVE HEADER ; 12-04-92
 +1       ;;5.3;Registration;;Aug 13, 1993
 +2       ;
 +3       ;
MKHEAD    ;-- write header
 +1        NEW SEQ,OSEQ,REF,TXT
 +2        SET OSEQ=$GET(^DGP(45.62,DGTMP,100,0))
           if OSEQ']""
               QUIT 
 +3        SET SEQ=$PIECE(OSEQ,U,3)
           SET REF="^DGP(45.62,"_DGTMP_",100)"
           SET SEQ=SEQ+1
 +4        FOR I=1:1
               SET TXT=$PIECE($TEXT(HEADTXT+I),";;",2)
               if TXT="END"
                   QUIT 
               SET @REF@(SEQ,0)="$"_TXT
               SET SEQ=SEQ+1
 +5       ;-- update
 +6        SET $PIECE(^DGP(45.62,DGTMP,100,0),U,3,4)=SEQ_U_SEQ
 +7        QUIT 
 +8       ;
HEADTXT   ;-- This is the header text describing the format of the records.
 +1       ;;Each archived PTF record may contain the following records in the
 +2       ;;Archive File. These records correspond to the <101>, <401>, <501>
 +3       ;;and <701> screens in PTF. Each field in the record is delimited
 +4       ;;by a "^". All records begin with the original PTF record number
 +5       ;;followed by the record type. For example:
 +6       ;; <PTF #>^"501"^...
 +7       ;; <PTF #>^"401"^...
 +8       ;; All comments contained in the Archive file will have a "$" in the
 +9       ;;first column.
 +10      ;; All records are terminated by a <CR><LF>.
 +11      ;;The following description will describe the "pieces" of each record
 +12      ;;archived. A piece is a section deliminated by a "^".
 +13      ;;The <101> and <701> data will be contained in the following record:
 +14      ;; Piece #     Data
 +15      ;;   1         PTF Record number
 +16      ;;   2         Patient Name
 +17      ;;   3         Admission Date
 +18      ;;   4         Discharge Date
 +19      ;;   5         Discharge Specialty
 +20      ;;   6         Type of Disposition
 +21      ;;   7         Discharge Status
 +22      ;;   8         Outpatient Treatment
 +23      ;;   9         ASIH Days
 +24      ;;  10         C&P Status
 +25      ;;  11         VA Auspices
 +26      ;;  12         Income
 +27      ;;  13-22      ICD Codes
 +28      ;;  23         Suicide Indicator
 +29      ;;  24         Legionnaire's Disease Indicator
 +30      ;;  25         Substance Abuse
 +31      ;;  26         Psychiatry Classification Severity
 +32      ;;  27         Current Functional Assessment
 +33      ;;  28         Highest Level Psych Classification
 +34      ;;The <401> record will be contained in the following record format.
 +35      ;;These records may not be present for the episode of care described
 +36      ;;by this PTF record. In addition, for each <401> there may be an
 +37      ;;associated <401P>.
 +38      ;;<401> Record.
 +39      ;; Piece #     Data
 +40      ;;   1         PTF Record Number
 +41      ;;   2         "401"
 +42      ;;   3         Sequence Number (for multiple <401>s)
 +43      ;;   4         Surgery Date
 +44      ;;   5         Surgical Specialty
 +45      ;;   6         Category of Chief Surgeon
 +46      ;;   7         Category of First Assistant
 +47      ;;   8         Principal Anesthetic
 +48      ;;   9         Source of Payment
 +49      ;;  10-14      ICD Codes
 +50      ;;  15         Kidney Source
 +51      ;;<401P> Record.
 +52      ;; Piece #     Data
 +53      ;;   1         PTF Record Number
 +54      ;;   2         "401P"
 +55      ;;   3         Sequence Number (will match a <401> record)
 +56      ;;   4-9       Procedure Codes
 +57      ;;There will be at least one <501> record for the episode of care
 +58      ;;described by this PTF record.
 +59      ;;<501> Record.
 +60      ;; Piece #     Data
 +61      ;;   1         PTF Record Number
 +62      ;;   2         "501"
 +63      ;;   3         Sequence Number
 +64      ;;   4         Movement Date
 +65      ;;   5         Treated for SC Condition
 +66      ;;   6         Leave Days
 +67      ;;   7         Pass Days
 +68      ;;   8         Losing Specialty
 +69      ;;   9-18      ICD Codes
 +70      ;;  19         Suicide Indicator
 +71      ;;  20         Legionnaire's Disease Indicator
 +72      ;;  21         Substance Abuse
 +73      ;;  22         Psychiatry Classification Severity
 +74      ;;  23         Current Functional Assessment
 +75      ;;  24         Highest Level Psych Classification
 +76      ;;The <535> record is present only for ward specialty movements
 +77      ;;for the patient if a transfer from one ward to another resulted
 +78      ;;in a specialty change.
 +79      ;;<535> Record.
 +80      ;; Piece #     Data
 +81      ;;   1         PTF Record Number
 +82      ;;   2         "535"
 +83      ;;   3         Sequence Number
 +84      ;;   4         Movement Date
 +85      ;;   5         Losing Ward Specialty
 +86      ;;   6         Leave Days
 +87      ;;   7         Pass Days
 +88      ;;   8         Losing Ward
 +89      ;;The <601> will not be present for all episodes of care.
 +90      ;;<601> Record.
 +91      ;; Piece #     Data
 +92      ;;   1         PTF Record Number
 +93      ;;   2         "601"
 +94      ;;   3         Sequence Number
 +95      ;;   4         Procedure Date
 +96      ;;   5         Specialty
 +97      ;;   6         Dialysis Type
 +98      ;;   7         Number of Treatments
 +99      ;;   8-12      Procedure Codes
 +100     ;;END