This article concerns the creation of unique numbers with AP REXX programs.
I have a REXX routine that builds a UNIQUE file that it will write to and then process. Problem is, this routine can be called more than once simultaneously and the file gets overwritten. How do I make sure that every time the REXX runs, it generates a unique filename?
Windows Server, Open Object REXX
Since your REXX routine can be called more than once simultaneously, I suggest that you use the SysQueryProcess(PID) utility which is available in Open Object REXX. Using this utility, you will get the process ID for each running REXX routine that you call. Your filenames can then be concatenated with this PID, which will be unique, especially when the routine is called more than once simultaneously.
Please read the AP r11.4.x administration guide "Configuring Open Object REXX" to setup AP for using OO-REXX interpreter instead of the AP Embedded REXX interpreter:
Configuring Open Object REXX in AP