[U2] Guaranteed unique sequential keys
What is the most reliable way to generate unique sequential keys without having to resort to a record on disk updated through readu/write? The keys don't have to be contiguous but only be sortable in the order in which they were generated by several phantom processes running concurrently. I'm currently approximating this using a concatenation of date and time with millisecondsB but I'm worried about the possibility of two phantoms generating exactly the same key. B Although no collision has been detected so far, I have added an extra check where after generating the key I first test if a record with that key exists. If so IB increment and append aB serial number and repeat the test until aB unique key is found. ItB seems to be working well but I still think there is a better way to do this. B Thanks for any help. B Marco. __ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Guaranteed unique sequential keys
Marco, I have used similar processes in the past, but also have appended port number to the beginning of the key. Separating the fields with '*' so the date and time can also be used as a time stamp rather than duplicate the same info in the record. Cheers, David Murray * Learn and do * Excel and share http://u2blog.org -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marco Manyevere Sent: Thursday, April 24, 2008 5:55 AM To: u2-users@listserver.u2ug.org Subject: [U2] Guaranteed unique sequential keys What is the most reliable way to generate unique sequential keys without having to resort to a record on disk updated through readu/write? The keys don't have to be contiguous but only be sortable in the order in which they were generated by several phantom processes running concurrently. I'm currently approximating this using a concatenation of date and time with millisecondsB but I'm worried about the possibility of two phantoms generating exactly the same key. B Although no collision has been detected so far, I have added an extra check where after generating the key I first test if a record with that key exists. If so IB increment and append aB serial number and repeat the test until aB unique key is found. ItB seems to be working well but I still think there is a better way to do this. B Thanks for any help. B Marco. __ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
Re: [U2] Guaranteed unique sequential keys
Marco Manyevere wrote: What is the most reliable way to generate unique sequential keys without having to resort to a record on disk updated through readu/write? The keys don't have to be contiguous but only be sortable in the order in which they were generated by several phantom processes running concurrently. I'm currently approximating this using a concatenation of date and time with millisecondsB but I'm worried about the possibility of two phantoms generating exactly the same key. B Although no collision has been detected so far, I have added an extra check where after generating the key I first test if a record with that key exists. If so IB increment and append aB serial number and repeat the test until aB unique key is found. ItB seems to be working well but I still think there is a better way to do this. B Thanks for any help. Assuming unix, add the process id to your key. So if you're currently using internal_date*internal*time, add *pid. There's a GCI interlude to get the process id, I *think* it's GETPID, but you'll have to look that up. If you're on windows, this won't help you much. -- Allen Egerton aegerton at pobox dot com --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Guaranteed unique sequential keys
Of course if the port number is added to the end of the key then you can still sort by date/time. In the past I've done an R%5 oconv on both the (internal) date and time before concatenation - this gives you a 10 digit number regardless of the date and time used, so no need for separators... Edward -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Murray Sent: 24 April 2008 11:53 To: u2-users@listserver.u2ug.org Subject: RE: [U2] Guaranteed unique sequential keys Marco, I have used similar processes in the past, but also have appended port number to the beginning of the key. Separating the fields with '*' so the date and time can also be used as a time stamp rather than duplicate the same info in the record. Cheers, David Murray * Learn and do * Excel and share http://u2blog.org -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marco Manyevere Sent: Thursday, April 24, 2008 5:55 AM To: u2-users@listserver.u2ug.org Subject: [U2] Guaranteed unique sequential keys What is the most reliable way to generate unique sequential keys without having to resort to a record on disk updated through readu/write? The keys don't have to be contiguous but only be sortable in the order in which they were generated by several phantom processes running concurrently. I'm currently approximating this using a concatenation of date and time with millisecondsB but I'm worried about the possibility of two phantoms generating exactly the same key. B Although no collision has been detected so far, I have added an extra check where after generating the key I first test if a record with that key exists. If so IB increment and append aB serial number and repeat the test until aB unique key is found. ItB seems to be working well but I still think there is a better way to do this. B Thanks for any help. B Marco. __ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- Please remember to recycle wherever possible. Reduce, reuse, recycle, think do you need to print this e-mail? --- This e-mail and any attachment(s), is confidential and may be legally privileged. It is intended solely for the addressee. If you are not the addressee, dissemination, copying or use of this e-mail or any of its content is prohibited and may be unlawful. If you are not the intended recipient please inform the sender immediately and destroy the e-mail, any attachment(s) and any copies. All liability for viruses is excluded to the fullest extent permitted by law. It is your responsibility to scan or otherwise check this email and any attachment(s). Unless otherwise stated (i) views expressed in this message are those of the individual sender (ii) no contract may be construed by this e-mail. Emails may be monitored and you are taken to consent to this monitoring. Civica Services Limited, Company No. 02374268; Civica UK Limited, Company No. 01628868 Both companies are registered in England and Wales and each has its registered office at 2 Burston Road, Putney, London, SW15 6AR. --- --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Guaranteed unique sequential keys
If you use @USERNO, instead of the pid, it will be OS independent. Tom Whitmore -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Allen Egerton Sent: Thursday, April 24, 2008 6:58 AM To: u2-users@listserver.u2ug.org Subject: Re: [U2] Guaranteed unique sequential keys Marco Manyevere wrote: What is the most reliable way to generate unique sequential keys without having to resort to a record on disk updated through readu/write? The keys don't have to be contiguous but only be sortable in the order in which they were generated by several phantom processes running concurrently. I'm currently approximating this using a concatenation of date and time with millisecondsB but I'm worried about the possibility of two phantoms generating exactly the same key. B Although no collision has been detected so far, I have added an extra check where after generating the key I first test if a record with that key exists. If so IB increment and append aB serial number and repeat the test until aB unique key is found. ItB seems to be working well but I still think there is a better way to do this. B Thanks for any help. Assuming unix, add the process id to your key. So if you're currently using internal_date*internal*time, add *pid. There's a GCI interlude to get the process id, I *think* it's GETPID, but you'll have to look that up. If you're on windows, this won't help you much. -- Allen Egerton aegerton at pobox dot com --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Guaranteed unique sequential keys
Setup a loop This assumes you've already set up ID with the date:time I=0 LOOP I += 1 WRITE.ID = ID : '*' : I READV JUST.CHECKING FROM FILE.NAME, WRITE.ID, 0 ELSE WRITE REC ON FILE.NAME, WRITE.ID EXIT END REPEAT This will always append *1 to the end of the ID unless it already exists. If it does the loop will engage and will try *2, *3, ... until it hits an unused ID. I've used this several times in the past with total success. However, the above code is untested so there could be a typo, etc., but I hope you get the idea! hth, Allen -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Marco Manyevere Sent: Thursday, April 24, 2008 02:55 To: u2-users@listserver.u2ug.org Subject: [U2] Guaranteed unique sequential keys What is the most reliable way to generate unique sequential keys without having to resort to a record on disk updated through readu/write? The keys don't have to be contiguous but only be sortable in the order in which they were generated by several phantom processes running concurrently. I'm currently approximating this using a concatenation of date and time with millisecondsB but I'm worried about the possibility of two phantoms generating exactly the same key. B Although no collision has been detected so far, I have added an extra check where after generating the key I first test if a record with that key exists. If so IB increment and append aB serial number and repeat the test until aB unique key is found. ItB seems to be working well but I still think there is a better way to do this. B Thanks for any help. B Marco. __ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
Re: [U2] Guaranteed unique sequential keys
David, Allen, Edward, thanks for the suggestions but I want to be able to sort theB records in the exact physical order in which they occured.B Using the port or pid numbers could potentially give me the wrong sequence should two events occur within the same millisecond (unless it is ruled out that this is not possible). Regards, Marco. - Original Message From: Edward Brown [EMAIL PROTECTED] To: u2-users@listserver.u2ug.org Sent: Thursday, 24 April, 2008 1:07:13 PM Subject: RE: [U2] Guaranteed unique sequential keys Of course if the port number is added to the end of the key then you can still sort by date/time. In the past I've done an R%5 oconv on both the (internal) date and time before concatenation - this gives you a 10 digit number regardless of the date and time used, so no need for separators... Edward -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Murray Sent: 24 April 2008 11:53 To: u2-users@listserver.u2ug.org Subject: RE: [U2] Guaranteed unique sequential keys Marco, I have used similar processes in the past, but also have appended port number to the beginning of the key. Separating the fields with '*' so the date and time can also be used as a time stamp rather than duplicate the same info in the record. Cheers, David Murray *B B B B B B Learn and do *B B B Excel and share http://u2blog.org -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marco Manyevere Sent: Thursday, April 24, 2008 5:55 AM To: u2-users@listserver.u2ug.org Subject: [U2] Guaranteed unique sequential keys What is the most reliable way to generate unique sequential keys without having to resort to a record on disk updated through readu/write? The keys don't have to be contiguous but only be sortable in the order in which they were generated by several phantom processes running concurrently. I'm currently approximating this using a concatenation of date and time with millisecondsB but I'm worried about the possibility of two phantoms generating exactly the same key. B Although no collision has been detected so far, I have added an extra check where after generating the key I first test if a record with that key exists. If so IB increment and append aB serial number and repeat the test until aB unique key is found. ItB seems to be working well but I still think there is a better way to do this. B Thanks for any help. B Marco. B B B __ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ - -- Please remember to recycle wherever possible. Reduce, reuse, recycle, think do you need to print this e-mail? - -- This e-mail and any attachment(s), is confidential and may be legally privileged. It is intended solely for the addressee. If you are not the addressee, dissemination, copying or use of this e-mail or any of its content is prohibited and may be unlawful. If you are not the intended recipient please inform the sender immediately and destroy the e-mail, any attachment(s) and any copies. All liability for viruses is excluded to the fullest extent permitted by law. It is your responsibility to scan or otherwise check this email and any attachment(s). Unless otherwise stated (i) views expressed in this message are those of the individual sender (ii) no contract may be construed by this e-mail. Emails may be monitored and you are taken to consent to this monitoring.B Civica Services Limited, Company No. 02374268; Civica UK Limited, Company No. 01628868 Both companies are registered in England and Wales and each has its registered office at 2 Burston Road, Putney, London, SW15 6AR. - -- --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ __ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
[U2] Corrupt file
We are running UniData 6.0.4 on an HP.UX 11 and the following error keeps appearing: 2:blk check error in U_catch_tuple for file 'OPEN.MO', key '082352500', number=1327 I have run following command: :!guide OPEN.MO -o OPEN.MO Basic statistics: File type... Dynamic Hashing File size [dat001].. 8129536 [over001]. 43686912 File modulo. 7937 File minimum modulo. 7937 File split factor... 60 File merge factor... 40 File hash type.. 1 File block size. 1024 File Integrity: Group 1327, block 1328, record number 3 = 082352500 offset occurs in wrong order 35587084 Group 1327, block 34753, record number 3 = 082352500 offset error 35587084 Group 1327, block 34753, record number 2 = 076754900 record length of 414 is wrong. Group 1327, block 34753, record number 3 = 082352500 record length of 1035 is wrong. Group 1327, block 34753 bytes used 1449 and bytes left 989 are inconsistent Free blocks in overflow file(s). 7982 Management advice: This file's integrity has been compromised, please repair it. Files processed:1 Errors encountered: 5 We need to fix this problem, but the manuals are pretty vague on what steps are required. Do I use 'guide' and 'fixfile' or do I use 'verify2', 'dumpgroup' and 'fixgroup'? Can anyone help me with this? Wyatt Buffington --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Guaranteed unique sequential keys
You could use SETENV / GETENV but I wouldn't think this is any faster / safer than READU/WRITE. Edward -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marco Manyevere Sent: 24 April 2008 13:47 To: u2-users@listserver.u2ug.org Subject: Re: [U2] Guaranteed unique sequential keys David, Allen, Edward, thanks for the suggestions but I want to be able to sort theB records in the exact physical order in which they occured.B Using the port or pid numbers could potentially give me the wrong sequence should two events occur within the same millisecond (unless it is ruled out that this is not possible). Regards, Marco. - Original Message From: Edward Brown [EMAIL PROTECTED] To: u2-users@listserver.u2ug.org Sent: Thursday, 24 April, 2008 1:07:13 PM Subject: RE: [U2] Guaranteed unique sequential keys Of course if the port number is added to the end of the key then you can still sort by date/time. In the past I've done an R%5 oconv on both the (internal) date and time before concatenation - this gives you a 10 digit number regardless of the date and time used, so no need for separators... Edward -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Murray Sent: 24 April 2008 11:53 To: u2-users@listserver.u2ug.org Subject: RE: [U2] Guaranteed unique sequential keys Marco, I have used similar processes in the past, but also have appended port number to the beginning of the key. Separating the fields with '*' so the date and time can also be used as a time stamp rather than duplicate the same info in the record. Cheers, David Murray *B B B B B B Learn and do *B B B Excel and share http://u2blog.org -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marco Manyevere Sent: Thursday, April 24, 2008 5:55 AM To: u2-users@listserver.u2ug.org Subject: [U2] Guaranteed unique sequential keys What is the most reliable way to generate unique sequential keys without having to resort to a record on disk updated through readu/write? The keys don't have to be contiguous but only be sortable in the order in which they were generated by several phantom processes running concurrently. I'm currently approximating this using a concatenation of date and time with millisecondsB but I'm worried about the possibility of two phantoms generating exactly the same key. B Although no collision has been detected so far, I have added an extra check where after generating the key I first test if a record with that key exists. If so IB increment and append aB serial number and repeat the test until aB unique key is found. ItB seems to be working well but I still think there is a better way to do this. B Thanks for any help. B Marco. B B B __ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ - -- Please remember to recycle wherever possible. Reduce, reuse, recycle, think do you need to print this e-mail? - -- This e-mail and any attachment(s), is confidential and may be legally privileged. It is intended solely for the addressee. If you are not the addressee, dissemination, copying or use of this e-mail or any of its content is prohibited and may be unlawful. If you are not the intended recipient please inform the sender immediately and destroy the e-mail, any attachment(s) and any copies. All liability for viruses is excluded to the fullest extent permitted by law. It is your responsibility to scan or otherwise check this email and any attachment(s). Unless otherwise stated (i) views expressed in this message are those of the individual sender (ii) no contract may be construed by this e-mail. Emails may be monitored and you are taken to consent to this monitoring.B Civica Services Limited, Company No. 02374268; Civica UK Limited, Company No. 01628868 Both companies are registered in England and Wales and each has its registered office at 2 Burston Road, Putney, London, SW15 6AR. - -- --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ __ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe
RE: [U2] Guaranteed unique sequential keys
Wow - what kind of application needs THAT kind of accuracy?!?... old man voice Why I remember when two items writing in the same SECOND was a feat! /old man voice In this case, I don't know how you escape having to do a READVU on the item, and only writing on the ELSE clause, and changing the key if a THEN or LOCKED happens -- someone else showed using a READV, but you really have to do a READVU to ensure the items are not hitting at EXACTLY the same time. BASE.KEY = KEY SEQCNT = 1 DO.WRITE = 0 LOOP UNTIL DO.WRITE READVU TESTINGIT FROM FILENAME, KEY, 0 LOCKED * No need to wait, Drop To Key Update END THEN * Need a new key, Drop to Key Update END ELSE * Go! EXIT END * Once here, start adding sequence data... KEY = BASE.KEY:*:SEQCNT SEQCNT += 1 REPEAT WRITE REC ON FILENAME, KEY D3 has a 'System-Wide' Unique ID generator in their SYSTEM() selectiosn... U2 does not. Darn it. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marco Manyevere Sent: Thursday, April 24, 2008 7:47 AM To: u2-users@listserver.u2ug.org Subject: Re: [U2] Guaranteed unique sequential keys David, Allen, Edward, thanks for the suggestions but I want to be able to sort theB records in the exact physical order in which they occured.B Using the port or pid numbers could potentially give me the wrong sequence should two events occur within the same millisecond (unless it is ruled out that this is not possible). Regards, Marco. --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Guaranteed unique sequential keys
No, fast systems can generate records faster than SYSTEM(12) - so you need something to check the timestamp on SYSTEM(12) and handle accordingly. We've used a common block to do this. As far as two users writing the same time/date/mili - well you're going to need a port ID or a system to lock a next number array. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marco Manyevere Sent: Thursday, April 24, 2008 8:47 AM To: u2-users@listserver.u2ug.org Subject: Re: [U2] Guaranteed unique sequential keys David, Allen, Edward, thanks for the suggestions but I want to be able to sort theB records in the exact physical order in which they occured.B Using the port or pid numbers could potentially give me the wrong sequence should two events occur within the same millisecond (unless it is ruled out that this is not possible). Regards, Marco. - Original Message From: Edward Brown [EMAIL PROTECTED] To: u2-users@listserver.u2ug.org Sent: Thursday, 24 April, 2008 1:07:13 PM Subject: RE: [U2] Guaranteed unique sequential keys Of course if the port number is added to the end of the key then you can still sort by date/time. In the past I've done an R%5 oconv on both the (internal) date and time before concatenation - this gives you a 10 digit number regardless of the date and time used, so no need for separators... Edward -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Murray Sent: 24 April 2008 11:53 To: u2-users@listserver.u2ug.org Subject: RE: [U2] Guaranteed unique sequential keys Marco, I have used similar processes in the past, but also have appended port number to the beginning of the key. Separating the fields with '*' so the date and time can also be used as a time stamp rather than duplicate the same info in the record. Cheers, David Murray *B B B B B B Learn and do *B B B Excel and share http://u2blog.org -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marco Manyevere Sent: Thursday, April 24, 2008 5:55 AM To: u2-users@listserver.u2ug.org Subject: [U2] Guaranteed unique sequential keys What is the most reliable way to generate unique sequential keys without having to resort to a record on disk updated through readu/write? The keys don't have to be contiguous but only be sortable in the order in which they were generated by several phantom processes running concurrently. I'm currently approximating this using a concatenation of date and time with millisecondsB but I'm worried about the possibility of two phantoms generating exactly the same key. B Although no collision has been detected so far, I have added an extra check where after generating the key I first test if a record with that key exists. If so IB increment and append aB serial number and repeat the test until aB unique key is found. ItB seems to be working well but I still think there is a better way to do this. B Thanks for any help. B Marco. B B B __ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ - -- Please remember to recycle wherever possible. Reduce, reuse, recycle, think do you need to print this e-mail? - -- This e-mail and any attachment(s), is confidential and may be legally privileged. It is intended solely for the addressee. If you are not the addressee, dissemination, copying or use of this e-mail or any of its content is prohibited and may be unlawful. If you are not the intended recipient please inform the sender immediately and destroy the e-mail, any attachment(s) and any copies. All liability for viruses is excluded to the fullest extent permitted by law. It is your responsibility to scan or otherwise check this email and any attachment(s). Unless otherwise stated (i) views expressed in this message are those of the individual sender (ii) no contract may be construed by this e-mail. Emails may be monitored and you are taken to consent to this monitoring.B Civica Services Limited, Company No. 02374268; Civica UK Limited, Company No. 01628868 Both companies are registered in England and Wales and each has its registered office at 2 Burston Road, Putney, London, SW15 6AR. - -- --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ __ Sent from Yahoo! Mail. A Smarter Email
RE: [U2] Guaranteed unique sequential keys
And on this part ... potentially give me the wrong sequence should two events occur within the same millisecond (unless it is ruled out that this is not possible). I was only partially kidding about the 'two items a second' thing -- even if this were NOT possible today, in the lifetime of your software, you must plan on this being a reality with the next piece of hardware you get... I know of several programs we had to 'touch' once we started having 'overwrites' of data due to using a Date/TimeInSeconds stamp *way* back in the 80s. DW --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Guaranteed unique sequential keys
But common wouldn't help here as it can't be shared between processes? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marc Harbeson Sent: 24 April 2008 14:42 To: u2-users@listserver.u2ug.org Subject: RE: [U2] Guaranteed unique sequential keys No, fast systems can generate records faster than SYSTEM(12) - so you need something to check the timestamp on SYSTEM(12) and handle accordingly. We've used a common block to do this. As far as two users writing the same time/date/mili - well you're going to need a port ID or a system to lock a next number array. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marco Manyevere Sent: Thursday, April 24, 2008 8:47 AM To: u2-users@listserver.u2ug.org Subject: Re: [U2] Guaranteed unique sequential keys David, Allen, Edward, thanks for the suggestions but I want to be able to sort theB records in the exact physical order in which they occured.B Using the port or pid numbers could potentially give me the wrong sequence should two events occur within the same millisecond (unless it is ruled out that this is not possible). Regards, Marco. - Original Message From: Edward Brown [EMAIL PROTECTED] To: u2-users@listserver.u2ug.org Sent: Thursday, 24 April, 2008 1:07:13 PM Subject: RE: [U2] Guaranteed unique sequential keys Of course if the port number is added to the end of the key then you can still sort by date/time. In the past I've done an R%5 oconv on both the (internal) date and time before concatenation - this gives you a 10 digit number regardless of the date and time used, so no need for separators... Edward -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Murray Sent: 24 April 2008 11:53 To: u2-users@listserver.u2ug.org Subject: RE: [U2] Guaranteed unique sequential keys Marco, I have used similar processes in the past, but also have appended port number to the beginning of the key. Separating the fields with '*' so the date and time can also be used as a time stamp rather than duplicate the same info in the record. Cheers, David Murray *B B B B B B Learn and do *B B B Excel and share http://u2blog.org -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marco Manyevere Sent: Thursday, April 24, 2008 5:55 AM To: u2-users@listserver.u2ug.org Subject: [U2] Guaranteed unique sequential keys What is the most reliable way to generate unique sequential keys without having to resort to a record on disk updated through readu/write? The keys don't have to be contiguous but only be sortable in the order in which they were generated by several phantom processes running concurrently. I'm currently approximating this using a concatenation of date and time with millisecondsB but I'm worried about the possibility of two phantoms generating exactly the same key. B Although no collision has been detected so far, I have added an extra check where after generating the key I first test if a record with that key exists. If so IB increment and append aB serial number and repeat the test until aB unique key is found. ItB seems to be working well but I still think there is a better way to do this. B Thanks for any help. B Marco. B B B __ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ - -- Please remember to recycle wherever possible. Reduce, reuse, recycle, think do you need to print this e-mail? - -- This e-mail and any attachment(s), is confidential and may be legally privileged. It is intended solely for the addressee. If you are not the addressee, dissemination, copying or use of this e-mail or any of its content is prohibited and may be unlawful. If you are not the intended recipient please inform the sender immediately and destroy the e-mail, any attachment(s) and any copies. All liability for viruses is excluded to the fullest extent permitted by law. It is your responsibility to scan or otherwise check this email and any attachment(s). Unless otherwise stated (i) views expressed in this message are those of the individual sender (ii) no contract may be construed by this e-mail. Emails may be monitored and you are taken to consent to this monitoring.B Civica Services Limited, Company No. 02374268; Civica UK Limited, Company No. 01628868 Both companies are registered in England and Wales and each has its registered office at 2 Burston Road, Putney, London, SW15 6AR.
Re: [U2] Corrupt file
Wyatt, A simple memresize or RESIZE should clear these errors up. Buffington, Wyatt [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 04/24/2008 09:54 AM Please respond to u2-users@listserver.u2ug.org To u2-users@listserver.u2ug.org cc Subject [U2] Corrupt file We are running UniData 6.0.4 on an HP.UX 11 and the following error keeps appearing: 2:blk check error in U_catch_tuple for file 'OPEN.MO', key '082352500', number=1327 I have run following command: :!guide OPEN.MO -o OPEN.MO Basic statistics: File type... Dynamic Hashing File size [dat001].. 8129536 [over001]. 43686912 File modulo. 7937 File minimum modulo. 7937 File split factor... 60 File merge factor... 40 File hash type.. 1 File block size. 1024 File Integrity: Group 1327, block 1328, record number 3 = 082352500 offset occurs in wrong order 35587084 Group 1327, block 34753, record number 3 = 082352500 offset error 35587084 Group 1327, block 34753, record number 2 = 076754900 record length of 414 is wrong. Group 1327, block 34753, record number 3 = 082352500 record length of 1035 is wrong. Group 1327, block 34753 bytes used 1449 and bytes left 989 are inconsistent Free blocks in overflow file(s). 7982 Management advice: This file's integrity has been compromised, please repair it. Files processed:1 Errors encountered: 5 We need to fix this problem, but the manuals are pretty vague on what steps are required. Do I use 'guide' and 'fixfile' or do I use 'verify2', 'dumpgroup' and 'fixgroup'? Can anyone help me with this? Wyatt Buffington --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Corrupt file
Wyatt; guide and verify2 simply find the corruption. dumpgroup/fixgroup and fixfile are used to correct the file. fixfile takes the output from guide and does it's own dumpgroup and fixgroup. I use dump/fixgroup mostly because I like to see what's happening. My steps: 1. get exclusive access to the file 2. create OS level copy of the file 3. use RECORD to get the other items in the group (RECORD OPEN.MO 082352500) within UniData 4. Dump the group (DUMPGROUP OPEN.MO 1327 -dopenmo1327) from the OS prompt 5. Fix the group (FIXGROUP OPEN.MO 1327 -iopenmo1327) also from the OS prompt (the options are lowercase and can not have a space after them) 6. verify the file is OK (GUIDE OPEN.MO -O) from the OS 7. verify that your data is all there using the list of items from step 3. Edit the records. You can create a VOC entry to your backup copy to compare if things don't look right. There is a section in the Administering UniData document on File Corruption that explains all of the above. There is also an Advanced File Fixing for UniData document. I'm not sure if I got it from the website or the support disc that they send out. hth Colin Alfke Calgary, Canada -Original Message- From: Buffington, Wyatt We are running UniData 6.0.4 on an HP.UX 11 and the following error keeps appearing: 2:blk check error in U_catch_tuple for file 'OPEN.MO', key '082352500', number=1327 I have run following command: :!guide OPEN.MO -o OPEN.MO Basic statistics: File type... Dynamic Hashing File size [dat001].. 8129536 [over001]. 43686912 File modulo. 7937 File minimum modulo. 7937 File split factor... 60 File merge factor... 40 File hash type.. 1 File block size. 1024 File Integrity: Group 1327, block 1328, record number 3 = 082352500 offset occurs in wrong order 35587084 Group 1327, block 34753, record number 3 = 082352500 offset error 35587084 Group 1327, block 34753, record number 2 = 076754900 record length of 414 is wrong. Group 1327, block 34753, record number 3 = 082352500 record length of 1035 is wrong. Group 1327, block 34753 bytes used 1449 and bytes left 989 are inconsistent Free blocks in overflow file(s). 7982 Management advice: This file's integrity has been compromised, please repair it. Files processed:1 Errors encountered: 5 We need to fix this problem, but the manuals are pretty vague on what steps are required. Do I use 'guide' and 'fixfile' or do I use 'verify2', 'dumpgroup' and 'fixgroup'? Can anyone help me with this? Wyatt Buffington --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
Re: [U2] Guaranteed unique sequential keys
I have already found records that are only 28 milliseconds apart and the server isnt really a big one. Its not so much the clock accuracy thats important but the records must be processed in exactly the same order in which they were written to disk. Thanks for the confirmation. It seems there is no other way to do this. Regards, Marco. Wow - what kind of application needs THAT kind of accuracy?!?...B old man voice Why I remember when two items writing in the same SECOND was a feat! /old man voice In this case, I don't know how you escape having to do a READVU on the item, and only writing on the ELSE clause, and changing the key if a THEN or LOCKED happens -- someone else showed using a READV, but you really have to do a READVU to ensure the items are not hitting at EXACTLY the same time. BASE.KEY = KEY SEQCNT = 1 DO.WRITE = 0 LOOP UNTIL DO.WRITE B READVU TESTINGIT FROM FILENAME, KEY, 0 LOCKED B B * No need to wait, Drop To Key Update B END THEN B B * Need a new key, Drop to Key Update B END ELSE B B * Go! B B EXIT B END B * Once here, start adding sequence data... B KEY = BASE.KEY:*:SEQCNT B SEQCNT += 1 REPEAT WRITE REC ON FILENAME, KEY D3 has a 'System-Wide' Unique ID generator in their SYSTEM() selectiosn... U2 does not.B Darn it. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marco Manyevere Sent: Thursday, April 24, 2008 7:47 AM To: u2-users@listserver.u2ug.org Subject: Re: [U2] Guaranteed unique sequential keys David, Allen, Edward, thanks for the suggestions but I want to be able to sort theB records in the exact physical order in which they occured.B Using the port or pid numbers could potentially give me the wrong sequence should two events occur within the same millisecond (unless it is ruled out that this is not possible). Regards, Marco. --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ ___ Yahoo! For Good. Give and get cool things for free, reduce waste and help our planet. Plus find hidden Yahoo! treasure http://green.yahoo.com/uk/earth-day/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Guaranteed unique sequential keys
D3 has a 'System-Wide' Unique ID generator in their SYSTEM() selectiosn... U2 does not. Darn it. Ah, but nothing's free. To ensure uniqueness, there needs to be some sort of negotiation. Years ago I worked on a Sequoia system running Pick O/A. We were happy to see SYSTEM(19), which provided a unique ID. We used it in some processes that were used by many users and discovered that performance suffered dramatically. After talking with the system engineers, we discovered that there was a semaphore that negotiated the requests to ensure that exactly one user was served at a time, then assigned the unique ID to that user. The problem was that, if you have dozens of users requesting an ID simultaneously, you have a bottleneck. Because we didn't care what the ID contained, we did something similar to what others here have suggested - a combination of port, date and time the program started, and a counter unique to the process. Performance system-wide improved dramatically and immediately. If it's important to have an ID that guarantees that you can sort the file in the order the transactions occurred, the READU scenario is probably the best. You could probably work out something with linked C routines and/or a socket server, but there will still be a bottleneck if there are many simultaneous requests. Tim Snyder Consulting I/T Specialist U2 Lab Services Information Management, IBM Software Group --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Guaranteed unique sequential keys
Is the start time tied in with the phantom starting up? If so the process number is generally allocated in an incremental fashion, so date:milliseconds:process number would give you an approximation of what you're looking for? Some background information on what the phantoms are doing might help others come up with ideas. Edward -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: 24 April 2008 15:44 To: u2-users@listserver.u2ug.org Subject: RE: [U2] Guaranteed unique sequential keys Not that I know all that much about it, but if outside of the box is needed. What would the possibility be of a callc routine to access a common memory location? Bruce M Neylon Health Care Management Group Edward Brown [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 04/24/2008 10:06 AM Please respond to u2-users@listserver.u2ug.org To u2-users@listserver.u2ug.org cc Subject RE: [U2] Guaranteed unique sequential keys But common wouldn't help here as it can't be shared between processes? --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- Please remember to recycle wherever possible. Reduce, reuse, recycle, think do you need to print this e-mail? --- This e-mail and any attachment(s), is confidential and may be legally privileged. It is intended solely for the addressee. If you are not the addressee, dissemination, copying or use of this e-mail or any of its content is prohibited and may be unlawful. If you are not the intended recipient please inform the sender immediately and destroy the e-mail, any attachment(s) and any copies. All liability for viruses is excluded to the fullest extent permitted by law. It is your responsibility to scan or otherwise check this email and any attachment(s). Unless otherwise stated (i) views expressed in this message are those of the individual sender (ii) no contract may be construed by this e-mail. Emails may be monitored and you are taken to consent to this monitoring. Civica Services Limited, Company No. 02374268; Civica UK Limited, Company No. 01628868 Both companies are registered in England and Wales and each has its registered office at 2 Burston Road, Putney, London, SW15 6AR. --- --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Guaranteed unique sequential keys
True. :-) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Edward Brown Sent: Thursday, April 24, 2008 10:07 AM To: u2-users@listserver.u2ug.org Subject: RE: [U2] Guaranteed unique sequential keys But common wouldn't help here as it can't be shared between processes? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marc Harbeson Sent: 24 April 2008 14:42 To: u2-users@listserver.u2ug.org Subject: RE: [U2] Guaranteed unique sequential keys No, fast systems can generate records faster than SYSTEM(12) - so you need something to check the timestamp on SYSTEM(12) and handle accordingly. We've used a common block to do this. As far as two users writing the same time/date/mili - well you're going to need a port ID or a system to lock a next number array. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marco Manyevere Sent: Thursday, April 24, 2008 8:47 AM To: u2-users@listserver.u2ug.org Subject: Re: [U2] Guaranteed unique sequential keys David, Allen, Edward, thanks for the suggestions but I want to be able to sort theB records in the exact physical order in which they occured.B Using the port or pid numbers could potentially give me the wrong sequence should two events occur within the same millisecond (unless it is ruled out that this is not possible). Regards, Marco. - Original Message From: Edward Brown [EMAIL PROTECTED] To: u2-users@listserver.u2ug.org Sent: Thursday, 24 April, 2008 1:07:13 PM Subject: RE: [U2] Guaranteed unique sequential keys Of course if the port number is added to the end of the key then you can still sort by date/time. In the past I've done an R%5 oconv on both the (internal) date and time before concatenation - this gives you a 10 digit number regardless of the date and time used, so no need for separators... Edward -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Murray Sent: 24 April 2008 11:53 To: u2-users@listserver.u2ug.org Subject: RE: [U2] Guaranteed unique sequential keys Marco, I have used similar processes in the past, but also have appended port number to the beginning of the key. Separating the fields with '*' so the date and time can also be used as a time stamp rather than duplicate the same info in the record. Cheers, David Murray *B B B B B B Learn and do *B B B Excel and share http://u2blog.org -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marco Manyevere Sent: Thursday, April 24, 2008 5:55 AM To: u2-users@listserver.u2ug.org Subject: [U2] Guaranteed unique sequential keys What is the most reliable way to generate unique sequential keys without having to resort to a record on disk updated through readu/write? The keys don't have to be contiguous but only be sortable in the order in which they were generated by several phantom processes running concurrently. I'm currently approximating this using a concatenation of date and time with millisecondsB but I'm worried about the possibility of two phantoms generating exactly the same key. B Although no collision has been detected so far, I have added an extra check where after generating the key I first test if a record with that key exists. If so IB increment and append aB serial number and repeat the test until aB unique key is found. ItB seems to be working well but I still think there is a better way to do this. B Thanks for any help. B Marco. B B B __ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ - -- Please remember to recycle wherever possible. Reduce, reuse, recycle, think do you need to print this e-mail? - -- This e-mail and any attachment(s), is confidential and may be legally privileged. It is intended solely for the addressee. If you are not the addressee, dissemination, copying or use of this e-mail or any of its content is prohibited and may be unlawful. If you are not the intended recipient please inform the sender immediately and destroy the e-mail, any attachment(s) and any copies. All liability for viruses is excluded to the fullest extent permitted by law. It is your responsibility to scan or otherwise check this email and any attachment(s). Unless otherwise stated (i) views expressed in this message are those of the individual sender (ii) no contract may be construed by this e-mail. Emails may be monitored and you are taken to consent to this monitoring.B
RE: [U2] Guaranteed unique sequential keys
You need to re-read my solution, it will do exactly what you want. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Marco Manyevere Sent: Thursday, April 24, 2008 05:47 To: u2-users@listserver.u2ug.org Subject: Re: [U2] Guaranteed unique sequential keys David, Allen, Edward, thanks for the suggestions but I want to be able to sort theB records in the exact physical order in which they occured.B Using the port or pid numbers could potentially give me the wrong sequence should two events occur within the same millisecond (unless it is ruled out that this is not possible). Regards, Marco. - Original Message From: Edward Brown [EMAIL PROTECTED] To: u2-users@listserver.u2ug.org Sent: Thursday, 24 April, 2008 1:07:13 PM Subject: RE: [U2] Guaranteed unique sequential keys Of course if the port number is added to the end of the key then you can still sort by date/time. In the past I've done an R%5 oconv on both the (internal) date and time before concatenation - this gives you a 10 digit number regardless of the date and time used, so no need for separators... Edward -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Murray Sent: 24 April 2008 11:53 To: u2-users@listserver.u2ug.org Subject: RE: [U2] Guaranteed unique sequential keys Marco, I have used similar processes in the past, but also have appended port number to the beginning of the key. Separating the fields with '*' so the date and time can also be used as a time stamp rather than duplicate the same info in the record. Cheers, David Murray *B B B B B B Learn and do *B B B Excel and share http://u2blog.org -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marco Manyevere Sent: Thursday, April 24, 2008 5:55 AM To: u2-users@listserver.u2ug.org Subject: [U2] Guaranteed unique sequential keys What is the most reliable way to generate unique sequential keys without having to resort to a record on disk updated through readu/write? The keys don't have to be contiguous but only be sortable in the order in which they were generated by several phantom processes running concurrently. I'm currently approximating this using a concatenation of date and time with millisecondsB but I'm worried about the possibility of two phantoms generating exactly the same key. B Although no collision has been detected so far, I have added an extra check where after generating the key I first test if a record with that key exists. If so IB increment and append aB serial number and repeat the test until aB unique key is found. ItB seems to be working well but I still think there is a better way to do this. B Thanks for any help. B Marco. B B B __ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ - -- Please remember to recycle wherever possible. Reduce, reuse, recycle, think do you need to print this e-mail? - -- This e-mail and any attachment(s), is confidential and may be legally privileged. It is intended solely for the addressee. If you are not the addressee, dissemination, copying or use of this e-mail or any of its content is prohibited and may be unlawful. If you are not the intended recipient please inform the sender immediately and destroy the e-mail, any attachment(s) and any copies. All liability for viruses is excluded to the fullest extent permitted by law. It is your responsibility to scan or otherwise check this email and any attachment(s). Unless otherwise stated (i) views expressed in this message are those of the individual sender (ii) no contract may be construed by this e-mail. Emails may be monitored and you are taken to consent to this monitoring.B Civica Services Limited, Company No. 02374268; Civica UK Limited, Company No. 01628868 Both companies are registered in England and Wales and each has its registered office at 2 Burston Road, Putney, London, SW15 6AR. - -- --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ __ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Guaranteed unique sequential keys
Hi Marco - this is in fact the way I update files on very busy systems - we are getting say 30 hits per second and for logging with unique keys I have in the past used the date():system(12):endbit where endbit is incremented after doing a readvu to check if it exists or not. (as per your example), and system(12) is time in milleseconds If you do not need to have absolute order then the @userno is a useful extra to the key and will give guaranteed uniqueness. Symeon. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marco Manyevere Sent: 24 April 2008 10:55 To: u2-users@listserver.u2ug.org Subject: [U2] Guaranteed unique sequential keys What is the most reliable way to generate unique sequential keys without having to resort to a record on disk updated through readu/write? The keys don't have to be contiguous but only be sortable in the order in which they were generated by several phantom processes running concurrently. I'm currently approximating this using a concatenation of date and time with millisecondsB but I'm worried about the possibility of two phantoms generating exactly the same key. B Although no collision has been detected so far, I have added an extra check where after generating the key I first test if a record with that key exists. If so IB increment and append aB serial number and repeat the test until aB unique key is found. ItB seems to be working well but I still think there is a better way to do this. B Thanks for any help. B Marco. __ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Guaranteed unique sequential keys
OOPS!! I forgot the RELEASE on the THEN!! Bad David!! BASE.KEY = KEY SEQCNT = 1 DO.WRITE = 0 LOOP UNTIL DO.WRITE READVU TESTINGIT FROM FILENAME, KEY, 0 LOCKED * No need to wait, Drop To Key Update END THEN RELEASE FILENAME, KEY ; VERY NEEDED! * Need a new key, Drop to Key Update END ELSE * Go! EXIT END * Once here, start adding sequence data... KEY = BASE.KEY:*:SEQCNT SEQCNT += 1 REPEAT WRITE REC ON FILENAME, KEY --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Guaranteed unique sequential keys
Use the suggestion about a read to verify the non-existence of the record and then loop around until the time() function changes to a unique id. From: [EMAIL PROTECTED] To: u2-users@listserver.u2ug.org Subject: RE: [U2] Guaranteed unique sequential keys Date: Thu, 24 Apr 2008 11:02:26 -0500 Consider using a lock-and-write thing... --Bill SUBROUTINE SUB.LOCK.AND.WRITE.R2 ( R.This, This.File, Record.ID ) prompt '' open This.File to F.This.File else gosub Error.Opening.File gosub Lock.And.Write goThe.End *--- -- *--- -- Lock.And.Write: Lock.Test = recordlocked (F.This.File, Record.ID) *crt 'This.File___ ' : F.This.File : ' ___ ' : ' [] ' : *input Ans begin case case Lock.Test = 0 ;recordlocku F.This.File, Record.ID write R.This on F.This.File, Record.ID release F.This.File, Record.ID case 1; gosub Error.Record.Locking end case return *--- --- Error.Opening.File: crt @(-1) crt @(-5) crt crt crt crt crt crt crt crt crt crt crt crt ' Big Problem...' : @(-6) crt crt ' _ ' crt ' \\ ' : This.File crt ' \ Error Opening File \' crt ' \\Contact HK.IT ' crt ' [X] ' crt '' : input Ans, 1 Ans = upcase(Ans) begin case case Ans = 'X' ; null case 1 ; go Error.Opening.File end case return to The.End *--- --- Error.Record.Locking: crt @(-1) crt @(-5) crt crt crt crt crt crt crt crt crt crt ' Big Problem...' : @(-6) crt crt ' _ ' crt ' \\ ' : This.File crt ' \ Error, Record Lock \' crt ' \\Contact HK.IT ' crt crt ' Open New Gull Session, Try UNLOCK.ME ' crt ' [X] ' crt ' ' : input Ans, 1 Ans = upcase(Ans) begin case case Ans = 'X' ; null case 1 ; go Error.Record.Locking end case return to The.End *--- --- The.End: RETURN END -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of David Wolverton Sent: Thursday, April 24, 2008 9:59 AM To: u2-users@listserver.u2ug.org Subject: RE: [U2] Guaranteed unique sequential keys And on this part ... potentially give me the wrong sequence should two events occur within the same millisecond (unless it is ruled out that this is not possible). I was only partially kidding about the 'two items a second' thing -- even if this were NOT possible today, in the lifetime of your software, you must plan on this being a reality with the next piece of hardware you get... I know of several programs we had to 'touch' once we started having 'overwrites' of data due to using a Date/TimeInSeconds stamp *way* back in the 80s. DW --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ _ Spell a grand slam in this game where word skill meets World Series. Get in the game. http://club.live.com/word_slugger.aspx?icid=word_slugger_wlhm_admod_april08 --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Guaranteed unique sequential keys
Humor But then you've limited your performance to one write a millisecond at best... Who could *stand* that kind of limitation?!? /Humor -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ron Hutchings Sent: Thursday, April 24, 2008 10:55 AM To: u2-users@listserver.u2ug.org Subject: RE: [U2] Guaranteed unique sequential keys Use the suggestion about a read to verify the non-existence of the record and then loop around until the time() function changes to a unique id. --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Guaranteed unique sequential keys
Lol Now you've opened up the GOTO or LOOP REPEAT debate. :-) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of DAVID WADEMAN Sent: Thursday, April 24, 2008 10:58 AM To: u2-users@listserver.u2ug.org Cc: u2-users@listserver.u2ug.org Subject: RE: [U2] Guaranteed unique sequential keys I had this issue where I was overwriting files and found out that I need to used @ rather than the (). I know there a difference in using time/date where : @DATE [EMAIL PROTECTED] is when the user/phantom was logged in DATE() {TIME()} is the actually time and date I got around this by using this to write to the file: XKEY = @LOGNAME:*:DATE():*:TIME() Then I can create VF like X.DATE I FIELD(@ID,@VM,2) D2/ Date 20L S X.TIME I FIELD(@ID,@VM,3) MTH Time 20L S Also you can avoid 2 processes not writing to the same file by inserting this right before you write to the file and/or to make sure also you can: X.DATA = Something DO_AGAIN: XKEY = @LOGNAME:*:DATE():*:TIME() READ XFILE.REC FROM F.XFILE, X.KEY THEN SLEEP(1) GOTO DO_AGAIN END ELSE WRITE X.DATA TO F.XFILE, X.KEY END This is Unix and UniData (not sure with the rest) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marco Manyevere Sent: Thursday, April 24, 2008 5:55 AM To: u2-users@listserver.u2ug.org Subject: [U2] Guaranteed unique sequential keys What is the most reliable way to generate unique sequential keys without having to resort to a record on disk updated through readu/write? The keys don't have to be contiguous but only be sortable in the order in which they were generated by several phantom processes running concurrently. I'm currently approximating this using a concatenation of date and time with millisecondsB but I'm worried about the possibility of two phantoms generating exactly the same key. B Although no collision has been detected so far, I have added an extra check where after generating the key I first test if a record with that key exists. If so IB increment and append aB serial number and repeat the test until aB unique key is found. ItB seems to be working well but I still think there is a better way to do this. B Thanks for any help. B Marco. __ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Guaranteed unique sequential keys
Only needed if you care about eventually running out of locks. LOL It will run a few thousand transactions before it blows up the system. :-D -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Wolverton Sent: Thursday, April 24, 2008 11:51 AM To: u2-users@listserver.u2ug.org Subject: RE: [U2] Guaranteed unique sequential keys OOPS!! I forgot the RELEASE on the THEN!! Bad David!! BASE.KEY = KEY SEQCNT = 1 DO.WRITE = 0 LOOP UNTIL DO.WRITE READVU TESTINGIT FROM FILENAME, KEY, 0 LOCKED * No need to wait, Drop To Key Update END THEN RELEASE FILENAME, KEY ; VERY NEEDED! * Need a new key, Drop to Key Update END ELSE * Go! EXIT END * Once here, start adding sequence data... KEY = BASE.KEY:*:SEQCNT SEQCNT += 1 REPEAT WRITE REC ON FILENAME, KEY --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
Re: [U2] Unidata @LOGNAME
At 08:12 AM 4/17/2008, you wrote: Under Unidata 7.1.x on Solaris (9/10) we're seeing @LOGNAME truncated to 8 characters. Others on different OSes are not seeing this behavior. Does anyone know if this is a Unidata setting or how Unidata is interacting with a system call (eg: and therefor cannot be changed)? Sorry I am a little late in replying. Here is a bit of information I was able to gather from a IBM engineer some time ago when we encountered problems with the value returned as well. @LOGNAME is implemented as a global variable for the udt process. It returns the same value in both ECL and UniBasic. And it is implemented the same on all Unix platforms. @LOGNAME is set by calling cuserid(LOGNAME). However, we have implemented our own cuserid()function since 08/08/94. static int U_myuidflag = 0; static char U_myuidbuf[256] = {0}; char *cuserid(buffer) d_char buffer[]; { int uid; char *p; struct passwd *pw; if (U_myuidflag == 0) { if ((p = getlogin()) == (char *) 0 || p[0] == '\0') { uid = getuid(); pw = getpwuid(uid); if (pw != (struct passwd *) 0) p = pw-pw_name; else p = (char *) 0; } if (p != (char *) 0) strcpy(U_myuidbuf, p); else U_myuidbuf[0] = '\0'; U_myuidflag = 1; } if (buffer != (char *) 0) { strcpy(buffer, U_myuidbuf); return (buffer); } else { return (U_myuidbuf); } } Here is output from man page aboput getlogin: DESCRIPTION The getlogin() function returns a pointer to the login name as found in /var/adm/utmp. It may be used in conjunction with getpwnam(3C) to locate the correct password file entry when the same user ID is shared by several login names. If getlogin() is called within a process that is not attached to a terminal, it returns a null pointer. The correct procedure for determining the login name is to call cuserid(3S), or to call getlogin() and if it fails to call getpwuid(3C) BTW, the implmentation on NT is different and it is much more complex to describe here. HTH, Doug Miller --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] UniSubroutine question with UOJ
This is reponse to Symeon Breen's reply. Yes, CRT does not prevent UniObject to call UniSubrouitne. But you can't see the CRT output unless you convert them into an output paramater like Eric Armstrong suggests here. But my problem is sometimes the Unidata subroutine fires some warning messages, such as 'Uninitilized variables at line x'. In terminal mode, Unidata subroutine still runs under this situation. But when you run UniObject for Java to call the subroutine, UOJ just outputs nothing. Same things happen when you turn on the Unidata debugger function. Is there a way that I can let UOJ still successfully call the subrotuine even there could be such warning happening:'Uninitilized variables at line x'. That sounds odd - in standard uniobjects, or with uo.net it still works fine even with a crt in the sub - not good practice of course but it certainly works. I cant figure out why uoj would be different, they all use the same backend udcs processes. Is this Unidata on *nix or windows ? -- View this message in context: http://www.nabble.com/UniSubroutine-question-with-UOJ-tp16763989p16852462.html Sent from the U2 - Users mailing list archive at Nabble.com. --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
[U2] New Resize tool for U2
[AD] U2logic announces a new Unidata resize tool available on May 2nd called XLr8 Resizer. It will be downloadable at www.u2logic.com/update via Eclipse's Update Manager. XLr8 Resizer will be out for Universe 2 weeks later. XLr8 Resizer is built as a plug-in for the open source Eclipse.org platform. This tool has been built from the ground up to run on Unidata. This tool uses the native database programs to produce the data account by account. There are no installation programs or accounts for either database meaning you will be up and running fast. XLr8 Resizer displays information in an easy intuitive way that allows database administrators or even those with limited knowledge of the database to see problem files. The tool allows constant feed back on what is doing whether gathering statistics or resizing a file, you will always be informed. This tool is smart enough to know the difference between static and dynamic files when resizing. You can customize the calculations of new modulos to match your environment or taste. XLr8 Resizer does not require a large initial investment for the software based on the number of database licenses. This tool is available on a yearly subscription basis for a single workstation. Software updates are available from our web site via the Update Manger in Eclipse and they are sometimes as often as twice a week as we add new features and fix those undesirable ones. U2logic Team [EMAIL PROTECTED] [/AD] --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] UniSubroutine question with UOJ
Sorry - maybe I misunderstood you - when you say returns nothing I assumed you meant the returned parameters in the call are empty. This would be odd as it certainly works in uoj as I stated regardless of crt's and error messages. However there is no way of capturing any crt, or error message statements in uniobjects per se - What I have done in the past (so that I can run my backend apps in pseudo debug mode wHich means I pass a param in and I do lots of crt's) is perform a COMO ON UniqueName at the top of the unibasic, and at the end, before returning I do a COMO OFF and then open _PH_ and read in the como output and return that as a parameter in the subroutine - e.g. SUBROUTINE getdata(invars,debugmode,outvars,Err,debugOutput) IF debugmode THEN EXECUTE COMO ON TEST END IF debugmode THEN CRT Starting processing ... do processing IF debugmode THEN CRT Finished processing EXECUTE COMO OFF OPEN _PH_ TO PFIL THEN READ debugOutput FROM PHFIL,TEST ELSE debugOutpu='' END END RETURN You can then use the debugOutput returned variable in your calling java. NB If the database is universe the como output goes to a different file. HTH Symeon -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of waivic Sent: 24 April 2008 21:39 To: u2-users@listserver.u2ug.org Subject: RE: [U2] UniSubroutine question with UOJ This is reponse to Symeon Breen's reply. Yes, CRT does not prevent UniObject to call UniSubrouitne. But you can't see the CRT output unless you convert them into an output paramater like Eric Armstrong suggests here. But my problem is sometimes the Unidata subroutine fires some warning messages, such as 'Uninitilized variables at line x'. In terminal mode, Unidata subroutine still runs under this situation. But when you run UniObject for Java to call the subroutine, UOJ just outputs nothing. Same things happen when you turn on the Unidata debugger function. Is there a way that I can let UOJ still successfully call the subrotuine even there could be such warning happening:'Uninitilized variables at line x'. That sounds odd - in standard uniobjects, or with uo.net it still works fine even with a crt in the sub - not good practice of course but it certainly works. I cant figure out why uoj would be different, they all use the same backend udcs processes. Is this Unidata on *nix or windows ? -- View this message in context: http://www.nabble.com/UniSubroutine-question-with-UOJ-tp16763989p16852462.html Sent from the U2 - Users mailing list archive at Nabble.com. --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Guaranteed unique sequential keys
I forgot to mention in my previous post is that a WRITE of a new record into a UniVerse/SQL table is regarded as an INSERT. So the new key generation will occur. --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
Re: [U2] Guaranteed unique sequential keys
Here is a UniVerse/SQL answer. Create the primary key with a default value of NEXT AVAILABLE. CREATE TABLE MyTable ( MyKey INTEGER NOT NULL PRIMARY KEY DEFAULT NEXT AVAILABLE, Column1 VARCHAR, Column2 VARCHAR, Column3 VARCHAR NOT NULL MULTIVALUED, Column4 VARCHAR MULTIVALUED, ASSOCIATION MyASSOC(Column3 KEY, Column4) ); Whenever you insert a row without supplying a key value, the next available key value will be used. This uses the same mechanism as REVISE, namely an item called NEXT.AVAILABLE in the file dictionary. --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Guaranteed unique sequential keys
That's very good, but DICT NEXT.AVAILABLE sure is ugly. It means you can't make a dictionary read-only. Dictionaries should be under source control. And a data file can have multiple dictionaries. A better answer would be to embed the next-id in the file header. Then give a utility to edit it similar to how SET.INDEX can edit the file header's path to it's index dir. If one were to set up an SQL table like that, what would you consider a good UV/Basic coding practice for writing to it? Explicit, low-level readu increment of the next id record? -Original Message- From: Ray Wurlod Here is a UniVerse/SQL answer. Create the primary key with a default value of NEXT AVAILABLE. CREATE TABLE MyTable ( MyKey INTEGER NOT NULL PRIMARY KEY DEFAULT NEXT AVAILABLE, Column1 VARCHAR, Column2 VARCHAR, Column3 VARCHAR NOT NULL MULTIVALUED, Column4 VARCHAR MULTIVALUED, ASSOCIATION MyASSOC(Column3 KEY, Column4) ); Whenever you insert a row without supplying a key value, the next available key value will be used. This uses the same mechanism as REVISE, namely an item called NEXT.AVAILABLE in the file dictionary. --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
Re: [U2] Guaranteed unique sequential keys
I'm surprised to see most people suggesting a date time stamp for the record key. Isn't a sequential number the ideal? Which hashes better? I like Mr. Stevenson's suggestion of storing a next-available key in the file header. It could be configurable by file to be an integer, or some of the other suggestions, like a date*time*millisecond stamp, or date*time*sequential integer. Does the U2 User's Group make suggestions to IBM? -- Louie in Seattle --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
Re: [U2] Guaranteed unique sequential keys
How to write? I'd probably go for INSERT statements via the pre-defined @HSTMT statement handle and the BCI function SQLExecDirect. That's because the WRITE statement requires a key value. --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Guaranteed unique sequential keys
You'll need a central key generator to manage high resolution sortable sequential keys. You can use whatever connection medium is feasible and let a single process/phantom generate the keys in numerical order. The problem with using a key generator like this is that you could easily produce a bottleneck. On the other hand, the benefit of doing it this way is that the generator can be a single phantom. It can keep track of the last used key in memory and can pregenerate keys for near-future or parallel usage. If the connection medium you choose allows for multiple requests at a time, then your management code must be able to manage and pregenerate keys for each thread concurrently. A wide solution could be a socket service that serves unique keys to clients. I use base-16 for a lot of sequential keys so that I have many unique iterations per key length. I always use them as direct pointers and I never sort them, though. Hex sortability from LIST/SORT/SELECT could be questionable. Glen -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Marco Manyevere Sent: Thursday, April 24, 2008 5:55 AM To: u2-users@listserver.u2ug.org Subject: [U2] Guaranteed unique sequential keys What is the most reliable way to generate unique sequential keys without having to resort to a record on disk updated through readu/write? The keys don't have to be contiguous but only be sortable in the order in which they were generated by several phantom processes running concurrently. I'm currently approximating this using a concatenation of date and time with millisecondsB but I'm worried about the possibility of two phantoms generating exactly the same key. B Although no collision has been detected so far, I have added an extra check where after generating the key I first test if a record with that key exists. If so IB increment and append aB serial number and repeat the test until aB unique key is found. ItB seems to be working well but I still think there is a better way to do this. B Thanks for any help. B Marco. __ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/