Re: tsunami help
- Posted by "George Walters" <gwalters at sc.rr.com> Dec 16, 2003
- 444 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> > >