Posted by Grant E Foraker on May 31, 2022 at 13:18:43:
Have the following in an INC used by many programs. Basically, the initial SPOOL name has "-Cancelled" added to all the PDF's for registers, journals, and other forever reports. Once the user clicks PROCEED (Print OK), I remove the "-Cancelled" leaving the forever name in DocMgr. Sometimes, the DSTAT in the routine returns a null file name and the OPEN crashes. I added a MSGBOX in 2019 but nobody ever calls :)
===============================================================
!------------------- CHANGE DOCMGR NAME ----------------------------------------
CLOSE (78)
LET DOCMGRSTAT$ = DSTAT(ZLP$)
LET PDFL = POS(':',DOCMGRSTAT$) + 1
LET DOCMGRDIR$ = SUB(DOCMGRSTAT$,PDFL-4,3)
LET DOCMGRFILE$ = SUB(DOCMGRSTAT$,PDFL,8)
!------------------- 03/06/2019 ------------------------------------------------
IF STRIP(DOCMGRFILE$) EQ ''
LET MBMSG$ = 'The interface between your PDF software and Comet has failed. '
LET MBMSG$ = MBMSG$ + 'Please contact your Comet Tech Support. '
LET MBMSG$ = MBMSG$ + '@0D0A0D0A@Reference: ' + ZLP$
MSGBOX MBMSG$
ERROR
ENDIF
!-------------------------------------------------------------------------------
OPEN (78) DOCMGRFILE$, DIR = DOCMGRDIR$
POSITION (78) KEY = '@FF@'
APD10:
LET JobSerial$ = PREV(78, EXCP = APD80) ! END OF FILE
INQUIRE (78,DocCat) KEY = JobSerial$
IF POS(UPROG$,JobName$) EQ 0 GOTO APD10 ! WRONG PROGRAM
LET PDFL = POS('-Cancelled',JobName$)
IF PDFL EQ 0 GOTO APD10 ! WRONG REGISTER
LET OldJobName$ = JobName$ ! SAVE OLD PDF FILE NAME
LET JobName$ = SUB(OLDJOBNAME$,1,PDFL-1) + SUB(OLDJOBNAME$,PDFL+10,252)
LET NEWJOBNAME$ = JOBNAME$
WRITE (78,DocCat) KEY = JobSerial$
APD20:
CLOSE (78)
==========================================================
Each file can be a maximum of 1MB in length Uploaded files will be purged from the server on a regular basis.