From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ccc96dfdd6a003a7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-13 10:39:50 PST Path: archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed1.earthlink.net!newsfeed2.earthlink.net!newsfeed.earthlink.net!news.mindspring.net!not-for-mail From: "Brian Catlin" Newsgroups: comp.lang.ada Subject: Re: Reading variable-length records from a file Date: Mon, 13 Aug 2001 10:39:35 -0700 Organization: Sannas Consulting Message-ID: <9l93cp$bbf$1@slb7.atl.mindspring.net> References: <9l19l4$45m$1@slb7.atl.mindspring.net> <3B778C6E.9B43450D@canal-plus.fr> NNTP-Posting-Host: a5.f7.ec.82 X-Server-Date: 13 Aug 2001 17:39:37 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 Xref: archiver1.google.com comp.lang.ada:11858 Date: 2001-08-13T17:39:37+00:00 List-Id: 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" 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 > ____________________________________________________________________________