aldweb

Close I. aldweb

Close II. PC Freeware

Close III. Palm Freeware

Close IV. Palm Shareware

Close V. iziBasic Palm

Close VI. Palm Knowledge

Close VII. Pocket Computer

Close VIII. miniPortail

Special !



Mobile version of
the aldweb Site

m.aldweb.com


Neither French, nor English?

Try one of these flags then:
[de] [es] [it] [pt]
Search




Weather / Spam / www

Lyon Weather


aldweb against spam


Newsletter
To receive news about this website, consider subscribing to our Newsletter.
Subscribe
Unsubscribe
298 Subscribers
Family's web sites

Webmaster - Infos
Friends News
Visits

   visitors

   visitors online

Poll
What do you think of the new design of the aldweb Site?
 
Great !
Beautiful
Average
So ugly...
Results
forum.gifForum - iziBasic - Topic #1250

Forum - Forum
iziBasic - iziBasic


Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 257

active  Topic # 1250  How does reading of .pdb work

12/08/2005 @ 10:14
by Az Moghal

Anonymous



Hi Laurent,

Need to ask question which to you BASIC developers is probably very trivial.

In this code snippet below from IBAddress_ibas.txt can you explain how
the record is being split into its constituent field values as there doesn't seem to be any incremental loop or field delimiters involved. It seems to magicaly assign field to string variable before doing print, how does it know start/end of each field and size in record?

_W1Now:
OPEN "iBAddrDB" FOR RANDOM AS #1
J=I-1*7+1
SEEK #1,J
PRINT #1,N
PRINT #1,A$­­ : PRINT #1,B$­­
PRINT #1,C$­­ : PRINT #1,D$­­
PRINT #1,E$­­ : PRINT #1,F$­­
CLOSE #1
RETURN

  Post an answer  Top

[]   


Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 1
--------
12/08/2005 @ 13:39
by Khertan

Anonymous

visitor
It's very simple ... for each print you create a new record ...

And for each INPUT you read the record and the next input will read the next record...
Write to Khertan   Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 2
--------
12/08/2005 @ 13:46
by aldweb

Anonymous

visitor
Hello Az,

This routine W1Now = Write ONE Record Now only writes one record.
A record is a set of 7 fields, each containing a single information as defined for one person in iBAddress' main form.

This routine is called for each single writing operation in the database, passing the values required:
- I which is a number telling which record to write
- N, A$­­ to F$­­ containing the 7 fields' information

In the iBAddress database, all records are made of 7 fields which are stacked. So, if you have created 3 persons, 21 fields will be stored in the database, record 1 starting at position 1, record 2 starting at position 8, record 3 starting at position 15.

Then, if we look back at this routine in details.
First, J is calculated to point to the first field of a record. As we are in PARSER OFF mode, here is what it really calculated: J=(I-1)*7+1
If I=1 then J=1
If I=2 then J=8
If I=3 then J=15
The SEEK instruction then jumps to that field in the opened database.
The following 7 PRINT instructions replace each single field value in the database (for existing fields) or adds them on top of the database (for a new record). Indeed, the PRINT instruction writes in a given position in a file and then increments the position in the file to the next field, as explained in the documentation.

I hope these explanations clarify your understanding

Cheers

@+
aldweb
Write to aldweb   Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 3
--------
12/08/2005 @ 13:50
by aldweb

Anonymous

visitor
Yups, Khertan and myself did not use the word "record" in the same way, and Khertan has the right use!

A "file record" is what I called a "field" in my explanations. What I called a "record" was, let's say, a "person record" made of 7 informations or "fields", and thus being a set of 7 "file record".

I am pretty sure I confused everyone, including myself, with the previous sentence!

Cheers

@+
aldweb
Write to aldweb   Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 4
--------
12/08/2005 @ 14:01
by Az Moghal

Anonymous

visitor
Thanks Guys..

I appreciate the quick response

Regards

Az Moghal
  Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 5
--------
12/08/2005 @ 18:16
by Khertan

Anonymous

visitor
Just for information, i think using 7 record s for 7 field is not very clean ... in a most way doing only one record containing the seven field is better. You can do that by concatenated the field with a separator character and when reading parsing the record to separate field with the character.

It s just a comment on the iBAdress example.

(If you want a example of what i m trying to explain, just ask me, i ll give you)
Write to Khertan   Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 6
--------
12/08/2005 @ 18:41
by aldweb

Anonymous

visitor
You are very right Khertan
The MegaString is especially well suited for doing so
But at the time I wrote this sample program, the MegaString had not been implemented yet

Cheers

@+
aldweb
Write to aldweb   Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 7
--------
13/08/2005 @ 22:18
by apdi2003

Anonymous

visitor
La réponse dépend toujours un peu de la question qu'on se pose. Khertan a surement raison pour optimiser la taille des fichiers, par contre la présentation des enregistrements triés suivant les différents champs d'information (qui est une des visées pédagogiques de iBadress) n'est pas du tout facilitée. Et la création/maintenance de fichiers d'index n'a rien de basique.

apdi2003
  Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 8
--------
13/08/2005 @ 23:36
by aldweb

Anonymous

visitor
Oui, Khertan a raison pour optimiser la taille des fichiers sur ces nouveaux modèles de Palm qui fonctionnent en réservant des clusters de plusieurs Ko pour chaque enregistrement alors que les Palms "traditionnels" mappaient chaque octet employé. C'est ce qui a été massivement reproché aux T5 et Tréo650 lors de leur sortie, les fichiers prenant un embonpoint envahissant...

Et, ce n'est pas si compliqué que ça d'aligner toutes les données dans un seul enregistrement, avec un séparateur, puis de relire ainsi chaque enregistrement. C'est ce que je fais pour les piles initiales de nombres et de textes dans iziBasic (voir les ressources iBas 1 et iBas 31 dans un programme compilé par iziBasic)

Maintenant, apdi2003, tu as raison aussi, la méthode pédagogique utilisée dans iBAddress est aussi valable, surtout pour les Palms "traditionnels" car il n'y a alors aucun gachi d'espace mémoire pour des routines de lecture/écriture des enregistrements un peu plus simples à écrire.

Mon prochain projet, c'est un scoop, actuellement en fin de codage, que j'ai appelé ViziBasic (pour Visual editor pour iziBasic, bref un environnement complet de développement d'applications GUI avec génération de code iziBasic automatisé) fonctionnera sur un principe similaire à iBAddress, la MegaString étant utilisée par ailleurs pour générer un DOC code source compilable par iziBasic.


@+
aldweb
Write to aldweb   Post an answer  Top
active topic active   closed topic closed   Sticky Sticky   New New message   -   Correct Correct message   Close Close topic   Make sticky Make sticky
[]
Forum Topic  Forum 



 
^ Top ^