Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!psuvax1!ukma!hsdndev!cmcl2!lanl!cochiti.lanl.gov!jlg From: jlg@cochiti.lanl.gov (Jim Giles) Newsgroups: comp.lang.fortran Subject: Re: Implied do loop in write (SUMMARY) Message-ID: <22632@lanl.gov> Date: 25 Apr 91 19:41:46 GMT References: <1991Apr23.201123.3908@unixg.ubc.ca> Sender: news@lanl.gov Organization: Los Alamos National Laboratory Lines: 37 In article , moshkovi@sanandreas.ecn.purdue.edu (Gennady Moshkovich) writes: |> [...] |> Just look at the code, and you will see where the problem is. |> You can't print with this code more then _10_ elements in a row. |> I can repeat again !!!. I don't know beforehand how many |> elements I have, I can have 3, or I can have 300, but the |> output MUST look nice. Why not use the following: do 10 i=1,n write(6,100) (matrix(i,j),j=1,m) 10 continue ... 100 format('0 row:',i9,(t16,8i8)) This program will produce the following output: row: 1 1234567 2345678 3456789 ... 8765432 1232244 ... ... 1223343 ... row: 2 ... In other words, each row will be printed out (using as many lines as required), then a blank line and the start of the next row. Further, the elements of each row will be printed 8 per line starting in column 16 (the last line will only contain mod(m,8) elements). The only dependence on the sizes of n and m is the format specifier for row number (i9) - which limits you to a billion rows. Pick a smaller or larger field depending on the maximum characteristics of your program (a billion rows is a lot, you may want to make the field smaller so that there's not so much space after the colon). J. Giles