Partially. Does Fortran now have reduction operators, e.g., inner product, trace?
-- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 ________________________________________ From: IBM Mainframe Discussion List [IBM-MAIN@LISTSERV.UA.EDU] on behalf of Frank Swarbrick [frank.swarbr...@outlook.com] Sent: Tuesday, June 9, 2020 10:42 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: COBOL Question Do you mean like this? integer, dimension(10) :: a, b, c a = [1,2,3,4,5,6,7,8,9,10] b = [2,3,4,5,6,7,8,9,10,11] c = a + b print *, "a = ", a print *, "b = ", b print *, "c = ", c a = 1 2 3 4 5 6 7 8 9 10 b = 2 3 4 5 6 7 8 9 10 11 c = 3 5 7 9 11 13 15 17 19 21 Apparently added as part of the Fortran 90 standard. ________________________________ From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on behalf of Seymour J Metz <sme...@gmu.edu> Sent: Tuesday, June 9, 2020 8:16 AM To: IBM-MAIN@LISTSERV.UA.EDU <IBM-MAIN@LISTSERV.UA.EDU> Subject: Re: COBOL Question Have they added array operations to Fortran? -- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 ________________________________________ From: IBM Mainframe Discussion List [IBM-MAIN@LISTSERV.UA.EDU] on behalf of Bob Bridges [robhbrid...@gmail.com] Sent: Tuesday, June 9, 2020 12:35 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: COBOL Question I haven't written anything in FORTRAN since some time in the late '70s. But even much more recently I heard it's regarded by number crunchers, engineers say, as the best language for sheer speed. Not so great for report writing and formatting. --- Bob Bridges, robhbrid...@gmail.com, cell 336 382-7313 /* If a problem has a single neck, it has a simple solution. */ -----Original Message----- From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf Of Frank Swarbrick Sent: Monday, June 8, 2020 21:22 I've been teaching myself (modern) Fortran the last few weeks. Just because. It has an interesting behavior that I kind of like. Normal IF statement: if (something) then <statement 1> <statement 2> end if But it also has a "one line IF" (not sure offhand of the Fortran "name" for this): if (something) <single statement> <single statement> must be on the same line as the if and the condition (unless you specify the "line continuation character"), and of course only one statement is allowed. Kind of like the C/Java if statement with out a statement block, but less dangerous because of the "on the same line" requirement. Here is one way I've used it in practice. call get_command_argument(1, host) if (inet_addr(host) .lt. 0) call error_stop("Host must be in dotted decimal format.") call get_command_argument(2, port_str) read (port_str, '(i5)', iostat = iostat) port ! convert string 'port_str' to integer 'port' if (iostat .ne. 0 .or. port .le. 0) call error_stop("Port must be positive numeric (0-32767).") Using "if/then" instead of just "if" I'd have had this: call get_command_argument(1, host) if (inet_addr(host) .lt. 0) then call error_stop("Host must be in dotted decimal format.") end if call get_command_argument(2, port_str) read (port_str, '(i5)', iostat = iostat) port ! convert string 'port_str' to integer 'port' if (iostat .ne. 0 .or. port .le. 0) then call error_stop("Port must be positive numeric (0-32767).") end if Given by absolute druthers I would have the then clause part of the single line if instead of the if/end if, but its still pretty nice regardless, as it doesn't cause as much "clutter" as error handling often does. On a side note, I think Fortran has done a much better job than COBOL of adding "modern" features (starting with Fortran 90 in 1990). If only the COBOL "designers" had followed in their footsteps. And in my mind Fortran had even more to "make up" for in regards to it's less than ideal beginnings. Which Fortran can even be forgiven for then, being I believe about five years older than COBOL (Cobol?). ________________________________ From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on behalf of Bob Bridges <robhbrid...@gmail.com> Sent: Sunday, June 7, 2020 12:35 PM The only language I can think of off-hand that doesn't require some sort of END to close a DO (I'm sure there are others) is ISPF. But, in REXX at least, I never use single-statement DOs. I see them all the time, and I don't get it. Like this: if x=0 then do x=x+1 end Or, more painfully: select when idx="T" then do countt=countt+1 end when idx="U" then do countu=countu+1 end when idx="V" then do countv=countv+1 end when idx="W" then do countw=countw+1 end otherwise do countx=countx+1 end end Why? If it were easier to read, I might sympathize. But it's harder, not easier. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN