1. EDS help

--part1_132.20e02738.2c226466_boundary

Would a knowledgeable EDS user please help me out.  
I have taken a 35000 line text file and used DUMPCSV.EX to create a 35000 
item EDS database (with unique keys 1,2,3......35000).  I would like chop each 
record up and rewrite the info back to the same record.  Below is my code and 
the EX.ERR file.  I am confused......I just am not understanding the error 
message. 
THANKS!

STRIPIT.EX

include database.e
sequence upc, item, code, descrip, dept 
integer tries, err

--open database (copied from database.doc)
 tries = 0
              while 1 do
                  err = db_open("fullset", DB_LOCK_NO) 
                  if err = DB_OK then
                      exit
                  elsif err = DB_LOCK_FAIL then
                    tries += 1
                    if tries > 10 then
                          puts(2, "too many tries, giving up\n")
                          abort(1)
                    else    
                        sleep(5)
                    end if
                  else
                    puts(2, "Couldn't open the database!\n")
                    abort(1)
                  end if
              end while

--select database
    if db_select("fullset") != DB_OK then
        puts(2, "Couldn't select database\n")
    end if

--select table
    if db_select_table("all") != DB_OK then
        puts(2, "Couldn't find table!\n")
        abort(1)
    end if


--start loop of rewriting data--currently not a loop
--trying to get it to work for the first item

item=db_record_data(1)

? item
--I think the problem is here!
    --reorganize data
        upc=item[11..11]&item[13..17]&item[19..24]
        code=item[25..31]
        descrip=item[33..63]
        dept=item[73..75]

    --replace data 
        db_replace(1, {upc, code, descrip, dept})

--bottom of loop (eventually)
db_dump
--close database
db_close


EX.ERR

C:\EUPHORIA\Programs\stripit.ex:45
slice starts past end of sequence (11 > 1) 

Global & Local Variables

 C:\EUPHORIA\Programs\machine.e:
    check_calls = 1

 C:\EUPHORIA\Programs\file.e:
    SLASH = 92'\'
    my_dir = -2

 C:\EUPHORIA\Programs\get.e:
    input_file = <no value>
    input_string = <no value>
    string_next = <no value>
    ch = <no value>

 C:\EUPHORIA\Programs\database.e:
    current_db = 3
    current_table = 23
    db_names = {{102'f',117'u',108'l',108'l',115's',101'e',116't',46'.',
101'e',100'd',98'b'}}
    db_file_nums = {3}
    db_lock_methods = {0}
    current_lock = 0
    key_pointers = {410,502,594,686,778,870,962,1054,1146,1238,1330,1422,
1514,1606,1698,1790,1882,1974,2066,2158,2294,2386,2478,2570,2662,2798,
2890,2982,3074,3166,3310,3402,3494,3586,3678,3770,3862,4006,4098,4190,
4282,4374,4466,4618,4710,4802,4894,4986,5078,5170,5262,5414,5506,5598,
5690,5782,5874,5966,6126,6218,6310,6402,6494,6586,6678,6770,6862,7022,
7114,7206,7298,7390,7482,7574,7666,7875,7967,8059,8151,8243,8335,8427,
8519,8611,8703,8871,8963,9055,9147,9239,9331,9423,9515,9607,9783,9875,
9967,10059,10151,10243,10335,10427,10519,10611,10703,10879,10971,11063,
11155,11247,11339,11431,11523,11615,11707,11891,11983,12075,12167,12259,
12351,12443,12535,12627,12719,12811,12903,7783,7774,7765,7751,13520,13612,
13704,13796,13888,13980,14072,14264,14356,14448,14540,14632,14724,14816,
14908,15000,15092,15184,15276,15368,15560,15652,15744,15836,15928,16020,
16112,16204,16296,16388,16480,16572,16772,16864,16956,17048,17140,17232,
17324,17416,17508,17600,17692,17784,17876,17968,18168,18260,18352,18444,
18536,18628,18720,18812,18904,18996,19088,19180,19272,19480,19572,19664,
19756,19848,19940,20032,20124,20216,20308,20400,20492,20584,20676,20768,
20976,21068,21160,21252,21344,21436,21528,21620,21712,21804,21896,21988,
22080,22172,13096,22579,22671,22763,22855,22947,23039,23131,23223,23315,
23407,23499,23591,23683,23775,23867,24083,24175,24267,24359,24451,24545,
24639,24733,24827,24921,25015,25109,25203,25297,25391,25617,25711,25805,
25899,25993,26087,26181,26275,26369,26463,26557,26651,26745,26839,26933,
27027,27121,27347,27441,27535,27629,27723,27817,27911,28005,28099,28193,
28287,28381,28475,28569,28663,28757,28991,29085,29179,29273,29367,29461,
29555,29649,29743,29837,29931,30025,30119,30213,30307,30401,30495,30589,
30823,30917,31011,31105,31199,31293,31387,31481,31575,31669,31763,31857,...
    db_fatal_id = 0
    mem = 2203161128

 C:\EUPHORIA\Programs\stripit.ex:
    upc = <no value>
    item = {{53'5',48'0',48'0',32' ',32' ',32' ',32' ',32' ',48'0',48'0',
48'0',45'-',48'0',48'0',48'0',48'0',48'0',45'-',48'0',48'0',48'0',48'0',
49'1',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',67'C',65'A',
77'M',69'E',76'L',32' ',67'C',65'A',82'R',84'T',79'O',78'N',32' ',68'D',
73'I',83'S',67'C',79'O',85'U',78'N',84'T',32' ',32' ',32' ',32' ',32' ',
32' ',32' ',32' ',32' ',32' ',69'E',65'A',67'C',72'H',32' ',32' ',32' ',
32' ',32' ',49'1',50'2',49'1'}}
    code = <no value>
    descrip = <no value>
    dept = <no value>
    tries = 0
    err = 0





--part1_132.20e02738.2c226466_boundary
Content-Type: text/html; charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

<HTML><FONT FACE=3Darial,helvetica><FONT  SIZE=3D2 FAMILY=3D"SANSSERIF" FACE=
=3D"Arial" LANG=3D"0">Would a knowledgeable EDS user please help me out.&nbs=
p; <BR>
I have taken a 35000 line text file and used DUMPCSV.EX to create a 35000 it=
em EDS database (with unique keys 1,2,3......35000).&nbsp; I would like chop=
 each record up and rewrite the info back to the same record.&nbsp; Below is=
 my code and the EX.ERR file.&nbsp; I am confused......I just am not underst=
anding the error message. <BR>
THANKS!<BR>
<BR>
STRIPIT.EX<BR>
<BR>
include database.e<BR>
sequence upc, item, code, descrip, dept <BR>
integer tries, err<BR>
<BR>
--open database (copied from database.doc)<BR>
 tries =3D 0<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p; while 1 do<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp; err =3D db_open("fullset", DB_LOCK_NO) <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp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p;&nbsp;&nbsp; else&nbsp;&nbsp;&nbsp; <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sleep(5)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end if<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp; else<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; puts(2, "Couldn't open the database!\=
n")<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; abort(1)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp; end if<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p; end while<BR>
<BR>
--select database<BR>
&nbsp;&nbsp;&nbsp; if db_select("fullset") !=3D DB_OK then<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; puts(2, "Couldn't select database=
\n")<BR>
&nbsp;&nbsp;&nbsp; end if<BR>
<BR>
--select table<BR>
&nbsp;&nbsp;&nbsp; if db_select_table("all") !=3D DB_OK then<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; puts(2, "Couldn't find table!\n")=
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; abort(1)<BR>
&nbsp;&nbsp;&nbsp; end if<BR>
<BR>
<BR>
--start loop of rewriting data--currently not a loop<BR>
--trying to get it to work for the first item<BR>
<BR>
item=3Ddb_record_data(1)<BR>
<BR>
? item<BR>
--I think the problem is here!<BR>
&nbsp;&nbsp;&nbsp; --reorganize data<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; upc=3Ditem[11..11]&amp;item[13..1=
7]&amp;item[19..24]<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; code=3Ditem[25..31]<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; descrip=3Ditem[33..63]<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dept=3Ditem[73..75]<BR>
<BR>
&nbsp;&nbsp;&nbsp; --replace data <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; db_replace(1, {upc, code, descrip=
, dept})<BR>
<BR>
--bottom of loop (eventually)<BR>
db_dump<BR>
--close database<BR>
db_close<BR>
<BR>
<BR>
EX.ERR<BR>
<BR>
C:\EUPHORIA\Programs\stripit.ex:45<BR>
slice starts past end of sequence (11 &gt; 1) <BR>
<BR>
Global &amp; Local Variables<BR>
<BR>
 C:\EUPHORIA\Programs\machine.e:<BR>
&nbsp;&nbsp;&nbsp; check_calls =3D 1<BR>
<BR>
 C:\EUPHORIA\Programs\file.e:<BR>
&nbsp;&nbsp;&nbsp; SLASH =3D 92'\'<BR>
&nbsp;&nbsp;&nbsp; my_dir =3D -2<BR>
<BR>
 C:\EUPHORIA\Programs\get.e:<BR>
&nbsp;&nbsp;&nbsp; input_file =3D &lt;no value&gt;<BR>
&nbsp;&nbsp;&nbsp; input_string =3D &lt;no value&gt;<BR>
&nbsp;&nbsp;&nbsp; string_next =3D &lt;no value&gt;<BR>
&nbsp;&nbsp;&nbsp; ch =3D &lt;no value&gt;<BR>
<BR>
 C:\EUPHORIA\Programs\database.e:<BR>
&nbsp;&nbsp;&nbsp; current_db =3D 3<BR>
&nbsp;&nbsp;&nbsp; current_table =3D 23<BR>
&nbsp;&nbsp;&nbsp; db_names =3D {{102'f',117'u',108'l',108'l',115's',101'e',=
116't',46'.',<BR>
101'e',100'd',98'b'}}<BR>
&nbsp;&nbsp;&nbsp; db_file_nums =3D {3}<BR>
&nbsp;&nbsp;&nbsp; db_lock_methods =3D {0}<BR>
&nbsp;&nbsp;&nbsp; current_lock =3D 0<BR>
&nbsp;&nbsp;&nbsp; key_pointers =3D {410,502,594,686,778,870,962,1054,1146,1=
238,1330,1422,<BR>
1514,1606,1698,1790,1882,1974,2066,2158,2294,2386,2478,2570,2662,2798,<BR>
2890,2982,3074,3166,3310,3402,3494,3586,3678,3770,3862,4006,4098,4190,<BR>
4282,4374,4466,4618,4710,4802,4894,4986,5078,5170,5262,5414,5506,5598,<BR>
5690,5782,5874,5966,6126,6218,6310,6402,6494,6586,6678,6770,6862,7022,<BR>
7114,7206,7298,7390,7482,7574,7666,7875,7967,8059,8151,8243,8335,8427,<BR>
8519,8611,8703,8871,8963,9055,9147,9239,9331,9423,9515,9607,9783,9875,<BR>
9967,10059,10151,10243,10335,10427,10519,10611,10703,10879,10971,11063,<BR>
11155,11247,11339,11431,11523,11615,11707,11891,11983,12075,12167,12259,<BR>
12351,12443,12535,12627,12719,12811,12903,7783,7774,7765,7751,13520,13612,<B=
R>
13704,13796,13888,13980,14072,14264,14356,14448,14540,14632,14724,14816,<BR>
14908,15000,15092,15184,15276,15368,15560,15652,15744,15836,15928,16020,<BR>
16112,16204,16296,16388,16480,16572,16772,16864,16956,17048,17140,17232,<BR>
17324,17416,17508,17600,17692,17784,17876,17968,18168,18260,18352,18444,<BR>
18536,18628,18720,18812,18904,18996,19088,19180,19272,19480,19572,19664,<BR>
19756,19848,19940,20032,20124,20216,20308,20400,20492,20584,20676,20768,<BR>
20976,21068,21160,21252,21344,21436,21528,21620,21712,21804,21896,21988,<BR>
22080,22172,13096,22579,22671,22763,22855,22947,23039,23131,23223,23315,<BR>
23407,23499,23591,23683,23775,23867,24083,24175,24267,24359,24451,24545,<BR>
24639,24733,24827,24921,25015,25109,25203,25297,25391,25617,25711,25805,<BR>
25899,25993,26087,26181,26275,26369,26463,26557,26651,26745,26839,26933,<BR>
27027,27121,27347,27441,27535,27629,27723,27817,27911,28005,28099,28193,<BR>
28287,28381,28475,28569,28663,28757,28991,29085,29179,29273,29367,29461,<BR>
29555,29649,29743,29837,29931,30025,30119,30213,30307,30401,30495,30589,<BR>
30823,30917,31011,31105,31199,31293,31387,31481,31575,31669,31763,31857,...<=
BR>
&nbsp;&nbsp;&nbsp; db_fatal_id =3D 0<BR>
&nbsp;&nbsp;&nbsp; mem =3D 2203161128<BR>
<BR>
 C:\EUPHORIA\Programs\stripit.ex:<BR>
&nbsp;&nbsp;&nbsp; upc =3D &lt;no value&gt;<BR>
&nbsp;&nbsp;&nbsp; item =3D {{53'5',48'0',48'0',32' ',32' ',32' ',32' ',32'=20=
',48'0',48'0',<BR>
48'0',45'-',48'0',48'0',48'0',48'0',48'0',45'-',48'0',48'0',48'0',48'0',<BR>
49'1',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',67'C',65'A',<BR>
77'M',69'E',76'L',32' ',67'C',65'A',82'R',84'T',79'O',78'N',32' ',68'D',<BR>
73'I',83'S',67'C',79'O',85'U',78'N',84'T',32' ',32' ',32' ',32' ',32' ',<BR>
32' ',32' ',32' ',32' ',32' ',69'E',65'A',67'C',72'H',32' ',32' ',32' ',<BR>
32' ',32' ',49'1',50'2',49'1'}}<BR>
&nbsp;&nbsp;&nbsp; code =3D &lt;no value&gt;<BR>
&nbsp;&nbsp;&nbsp; descrip =3D &lt;no value&gt;<BR>
&nbsp;&nbsp;&nbsp; dept =3D &lt;no value&gt;<BR>
&nbsp;&nbsp;&nbsp; tries =3D 0<BR>
&nbsp;&nbsp;&nbsp; err =3D 0<BR>
<BR>
<BR>
<BR>
<BR>
--part1_132.20e02738.2c226466_boundary--

new topic     » topic index » view message » categorize

2. Re: EDS help

Kent,

I'd need to see the source to DUMPCSV.ex nad the text file to determine why
it was formatted that way, but this line of ex.err holdsa the key to this
crash:


    item = {{53'5',48'0',48'0',32' ',32' ',32' ',32' ',32' ',48'0',48'0',
48'0',45'-',48'0',48'0',48'0',48'0',48'0',45'-',48'0',48'0',48'0',48'0',
49'1',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',67'C',65'A',
77'M',69'E',76'L',32' ',67'C',65'A',82'R',84'T',79'O',78'N',32' ',68'D',
73'I',83'S',67'C',79'O',85'U',78'N',84'T',32' ',32' ',32' ',32' ',32' ',
32' ',32' ',32' ',32' ',32' ',69'E',65'A',67'C',72'H',32' ',32' ',32' ',
32' ',32' ',49'1',50'2',49'1'}}


This is a one-element sequence which contains a 75-element sequence (the
text string). It is probable that this is not the format you wanted.  But
you can change the code in stripit.ex to work with this format if you
desire, just add

item=item[1]

the line before

upc= . . .

This will make item into the 75-character string you are expecting.

-- Mike Nelson

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu