On Dec 28, 6:23=A0pm, richard <s...@[EMAIL PROTECTED]
> wrote:
> I have a list of a few thousand records that I need to resolve into
> one short list.
>
> I have compiled and sorted, a major list of items.
> Each item is currently listed multiple times due to the last field
> entry.
> I'm trying to make a short list where the duplicates are not entered,
> but counted.
> So each new item begins a new record in the short list.
>
> e.g.
>
> John Smith,123 adams,some where, 1234
> John Smith,123 adams,some where, 1245
> John Smith,123 adams,some where, 1266
>
> Bill Smith, Baker, else where, 3452
> Bill Smith, Baker, else where, 3588
> Bill Smith, Baker, else where, 3762
>
> Would become:
>
> John Smith, 3
> Bill Smith, 3
>
> Are you guys still messin around with ancient qbasic?
> Upgrade!www.libertybasic.com
> This puppy is everything that basic was with a lot of new twists.
> It also works within windows so you don't need to go into dos.
> Newer versions will include html.
>
> Can basic connect you to the internet and beyond?
> Liberty Basic can.
Since the list is already sorted the QBASIC program you need is
something like
-- Begin code ----
DIM J AS INTEGER
DIM dRecord AS STRING
DIM dNewItem AS STRING
DIM dCurrentItem AS STRING
DIM dTotal AS INTEGER
OPEN "count.txt" FOR OUTPUT AS #1
OPEN "records.txt" FOR INPUT AS #2
LET dCurrentItem =3D ""
LET dTotal =3D 0
DO WHILE NOT EOF(2)
LINE INPUT #2, dRecord
LET dNewItem =3D LEFT$(dRecord, INSTR(dRecord + ",", ",") - 1) + ","
IF dCurrentItem =3D dNewItem THEN
LET dTotal =3D dTotal + 1
ELSE
IF dTotal <> 0 THEN
PRINT #1, dCurrentItem; dTotal
END IF
LET dCurrentItem =3D dNewItem
LET dTotal =3D 1
END IF
LOOP
IF dTotal <> 0 THEN
PRINT #1, dCurrentItem; dTotal
END IF
CLOSE #2
CLOSE #1
SYSTEM
-- End code ----
As a matter of interest, it's quite easy to handle the internet with
QBASIC using the SHELL command. This allows QBASIC to transfer data
(either ftp or http data) via DOS programs such as ftp.exe or curl.exe
and then process it via QBASIC commands.
Cheers
Derek


|