- PSNPPSDL ;HP/ART - National Drug File Updates File Download ;09/23/2015
- ;;4.0;NATIONAL DRUG FILE;**513,563**; 30 Oct 98;Build 5
- ;
- ;Reference to ^XUSEC( supported by IA #10076
- ;
- Q
- ;
- DOWNLOAD ;Entry point for menu option PSN DOWNLOAD NDF UPDATES for immediate PPS-N update file download
- N PSENTER,PSNLEGF
- I $$GET1^DIQ(57.23,1,9,"I")="Y" D Q
- .W !!,"The PPS-N/NDF file download is already in progress. Please try again later."
- .R !!,"Press enter to continue...",PSENTER:120
- N DIRUT,DUOUT,DIR,X,Y
- I '$D(^XUSEC("PSN PPS ADMIN",DUZ)) D Q
- . W !!,"You do not have the appropriate security key to use this option"
- . W !,"please contact your ADPAC to resolve this issue.",!
- . S DIR(0)="E",DIR("A")=" Press ENTER to Continue"
- . D ^DIR
- ;
- S PSNLEGF="",PSNLEGF=$$LEGACY() I PSNLEGF Q
- D CHKD ;update Unix directory if needed and create it if entry does not exist.
- ;
- W !!!,"Warning: This download should only be done during off peak hours!"
- ;
- N DIRUT,DUOUT,DIR,X,Y
- W ! S DIR(0)="Y",DIR("?")="Please enter Y or N."
- S DIR("A")="Are you sure you want to immediately start an NDF update download"
- S DIR("B")="NO" D ^DIR I 'Y Q
- W !,"Please stand-by NDF update download may take up to 30 minutes...",!
- ;
- RUNIT ; Entry point for tasked menu option "PSN TASK SCHEDULED DOWNLOAD"
- N PSNSCJOB S PSNSCJOB=1 D EN^PSNFTP
- Q
- ;
- SCHDOPT ; Entry point for menu option "PSN TASK SCHEDULE DOWNLOAD" to create and/or edit the scheduling date/time
- N DIRUT,DUOUT,DIR,X,Y,PSSTART,PSFREQ,PSERROR,PSNLEGF
- I '$D(^XUSEC("PSN PPS ADMIN",DUZ)) D Q
- . W !!,"You do not have the appropriate security key to use this option"
- . W !,"please contact your ADPAC to resolve this issue.",!
- . S DIR(0)="E",DIR("A")=" Press ENTER to Continue"
- . D ^DIR
- ;
- S PSNLEGF="",PSNLEGF=$$LEGACY() I PSNLEGF Q
- D CHKD ;update Unix directory if needed and create it if entry does not exist.
- ;
- W !!!,"This option allows you to schedule a recurring TasKMan job to"
- W !,"perform the NDF update file download from PPS-N."
- W !!,"Warning! This download should be scheduled during non-peak hours."
- W !!,"You will need to select a date/time and how often this download should reoccur."
- ;
- N DIRUT,DUOUT,DIR,X,Y
- ;W !!
- D SCHCK("PSN TASK SCHEDULED DOWNLOAD","D") ;print scheduled tasks
- ;
- S DIR(0)="Y",DIR("?")="Please enter Y or N."
- S DIR("A")="Do you want to schedule an automatic NDF download in TaskMan",DIR("B")="NO"
- D ^DIR I (Y'>0)!$D(DIRUT) W @IOF Q
- ;
- D NOW^%DTC S %DT(0)=%,%DT="EFATX",%DT("A")="Enter date/time: " D ^%DT
- I (Y<0)!($D(DTOUT)) W !!,"No action taken!" D ENTER W @IOF Q
- S PSSTART=$$FMADD^XLFDT(Y,0,0,5)
- ;
- N DIRUT,DUOUT,DIR,X,Y
- W !! S DIR(0)="Y",DIR("?")="Please enter Y or N."
- S DIR("A")="Should this download be re-scheduled at the same time weekly"
- S DIR("B")="NO" D ^DIR I Y S PSFREQ="7D" G END
- I $D(DIRUT) W !!,"No action taken!" D ENTER W @IOF Q
- ;
- N DIRUT,DUOUT,DIR,X,Y
- W !! S DIR(0)="Y",DIR("?")="Please enter Y or N."
- S DIR("A")="Should this download be re-scheduled at the same time daily"
- S DIR("B")="NO" D ^DIR I Y S PSFREQ="1D" G END
- I $D(DIRUT) W !!,"No action taken!" D ENTER W @IOF Q
- I 'Y S PSFREQ="" W !!,"Warning! The download you have scheduled will occur only once."
- ;
- END ;
- N DIRUT,DUOUT,DIR,X,Y
- I PSFREQ="" D RESCH^XUTMOPT("PSN TASK SCHEDULED DOWNLOAD","@","","@")
- W !,"Your start time is:"
- D RESCH^XUTMOPT("PSN TASK SCHEDULED DOWNLOAD",PSSTART,"",PSFREQ,"L",.PSERROR)
- I +PSFREQ=1 W !!,"The download will automatically be re-scheduled Daily",!
- I +PSFREQ=7 W !!,"The download will automatically be re-scheduled Weekly",!
- I PSFREQ="" W !!,"The download will NOT automatically be re-scheduled",!
- D ENTER W @IOF
- Q
- ;
- SCHCK(OPTION,TYPE) ; check PPS-N scheduled Download or Install tasks
- ; input - OPTION as name of option
- ; TYPE as task type (D-Download/I-Install)
- ; output - print future queued tasked (external format)
- ;
- N I,II,PSIEN,XX,NODE,NODE1,PSNROOT
- ; check to see if the option is defined in option scheduler file and it is tasked.
- D OPTSTAT^XUTMOPT(OPTION,.PSNROOT) I '+$G(PSNROOT(1)) Q
- S (I,II)=0
- F S I=$O(PSNROOT(I)) Q:'I S II=II+1 D
- .I II=1 W !!!,"Scheduled "_$S(TYPE="D":"Downloads",TYPE="I":"Installs",1:"")_" are:",!,"-----------------------"
- .W !,$P(PSNROOT(I),"^")_" "_$$DATE($P(PSNROOT(I),"^",2),1)," ",$P(PSNROOT(I),"^",3),!
- I II=0 W !,"*** Currently NO scheduled "_$S(TYPE="D":"Downloads",TYPE="I":"Installs",1:"")," tasks.",!
- Q
- ;
- DATE(NODE,PIECE) ; return appropriate date
- ; input - NODE as node of data
- ; PIECE as piece of node to convert
- ; output - date in external format
- ;
- Q $$UP^XLFSTR($$FMTE^XLFDT($P(NODE,"^",PIECE)))
- ;
- LEGACY() ;check legacy update file processing parameter
- N PSNLEG,PSNF,PSENTER
- S (PSNF,PSNLEG)="",PSNLEG=$$GET1^DIQ(57.23,1,45) ;legacy update
- I PSNLEG="YES" S PSNF=1 D
- .W !!,"This option may not be utilized because the Legacy Update Processing"
- .W !,"site parameter is defined as YES. You may only install FORUM NDF patch updates.",!
- .R !!,"Press enter to continue...",PSENTER:120
- Q PSNF
- ;
- CHKD ; check Unix dir and update it if contains control char and other special characters
- I $$OS^%ZOSV()'="UNIX" Q
- N UNXLD,UNXLD1 S (UNXLD,UNXLD1)=""
- D UPDT
- S UNXLD=$$GETD^PSNFTP()
- I '$$DIREXIST^PSNFTP2(UNXLD) D MAKEDIR^PSNFTP2(UNXLD)
- Q
- ;
- UPDT ; update unix/linux directory, called by PSNPPSDL
- N DA,DIE,DR
- S UNXLD=$P($G(^PS(57.23,1,0)),"^",4) I UNXLD]"" D
- .S UNXLD1=$$STRIP^PSNPARM(UNXLD) I UNXLD]"",(UNXLD'=UNXLD1) S DIE="^PS(57.23,",DA=1,DR="3////"_UNXLD D ^DIE K DIE,DA,DR
- Q
- ;
- ENTER ; press enter key
- K DIR
- W ! S DIR(0)="E",DIR("A")=" Press ENTER to Continue" D ^DIR K DIR
- Q
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSNPPSDL 5756 printed Jan 18, 2025@03:25:39 Page 2
- PSNPPSDL ;HP/ART - National Drug File Updates File Download ;09/23/2015
- +1 ;;4.0;NATIONAL DRUG FILE;**513,563**; 30 Oct 98;Build 5
- +2 ;
- +3 ;Reference to ^XUSEC( supported by IA #10076
- +4 ;
- +5 QUIT
- +6 ;
- DOWNLOAD ;Entry point for menu option PSN DOWNLOAD NDF UPDATES for immediate PPS-N update file download
- +1 NEW PSENTER,PSNLEGF
- +2 IF $$GET1^DIQ(57.23,1,9,"I")="Y"
- Begin DoDot:1
- +3 WRITE !!,"The PPS-N/NDF file download is already in progress. Please try again later."
- +4 READ !!,"Press enter to continue...",PSENTER:120
- End DoDot:1
- QUIT
- +5 NEW DIRUT,DUOUT,DIR,X,Y
- +6 IF '$DATA(^XUSEC("PSN PPS ADMIN",DUZ))
- Begin DoDot:1
- +7 WRITE !!,"You do not have the appropriate security key to use this option"
- +8 WRITE !,"please contact your ADPAC to resolve this issue.",!
- +9 SET DIR(0)="E"
- SET DIR("A")=" Press ENTER to Continue"
- +10 DO ^DIR
- End DoDot:1
- QUIT
- +11 ;
- +12 SET PSNLEGF=""
- SET PSNLEGF=$$LEGACY()
- IF PSNLEGF
- QUIT
- +13 ;update Unix directory if needed and create it if entry does not exist.
- DO CHKD
- +14 ;
- +15 WRITE !!!,"Warning: This download should only be done during off peak hours!"
- +16 ;
- +17 NEW DIRUT,DUOUT,DIR,X,Y
- +18 WRITE !
- SET DIR(0)="Y"
- SET DIR("?")="Please enter Y or N."
- +19 SET DIR("A")="Are you sure you want to immediately start an NDF update download"
- +20 SET DIR("B")="NO"
- DO ^DIR
- IF 'Y
- QUIT
- +21 WRITE !,"Please stand-by NDF update download may take up to 30 minutes...",!
- +22 ;
- RUNIT ; Entry point for tasked menu option "PSN TASK SCHEDULED DOWNLOAD"
- +1 NEW PSNSCJOB
- SET PSNSCJOB=1
- DO EN^PSNFTP
- +2 QUIT
- +3 ;
- SCHDOPT ; Entry point for menu option "PSN TASK SCHEDULE DOWNLOAD" to create and/or edit the scheduling date/time
- +1 NEW DIRUT,DUOUT,DIR,X,Y,PSSTART,PSFREQ,PSERROR,PSNLEGF
- +2 IF '$DATA(^XUSEC("PSN PPS ADMIN",DUZ))
- Begin DoDot:1
- +3 WRITE !!,"You do not have the appropriate security key to use this option"
- +4 WRITE !,"please contact your ADPAC to resolve this issue.",!
- +5 SET DIR(0)="E"
- SET DIR("A")=" Press ENTER to Continue"
- +6 DO ^DIR
- End DoDot:1
- QUIT
- +7 ;
- +8 SET PSNLEGF=""
- SET PSNLEGF=$$LEGACY()
- IF PSNLEGF
- QUIT
- +9 ;update Unix directory if needed and create it if entry does not exist.
- DO CHKD
- +10 ;
- +11 WRITE !!!,"This option allows you to schedule a recurring TasKMan job to"
- +12 WRITE !,"perform the NDF update file download from PPS-N."
- +13 WRITE !!,"Warning! This download should be scheduled during non-peak hours."
- +14 WRITE !!,"You will need to select a date/time and how often this download should reoccur."
- +15 ;
- +16 NEW DIRUT,DUOUT,DIR,X,Y
- +17 ;W !!
- +18 ;print scheduled tasks
- DO SCHCK("PSN TASK SCHEDULED DOWNLOAD","D")
- +19 ;
- +20 SET DIR(0)="Y"
- SET DIR("?")="Please enter Y or N."
- +21 SET DIR("A")="Do you want to schedule an automatic NDF download in TaskMan"
- SET DIR("B")="NO"
- +22 DO ^DIR
- IF (Y'>0)!$DATA(DIRUT)
- WRITE @IOF
- QUIT
- +23 ;
- +24 DO NOW^%DTC
- SET %DT(0)=%
- SET %DT="EFATX"
- SET %DT("A")="Enter date/time: "
- DO ^%DT
- +25 IF (Y<0)!($DATA(DTOUT))
- WRITE !!,"No action taken!"
- DO ENTER
- WRITE @IOF
- QUIT
- +26 SET PSSTART=$$FMADD^XLFDT(Y,0,0,5)
- +27 ;
- +28 NEW DIRUT,DUOUT,DIR,X,Y
- +29 WRITE !!
- SET DIR(0)="Y"
- SET DIR("?")="Please enter Y or N."
- +30 SET DIR("A")="Should this download be re-scheduled at the same time weekly"
- +31 SET DIR("B")="NO"
- DO ^DIR
- IF Y
- SET PSFREQ="7D"
- GOTO END
- +32 IF $DATA(DIRUT)
- WRITE !!,"No action taken!"
- DO ENTER
- WRITE @IOF
- QUIT
- +33 ;
- +34 NEW DIRUT,DUOUT,DIR,X,Y
- +35 WRITE !!
- SET DIR(0)="Y"
- SET DIR("?")="Please enter Y or N."
- +36 SET DIR("A")="Should this download be re-scheduled at the same time daily"
- +37 SET DIR("B")="NO"
- DO ^DIR
- IF Y
- SET PSFREQ="1D"
- GOTO END
- +38 IF $DATA(DIRUT)
- WRITE !!,"No action taken!"
- DO ENTER
- WRITE @IOF
- QUIT
- +39 IF 'Y
- SET PSFREQ=""
- WRITE !!,"Warning! The download you have scheduled will occur only once."
- +40 ;
- END ;
- +1 NEW DIRUT,DUOUT,DIR,X,Y
- +2 IF PSFREQ=""
- DO RESCH^XUTMOPT("PSN TASK SCHEDULED DOWNLOAD","@","","@")
- +3 WRITE !,"Your start time is:"
- +4 DO RESCH^XUTMOPT("PSN TASK SCHEDULED DOWNLOAD",PSSTART,"",PSFREQ,"L",.PSERROR)
- +5 IF +PSFREQ=1
- WRITE !!,"The download will automatically be re-scheduled Daily",!
- +6 IF +PSFREQ=7
- WRITE !!,"The download will automatically be re-scheduled Weekly",!
- +7 IF PSFREQ=""
- WRITE !!,"The download will NOT automatically be re-scheduled",!
- +8 DO ENTER
- WRITE @IOF
- +9 QUIT
- +10 ;
- SCHCK(OPTION,TYPE) ; check PPS-N scheduled Download or Install tasks
- +1 ; input - OPTION as name of option
- +2 ; TYPE as task type (D-Download/I-Install)
- +3 ; output - print future queued tasked (external format)
- +4 ;
- +5 NEW I,II,PSIEN,XX,NODE,NODE1,PSNROOT
- +6 ; check to see if the option is defined in option scheduler file and it is tasked.
- +7 DO OPTSTAT^XUTMOPT(OPTION,.PSNROOT)
- IF '+$GET(PSNROOT(1))
- QUIT
- +8 SET (I,II)=0
- +9 FOR
- SET I=$ORDER(PSNROOT(I))
- if 'I
- QUIT
- SET II=II+1
- Begin DoDot:1
- +10 IF II=1
- WRITE !!!,"Scheduled "_$SELECT(TYPE="D":"Downloads",TYPE="I":"Installs",1:"")_" are:",!,"-----------------------"
- +11 WRITE !,$PIECE(PSNROOT(I),"^")_" "_$$DATE($PIECE(PSNROOT(I),"^",2),1)," ",$PIECE(PSNROOT(I),"^",3),!
- End DoDot:1
- +12 IF II=0
- WRITE !,"*** Currently NO scheduled "_$SELECT(TYPE="D":"Downloads",TYPE="I":"Installs",1:"")," tasks.",!
- +13 QUIT
- +14 ;
- DATE(NODE,PIECE) ; return appropriate date
- +1 ; input - NODE as node of data
- +2 ; PIECE as piece of node to convert
- +3 ; output - date in external format
- +4 ;
- +5 QUIT $$UP^XLFSTR($$FMTE^XLFDT($PIECE(NODE,"^",PIECE)))
- +6 ;
- LEGACY() ;check legacy update file processing parameter
- +1 NEW PSNLEG,PSNF,PSENTER
- +2 ;legacy update
- SET (PSNF,PSNLEG)=""
- SET PSNLEG=$$GET1^DIQ(57.23,1,45)
- +3 IF PSNLEG="YES"
- SET PSNF=1
- Begin DoDot:1
- +4 WRITE !!,"This option may not be utilized because the Legacy Update Processing"
- +5 WRITE !,"site parameter is defined as YES. You may only install FORUM NDF patch updates.",!
- +6 READ !!,"Press enter to continue...",PSENTER:120
- End DoDot:1
- +7 QUIT PSNF
- +8 ;
- CHKD ; check Unix dir and update it if contains control char and other special characters
- +1 IF $$OS^%ZOSV()'="UNIX"
- QUIT
- +2 NEW UNXLD,UNXLD1
- SET (UNXLD,UNXLD1)=""
- +3 DO UPDT
- +4 SET UNXLD=$$GETD^PSNFTP()
- +5 IF '$$DIREXIST^PSNFTP2(UNXLD)
- DO MAKEDIR^PSNFTP2(UNXLD)
- +6 QUIT
- +7 ;
- UPDT ; update unix/linux directory, called by PSNPPSDL
- +1 NEW DA,DIE,DR
- +2 SET UNXLD=$PIECE($GET(^PS(57.23,1,0)),"^",4)
- IF UNXLD]""
- Begin DoDot:1
- +3 SET UNXLD1=$$STRIP^PSNPARM(UNXLD)
- IF UNXLD]""
- IF (UNXLD'=UNXLD1)
- SET DIE="^PS(57.23,"
- SET DA=1
- SET DR="3////"_UNXLD
- DO ^DIE
- KILL DIE,DA,DR
- End DoDot:1
- +4 QUIT
- +5 ;
- ENTER ; press enter key
- +1 KILL DIR
- +2 WRITE !
- SET DIR(0)="E"
- SET DIR("A")=" Press ENTER to Continue"
- DO ^DIR
- KILL DIR
- +3 QUIT