1. tsunami help
- Posted by "George Walters" <gwalters at sc.rr.com> Dec 16, 2003
- 454 views
I'm trying to figure out how to use tsunami record manager. Here's my problem/question. I have a record {1,250,"Company 250", 1,3....etc) which is a customer setup record. 1 = company number (integer) ( 2 digits max) 250 = customer number (integer) (6 digits max) the key in EUdata base would be " 1 250" rc = trmSegDef (1,"company", 1, 1, 2, 0) rc = trmSegDef (2,"CustNbr", 1, 2, 6, 0) Is this how I would try to define the segments? Reading the doc it would seem that the segment fields for a key should be strings not integers or atoms. So I'm confused on how to get back a record once it's been written. record = GegEqual(atom hFile, 1 , {1, 250})............Is this how? Or do I have to construct a string key and if so then I'm really confused how the input and output get matched up. thanks for any pointers. george
2. Re: tsunami help
- Posted by "George Walters" <gwalters at sc.rr.com> Dec 16, 2003
- 442 views
Ron, you missed my question point. Your expample has vars that are strings, mine are not. They are either integer or string or atom... am I going to have to convert the record to all string fields? george ----- Original Message ----- From: "Ron Austin" <ronaustin at alltel.net> To: <EUforum at topica.com> Subject: RE: tsunami help > > > George Walters wrote: > > > > > > I'm trying to figure out how to use tsunami record manager. Here's my > > problem/question. > > > > I have a record {1,250,"Company 250", 1,3....etc) which is a customer > > setup > > record. > > > > 1 = company number (integer) ( 2 digits max) > > 250 = customer number (integer) (6 digits max) > > > > the key in EUdata base would be " 1 250" > > > > rc = trmSegDef (1,"company", 1, 1, 2, 0) > > rc = trmSegDef (2,"CustNbr", 1, 2, 6, 0) > > > > Is this how I would try to define the segments? Reading the doc it would > > seem that the segment fields for a key should be strings not integers or > > atoms. So I'm confused on how to get back a record once it's been > > written. > > > > record = GegEqual(atom hFile, 1 , {1, 250})............Is this how? Or > > do I > > have to construct a string key and if so then I'm really confused how > > the > > input and output get matched up. > > > > thanks for any pointers. > > > > george > > > > I use strings for my keys. Your seg defs are okay, except I would use a > > 6 for the flag parameter: > rc = trmSegDef (1,"company", 1, 1, 2, 6) > rc = trmSegDef (2,"CustNbr", 1, 2, 6, 6) > > The 6 means no duplicates allowed and no key compression used. > all the flags are listed below: > > Here's one of my init files: > > -- Diaginit.exw - by Ron Austin -- bubbashrimp > -- Initializes files using Tsunami Wrapper written > -- by H.W. Overman -- euman > > include trm_eu.ew > object result, > EyePath, > fio > > > EyePath = getenv("EYEDIR") > puts(1,EyePath) > fio = "Diagnosis.dat" > if sequence(EyePath) then > fio=EyePath&"\\Data\\Diagnosis.dat" > end if > > -- Step 1: define the Tsunami file ---------------------------- > > result = trm_FileDef(1, 0, 2) -- 1 page, no compression, 2 key segments > > -- Step 2: define the Tsunami file's key segment(s) ----------- > > -- trmSegDef (segment#,index name,key #, start location, length, flags) > --flags > -- 1 - case sensitive > -- 2 - no duplicates > -- 4 - no compression > -- 8 - binary key > -- 2+4=6 -- no dups, no key compression > result = trm_SegDef(1, "Diag_Code", 1, 1, 6, 6) > result = trm_SegDef(2, "Diagnosis", 2, 8, 44, 4) > > -- Step 3: - create the Tsunami file -------------------------- > result = trm_Create(fio, 1) > --if not result then > result = message_box(fio&" created successfully ","File Created ", > MB_OK) > --end if > > Notice that some of the statements have changed. Euman added a "trm_" > in front of all the statements to avoid possible clashes with statements > from other sources. > > so SegDef is now trm_SegDef, etc. > > I'll send you my Diagnosis.exw program and the current version of > trm_eu.ew and maybe that will help. > > I first built a record by padding each field and & ing them together. > Recently I changed and seperated the fields with a delimter (chr 127). > This saves space as you don't have to have fixed field length/fixed > record length records. You do have to pad the keys though. The > routines for adding delimters and extracting the fields is in the > program I am sending you. <snip> > >
3. Re: tsunami help
- Posted by "Euman" <euman at bellsouth.net> Dec 16, 2003
- 426 views
----- Original Message ----- From: "George Walters" <gwalters at sc.rr.com > I'm trying to figure out how to use tsunami record manager. Here's my > problem/question. > > I have a record {1,250,"Company 250", 1,3....etc) which is a customer setup > record. > > 1 = company number (integer) ( 2 digits max) > 250 = customer number (integer) (6 digits max) > > the key in EUdata base would be " 1 250" actually {32,company number ,32,32,32,32,32,customer number} the 32's are white spaces > rc = trmSegDef (1,"company", 1, 1, 2, 0) > rc = trmSegDef (2,"CustNbr", 1, 2, 6, 0) rc = trm_SegDef (1,"company", 1, 1, 2, 0) rc = trm_SegDef (2,"CustNbr", 2, 3, 6, 0) meaning, you can only have 99 company numbers and you can have 999999 customer numbers You can have multiple segments of one particular key result = trmSegDef(1, "company", 1, 1, 3, 6) result = trmSegDef(2, "CustNbr",2,38,1,4) result = trmSegDef(3, "Cust_uniqueID", 2, 4, 30, 4) note that I assign the third key as a second segment for the second key. This can be helpfull in many ways but you cant search from the third key because it belongs to the second key as a seperate segment. Not very confusing, If you need any help, I'll be writting a tool to create the database based on how many keys, their name and how many segments per key. This should be done in a week or so but try what I have written above so you'll better understand how this works. The key portions must be fixed width (whitespace left padded, if they are numbers and if names, right pad) to the length you provided in the trm_SegDef > Is this how I would try to define the segments? Reading the doc it would > seem that the segment fields for a key should be strings not integers or > atoms. So I'm confused on how to get back a record once it's been written. > record = GegEqual(atom hFile, 1 , {1, 250})............Is this how? Or do I > have to construct a string key and if so then I'm really confused how the > input and output get matched up. After you have created and opened the file, -- Get the first record result = trm_GetFirst(hFile, 1) buffer = trm_GetPosition(hFile, 0) var = peek4s(buffer) -- var should = 1 val = lPad(sprint(var), 2) -- lPad strips whitspaces from the left (not included in trm_eu.ew) result = trm_GegEqual( hFile, key, val) record = trm_GetRecord(result) so to answer your question, yes strings are passed... sprint( ) is used to convert numbers to strings > thanks for any pointers. > > george
4. Re: tsunami help
- Posted by "Euman" <euman at bellsouth.net> Dec 16, 2003
- 453 views
Hey George and all,' Make sure you get the latest version of trm_eu.ew http://www.rapideuphoria.com/trm_eu.zip Regards, Euman