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