![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I'm trying to create or find a way of creating unique ID's. System(19) only allows for 27 unique ID's per second (todays date concatenated with the internal time plus a letter between 'A' and 'Z' if system(19) is accessed more than once per second), and system(21) uses the internal date along with a number from 0 to 65535. When using system(19) the whole system can get throttled down waiting for a new second to elapse if more that 27 system(19)'s are performed in a single second. System(21) does not guarentee unique id's in a single day. I've experimented with a subroutine that uses a single record to dish out an ID and then increments the ID and writes the item back for the next process to use. This method seems extremely slow as compared to using the system(21). Does anyone have a better way? The subroutine is as follows: subroutine get.unique(val) open 'unique' to da.file else stop 201, 'unique' readu val from unique,'unique' else val = 0 end val += 1 if val gt 9999999 then val = 0 write val on unique,'unique' return When I run a test of 9 processes that just call this subroutine an print the value returned, many times a process will stop processing for a couple of seconds waiting for its turn. I would have thought that the numbers returned would have been distributed more evenly but most process get about 20 to 50 sequential numbers. I'm open for suggestions other than changing systems. :-) Regards, Dale |
#3
| |||
| |||
|
|
I'm trying to create or find a way of creating unique ID's. subroutine get.unique(val) open 'unique' to da.file else stop 201, 'unique' readu val from unique,'unique' else val = 0 end val += 1 if val gt 9999999 then val = 0 write val on unique,'unique' return When I run a test of 9 processes that just call this subroutine an print the value returned, many times a process will stop processing for a couple of seconds waiting for its turn. I would have thought that the numbers returned would have been distributed more evenly but most process get about 20 to 50 sequential numbers. I'm open for suggestions other than changing systems. :-) Regards, Dale |
#4
| |||
| |||
|
|
Hi You are getting bogged down with the file open not the reads and writes. Use a COMMON file or if you are really brave a NAMED COMMON for the file open and you will not be able to time it. Peter McMurray"Dale" <benedictknows... (AT) silk (DOT) net> wrote in messagenews:12ir8f23sshqf88 (AT) corp (DOT) supernews.com... I'm trying to create or find a way of creating unique ID's. System(19) only allows for 27 unique ID's per second (todays date concatenated with the internal time plus a letter between 'A' and 'Z' if system(19) is accessed more than once per second), and system(21) uses the internal date along with a number from 0 to 65535. When using system(19) the whole system can get throttled down waiting for a new second to elapse if more that 27 system(19)'s are performed in a single second. System(21) does not guarentee unique id's in a single day. I've experimented with a subroutine that uses a single record to dish out an ID and then increments the ID and writes the item back for the next process to use. This method seems extremely slow as compared to using the system(21). Does anyone have a better way? The subroutine is as follows: subroutine get.unique(val) open 'unique' to da.file else stop 201, 'unique' readu val from unique,'unique' else val = 0 end val += 1 if val gt 9999999 then val = 0 write val on unique,'unique' return When I run a test of 9 processes that just call this subroutine an print the value returned, many times a process will stop processing for a couple of seconds waiting for its turn. I would have thought that the numbers returned would have been distributed more evenly but most process get about 20 to 50 sequential numbers. I'm open for suggestions other than changing systems. :-) Regards, Dale- Hide quoted text -- Show quoted text - |
#5
| |||
| |||
|
|
I'm trying to create or find a way of creating unique ID's. System(19) only allows for 27 unique ID's per second (todays date concatenated with the internal time plus a letter between 'A' and 'Z' if system(19) is accessed more than once per second) |
#6
| |||
| |||
|
|
"Dale" wrote: I'm trying to create or find a way of creating unique ID's. System(19) only allows for 27 unique ID's per second (todays date concatenated with the internal time plus a letter between 'A' and 'Z' if system(19) is accessed more than once per second)That's not correct, many years ago RD enhanced system(19) to go to AA through ZZ. I don't care how fast your CPU is, you're not going to go through that many calls to this code in one second. The problem with the basic A to Z was that with a faster CPU we went through to Z and then the call hung on a lock until the clock ticked over to the next second - bad news. That problem was fixed quickly, and a looong time ago. T |
#7
| |||
| |||
|
|
I'm trying to create or find a way of creating unique ID's. Avoid system-level utilities when you can, in case they |
#8
| |||
| |||
|
|
You can produce system-global-unique ID's in your own application code if you concatenate a) time() b) this port number c) a one-up counter kept in a named common, set to 1 at logon D'oh! and of course |
#9
| |||
| |||
|
|
Now appears to goto 3 alphas (7.4.0), which will give >17,000 second, though on machinbe I tested on here only yielded 6,000/sec .... still "heaps" for most practical purposes On Oct 12, 3:19 pm, Tony Gravagno g6q3x9lu53... (AT) sneakemail (DOT) com.invalid> wrote: "Dale" wrote: I'm trying to create or find a way of creating unique ID's. System(19) only allows for 27 unique ID's per second (todays date concatenated with the internal time plus a letter between 'A' and 'Z' if system(19) is accessed more than once per second)That's not correct, many years ago RD enhanced system(19) to go to AA through ZZ. I don't care how fast your CPU is, you're not going to go through that many calls to this code in one second. The problem with the basic A to Z was that with a faster CPU we went through to Z and then the call hung on a lock until the clock ticked over to the next second - bad news. That problem was fixed quickly, and a looong time ago. T- Hide quoted text -- Show quoted text - |
#10
| |||
| |||
|
|
"Dale" wrote I'm trying to create or find a way of creating unique ID's. Avoid system-level utilities when you can, in case they change in the next release of D3. |
|
You can produce system-global-unique ID's in your own application code if you concatenate a) time() b) this port number c) a one-up counter kept in a named common, set to 1 at logon but you'll have to prevent two successive logon sessions on same pick port from getting into your app code during the same second. |
|
{maybe sleep 1 during logon proc, or sleep(1) in your top-level process at either its birth or at its final 'wrapup & die'} Also, since all of a-c above have varying lengths and are all numeric, you'll need a:'*':b:'*':c instead of just a:b:c or you'll risk duplicate ids. |
![]() |
| Thread Tools | |
| Display Modes | |
| |