Silverfrost Forums

Welcome to our forums

control characters

27 Dec 2011 3:34 #9402

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

28 Dec 2011 9:56 #9404

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.

1 Jan 2012 7:19 #9431

I see; thanks for the answer 😃

22 Oct 2012 3:41 #10875

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

22 Oct 2012 6:05 #10876

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

22 Oct 2012 2:10 #10881

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

22 Oct 2012 11:42 #10887

You can provide the <FF> using 'write (unit,'(a)') char (12)'.

Please login to reply.