Unique Output Filenames

Project:PDF Include project
Component:Code
Category:feature request
Priority:minor
Assigned:Unassigned
Status:active
Description

Problem:
Using PDFextract.p as example; Multiple Users running same program can cause all sessions to APPEND to the same filename.

Line2748:
OUTPUT TO VALUE(SESSION:TEMP-DIR + pID + String(pPage) + ".txt") BINARY NO-MAP NO-CONVERT APPEND.

Patch that fixed problem in our unix environment:

DEF VAR uniqie_id AS CHAR NO-UNDO.
DEF VAR form_uniq AS CHAR NO-UNDO.

ASSIGN
unique_id = ENCODE(STRING(TODAY) + STRING(ETIME) + pFileName)
form_uniq = SESSION:TEMP-DIR + unique_id + "-".

OUTPUT TO VALUE(form_uniq + pID + String(pPage) + ".txt") BINARY NO-MAP NO-CONVERT APPEND.


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
alonb's picture

#1

the progress standard libraries has a function that adds a counter to the file name incase the file already exists, for example, c:\test(1).p that you could also use.

http://www.oehive.org/project/lib

{slibos.i}

message os_getNextFile( "c:\test.p" ).