User bio
404 bio not found
Member since Jun 1, 2016


If you use the Backup and Restore functionality (^DBACK and ^DBREST) all identity values will be preserved.

If you are importing the data in another way you need to look at the $SYSTEM.SQL SetIdentityInsert ClassMethod, this allows you to insert id values when importing data through SQL statements for example.


This is a side effect of how Caché finds the string, the code performs a read() on the stream to load a chunk into memory before searching for the string.

The read() is setting the AtEnd property, but if the string being searched for appears more than once in the chunk in memory, only the first occurrence will be found.

So in order to read all occurrences of the string, you should not sue the AtEnd to determine when to Stop.

The following code will count the number of times "Invalid password" appears in the file.

set stream=##class(%Stream.FileCharacter).%New()
do stream.LinkToFile("d:\csp.log")
set x=""
set i=0
set j=0
write stream.Rewind()
while(i'=-1){set i=stream.FindAt(-1,"Invalid password",.x) set j=j+1}
write i
write j


Obviously you can alter the code in the while loop to perform any other action when it finds the string.

Certifications & Credly badges:
Oliver has no Certifications & Credly badges yet.
Global Masters badges:
Oliver has no Global Masters badges yet.
Oliver has no followers yet.
Oliver has not followed anybody yet.