|
Pages: [1]
|
 |
|
Author
|
Topic: (12) lines 'locks up' Rebol view ?? (Read 1141 times)
|
|
jfdutcher
|
Does anyone see why the code below should 'hang' View ? Cannot 'Quit' it or get a response. Other Win 2000 apps continue to function. This brief code worked fine before I added the for loop ....when it was a straight-thru request for just one record's data. Rebol[Title: "Sort dsysmst.txt to name sequence"]
port: open/binary/seek %/c/vetssrc/dietsys/dsysmst.txt
read-record: func [port record-size record-number] [ copy/part at port record-number - 1 * record-size + 1 record-size ]
substr: func [record offset len] [ copy/part at record offset len ]
for i 1 10 1 [ rec1: to-string read-record port 2690 i regnbr: substr rec1 3 4 lname: substr rec1 7 15 fname: substr rec1 22 15 minit: substr rec1 37 1 print [regnbr lname fname minit] ]
halt
|
|
|
|
|
Logged
|
|
|
|
|
jfdutcher
|
This just shows how bad some of us can be..... After starting to close apps that were open on the desktop....I started seeing the 'little' alert boxes wanting to know about permission to open a file on the desktop....they were hidden ....behind other windows.
I wasn't expecting that issue to arise.... just to do a 'print' exercise, but I guess it does.
John D.
|
|
|
|
|
Logged
|
|
|
|
|
jfdutcher
|
I will observe that now that I am seeing the printed results ....there seems to be an 'anomoly' in the second field in each print line; they have a 'digit' in front of the actual field value ..... hence
1524 2Hornbeck Edna 2466 7Badger Donald 3545 7Economou Thomas
The digit before last name is not part of the value retrieved from the file record .......wonder where it came from ??
|
|
|
|
|
Logged
|
|
|
|
|
jfdutcher
|
Thank the Lord not too many people read these....
The digit is the last piece of the 'first' field......
Clearly some kind of offset problem 'I' have....... but then, you knew that ..........
J.D.
|
|
|
|
|
Logged
|
|
|
|
|
jfdutcher
|
Well, maybe it's not 'all' me.... Clearly it is including the value of 'i' (from the for loop) or inserting the record number value from the file.... (the 1st (10) would be records 1-10. I'm not including record # in the 'print' request block... so don't expect to see either it....or the value of 'i'
|
|
|
|
|
Logged
|
|
|
|
|
jfdutcher
|
After this ...no more bull posted...
But it seems as though something is not right for if I just set a single field equal to the 1st 38 bytes from the records read and then print it as 'substr 0 38' the result is as it should be.
Since 'regnbr' starts in physical position (4) and the 1st position is (apparently) zero ('0') then the value of 'substr 3 4 ' ought to be the regnbr.
i.e The 1st record on the file is: '0015342HORNBECK EDNA' the next is: '0024667BADGER DONALD'
but I have to use 'substr 4 4' to get it
similarly 'lname' should be 'substr 7 15' but I have to use 'subtsr 8 15'
??
|
|
|
|
|
Logged
|
|
|
|
|
jfdutcher
|
It's not possible .....but it is.... If I use the values : lname: substr rec1 8 15 fname: substr rec1 22 15 minit: substr rec1 37 1
I get exactly the same results as using:
lname: substr rec1 8 15 fname: substr rec1 23 15 minit: substr rec1 38 1
??
|
|
|
|
|
Logged
|
|
|
|
|
jfdutcher
|
The upshot is ......how can 'different' offset values directed to the same physical file record deliver the 'same' resultant variable results ...... doesn't seem 'right' to me !
|
|
|
|
|
Logged
|
|
|
|
|
Brock
|
Did you figure this out?!?
My thoughts are to look in the substr function you are using for your answer as this is not a Rebol word.
|
|
|
|
|
Logged
|
|
|
|
|
Thør
|
Could you perhaps give us the structure, or maybe even an actual line/record from your input file? That would help a lot, me thinks.
Cheers!
|
|
|
|
|
Logged
|
|
|
|
|
|
Pages: [1]
|
|
|
 |
News: 01-09-08 Alpha version of REBOL 3 has been released!
2231 Posts in 579 Topics by 1730 Members
Latest Member: OpepriphefS
|