Home > Archive > Fortran > January 2006 > Dusting off Visual/Digital Fortran - how the heck to migrate printing?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Dusting off Visual/Digital Fortran - how the heck to migrate printing?
|
|
| cgilley@bravesw.com 2006-01-13, 7:01 pm |
| I have a project that is rearing its head again - moving some FORTRAN
from a VAX to a PC. Printing is posing an opportunity. Much of the
printing goes to a device that is routed to a serial port on the VAX -
txa0 for example.
How does one handle this portability issue in the new PC environment?
For the moment, I don't want to QuickWin the application. I've looked
astensively in the doc and google, and nothing seems to address this
very obvious need.
Suggestions?
chg
| |
|
|
<cgilley@bravesw.com> wrote in message
news:1137182037.251718.207190@g14g2000cwa.googlegroups.com...
>I have a project that is rearing its head again - moving some FORTRAN
> from a VAX to a PC. Printing is posing an opportunity. Much of the
> printing goes to a device that is routed to a serial port on the VAX -
> txa0 for example.
>
> How does one handle this portability issue in the new PC environment?
> For the moment, I don't want to QuickWin the application. I've looked
> astensively in the doc and google, and nothing seems to address this
> very obvious need.
>
> Suggestions?
>
> chg
>
Txa0 is a serial port.
The closest device under windows would be a serial printer connected to a
com port.
Jim
| |
| Charlie 2006-01-13, 7:01 pm |
| Jim,
appreciate the reply. But, let me elaborate, and maybe you can show
me where I'm being dense. So I have 10s of thousands of lines of code
that writhe to LU6, the default output device. In VMS land (I know
this is not a VMS centric area), this output goes to SYS$PRINT then on
to a few other device logicals eventually reaching txa0.
Is there a way to direct default output on the PC Digital FORTRAN to a
default printer?
| |
|
|
"Charlie" <cgilley@bravesw.com> wrote in message
news:1137189022.683342.231480@o13g2000cwo.googlegroups.com...
> Jim,
>
> appreciate the reply. But, let me elaborate, and maybe you can show
> me where I'm being dense. So I have 10s of thousands of lines of code
> that writhe to LU6, the default output device. In VMS land (I know
> this is not a VMS centric area), this output goes to SYS$PRINT then on
> to a few other device logicals eventually reaching txa0.
>
> Is there a way to direct default output on the PC Digital FORTRAN to a
> default printer?
>
Porting VAX Fortran to PCs has been my life for the past year or so.
Why not just direct the output (via the OPEN statement) to a file or files?
The files can then be examined or printed at your leisure.
| |
| Ken Plotkin 2006-01-13, 9:57 pm |
| On 13 Jan 2006 13:50:22 -0800, "Charlie" <cgilley@bravesw.com> wrote:
>Jim,
>
> appreciate the reply. But, let me elaborate, and maybe you can show
>me where I'm being dense. So I have 10s of thousands of lines of code
>that writhe to LU6, the default output device. In VMS land (I know
>this is not a VMS centric area), this output goes to SYS$PRINT then on
>to a few other device logicals eventually reaching txa0.
>
>Is there a way to direct default output on the PC Digital FORTRAN to a
>default printer?
If you've got lots of write(6,...) statements and no OPEN, and you
want those to go to the printer, it's easy.
Just put
open(unit=6,file='prn')
near the beginning of your main program. Just do it once, and the
default system printer is connected.
Under CVF if you don't have an open, then output will default to a
file named fort.6. If you'd like to send output to a file for
printing at your leisure, use an open with the file name of your
choice.
I'm not sure why you ask "How does one handle this portability issue
in the new PC environment?" in your first post. Some compilers will
default unit 6 to the printer, some won't. That kind of default is
really a compiler thing, not a system thing. I don't think there's
any portable way to get around system-specific device names (or file
name conventions), though.
Ken Plotkin
| |
| Dave Weatherall 2006-01-14, 3:57 am |
| On Fri, 13 Jan 2006 21:50:22 UTC, "Charlie" <cgilley@bravesw.com>
wrote:
> Jim,
>
> appreciate the reply. But, let me elaborate, and maybe you can show
> me where I'm being dense. So I have 10s of thousands of lines of code
> that writhe to LU6, the default output device. In VMS land (I know
> this is not a VMS centric area), this output goes to SYS$PRINT then on
> to a few other device logicals eventually reaching txa0.
>
> Is there a way to direct default output on the PC Digital FORTRAN to a
> default printer?
>
Actually, by default, on VMS Fortran
wriite (6,*)
will output to SYS$OUTPUT, Lun 6 was normally the line printer on
RSX.
It might have been redirected with an OPEN statement that assigns Lun
6 to SYS$PRINT, in which case you hould only have the one line to
change, as shown in a previous post :-
open (unit=6,file='PRNT')
IIRC on DOS the physical printer was PRN: I guess on WIndows you
might be able to write to COMn if you attach a serial printer to seral
port n. Never tried it though. Only ever used PRN or LPTn:. Check out
the port names in the Printer control panel.
If there is no OPEN (unit=6,...) then, if this code runs inside a DCL
shell, you might find a DEFINE or ASSIGN command that attaches FOR006
to SYS$PRINT or your TXAn: device.
You can still use TYPE or WRITE (,*) to write to the
console/SYS$OUPUT. But you probably know that.
If there's not a shell check the xxLOGIN.COM that the process runs
thro' before the executable starts.
--
Cheers - Dave.
| |
| Ken Plotkin 2006-01-14, 7:57 am |
| On 14 Jan 2006 02:23:25 -0600, "Dave Weatherall"
<djw-nothere@nospam.nohow> wrote:
[snip]
>IIRC on DOS the physical printer was PRN: I guess on WIndows you
>might be able to write to COMn if you attach a serial printer to seral
>port n. Never tried it though. Only ever used PRN or LPTn:. Check out
>the port names in the Printer control panel.
[snip]
That's right. PRN: is still the default system printer. LPTn: will
send it to a specific printer port, and COMn: will send it to a serial
port. Haven't seen a serial printer on a PC for years, though.
You leave the : off, so it's file= 'lpt1', not file='lpt1:'.
If the printer is on a USB port, addressing that can get a little
bizarre, involving capturing the port as a network device.
Ken Plotkin
| |
| Charlie 2006-01-14, 6:58 pm |
| Just for the record, this is less a technical printing issue and far
more of a "user stares at screen 'now what do I do' issue. More
replies to follow... Printing when you want to is not a good idea for
this system (taking the users into account).
| |
| Charlie 2006-01-14, 6:58 pm |
| VMS tutorial noted :) I admit I'm rusty, but accuracy is better.
| |
| Charlie 2006-01-14, 6:58 pm |
| Poor choice of words, I should have said adapting to the PC. I tried
the 'prn' device (as documented) and my fortran sample program hurled
an evil message. I think I have a setup issue...
more research
| |
|
|
"Charlie" <cgilley@bravesw.com> wrote in message
news:1137189022.683342.231480@o13g2000cwo.googlegroups.com...
> Jim,
>
> appreciate the reply. But, let me elaborate, and maybe you can show
> me where I'm being dense. So I have 10s of thousands of lines of code
> that writhe to LU6, the default output device. In VMS land (I know
> this is not a VMS centric area), this output goes to SYS$PRINT then on
> to a few other device logicals eventually reaching txa0.
>
> Is there a way to direct default output on the PC Digital FORTRAN to a
> default printer?
>
O I see, the default assignment of unit 6 to the default printer is how this
works.
There really ought to be the same type of assignment in CVF, but I would not
know. After all, a default printer is a default printer.
If there is an open statement for unit 6, it needs to be changed because
there is no such thing as Sys$Print on Windows. That is in reality a queue
name.
Perhaps there is an environment variable which contains the name of the
default printer.
Jim
| |
|
| Windows 95/98/ME had PRN as a reserved word that would connect to the
(serial) printer port. LPT1 was need to connect to the (parallel) printer
port.
Windows NT I am not sure of, but Windows 2000/XP have dropped this
behaviour.
You may also have needed PRN: and LPT1: as the connection string.
"Charlie" <cgilley@bravesw.com> wrote in message
news:1137251376.295609.257650@g47g2000cwa.googlegroups.com...
> Poor choice of words, I should have said adapting to the PC. I tried
> the 'prn' device (as documented) and my fortran sample program hurled
> an evil message. I think I have a setup issue...
>
> more research
>
| |
| Charlie 2006-01-15, 7:12 pm |
| Steve,
My version is a bit dated (6.0) , guess like all of us these days,
but thanks for the pointer.
I'll be updating my copy shortly to the latest.
All - through all of the suggestions and comments, I'm pretty sure I
can port this code completely
now. Neurons between my ears are warming up...
Thanks all
| |
| pjlsr@netscape.com 2006-01-15, 9:58 pm |
|
Ken Plotkin wrote:
> On 14 Jan 2006 02:23:25 -0600, "Dave Weatherall"
> <djw-nothere@nospam.nohow> wrote:
>
> [snip]
> [snip]
>
> That's right. PRN: is still the default system printer. LPTn: will
> send it to a specific printer port, and COMn: will send it to a serial
> port. Haven't seen a serial printer on a PC for years, though.
>
> You leave the : off, so it's file= 'lpt1', not file='lpt1:'.
>
> If the printer is on a USB port, addressing that can get a little
> bizarre, involving capturing the port as a network device.
>
> Ken Plotkin
| |
| pjlsr@netscape.com 2006-01-15, 9:58 pm |
| I'd like to know just how to address USB port. I have an old routine
that use to print a file the way I wanted it, but since I got an
ALL-IN-ONE HP machine The routine no longer works. Seems like it needs
to be on a parallel printer.
Pete loftus
| |
| Ken Plotkin 2006-01-15, 9:58 pm |
| On 15 Jan 2006 18:28:24 -0800, pjlsr@netscape.com wrote:
>I'd like to know just how to address USB port. I have an old routine
>that use to print a file the way I wanted it, but since I got an
>ALL-IN-ONE HP machine The routine no longer works. Seems like it needs
>to be on a parallel printer.
Here are a link couple of links that describes the process:
http://support.mfm.com/support/trou...inting/unc.html
http://support.riverdeep.net/techtips_detail.asp?id=156
I have not done this myself - I bought a printer PCMCIA for my
PRN-less laptop. But I do know (from a post here a while back, and
from a colleague who was in the same boat) that you can address a USB
printer as PRN, and that the solution involved capturing the printer
port. So I googled "capture printer port." These two links (and a
bunch more similar ones) turned up.
Ken Plotkin
| |
| meek@skyway.usask.ca 2006-01-16, 9:57 pm |
| In a previous article, pjlsr@netscape.com wrote:
>I'd like to know just how to address USB port. I have an old routine
>that use to print a file the way I wanted it, but since I got an
>ALL-IN-ONE HP machine The routine no longer works. Seems like it needs
>to be on a parallel printer.
>
>Pete loftus
>
That's a pretty vague description ... was your old routine
a printer driver ? Why can't you just use default device
e.g. lpt1: (in windows) or whatever LPT# the device happens to be
What do you mean by "the way you wanted it" - "same format" ?
or "printed with the same calling method"?
Chris
| |
| pjlsr@netscape.com 2006-01-16, 9:57 pm |
| It was a fortran program that would read an existing file ( only
ascii text files would result in usefull output), compose a line of
characters arranged as I wanted them, then sent them to the printer and
voila, I would have a printed file. THe line was created using HP PCL
codes. A small obj file (using a bios interupt call) was linked with
the fortran obj file to to do the actual output to the printer. Its
most common use was to print out long numerical data lists in reduced
type and up to as many as 192 characters spaces per line on 8.5 * 11
paper. A paper trail was the object.
| |
| meek@skyway.usask.ca 2006-01-17, 8:01 am |
| In a previous article, pjlsr@netscape.com wrote:
> It was a fortran program that would read an existing file ( only
>ascii text files would result in usefull output), compose a line of
>characters arranged as I wanted them, then sent them to the printer and
>voila, I would have a printed file. THe line was created using HP PCL
>codes. A small obj file (using a bios interupt call) was linked with
>the fortran obj file to to do the actual output to the printer. Its
>most common use was to print out long numerical data lists in reduced
>type and up to as many as 192 characters spaces per line on 8.5 * 11
>paper. A paper trail was the object.
>
You can do that without the bios (I don't understand why
you need that anyway)- the small characters/long line
that is.
You just have to send the codes for pitch, lines per inch
to the printer first. These are not ascii, but you can use
the char() function (if you have it ) to make the HP PCL characters
I append my (messy - but it's been through the wars!)
program to print a compressed ascii file. WATCOM
fortran from www.openwatcom.org (free). The include
file adds stuff needed for the system calls.
I don't think HP 1150 has any smaller pitch - my max is
152 chars/line (approx) - however other HP printers might
- e.g. HP LJII can specify 48 lpi and seems to have select_it_
yourself pitch (cpi) and height ; but our HP LJ II is long
gone ... so I cant test it.
Chris
C>>>>>>>>>>>c:\watcom\cmfwin32\hpprint2.for<<<<<<<<<<<<<<<<<<
C>>>>=hpprint1 except even smaller than 16cpi and try 16 Lpi
C>>> = hpprint.for except ~16cpi and 12 lines.inch and 120 lines/page
C>>>>>> c:\watcom\cmfwin32\etprint.for - EPSON C84 try to get 12cpi
C... but cant get printer to do 12 cpi .... yet!W%^$^
C....C:\watcom\cmfdos32\vtprint.for, Q&D ascii copy to lpt1:
C.... testing use of command line arguments
C>>> but moving towards binary dump program
C>> cmds: rec len; # bytes to print from each rec;
C>>>> skip n recs,"more"(=next 256 bytes or next rec)
C>>use getkey stuff / from pccrtw32 ??
SAVE
INCLUDE 'FSUBLIB.FI'
PARAMETER (NPERPG=150) !HP LJ 1150 max lines/page at 6 lpi is 58!!
!could try 8 lpi ... but 7 is NA
character cmd*128,cmdlin*128
integer cmdlen,status
Character*128 STRNG,fmt,fmt1,HNAME
logical ex
integer*1 bytes(5),byte
character*40 fname
character*1 null
character*5 formfd
character*3 amonth(12)
character*1 gname(128)
c... HP LJ 1150 does not have manual cpi and lpi, so add cntl to 1st line of each page
C
character*22 cpi12
integer*1 icpi12(22)
equivalence (cpi12,icpi12(1))
data icpi12/
1 27,38,108,49,54,68, !try 16 Lpi
1 27,40,115,50,48,72, ! and 20cpi
1 27,38,107,50,83,
1 27,40,115,50,66/ !8 lpi & 12 cpi(I hope) & T-Roman,d-bold
integer narg,lenarg,ios,year,month,day,hour,minu
te,second
character*152 page(NPERPG)
equivalence (bytes(1),formfd),(gname(1),strng),(byte
,null)
data amonth/ 'Jan','Feb','Mar','Apr','May','Jun','Jul
','Aug',
1'Sep','Oct','Nov','Dec'/
data nl/0/,bytes/27,42,114,66,12/ !HP LJ II formfeed (I hope)
write(page(1),*)
byte=0
print*,'copy ascii file to lpt1: page-by-page @ 20cpi/16Lpi'
print*,'(NOTE: Truncates line at 152 chars!, 150 lines per pg)'
narg=iargc()
Lenarg=igetarg(0,STRnG)
print*,' program name is:',STRNG(1:lenarg)
if(narg-1.lt.1)then
print*,' Enter file name?'
read 4455,strng
4455 format(a128)
lenarg=len(strng)
goto 30
endif
LENARG=IGETARG(1,STRNG)
strng(lenarg+1:lenarg+1)=char(0)
HNAME=STRNG !SAVE FILE NAME
ln=lenarg !save so can print name in header line
npage1=0
if(narg-1.lt.2)then
npage2=999999 !No args follow file name, so all pgs
itype=0
else
if(narg-1.lt.3)then ! 1 arg follows file name
itype=1
lenarg=igetarg(2,strng)
strng(lenarg+1:lenarg+1)=char(32) !space so number field doesn't end with 0
read(strng,*)npage2
npage1=0
print*,'Print first ',npage2,' pages'
npage2=npage2-1 !was getting an extra,so quik fix
elseif(narg-1.lt.4)then !assume 2 args
c print*,'not implemented!!'
itype=2
lenarg=igetarg(2,strng)
strng(lenarg+1:lenarg+1)=char(32) !space so number field doesn't end with 0
read(strng,*)npage1
lenarg=igetarg(3,strng)
strng(lenarg+1:lenarg+1)=char(32)
read(strng,*)npage2
print'(''extract&print page#'',i3,'' -to- page#'',i3)',
1 npage1,npage2
endif
endif
c.. itype=0 print all; =1 print 1st n; = 2 print n1 to n2
30 inquire(file=HNAME,exist=ex)
if(.not. ex)then
print*,'file=',STRNG,' not found; so pause(rtn to quit)'
pause
stop
endif
open(16,file=HNAME,err=800,form='formatt
ed',
1 iostat=ios,status='old')
CALL getTIM(hour,minute,second,hsecs)
CALL getdat(year,month,day)
if(ln.gt.20)ln=20
fmt1=''' :VTPrinted from Pentium: '',i2,''-'',a3'//
1 ',''-'',i4,'' '',i2,'':'',i2.2,'':'',i2.2,'' >>'''
c print*,'Test1:',fmt1
write(fmt,3233)ln,fmt1
3233 format('('' << ''',',A',i2.2,',',a77,')')
c print*,'test2:',fmt
c... leave 1st line on 1st page blank
if(npage1.le.1)
1 write(page(2),fmt)hname,day,amonth(month
),year,hour,
1 minute,second
c... and leav a blnk line after the header line - use it for page#
nl=3 !line 2 = header, line 3 = blank.(line 1=page#)
NPAGE=1
10 nl=nl+1
read(16,'(a152)',err=850,end=910,iostat=
ios)page(nl)
if(nl.lt.nperpg)goto 10
c... end of page or end of i/p file
900 if(npage.ge.npage1)then
cmdlen=fgetenv('comspec',cmd)
cmd(cmdlen+1:cmdlen+1)=char(0)
fname='asciiop.tmp'
inquire(file=fname,exist=ex)
if(.not. ex)then
open(17,file=fname,form='formatted',stat
us='new')
else
print*,'file:',fname,
1 ' already exists:quit(1) or write over old(0)?'
read*,icmd1
if(icmd1.eq.1)stop
open(17,file=fname,form='formatted',stat
us='unknown')
endif
endif
if(nl.gt.0)then
npage=npage+1
if(npage.ge.npage1)then
write(page(1),'(70x,''page#'',i2)')npage
-1
DO L=1,NL
if(L.eq. 1)write(17,'(a12,1X,a152)')cpi12(1:12),p
age(L)
if(L.ne.1)write(17,'(1X,a152)')page(L)
ENDDO
WRITE(17,'(a5)')formfd
CLOSE(17)
c IF(2.EQ.2)THEN
c PRINT*,'TEST - STOP'
c STOP
c ENDIF
write(cmdlin,'(''/c copy/b '',a12,'' lpt1:'')')fname
cmdlin(32:32)=char(0)
status=fspawn(cmd,cmdlin)
write(cmdlin,'(a7,a12)')'/c del ',fname
cmdlin(20:20)=char(0)
status=fspawn(cmd,cmdlin)
c...messy ... odd fixes just to make it do what I want
if((itype.ne.2.and.npage.gt.npage2+1).or.
1 (itype.eq.2.and.npage.gt.npage2))then
print*,'stop after reqd # pages'
stop
endif
else
print*,'skipping o/p page#',npage
endif
endif
nl=1 !always leave a margin of 1 line at top
!- else gets very close to edge!
!use it for page #
if(istop.eq.1)stop
goto 10
800 print*,'read err so stop,iostat=',ios
stop
850 print*,'open i/p file: err,so stop,iostat=',ios
stop
910 print*,'eof'
istop=1
nl=nl-1
goto 900
END
------------------------------------------
| |
| pjlsr@netscape.com 2006-01-17, 9:57 pm |
| It was set up that way so that there could be as many as four 80
character pages per 8.5 *11 sheet, just to reduce the volume of some
very long files which were for reference and record purposes. There is
a long history to the use of the bios interrupt and at the time the
fortran routine was written I didn't know any other sure way.
I printed out your program just to see how you did it.
Thanks
| |
| meek@skyway.usask.ca 2006-01-18, 7:03 pm |
| In a previous article, pjlsr@netscape.com wrote:
>It was set up that way so that there could be as many as four 80
>character pages per 8.5 *11 sheet, just to reduce the volume of some
>very long files which were for reference and record purposes. There is
>a long history to the use of the bios interrupt and at the time the
>fortran routine was written I didn't know any other sure way.
> I printed out your program just to see how you did it.
>
>Thanks
>
I kept a copy of some of the (excellent ) HP LJ II manual-
these days you get minimal information with a printer -
and the code for setting pitch, where #..# = characters/inch
is (decimal) 27 40 115 #..# 72
(It's called "primary pitch" - don't know why)
"primary height" is set by
27 40 115 #..# 088
where #..# is the "# points"
IIRC #..# must be written in ascii digits
(i.e. '0',..,'9' = 48,..,57 decimal)
And - the HPPCL is HP PCL5e. Non HP printers seem to have
HPPCL3 (based on a sample of 1 or 2!).
Chris
|
|
|
|
|