- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm running into a problem with Digital Visual Fortran. It seems that it will only write 6 records per line, e.g. the code
Write(10,*) 1, 2, 3, 4, 5, 6 ,7, 8, 9
Produces the output
1 2 3 4 5 6
7 8 9
How do you make it write it all on the same line, producing a file with n lines and 9 columns, where n is the number of write statements?
David
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Specify a format. Be as old-fashioned as you like. e.g.
write(10,'(9i3)')...
write(10,'(9i3)')...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are using list-directed formatting, which gives the "processor" (compiler/run-time system) great lattitude in how it formats the lines and when it starts new lines. As Tim suggests, if you want a specific layout, use explicit formatting.
You can also open the output file with RECL= and specify a value that will be used (I think) as the line width. But this is not portable and I do not recommend it.
You can also open the output file with RECL= and specify a value that will be used (I think) as the line width. But this is not portable and I do not recommend it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Um, not portable? AFAIK that's perfectly standard Fortran. What is not portable is the default field length of list-directed output, but if one specifies "sufficiently long" RECL it shouldn't matter.
Jugoslav
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What I meant was that the effect of using RECL= on list-directed output is non-standard and therefore non-portable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Won't specifying a RECL also blank-pad the lines?
Incidentally, I can find (in the Rules for List-Directed Sequential WRITE Statements section of the lang_for.pdf document) that list-directed output will wrap. This is fine. Including when it will wrap for files opened without a RECL specifier would be nice.
Incidentally, I can find (in the Rules for List-Directed Sequential WRITE Statements section of the lang_for.pdf document) that list-directed output will wrap. This is fine. Including when it will wrap for files opened without a RECL specifier would be nice.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, it won't blank-pad. For the purpose of list-directed output, RECL= specifies the "margin" at which a new record will be started. You can find the default RECL values in the Building Applications manual.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page