QUE(RTN,DESC,START,ASK)	;
	; Queues a job to Taskman with optional user interaction
	; Inputs
	;    RTN : The full routine info to queue
	;   DESC : The Description for the task
	;  START : <opt> The start date/time (in FM format) for this job
	;        :  If null, uses today's date/time
	;    ASK : <opt> Prompt the user to queue the job?
	;        :  ASK = 0 (don't) or 1 (ask) If null, defaults to 1
	; Outputs
	;   0 if not tasked, or the Taskman task # if tasked       
	;
	N %,QUE,TIME,I,X,Y,DTOUT,STOP,%DT
	N ZTSK,ZTRTN,ZTDESC,ZTIO,ZTDTH
	S QUE=0
	S RTN=$G(RTN)
	S DESC=$G(DESC)
	I RTN=""!(DESC="") Q 0
	S START=$G(START)
	S ASK=$G(ASK)
	I ASK="" S ASK=1
	I 'ASK S %=1
	S STOP=0
	I START="" D  ;
	. I ASK D  ;
	. . ; prompt user for start date/time
	. . S Y=""
	. . F  D  Q:STOP  S:Y>0 START=Y Q:Y>0  ;
	. . . S %DT="AEFRX"
	. . . S %DT("A")="Date/Time to run this job: "
	. . . S %DT("B")="NOW"
	. . . S %DT(0)="NOW"
	. . . S Y=""
	. . . D ^%DT
	. . . I $D(DTOUT)!($E(X)="^") S STOP=1 Q
	. . ;
	. ; no user interaction requested so set start time to now
	. I 'ASK S START=$$NOW^XLFDT
	;
	I STOP Q 0
	;
	I ASK D  ;
	. W !!,RTN,!,"  ",DESC
	. W !,"    Continue"
	. S %=1
	. D YN^DICN
	I %=1 D  ;
	. S ZTRTN=RTN
	. S ZTDESC=DESC
	. S ZTIO=""
	. S ZTDTH=START
	. S ZTDTH=$$FMTH^XLFDT(ZTDTH)
	. S TIME=ZTDTH
	. K ZTSK
	. D ^%ZTLOAD
	. W !!," ",RTN,!,"  ",DESC
	. I +$G(ZTSK)'>0 W !,"Could not queue the job." H 2 Q
	. I $G(ZTSK) W !,"Queued. Task #",ZTSK,"  for ",$$FMTE^XLFDT($$HTFM^XLFDT(TIME),"")
	. S QUE=ZTSK
	Q QUE
	
 
	 

Samples