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

SCRPPRAH.m

Go to the documentation of this file.
SCRPPRAH ;ALB/DJS - Preceptor Assignment History Extract for PCMMR Data Validation; 04/18/14
 ;;5.3;Scheduling;**620**;AUG 13, 1993;Build 11
 ;
ENTER ; Entry point
 ; 
 ; Extract file will be a delimited text file (.TXT) that will provide information for PCMM data validation
 ; Delimiter is a pipe ("|") character
 ;
 ; FILE OUTPUT:
 ;
 ; STANUM - Station #
 ; PREAHIEN - IEN of Preceptor Assignment History
 ; TPIEN - IEN of Team Position
 ; TMPOS - Team Position
 ; EFFDT - Effective Date
 ; STATUS - Status
 ; STATRSN - Status Reason
 ; PRCTPIEN - IEN of Preceptor Team Position
 ; PRETMPOS - Preceptor Team Position
 ; DATEENT - Date/Time Entered
 ; PRECPTNM - Preceptor Name
 ;
 N SCMCPATH,SCMCHFS,SCMCERR,SCMCMODE,MSG,IOF
 N SCDATA,SCIENS,STANUM,PREAHIEN,TPIEN,TMPOS,EFFDT,STATUS,STATRSN,PRCTPIEN,PRETMPOS,DATEENT,PRECPTNM,SITE
 S SITE=$$SITE^VASITE,STANUM=$P(SITE,"^",3)
 S SCMCPATH=$$DEFDIR^%ZISH(),SCMCHFS=STANUM_"_PCMMPRECEPTORASSIGNMENTHISTORY.TXT",SCMCERR=0 U 0 W !!,SCMCPATH
 D HFSOPEN("SCMCRP",SCMCPATH,SCMCHFS,"W") I SCMCERR G END
 U IO
 D COLHDR,SETREC G END
 ;
SETREC  ;$O through preceptor assignment history file
    S PREAHIEN=0
 F  S PREAHIEN=$O(^SCTM(404.53,PREAHIEN)) Q:PREAHIEN=""!(PREAHIEN'?.N)  D
 .K SCDATA
 .S SCIENS=+$G(PREAHIEN)_","
 .D GETS^DIQ(404.53,SCIENS,".01;.02;.04;.05;.06;.07;.08;200","IE","SCDATA","")
 .S TPIEN=$G(SCDATA(404.53,SCIENS,.01,"I"))
 .S TMPOS=$G(SCDATA(404.53,SCIENS,.01,"E"))
 .S EFFDT=$G(SCDATA(404.53,SCIENS,.02,"E"))
 .S STATUS=$G(SCDATA(404.53,SCIENS,.04,"E"))
 .S STATRSN=$G(SCDATA(404.53,SCIENS,.05,"E"))
 .S PRCTPIEN=$G(SCDATA(404.53,SCIENS,.06,"I"))
 .S PRETMPOS=$G(SCDATA(404.53,SCIENS,.06,"E"))
 .S DATEENT=$G(SCDATA(404.53,SCIENS,.08,"E"))
 .S PRECPTNM=$G(SCDATA(404.53,SCIENS,200,"E"))
 .W STANUM_"|"_PREAHIEN_"|"_TPIEN_"|"_TMPOS_"|"_EFFDT_"|"_STATUS_"|"_STATRSN_"|"_PRCTPIEN_"|"_PRETMPOS_"|"_DATEENT_"|"_PRECPTNM,!
 Q
 ;
COLHDR ;Create column header for Preceptor Assignment History extract file
 W "Station #|Prec. Assign. Hist. IEN|Team Position IEN|Team Position|Effective Date|Status|Status Reason|Preceptor Team Position IEN|Preceptor Team Position|Date Entered|Preceptor Name",!
 Q
 ;
END D HFSCLOSE("SCMCRP",SCMCHFS)
 N I
 I '+SCMCERR D  Q  ;Create pipe delimited output if no errors
 .S MSG=$NA(^TMP("SCMC",$J))
 ;Replace "##FFFF##" with Form Feeds - code needed for LINUX environments
 S I=0 F  S I=$O(^TMP("SCMC",$J,1,I)) Q:'I  D
 .S:^TMP("SCMC",$J,1,I)["##FFFF##" ^TMP("SCMC",$J,1,I)=$P(^TMP("SCMC",$J,1,I),"##FFFF##")_$C(13,12)_$P(^TMP("SCMC",$J,1,I),"##FFFF##",2)
 .S ^TMP("SCMC",$J,1,I)=^TMP("SCMC",$J,1,I)_$C(13)
 .S:^TMP("SCMC",$J,1,I)["$END" ^TMP("SCMC",$J,1,I)=""
 S MSG=$NA(^TMP("SCMC",$J))
 Q
 ;
HFSOPEN(HANDLE,SCMCPATH,SCMCHFS,SCMCMODE) ; Open File
 N POP
 D OPEN^%ZISH(HANDLE,SCMCPATH,SCMCHFS,$G(SCMCMODE,"W")) D:POP  Q:POP
 .S SCMCERR=1,^TMP("SCMC",$J,1)="0^Unable to open file "
 S IOF="$$IOF^SCRPPRAH"   ;resets screen position and adds page break flag - added to deal with Linux environments.
 Q
 ;
HFSCLOSE(HANDLE,SCMHFS) ;Close HFS and unload data
 D CLOSE^%ZISH(HANDLE)
 Q
 ;
IOF() ;used to reset position and insert page break flag when @IOF is executed.
 S $X=0,$Y=0
 Q "##FFFF##"_$C(13,10)
 ;