AUTLCMP2 ;IHS/OIT/FBD - COMPARE ISO 639-2 LANGUAGE CODES TO TEXT FILE
;;98.1;IHS DICTIONARIES (POINTERS);**26**;FEB 9,2011;Build 6
;
;IHS/OIT/FBD - UTILITY TO COMPARE THE CONTENTS OF A TEXT FILE CONTAINING
;THE ISO 639-2 LANGUAGE CODE SET AGAINST CURRENT ENTRIES IN THE RPMS
;LANGUAGES FILE (FILE #9999999.99) AND IDENTIFY THE FOLLOWING:
; - ENTRIES IN THE TEXT FILE NOT MATCHED AGAINST THE LANGUAGES; THESE
; REPRESENT POTENTIAL NEW ENTRIES WHICH NEED TO BE EVALUATED FOR
; ADDITION TO THE LANGUAGES FILE.
; - ENTRIES IN THE LANGUAGES FILE WHICH DO NOT HAVE A CORRESPONDING
; TEXT FILE ENTRY; THESE REPRESENT POTENTIALLY OBSOLETE OR ERRONEOUS
; LANGUAGES FILE ENTRIES.
;
;THE TEXT FILE SHOULD BE NAMED 'ISO-639-2_utf-8.txt' AND RESIDE IN THE
;DIRECTORY SPECIFIED IN THE FILE IMPORT PATH FIELD OF THE RPMS SITE FILE.
;THE SOURCE FOR THE TEXT FILE CAN BE FOUND AT THE FOLLOWING URL:
;http://www.loc.gov/standards/iso639-2/ascii_8bits.html
;THE FILE'S DATA WILL BE ARRANGED IN THE FOLLOWING FORMAT, WITH FIELDS
;SEPARATED BY PIPE CHARACTERS (|):
;
;ISO 639-2 Code B|ISO 639-2 Code T|ISO 639-1 Code|English Language name|French Language name
;
;THE FRENCH LANGUAGE NAME FIELD IS NOT USED BY RPMS; IT IS INCLUDED
;SOLELY TO DOCUMENT ITS PRESENCE IN THE LIBRARY OF CONGRESS TABLES.
;ITS INCLUSION MAY BE CONSIDERED OPTIONAL.
;
;SOME LANGUAGES HAVE TWO ISO 639-2 CODES REFLECTING BIBLIOGRAPHIC USAGE
;VERSUS TERMINOLOGY USAGE; THESE LANGUAGES WILL HAVE BOTH THE ISO 639-2
;Code B AND ISO 639-2 Code T FIELDS POPULATED. THE VAST MAJORITY OF
;LANGUAGES WILL HAVE ONLY A SINGLE CODE, IN WHICH CASE ONLY THE
;ISO 639-2 Code B FIELD WILL BE POPULATED.
;
;
D INIT
D:'AUTEXIT MAIN
D CLEANUP
Q
;
INIT ;PRIMARY MODULE INITIALIZATION
S AUTEXIT=0
S AUTDIR=$P(^AUTTSITE(1,1),U,1) ;RPMS SITE/FILE IMPORT PATH DIRECTORY
S AUTFILE="ISO-639-2_utf-8.txt" ;IMPORT FILE NAME
S AUTFS="|" ;TEXT FILE'S FIELD SEPARATOR
K AUTMATCH S AUTMATCH=0 ;ARRAY TO LOG MATCHED CODES FROM TEXT FILE
K AUTMISS S AUTMISS=0 ;ARRAY TO LOG UNMATCHED CODES FROM TEXT FILE
;
S IOP="HFS"
S %ZIS("HFSNAME")=AUTDIR_AUTFILE
S %ZIS("HFSMODE")="R"
D ^%ZIS
I POP D Q
.W !!,"JOB ABORTED - FILE ",AUTFILE," NOT FOUND IN ",AUTDIR," IMPORT DIRECTORY.",!
.S AUTEXIT=1
Q
;
MAIN ;PRIMARY MODULE EXECUTION DRIVER
F D Q:AUTEXIT
.U IO
.R AUTRCD:0
.I AUTRCD="" D ^%ZISC S AUTEXIT=1 Q
.D EXTRACT
.U IO(0) W !,AUTISO2," - ",AUTISO2T," - ",AUTISO1," - ",AUTLANG ;DEBUG
.D EVAL
Q
;
S AUTISO2=$P(AUTISO,AUTFS,1) ;ISO 639-2 CODE
S AUTISO2T=$P(AUTISO,AUTFS,2) ;ISO 639-2 TERMINOLOGY CODE (IF PRESENT)
S AUTISO1=$P(AUTISO,AUTFS,3) ;ISO 639-1 CODE (IF PRESENT)
S AUTLANG=$P(AUTISO,AUTFS,4) ;ENGLISH NAME FOR LANGUAGE
Q
;
EVAL ;EVALUATE EXTRACTED CODE(S)
Q
;
CLEANUP ;POST-EXECUTION PARTITION CLEANUP
;K AUTDIR,AUTEXIT,AUTFILE,AUTFS,AUTRCD
;K AUTISO1,AUTISO2,AUTISO2T,AUTLANG
Q
AUTLCMP2 ;IHS/OIT/FBD - COMPARE ISO 639-2 LANGUAGE CODES TO TEXT FILE
+1 ;;98.1;IHS DICTIONARIES (POINTERS);**26**;FEB 9,2011;Build 6
+2 ;
+3 ;IHS/OIT/FBD - UTILITY TO COMPARE THE CONTENTS OF A TEXT FILE CONTAINING
+4 ;THE ISO 639-2 LANGUAGE CODE SET AGAINST CURRENT ENTRIES IN THE RPMS
+5 ;LANGUAGES FILE (FILE #9999999.99) AND IDENTIFY THE FOLLOWING:
+6 ; - ENTRIES IN THE TEXT FILE NOT MATCHED AGAINST THE LANGUAGES; THESE
+7 ; REPRESENT POTENTIAL NEW ENTRIES WHICH NEED TO BE EVALUATED FOR
+8 ; ADDITION TO THE LANGUAGES FILE.
+9 ; - ENTRIES IN THE LANGUAGES FILE WHICH DO NOT HAVE A CORRESPONDING
+10 ; TEXT FILE ENTRY; THESE REPRESENT POTENTIALLY OBSOLETE OR ERRONEOUS
+11 ; LANGUAGES FILE ENTRIES.
+12 ;
+13 ;THE TEXT FILE SHOULD BE NAMED 'ISO-639-2_utf-8.txt' AND RESIDE IN THE
+14 ;DIRECTORY SPECIFIED IN THE FILE IMPORT PATH FIELD OF THE RPMS SITE FILE.
+15 ;THE SOURCE FOR THE TEXT FILE CAN BE FOUND AT THE FOLLOWING URL:
+16 ;http://www.loc.gov/standards/iso639-2/ascii_8bits.html
+17 ;THE FILE'S DATA WILL BE ARRANGED IN THE FOLLOWING FORMAT, WITH FIELDS
+18 ;SEPARATED BY PIPE CHARACTERS (|):
+19 ;
+20 ;ISO 639-2 Code B|ISO 639-2 Code T|ISO 639-1 Code|English Language name|French Language name
+21 ;
+22 ;THE FRENCH LANGUAGE NAME FIELD IS NOT USED BY RPMS; IT IS INCLUDED
+23 ;SOLELY TO DOCUMENT ITS PRESENCE IN THE LIBRARY OF CONGRESS TABLES.
+24 ;ITS INCLUSION MAY BE CONSIDERED OPTIONAL.
+25 ;
+26 ;SOME LANGUAGES HAVE TWO ISO 639-2 CODES REFLECTING BIBLIOGRAPHIC USAGE
+27 ;VERSUS TERMINOLOGY USAGE; THESE LANGUAGES WILL HAVE BOTH THE ISO 639-2
+28 ;Code B AND ISO 639-2 Code T FIELDS POPULATED. THE VAST MAJORITY OF
+29 ;LANGUAGES WILL HAVE ONLY A SINGLE CODE, IN WHICH CASE ONLY THE
+30 ;ISO 639-2 Code B FIELD WILL BE POPULATED.
+31 ;
+32 ;
+33 DO INIT
+34 IF 'AUTEXIT
DO MAIN
+35 DO CLEANUP
+36 QUIT
+37 ;
INIT ;PRIMARY MODULE INITIALIZATION
+1 SET AUTEXIT=0
+2 ;RPMS SITE/FILE IMPORT PATH DIRECTORY
SET AUTDIR=$PIECE(^AUTTSITE(1,1),U,1)
+3 ;IMPORT FILE NAME
SET AUTFILE="ISO-639-2_utf-8.txt"
+4 ;TEXT FILE'S FIELD SEPARATOR
SET AUTFS="|"
+5 ;ARRAY TO LOG MATCHED CODES FROM TEXT FILE
KILL AUTMATCH
SET AUTMATCH=0
+6 ;ARRAY TO LOG UNMATCHED CODES FROM TEXT FILE
KILL AUTMISS
SET AUTMISS=0
+7 ;
+8 SET IOP="HFS"
+9 SET %ZIS("HFSNAME")=AUTDIR_AUTFILE
+10 SET %ZIS("HFSMODE")="R"
+11 DO ^%ZIS
+12 IF POP
Begin DoDot:1
+13 WRITE !!,"JOB ABORTED - FILE ",AUTFILE," NOT FOUND IN ",AUTDIR," IMPORT DIRECTORY.",!
+14 SET AUTEXIT=1
End DoDot:1
QUIT
+15 QUIT
+16 ;
MAIN ;PRIMARY MODULE EXECUTION DRIVER
+1 FOR
Begin DoDot:1
+2 USE IO
+3 READ AUTRCD:0
+4 IF AUTRCD=""
DO ^%ZISC
SET AUTEXIT=1
QUIT
+5 DO EXTRACT
+6 ;DEBUG
USE IO(0)
WRITE !,AUTISO2," - ",AUTISO2T," - ",AUTISO1," - ",AUTLANG
+7 DO EVAL
End DoDot:1
IF AUTEXIT
QUIT
+8 QUIT
+9 ;
+1 ;ISO 639-2 CODE
SET AUTISO2=$PIECE(AUTISO,AUTFS,1)
+2 ;ISO 639-2 TERMINOLOGY CODE (IF PRESENT)
SET AUTISO2T=$PIECE(AUTISO,AUTFS,2)
+3 ;ISO 639-1 CODE (IF PRESENT)
SET AUTISO1=$PIECE(AUTISO,AUTFS,3)
+4 ;ENGLISH NAME FOR LANGUAGE
SET AUTLANG=$PIECE(AUTISO,AUTFS,4)
+5 QUIT
+6 ;
EVAL ;EVALUATE EXTRACTED CODE(S)
+1 +2 QUIT
+3 ;
CLEANUP ;POST-EXECUTION PARTITION CLEANUP
+1 ;K AUTDIR,AUTEXIT,AUTFILE,AUTFS,AUTRCD
+2 ;K AUTISO1,AUTISO2,AUTISO2T,AUTLANG
+3 QUIT