XUSECBUL ;SFISC/BT-SEND SEPARATION MESSAGE TO G.XUSEC/PRS PAID SEPARATION ;10 AM  10 Jan 2006
 ;;8.0;KERNEL;**384**;Jul 10, 1995;Build 8
 N TMP,NAME,SSN,SERVICE,MSGSBJ,WHO,LN,OUT,IEN200
 S (NAME,SSN,SERVICE,OUT)=""
 D  I OUT'="Y" Q  ;Person's 'SEPARATION IND' not equal to Y
 . N DIERR,IENS,Z,ZERR
 . S IENS=DA_","
 . D GETS^DIQ(450,IENS,".01;8;80;700","EI","Z","ZERR")
 . S OUT=Z(450,IENS,80,"E")
 . I OUT'="Y" Q
 . S NAME=Z(450,IENS,.01,"E")
 . S SSN="***-**-"_$P(Z(450,IENS,8,"E"),"-",3)
 . I Z(450,IENS,700,"I") S SERVICE=$$GET1^DIQ(200,Z(450,IENS,700,"I")_",",29,"","","ZERR"),IEN200=Z(450,IENS,700,"I")
 . Q
 I +IEN200,'$$ACTIVE^XUSER(+IEN200) Q
 ; Mail back message
 S LN=1
 S TMP(LN)=NAME_" ("_SSN_") separated from "_SERVICE_".",LN=LN+1
 S TMP(LN)="Please terminate the employee.",LN=LN+1
 S WHO(DUZ)=""
 I $$GOTLOCAL^XMXAPIG("XUSEC/PRS PAID SEPARATION") S WHO("G.XUSEC/PRS PAID SEPARATION")=""
 S MSGSBJ="Employee ("_NAME_") Seperated From Station Notification"
 ;
SEND D SENDMSG^XMXAPI(DUZ,MSGSBJ,"TMP",.WHO)
 D CLEAN^DILF
 Q
