PXBGSC ;SLC/PKR - Get the V Standard Codes before data. ;08/29/2016
 ;;1.0;PCE PATIENT CARE ENCOUNTER;**211**;Aug 12, 1996;Build 454
 ;
SC(VISIT,SCIENLST) ;--Gather the entries in the V Standard Codes file
 N CODE,CODESYS,DA,DIC,DIQ,DR,IEN,PLIEN
 N SOURC,TEMP
 ;
 ;Looking at PXBGHF and PXAIHF there is a lot of data built in 
 ;PXBGHF that is never used in PXAIHF. The main thing it does is to
 ;return a list of IENs to PXAIHF. We do the same thing here for SC.
 I '$D(^AUPNVSC("AD",VISIT)) Q
 S IEN=0
 F  S IEN=$O(^AUPNVSC("AD",VISIT,IEN)) Q:IEN'>0  D
 . S TEMP=^AUPNVSC(IEN,0)
 . S CODE=$P(TEMP,U,1)
 . S CODESYS=$P(TEMP,U,5)
 . S SCIENLST(CODE,CODESYS,IEN)=""
 Q
 ;
 ;WHAT DOES THIS DO?
 ;D PL^PXBGPL(PATIENT)
 Q
 ;
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPXBGSC   744     printed  Sep 23, 2025@20:02:47                                                                                                                                                                                                       Page 2
PXBGSC    ;SLC/PKR - Get the V Standard Codes before data. ;08/29/2016
 +1       ;;1.0;PCE PATIENT CARE ENCOUNTER;**211**;Aug 12, 1996;Build 454
 +2       ;
SC(VISIT,SCIENLST) ;--Gather the entries in the V Standard Codes file
 +1        NEW CODE,CODESYS,DA,DIC,DIQ,DR,IEN,PLIEN
 +2        NEW SOURC,TEMP
 +3       ;
 +4       ;Looking at PXBGHF and PXAIHF there is a lot of data built in 
 +5       ;PXBGHF that is never used in PXAIHF. The main thing it does is to
 +6       ;return a list of IENs to PXAIHF. We do the same thing here for SC.
 +7        IF '$DATA(^AUPNVSC("AD",VISIT))
               QUIT 
 +8        SET IEN=0
 +9        FOR 
               SET IEN=$ORDER(^AUPNVSC("AD",VISIT,IEN))
               if IEN'>0
                   QUIT 
               Begin DoDot:1
 +10               SET TEMP=^AUPNVSC(IEN,0)
 +11               SET CODE=$PIECE(TEMP,U,1)
 +12               SET CODESYS=$PIECE(TEMP,U,5)
 +13               SET SCIENLST(CODE,CODESYS,IEN)=""
               End DoDot:1
 +14       QUIT 
 +15      ;
 +16      ;WHAT DOES THIS DO?
 +17      ;D PL^PXBGPL(PATIENT)
 +18       QUIT 
 +19      ;