From:	SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM" 21-MAY-1993 09:28:55.05
To:	EVERHART
CC:	
Subj:	Re: FORTRAN Carriage Control conver routine?

From: 00prneubauer@leo.bsuvc.bsu.edu (Paul Neubauer)
X-Newsgroups: comp.os.vms
Subject: Re: FORTRAN Carriage Control conver routine?
Message-Id: <1993May20.120749.19548@bsu-ucs>
Date: 20 May 93 17:07:49 GMT
Organization: Ball State U.
Lines: 116
To: Info-VAX@kl.sri.com
X-Gateway-Source-Info: USENET

> In article <1993May18.221707.32@bhnrc.usda.gov> 
>  doherty@bhnrc.usda.gov (Bob Doherty) writes:
>>In article <1993May18.131623.233@sfpp.com>, 
>>  longo@sfpp.com (Bob Longo) writes:
>>> Does anyone have a utility that will convert a FORTRAN carriage control file
>>> into a carriage return carriage control file?  In other words, I have a file
>>> that has the FORTRAN carriage control bytes at the beginning of the records
>>> (such as +, 0, 1, etc.) and I want the output file to be a regular ASCII file
>>> with blank lines, <FF> characters, etc. where appropriate.
>>> 
>>> DEC says this must be done with a program and CONVERT cannot do it.  Someone
>>> must have done this before, so before I re-invent the wheel, can anyone help?
>>
>>DEC is right, and they even supply the program, even if they don't seem to
>>realize it -- TECO.  To convert foo.bar:
>>
>>$ edit/teco
>>*erfoo.bar$ewfoo.cnv/cr$hkex$$
>>
>>where the $ are actually escapes, Ctrl-[.
>>
>>Happy TECOing!!

I don't know whether the TECO program does or does not remove the
actual carriage control characters from the beginnings of the lines. I
just can't parse the TECO.  :-(

In article <1993May19.135735.8882@sarah.albany.edu>, 
 sysbrc@hyperfine.phy.albany.edu (Brian Cuttler) writes:
> I think even EDT will do what you want (may not be cheap for this
> type of operation, but it should work). EDT will read in almost any
> type of file format, but it likes to write Carriage Control format
> files.

Again, you would have to actually remove the characters from the
beginnings of lines, not merely convert the file by reading it in and
writing it out as carriage return carriage control.  That much CAN be
done by CONVERT.

Here's my (EVE/TPU) routine to do the whole job.  I just use a command
procedure to wrap up both CONVERT and EVE non-interactively.  The
command procedure uses the other two files.  I suspect that someone
like Carl Lydick would just use SYS$INPUT for the other two files and
include them in the command procedure, but I like having them
separate.  It's just taste and what you are used to, but I happen to
prefer seeing the different command sets in different files.  Your
tastes may vary.  :-) 

Cut the following into 3 files NOFOR .COM, .TPU and .FDL and put them
into the same directory (as each other, not necessarily the same
directory as the file(s) to be converted).

$!--------------------- NOFOR.COM -----------------------------------
$ if p2 .eqs. "" 
$    then 
$	write sys$output "Usage:  $ @NOFOR input-file output-file"
$	exit
$    endif
$ proc = f$environment("procedure")
$ this_device = f$parse(proc,,,"device")
$ this_dir = f$parse(proc,,,"directory")
$ convert/fdl='this_device''this_dir'nofor 'p1' 'p2'
$ edit/tpu/nodisp/section=eve$section/command='this_device''this_dir'nofor 'p2'
$ exit
$!
$!-------------------------------------------------------------
$! This command procedure converts a file in FORTRAN format to an ordinary 
$! text file.  The procedure also requires the associated files NOFOR.FDL and 
$! NOFOR.TPU.  
$!
$! Usage:
$! 	@NOFOR input-file output-file
$! 
$! Written by: Paul Neubauer, 14-MAY-1990


!----------------------- NOFOR.TPU --------------------------
! This TPU program is designed to be used in conversion of FORTRAN output
! with FORTRAN carriage-control to straight ASCII.
!
!	Written by:  Paul Neubauer,  14-MAY-1990
!
procedure fix_fortran 
loop
    exitif mark(none) = end_of(current_buffer);
    position (line_begin);
    case current_character
        [' '] : erase_character(1);			! sgl spacing
        ['0'] : erase_character(1); split_line;		! dbl spacing
        ['1'] : erase_character(1); copy_text('');	! new page
        ['+'] : eve_delete; erase_character(1); copy_text('
                position (line_end); copy_text('
        ['$'] : erase_character(1); 		! should have no return at eoln
        ['                copy_text('
    endcase;
    move_vertical (1);
endloop;
endprocedure; ! fix_fortran 

!
!	START OF EXECUTION
!
input_file := get_info (command_line, 'file_name');
fix_fortran;
write_file (current_buffer);
quit;

!----------------------- NOFOR.TPU --------------------------
RECORD
         CARRIAGE_CONTROL        CARRIAGE_RETURN

!------------------------ Cut here -- END of NOFOR files -----

-- 
Paul Neubauer   00prneubauer@leo.bsuvc.bsu.edu  00prneubauer@bsuvax1.BITNET
                00prneubauer@bsu-ucs.UUCP       neubauer@bsu-cs.UUCP

