comp.lang.ada
 help / color / mirror / Atom feed
From: "Brian Catlin" <briancatlin@mindspring.com>
Subject: Re: Reading variable-length records from a file
Date: Mon, 13 Aug 2001 10:39:35 -0700
Date: 2001-08-13T17:39:37+00:00	[thread overview]
Message-ID: <9l93cp$bbf$1@slb7.atl.mindspring.net> (raw)
In-Reply-To: 3B778C6E.9B43450D@canal-plus.fr

Unfortunately, the files were ZIPped up and sent to me; I don't have a VMS system to perform the conversion.  Therefore, I want to
write an Ada program to convert the files for me.  I could have written a C program to do this in the time it took for me to write
the original post, but I want to "get both lobes around the Ada paradigm", and do it in Ada.  So far, the only suggestion on
actually doing the conversion in Ada was to read two characters, multiply the first by 256, add them together, and then read that
number of characters from the file.  GROSS!  There has to be a better way!

 -Brian

"Thierry Lelegard" <thierry.lelegard@canal-plus.fr> wrote in message news:3B778C6E.9B43450D@canal-plus.fr...
> > What is the best method for reading variable-length records from a file, using Ada (generic Ada, or GNAT)?  I have some files,
from
> > a VMS system, that I want to read on a Win2K system.  The files have the VMS standard "implied carriage control", which means
that
> > each "record" (or line; it's a text file) has a two-byte count value, followed by "count" bytes (characters).
>
> How do you move the file from VMS to Windows?
>
> If you use FTP, simply specify "ASCII mode" instead of "IMAGE mode"
> during the transfer and you will get a plain Windows text file.
>
> If you share the file system (NFS, Samba), make sure that the file
> is created with the "stream" or "stream_lf" attribute (use FDL options).
>
> Otherwise, if you can't modify the way the file is created, you can
> convert it on VMS using the following DCL procedure. This changes
> the physical content while preserving the logical one. After conversion,
> the file remains a valid text file on VMS but is also Windows-compliant.
>
> $ convert/fdl=sys$input: 'infile' 'outfile'
>         file
>           organization sequential
>         record
>           block_span yes
>           carriage_control carriage_return
>           format stream
> $
>
> We work in an heterogeneous environment (VMS + UNIX + Windows) and
> we share all Ada source files (text files) on the same file system
> without problem.
>
> -Thierry
> ____________________________________________________________________________
>
> Thierry Lelegard, "The Jazzing Troll", Email: thierry.lelegard@canal-plus.fr
> CANAL+ Technologies, 34 place Raoul Dautry, 75906 Paris Cedex 15, France
> Tel: +33 1 71 71 54 30   Fax: +33 1 71 71 52 08   Mobile: +33 6 03 00 65 75
> ____________________________________________________________________________





  reply	other threads:[~2001-08-13 17:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-10 18:37 Reading variable-length records from a file Brian Catlin
2001-08-10 19:04 ` Larry Kilgallen
2001-08-10 21:28 ` Mark Johnson
2001-08-13  8:14 ` Thierry Lelegard
2001-08-13 17:39   ` Brian Catlin [this message]
2001-08-13 18:29     ` tmoran
2001-08-13 18:51     ` Larry Kilgallen
  -- strict thread matches above, loose matches on Subject: below --
2001-08-13 21:29 Gautier Write-only-address
2001-08-13 22:41 ` Larry Kilgallen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox