From: Neil Rieck [n.rieck@sympatico.ca] Sent: Friday, September 07, 2001 6:30 AM To: Info-VAX@Mvb.Saic.Com Subject: Re: Converting a stream_lf file to a variable file Many people are under the impression that characters like and/or are found in "RMS based" OpenVMS text files. This isn't true. If you don't believe me, just EDIT and save a small file then use DUMP to view it. You'll see that all RMS strings begin with a 16 bit word which represent the number of characters on that line which is then followed by the actual ASCII characters. Blank lines contain a 16 bit word equal to zero. The last word in the file only contains hex FFFF (65,536). Text files that are created without using RMS may have embedded paper commands and no line length information. The only way to use BASIC to convert a text file produced by "C" is to read in 512 byte blocks (if possible), extract only what you need, then use PRINT statements to disk which will create a proper RMS formatted text file. The following zip contains 2 files: http://www3.sympatico.ca/n.rieck/demo_vms/basic-open-useropen-bas.zip 1) The first file is just a USEROPEN demo which allows DEC-BASIC to PEEK at the RAB (record access block) and FAB (file access block) information. 2) The second file is a practical USEROPEN application to fix text files which were FTP'd to OpenVMS using a BINARY transfer mode rather than an ASCII transfer mode (These kinds of files all have embedded and chars in 512 byte fixed size blocks). If it's not possible to open your file exactly as I have done, then you could try variations on my theme: 1) you may wish to "not call SYS$CLOSE" in the USEROPEN routine, and then use the MOVE FROM statement to transfer data from the RMS buffer into a dynamic string or map. (this means you wouldn't need to do a second reopen as I have done) 2) as others have already suggested in this news group, you could tweak the file attributes prior to BASIC's open via the following DCL command: $ SET FILE/ATTR=(ORG:SEQ,LRL:512,MRS:512,RAT:NONE,RFM:FIX) myfile.txt This does not change the contents of a file, only the file header (which tells RMS how to process the contents when doing record i/o) ------------------------------------------------------------ p.s. This is not a VMS anomaly; TEXT files are stored differently on almost every computer platform I've ever worked on. For example, 1) WINDOWS NOTEPAD stores followed by at the end of each line. 2) CP/M stores only . 3) OpenVMS (when created via RMS) was described above. It is because of these platform differences that FTP requires you transfer a file using ASCII mode rather than BINARY mode. When you use ASCII mode to do a file PUT, the FTP client translates local text into a neutral known format, then sends it to the FTP server where the remote machine stores it using rules of the remote platform. ------------------------------------------------------------ Neil Rieck Kitchener/Waterloo/Cambridge, Ontario, Canada. http://www3.sympatico.ca/n.rieck/ http://www3.sympatico.ca/n.rieck/links/compaq_memorial_site.html