 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
bjelbo
Joined: 19 Dec 2011 Posts: 3
|
Posted: Tue Dec 27, 2011 4:34 pm Post subject: control characters |
|
|
Hi
As far as I understand, the first character of a format statement should dictate the vertical position of the bufferline to be printed, with the following characters denoting:
1 skip to new page
blank single spacing
0 double spacing
+ no spacing(print over previous line)
ex.
WRITE (*,100)
100 ('1', 'This at the top of a new page')
should print the string 'this at...' at the top of a new page.
However, when I try this out, I don't see any results, except the respective control character (1, blank, 0, or +) is printed as the first symbol of the respective output line.
peace |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8211 Location: Salford, UK
|
Posted: Wed Dec 28, 2011 10:56 am Post subject: |
|
|
These control chararacters are for a particular type of hardware called a line printer. I am not sure if they are still used.
In the early days, cumputer output was often sent to this kind of device. |
|
Back to top |
|
 |
bjelbo
Joined: 19 Dec 2011 Posts: 3
|
Posted: Sun Jan 01, 2012 8:19 pm Post subject: |
|
|
I see; thanks for the answer  |
|
Back to top |
|
 |
AL19
Joined: 18 Oct 2012 Posts: 2
|
Posted: Mon Oct 22, 2012 4:41 am Post subject: |
|
|
Yes, these control characters are typically used with line printers but these printers are still being sold and used by major corporations.
I am evaluating the migration of a Fortran-77 application to FTN95. The only problem I have run into is in the printing of a 20 page report at the end of a manufacturing run. The modules that print the report use these control characters (including 1's to do form feeds between sections) to format the report.
As reported earlier the '1' control character does not produce the required form feed character in the output file. Is there any way to get the report properly formatted without having to count output lines or converting the program to do Unformatted output? Obviously, getting FTN95 to properly handle the control character is my preferred solution.
Thanks |
|
Back to top |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2402 Location: Yateley, Hants, UK
|
Posted: Mon Oct 22, 2012 7:05 am Post subject: |
|
|
The problem lies not with FTN95 which fully supports that old convention, but with Microsoft and modern Windows incarnations, which do not.
If you are able to use the form of the OPEN statement that connects you to LPT:, LPT1 or PRN: you will find the old carriage control characters still work. I had to abandon this when I started to use laptops that did not offer a parallel printer port. From Windows 2000 onwards, (and we are XP, Vista, 7 and now 8 beyond that), Windows buffered LPT: output into 512 byte blocks, which would even give you a problem getting the last page of output printed without running into the next job, as the last block would need to be filled and flushed.
You don't need <BLANK> because each write statement gives you a new line anyway. An additional blank line can be obtained with </> (diamond brackets <> used for emphasis). As far as <1> for new page is concerned, you may find it sufficient to send the ASCII for 'new page' i.e. FormFeed, by writing CHAR(12) into an A1 format. FF for formfeed is NOT the same as hexadecimal FF or ff.
Assuming that your original Fortran 77 program is as badly written as most Fortran (and I include most - if not all - of my own efforts over the last 4 decades in this, so this is not snobbery), then you won't want to play with the original FORMAT statements. In that case, 20 pages is not a large file, and you could write it to file completely as originally formatted, REWIND, then read it line by line interpreting that first character before printing. You could do this with something like A1, A80 (if it was formatted for an 80 column printer). If you couldn't manage the new page issue, you could always count lines and make up the page formatting by inserting the requisite number of blanks, but that will count as bad programming when someone else has to maintain the code.
If you want columns to line up vertically, you need to select a monospaced font on the printer.
Asking for Fortran carriage control is like bemoaning the fact that your 2012 Jaguar XF does not have a starting handle, which you were very used to using on your 1948 manufactured car! (and where are the trafficators?)
Eddie |
|
Back to top |
|
 |
AL19
Joined: 18 Oct 2012 Posts: 2
|
Posted: Mon Oct 22, 2012 3:10 pm Post subject: |
|
|
Thanks, Eddie for the rapid response.
I tried inserting the formfeed character, <C> hex, directly and it worked fine. Actually, that's the first thing I tried when I first looked at the problem but I must have made some silly error like replacing the '1' with the A1 in the format statement. When it didn't work I abandoned that option and move on. That's what you get when debugging at 2:00AM.
Just for the record FTN95 does have a problem in that it does not insert the formfeed character into the output file when the '1' control character is specified in the format statement. I have dumped the output file and all expected printer control characters are there except the <C> hex.
Thanks again for resetting my investigation!
Al |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2615 Location: Sydney
|
Posted: Tue Oct 23, 2012 12:42 am Post subject: |
|
|
You can provide the <FF> using "write (unit,'(a)') char (12)". |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|