Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: AUTEMTP

AUTEMTP.m

Go to the documentation of this file.
  1. AUTEMTP ;IHS/OIT/FBD - POPULATE EDUCATION MAJOR TOPIC PTR FIELD
  1. ;;98.1;IHS DICTIONARIES (POINTERS);**26**;APR 03,2013;Build 6
  1. ;
  1. Q ;NO TOP-LEVEL ENTRY CALL
  1. ;
  1. ;IN A GIVEN 'EDUCATION TOPICS' FILE ENTRY (RECORD IEN SPECIFIED
  1. ;IN VARIABLE 'X'), THIS ROUTINE WILL POPULATE THE 'MAJOR TOPIC PTR'
  1. ;FIELD BASED ON THE CONTENTS OF THE 'MAJOR TOPIC' FIELD.
  1. ;
  1. CHECK ;PRE-POPULATION DATA PORTABILITY CHECK
  1. S AUTETIEN=0 ;EDUCATION TOPIC RECORD IEN
  1. K AUTCRUPT,AUTMATCH,AUTNOMAT,AUTMNULL
  1. S (AUTCRUPT,AUTMATCH,AUTNOMAT,AUTMNULL)=0 ;MATCH/MISMATCH COUNTERS
  1. W:'$D(AUTQUIET) !!,"EDUCATION TOPICS CHECK SCAN OF MAJOR TOPICS STARTED...",!!
  1. F S AUTETIEN=$O(^AUTTEDT(AUTETIEN)) Q:'+AUTETIEN D ;
  1. .I '$D(^AUTTEDT(AUTETIEN,0)) D Q
  1. ..S AUTCRUPT=AUTCRUPT+1
  1. .S AUTMTEXT=$P(^AUTTEDT(AUTETIEN,0),U,6)
  1. .I AUTMTEXT="" D Q
  1. ..S AUTMNULL=AUTMNULL+1
  1. ..S AUTMNULL(AUTETIEN)=""
  1. .I $D(^AUTTEDMT("B",AUTMTEXT)) D
  1. ..S AUTMATCH=AUTMATCH+1
  1. ..S AUTMATCH(AUTETIEN)=$O(^AUTTEDMT("B",AUTMTEXT,""))
  1. .E D
  1. ..S AUTNOMAT=AUTNOMAT+1
  1. ..S AUTNOMAT(AUTETIEN)=AUTMTEXT
  1. D:'$D(AUTQUIET) CHECKOUT
  1. W:'$D(AUTQUIET) !,"CHECK SCAN COMPLETE.",!!
  1. Q
  1. ;
  1. CHECKOUT ;OUTPUT FROM CHECK SCAN
  1. W !,"RESULTS OF MAJOR TOPICS SCAN:",!
  1. W ?5,"# OF MATCHED MAJOR TOPICS = ",AUTMATCH,!
  1. W ?5,"# OF UNMATCHED MAJOR TOPICS = ",AUTNOMAT,!
  1. W ?5,"# OF NULL MAJOR TOPICS = ",AUTMNULL,!
  1. W ?5,"# OF CORRUPTED ED TOPICS = ",AUTCRUPT,!
  1. Q
  1. ;
  1. CVT(TIEN) ;CONVERT 'MAJOR TOPIC' FIELD TEXT TO 'MAJOR TOPIC PTR' FIELD POINTER
  1. N AUTMTP
  1. N DA,DIE,DR
  1. S AUTMTP=$$FIND(TIEN) Q:'+AUTMTP
  1. S DIE="^AUTTEDT(",DA=TIEN,DR=".07///`"_AUTMTP
  1. D ^DIE
  1. Q
  1. ;
  1. FIND(TIEN) ;FIND MATCH FOR 'MAJOR TOPIC' FIELD TEXT IN EDUCATION MAJOR TOPIC
  1. ;TIEN = IEN OF EDUCATION TOPIC RECORD
  1. ;RETURNED VALUE - SUCCESSFUL = IEN OF MATCHED EDUCATION MAJOR TOPIC RECORD IEN
  1. ; - UNSUCCESSFUL = 0^REASON FOR FAILURE
  1. N AUTMT,AUTMTP
  1. S U="^"
  1. S AUTQUIET=1 ;OUTPUT SILENCER FLAG
  1. ;
  1. I '+TIEN Q "0^INVALID TOPIC IEN VALUE PASSED"
  1. I '$D(^AUTTEDT(+TIEN,0)) Q "0^TOPIC RECORD "_+TIEN_" NOT FOUND"
  1. S AUTMT=$P(^AUTTEDT(TIEN,0),U,6) ;'MAJOR TOPIC' FIELD TEXT
  1. I AUTMT="" Q "0^NO MAJOR TOPIC SPECIFIED"
  1. S AUTMTP=$D(^AUTTEDMT("B",AUTMT))
  1. I '+AUTMTP Q "0^NO MAJOR TOPIC MATCH FOUND"
  1. S AUTMTP=$O(^AUTTEDMT("B",AUTMT,""))
  1. Q +AUTMTP
  1. ;
  1. CVTALL ;RUN 'MAJOR TOPIC' FIELD TEXT TO 'MAJOR TOPIC PTR' FIELD POINTER
  1. ; CONVERSION ON ALL EDUCATION TOPIC RECORDS
  1. N IEN
  1. S IEN=""
  1. S AUTQUIET=1 D CHECK
  1. F S IEN=$O(AUTMATCH(IEN)) Q:IEN="" D
  1. .D CVT(IEN)
  1. Q
  1. ;
  1. KILL(TIEN) ;KILL 'MAJOR TOPIC PTR' FIELD VALUE IN EDUCATION TOPIC RECORD TIEN
  1. ;USED FOR KILL LOGIC OF MUMPS XREF ON EDUCATION TOPIC FILE'S 'MAJOR TOPIC' FIELD
  1. N DA,DIE,DR
  1. S DIE="^AUTTEDT("
  1. S DA=TIEN
  1. S DR=".07///@"
  1. D ^DIE
  1. Q