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

PRCHLO5.m

Go to the documentation of this file.
  1. PRCHLO5 ;WOIFO/DAP/RLL-manual run for procurement reports ; 10/16/06 2:12pm
  1. V ;;5.1;IFCAP;**83,98,139,172**;Oct 20, 2000;Build 2
  1. ;Per VHA Directive 2004-038, this routine should not be modified.
  1. ;
  1. ;Patch PRC*5.1*172 are modifications to CLRS transmission processing
  1. ;to support those sites that have migrated to Full LINUX OS
  1. ;
  1. ENT ;This routine tasks out the execution of the procurement extract
  1. ;reports associated with PRC*5.1*83 (CLRS).
  1. ;
  1. N ZTRTN,ZTDESC,ZTDTH,ZTIO,PRCHPRO,ZTSK,ZTREQ,PRCPMSG
  1. S ZTRTN="RUNEXT^PRCHLO5"
  1. S ZTDESC="PRCPLO CLO Procurement Reports CLRS"
  1. S ZTDTH=$H
  1. S ZTREQ="@"
  1. S ZTIO=""
  1. D ^%ZTLOAD
  1. S PRCHPRO=ZTSK
  1. ;Calls mail group message generation and screen display with success
  1. ;or exception notification
  1. I $D(PRCHPRO)[0 S PRCPMSG(1)="A task could not be created for the CLO Procurement Reports - please contact IRM." W ! D EN^DDIOL(PRCPMSG(1)) D MAIL^PRCHLO4A Q
  1. ;
  1. S PRCPMSG(1)="Task # "_PRCHPRO_" entered for Procurement Reports."
  1. W !
  1. D EN^DDIOL(PRCPMSG(1))
  1. ;
  1. ;*98 Modified to move MAIL and MAILFTP tags to routine PRCHLO4A
  1. ;
  1. D MAIL^PRCHLO4A
  1. ;
  1. Q
  1. PRCPCMP ; Notification of completion of building Procurement Report Data
  1. N PRCPMSG
  1. S PRCPMSG(1)="PO Procurement Data extract complete."
  1. D EN^DDIOL(PRCPMSG(1))
  1. D MAIL^PRCHLO4A
  1. Q
  1. ;
  1. PRCPTST ; Notification of termination of building Procurement Report Data due to test system task origin (added in PRC*5.1*139)
  1. N PRCPMSG
  1. S PRCPMSG(1)="PO Procurement Data extract TERMINATED due to running on TEST system."
  1. D EN^DDIOL(PRCPMSG(1))
  1. D MAIL^PRCHLO4A
  1. K ^TMP($J),^TMP("PRCHLOG",$J)
  1. Q
  1. ;
  1. RUNEXT ; Run extract reports for PO Activity
  1. I '$$PROD^XUPROD() G PRCPTST ;Check added in patch PRC*139 to not execute on test systems
  1. N CLRSERR,CLRSTST1 ; error flag for exception handling,tst entry pt.
  1. ; CLRSERR will be set for the following conditions:
  1. ; 0 - Success, status message for completion is sent.
  1. ; 1 - Error creating ^TMP($J) data (i.e. disk full)
  1. ; 2 - Error creating Files(i.e. directory patch, VMS Space, etc.)
  1. ; 3 - Error creating .Com file for FTP transfer, permissions issue
  1. ; 4 - Error with FTP Transfer,ntwk/permissions, Report Server issue
  1. ; 5 - Error with file deletion/cleanup prior to processing
  1. ; 6 - Error, lock is present. Process already running
  1. S CLRSERR=0
  1. TSTMSG ; This entry point is used to test the messaging framework
  1. ; S SLRSTST1=1
  1. S CLRSERR=0
  1. ; Check for O/S version
  1. N CKOS
  1. S CKOS=$$OS^%ZOSV()
  1. ; use lock to prevent mult. runs
  1. L +^PRCP(446.7,"STATUS"):3 I $T=0 S CLRSERR=6
  1. I CLRSERR=0 D DELRUN^PRCHLO5
  1. I CLRSERR=5 D
  1. . N PRCPMSG
  1. . S PRCPMSG(1)="Error with file deletion/cleanup prior to processing. Please contact IRM."
  1. . S PRCPMSG(2)=" "
  1. . S PRCPMSG(3)="This error indicates the CLRS EXTRACT DIRECTORY has not"
  1. . S PRCPMSG(4)="been properly set up during the installation of this patch."
  1. . S PRCPMSG(5)=" "
  1. . S PRCPMSG(6)="(Please refer to the pre installation instructions for PRC*5.1*83)"
  1. . S PRCPMSG(7)=" "
  1. . S PRCPMSG(8)="A valid directory must be set up with the"
  1. . S PRCPMSG(9)="proper read/write/execute/delete privileges."
  1. . S PRCPMSG(10)=" "
  1. . S PRCPMSG(11)="In addition, the directory name which you create"
  1. . S PRCPMSG(12)="must be added as the CLRS EXTRACT DIRECTORY"
  1. . S PRCPMSG(13)="through the CLO System Parameters Option."
  1. . S PRCPMSG(14)="If the field is blank, you will generate this error."
  1. . S PRCPMSG(15)=" "
  1. . S PRCPMSG(16)="Please confirm all steps have been performed"
  1. . S PRCPMSG(17)="according to the pre installation instructions for patch PRC*5.1*83."
  1. . D MAILFTP^PRCHLO4A
  1. . Q
  1. ; Begin to build files
  1. I CLRSERR=0 D INIT^PRCHLO
  1. I CLRSERR=0 D PRCPCMP^PRCHLO5 ; PO activity Extract logic completed
  1. I $D(CLRSTST1) D ; test point to generate message 1
  1. . Q:CLRSTST1'=1
  1. . S CLRSERR=1
  1. . Q
  1. I CLRSERR=1 D
  1. . N PRCPMSG ; error building ^TMP($J)
  1. . S PRCPMSG(1)="Error, No Data for PO Activity Files, contact IRM"
  1. . D MAILFTP^PRCHLO4A
  1. . Q
  1. CRFILE ; Create .txt file to confirm write privileges to directory
  1. I CLRSERR=0 D TSTF^PRCHLO4 ; will return CLRSERR=2 on error
  1. I CLRSERR=0 D CLRSFIL^PRCHLO4
  1. I CLRSERR=2 D
  1. . N PRCPMSG
  1. . S PRCPMSG(1)="Error, Problem with FTP File Creation, contact IRM"
  1. . D MAILFTP^PRCHLO4A
  1. . Q
  1. I CLRSERR=0 D
  1. . N PRCPMSG
  1. . S PRCPMSG(1)="Built PO Activity Extracts and GIP Extracts for transfer"
  1. . D MAILFTP^PRCHLO4A
  1. . Q
  1. I CKOS["VMS" D
  1. . I CLRSERR=0 D CRTCOM^PRCHLO4
  1. . Q
  1. I CKOS["NT" D
  1. . I CLRSERR=0 D CRTWIN^PRCHLO4A
  1. . Q
  1. ;PRC*5.1*172 added check for Full Linux
  1. I CKOS["UNIX" D
  1. . I CLRSERR=0 D
  1. . . D CRTUNX1^PRCHLO4
  1. . . Q
  1. . Q
  1. I CLRSERR=6 D
  1. . N PRCPMSG
  1. . S PRCPMSG(1)="Error encountered when attempting to run CLO PO"
  1. . S PRCPMSG(2)="activity reports due to other CLRS extracts in"
  1. . S PRCPMSG(3)="progress. Please try again later."
  1. . D MAILFTP^PRCHLO4A
  1. . Q
  1. I $D(CLRSTST1) D ; test point to generate message 3
  1. . Q:CLRSTST1'=3
  1. . S CLRSERR=3
  1. . Q
  1. I CLRSERR=0 D CKRPTSV^PRCHLO4A ;ping report server for availability
  1. I CLRSERR=3 D
  1. . N PRCPMSG
  1. . S PRCPMSG(1)="Error, problem creating SETUP file for FTP Transfer, contact IRM."
  1. . S PRCPMSG(2)="The Report Server may be unavailable for processing."
  1. . D MAILFTP^PRCHLO4A
  1. . Q
  1. I CLRSERR=0 D
  1. . N PRCPMSG,FILEDIR
  1. . S FILEDIR=$$GET^XPAR("SYS","PRCPLO EXTRACT DIRECTORY",1,"Q")
  1. . S PRCPMSG(1)="Final FTP Setup complete, beginning FTP Transfer"
  1. . S PRCPMSG(2)=" "
  1. . S PRCPMSG(3)="The file transfer to the report server has been initiated."
  1. . S PRCPMSG(4)="You will be receiving a notification that the FTP"
  1. . S PRCPMSG(5)="process has completed. The notification message"
  1. . S PRCPMSG(6)="should be received within the hour. If you do not"
  1. . S PRCPMSG(7)="receive the FTP process has completed message,"
  1. . S PRCPMSG(8)="please contact IRM. IRM can confirm the process"
  1. . S PRCPMSG(9)="is still running by performing the following"
  1. . S PRCPMSG(10)="command:"
  1. . S PRCPMSG(11)=" "
  1. . S PRCPMSG(12)="At the MUMPS Programmer prompt, type D ^%SS"
  1. . S PRCPMSG(13)=" "
  1. . S PRCPMSG(14)="See if there are any PRCHLO* routines running."
  1. . S PRCPMSG(15)=" "
  1. . S PRCPMSG(16)="If these routines are present, the process is still"
  1. . S PRCPMSG(17)="running. If you waited one hour, and did not get the"
  1. . S PRCPMSG(18)="FTP process has completed message, a problem"
  1. . S PRCPMSG(19)="was encountered. Further troubleshooting can be"
  1. . S PRCPMSG(20)="performed by examining the LOGFILE CLRSxxxFTP1.LOG"
  1. . S PRCPMSG(21)="where xxx is your station ID#. The logfile is"
  1. . S PRCPMSG(22)="located in the following directory: "_FILEDIR
  1. . S PRCPMSG(23)=" "
  1. . D MAILFTP^PRCHLO4A
  1. . Q
  1. I CKOS["VMS" D
  1. . I CLRSERR=0 D
  1. . . D CRTCOM1^PRCHLO4
  1. . . D FTPCOM^PRCHLO4
  1. . . Q
  1. . Q
  1. ;PRC*5.1*172 added check for Full Linux
  1. I CKOS["UNIX" D
  1. . I CLRSERR=0 D
  1. . . D UNXFTP^PRCHLO4
  1. . . Q
  1. . Q
  1. I CKOS["NT" D
  1. . I CLRSERR=0 D
  1. . . D CRTWIN^PRCHLO4A
  1. . . D FTPCOM^PRCHLO4A
  1. . . Q
  1. . Q
  1. ; release the lock
  1. L -^PRCP(446.7,"STATUS")
  1. I CLRSERR=4 D
  1. . N PRCPMSG,FILEDIR
  1. . S FILEDIR=$$GET^XPAR("SYS","PRCPLO EXTRACT DIRECTORY",1,"Q")
  1. . S PRCPMSG(1)="An Error occurred during the FTP Transfer "_$$HTE^XLFDT($H)
  1. . S PRCPMSG(2)="Contact IRM to perform troubleshooting steps"
  1. . S PRCPMSG(3)="by examining the logfile CLRSxxxFTP1.LOG where"
  1. . S PRCPMSG(4)="xxx is your station number. The logfile is located"
  1. . S PRCPMSG(5)="the FTP directory "_FILEDIR
  1. . S PRCPMSG(6)=" "
  1. . D MAILFTP^PRCHLO4A
  1. . Q
  1. I CLRSERR=0 D
  1. . N PRCPMSG,FILEDIR
  1. . S FILEDIR=$$GET^XPAR("SYS","PRCPLO EXTRACT DIRECTORY",1,"Q")
  1. . S PRCPMSG(1)="The FTP Transfer process completed, "_$$HTE^XLFDT($H)
  1. . S PRCPMSG(2)=" "
  1. . S PRCPMSG(3)="The Clinical Logistics 0ffice should examine the Report Server"
  1. . S PRCPMSG(4)="FTP directory for your files. If the files from your"
  1. . S PRCPMSG(5)="station are not found, IRM can provide additional"
  1. . S PRCPMSG(6)="troubleshooting steps by examining the LOGFILE"
  1. . S PRCPMSG(7)="CLRSxxxFTP1.LOG where xxx is your station number."
  1. . S PRCPMSG(8)="The logfile is located in the directory: "_FILEDIR
  1. . S PRCPMSG(9)=" "
  1. . S PRCPMSG(10)="The contents of the logfile are listed below:"
  1. . D LOG2FILE^PRCHLO4A
  1. . Q
  1. ; CLEAN UP
  1. K ^TMP($J)
  1. K ^TMP("PRCHLOG",$J)
  1. Q
  1. DELRUN ; delete previous run at the beginning of the program
  1. ;
  1. N FILCK,FILDEL,TFILE1,TFILE2,OUTFL1,OUTFL2,POP,STID
  1. ; create, delete, then create files to clean up and confirm
  1. ; write / delete privileges to directory
  1. S POP=""
  1. S STID=$$GET1^DIQ(4,$$KSP^XUPARAM("INST")_",",99)
  1. S OUTFL1="CLRS"_STID_"TST.TXT"
  1. S OUTFL2="IFCP"_STID_"TST.TXT"
  1. S FILEDIR=$$GET^XPAR("SYS","PRCPLO EXTRACT DIRECTORY",1,"Q")
  1. I FILEDIR="" D
  1. . S CLRSERR=5
  1. . Q
  1. I FILEDIR=" " D
  1. . S CLRSERR=5
  1. . Q
  1. I CLRSERR=0 D OPEN^%ZISH("TFILE1",FILEDIR,OUTFL1,"W")
  1. I POP D
  1. . S CLRSERR=5
  1. . Q
  1. I CLRSERR=0 D
  1. . D USE^%ZISUTL("TFILE1")
  1. . W !,"$ ! This is a test file to confirm write/delete access"
  1. . W !,"$ ! once file access is confirmed, file is deleted"
  1. . W !,"$ EXIT"
  1. . D CLOSE^%ZISH("TFILE1")
  1. . D OPEN^%ZISH("TFILE2",FILEDIR,OUTFL2,"W")
  1. . D USE^%ZISUTL("TFILE2")
  1. . W !,"$ ! This is a test file to confirm write/delete access"
  1. . W !,"$ ! once file access is confirmed, file is deleted"
  1. . W !,"$ EXIT"
  1. . D CLOSE^%ZISH("TFILE2")
  1. . Q
  1. ;
  1. DELWIN ; DELETE windows files, need to handle 1 file at a time
  1. ; SACC Exception received for usage of $ZF(-1) in PRC*5.1*83
  1. ; See IFCAP technical manual.
  1. I CKOS["NT" D DELWIN^PRCHLO4A
  1. DELFILS ; Delete the files / clean-up before processing
  1. ;
  1. ; SACC Exception received for usage of $ZF(-1) in PRC*5.1*83
  1. ; See IFCAP technical manual
  1. I CKOS["VMS" D ;O/S IS VMS
  1. . Q:CLRSERR'="0"
  1. . N PV,PV1,XPV,XPV1
  1. . S XPV="S PV=$ZF(-1,""DELETE "_FILEDIR_"*"_STID_"*.*;*"")"
  1. . X XPV
  1. . Q
  1. ;PRC*5.1*172 added check for Full Linux
  1. I CKOS["UNIX" D
  1. . D DELUNX^PRCHLO4A
  1. . Q
  1. Q