Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Struggling with line continuation

RoyRogers
Beginner
622 Views
 character :: wch9*47 = 'Scdap component-fission product &'
& 'number (nn).'
character :: wcha*46 = 'Scdap component-axial-mesh &'
& 'number (iikkjj).'
character :: wchb*33 = 'Couple creep rupture number (nn).'
character :: wchc*33 = 'ASYST creep rupture number (nn).'
character :: wchd*27 = 'Couple node number (nnn01).'
character :: wche*48 = 'Couple fission product-node &'
& 'number (iinnn01).'
Here are the errors that I am getting
graphics\3d\displayw3.for(35): error #5082: Syntax error, found CHARACTER_CONSTANT '(cccg0ssnn).' when expecting one of: ( * ) :: , <END-OF-STATEMENT> ; . (/ + - : ] /) ' ** / // > .LT. ...
& '(cccg0ssnn).'
--------------------------------^
graphics\3d\displayw3.for(42): error #5082: Syntax error, found CHARACTER_CONSTANT 'number (nn).' when expecting one of: ( * ) :: , <END-OF-STATEMENT> ; . (/ + - : ] /) ' ** / // > .LT. ...
& 'number (nn).'
-------------------------------^
graphics\3d\displayw3.for(44): error #5082: Syntax error, found CHARACTER_CONSTANT 'number (iikkjj).' when expecting one of: ( * ) :: , <END-OF-STATEMENT> ; . (/ + - : ] /) ' ** / // > .LT. ...
& 'number (iikkjj).'
-------------------------------^
graphics\3d\displayw3.for(49): error #5082: Syntax error, found CHARACTER_CONSTANT 'number (iinnn01).' when expecting one of: ( * ) :: , <END-OF-STATEMENT> ; . (/ + - : ] /) ' ** / // > .LT. ...
& 'number (iinnn01).'
-------------------------------^ 
0 Kudos
1 Solution
Steve_Lionel
Honored Contributor III
611 Views

That's not how continuation works in Fortran. Here's one approach:

 character :: wch9*47 = 'Scdap component-fission product &
                        &number (nn).'
  character :: wcha*46 = 'Scdap component-axial-mesh &
                         &number (iikkjj).'
  character :: wchb*33 = 'Couple creep rupture number (nn).'
  character :: wchc*33 = 'ASYST creep rupture number (nn).'
  character :: wchd*27 = 'Couple node number (nnn01).'
  character :: wche*48 = 'Couple fission product-node &
                         &number (iinnn01).'

Or you could do this:

 character :: wch9*47 = 'Scdap component-fission product ' // &
&                       'number (nn).'
  character :: wcha*46 = 'Scdap component-axial-mesh ' // &
&                        'number (iikkjj).'
  character :: wchb*33 = 'Couple creep rupture number (nn).'
  character :: wchc*33 = 'ASYST creep rupture number (nn).'
  character :: wchd*27 = 'Couple node number (nnn01).'
  character :: wche*48 = 'Couple fission product-node ' // &
&                        'number (iinnn01).'

 

View solution in original post

3 Replies
Steve_Lionel
Honored Contributor III
612 Views

That's not how continuation works in Fortran. Here's one approach:

 character :: wch9*47 = 'Scdap component-fission product &
                        &number (nn).'
  character :: wcha*46 = 'Scdap component-axial-mesh &
                         &number (iikkjj).'
  character :: wchb*33 = 'Couple creep rupture number (nn).'
  character :: wchc*33 = 'ASYST creep rupture number (nn).'
  character :: wchd*27 = 'Couple node number (nnn01).'
  character :: wche*48 = 'Couple fission product-node &
                         &number (iinnn01).'

Or you could do this:

 character :: wch9*47 = 'Scdap component-fission product ' // &
&                       'number (nn).'
  character :: wcha*46 = 'Scdap component-axial-mesh ' // &
&                        'number (iikkjj).'
  character :: wchb*33 = 'Couple creep rupture number (nn).'
  character :: wchc*33 = 'ASYST creep rupture number (nn).'
  character :: wchd*27 = 'Couple node number (nnn01).'
  character :: wche*48 = 'Couple fission product-node ' // &
&                        'number (iinnn01).'

 

Steve_Lionel
Honored Contributor III
589 Views

I should also note that, rather than variables these should probably be PARAMETER constants. So instead of, for example:

character :: wch9*47 =

you'd write:

character(*), parameter :: wch9 =

The length will be taken automatically from the value.

0 Kudos
andrew_4619
Honored Contributor III
557 Views

Given you have moved to freeform why not go with 132 character lines,  your example with be a lot easier to read and it would save you  time.

The Fortran 2023 line length limit (10000) is going a bit far and Intel does not support that if yet if you use standards checking.

0 Kudos
Reply