line continuation character is not working
I have been using fortran 77 for several months and line continuation character doesn't work sometimes.
if((b1(j).eq.0d0).and.(b3(j).ne.0d0))then
write(22,*) a1(j),a2(j),a3(j),a4(j),a5(j),a6(j),a7(j),a8(j),
& a9(j),a10(j),a11(j),a12(j),a13(j),a14(j),a15(j),
& b3(j),0.2
else if((b3(j).eq.0d0).and.(b1(j).ne.0d0))then
write(22,*) a1(j),a2(j),a3(j),a4(j),a5(j),a6(j),a7(j),
& a8(j),a9(j),a10(j),a11(j),a12(j),a13(j),
& a14(j),a15(j),b1(j),b2(j)
end if
This is the code and when I compile it, the compiler says that '&' is a invalid character. What I am really curious is that sometimes it works and sometimes it does not. Probably I have a basic misunderstanding in fortran syntax.
final.f:59:72: Error: Expected expression in WRITE statement at (1)
final.f:60:9:
& b3(j),0.2
1
Error: Invalid character in name at (1)
final.f:63:72: Error: Expected expression in WRITE statement at (1)
final.f:64:9:
& a14(j),a15(j),b1(j),b2(j)
1
Error: Invalid character in name at (1)
Anybody can help me?
parameter(m=813,n=616)
real*8 a5(m),a6(m),a7(m),a8(m),a9(m),a10(m),a11(m),a12(m),a13(m)
integer*8 a1(m),a2(m),a3(m),a4(m),p1(n)
real*8 p2(n),p3(n),p4(n),p5(n),p6(n),a14(m),a15(m)
real*8 b1(m),b2(m),b3(m)
character skip80*80
open(11,file='dist.dat')
open(12,file='mksa.dat')
open(13,file='mksb.dat')
open(14,file='mksc.dat')
open(15,file='mksi.dat')
open(22,file='ksaf.dat')
open(23,file='ksbf.dat')
open(24,file='kscf.dat')
open(25,file='ksif.dat')
read(12,*)skip80
do i=1,m
read(12,*) a1(i),a2(i),a3(i),a4(i),a5(i),a6(i),a7(i),
& a8(i),a9(i),a10(i),a11(i),a12(i),a13(i),a14(i),a15(i)
end do
do i=1,n
read(11,*) p1(i),p2(i),p3(i),p4(i),p5(i),p6(i)
end do
do j=1,m
do i=1,n
if(a1(j).eq.p1(i))then
b1(j)=p4(i)
b2(j)=p5(i)
b3(j)=p6(i)
end if
end do
if((b1(j).eq.0d0).and.(b3(j).ne.0d0))then
write(22,*) a1(j),a2(j),a3(j),a4(j),a5(j),a6(j),a7(j),a8(j)
& ,a9(j),a10(j),a11(j),a12(j),a13(j),a14(j),a15(j)
& ,b3(j),0.2
else if((b3(j).eq.0d0).and.(b1(j).ne.0d0))then
write(22,*) a1(j),a2(j),a3(j),a4(j),a5(j),a6(j),a7(j)
& ,a8(j),a9(j),a10(j),a11(j),a12(j),a13(j)
& ,a14(j),a15(j),b1(j),b2(j)
end if
end do
end
fortran gfortran fortran77
|
show 15 more comments
I have been using fortran 77 for several months and line continuation character doesn't work sometimes.
if((b1(j).eq.0d0).and.(b3(j).ne.0d0))then
write(22,*) a1(j),a2(j),a3(j),a4(j),a5(j),a6(j),a7(j),a8(j),
& a9(j),a10(j),a11(j),a12(j),a13(j),a14(j),a15(j),
& b3(j),0.2
else if((b3(j).eq.0d0).and.(b1(j).ne.0d0))then
write(22,*) a1(j),a2(j),a3(j),a4(j),a5(j),a6(j),a7(j),
& a8(j),a9(j),a10(j),a11(j),a12(j),a13(j),
& a14(j),a15(j),b1(j),b2(j)
end if
This is the code and when I compile it, the compiler says that '&' is a invalid character. What I am really curious is that sometimes it works and sometimes it does not. Probably I have a basic misunderstanding in fortran syntax.
final.f:59:72: Error: Expected expression in WRITE statement at (1)
final.f:60:9:
& b3(j),0.2
1
Error: Invalid character in name at (1)
final.f:63:72: Error: Expected expression in WRITE statement at (1)
final.f:64:9:
& a14(j),a15(j),b1(j),b2(j)
1
Error: Invalid character in name at (1)
Anybody can help me?
parameter(m=813,n=616)
real*8 a5(m),a6(m),a7(m),a8(m),a9(m),a10(m),a11(m),a12(m),a13(m)
integer*8 a1(m),a2(m),a3(m),a4(m),p1(n)
real*8 p2(n),p3(n),p4(n),p5(n),p6(n),a14(m),a15(m)
real*8 b1(m),b2(m),b3(m)
character skip80*80
open(11,file='dist.dat')
open(12,file='mksa.dat')
open(13,file='mksb.dat')
open(14,file='mksc.dat')
open(15,file='mksi.dat')
open(22,file='ksaf.dat')
open(23,file='ksbf.dat')
open(24,file='kscf.dat')
open(25,file='ksif.dat')
read(12,*)skip80
do i=1,m
read(12,*) a1(i),a2(i),a3(i),a4(i),a5(i),a6(i),a7(i),
& a8(i),a9(i),a10(i),a11(i),a12(i),a13(i),a14(i),a15(i)
end do
do i=1,n
read(11,*) p1(i),p2(i),p3(i),p4(i),p5(i),p6(i)
end do
do j=1,m
do i=1,n
if(a1(j).eq.p1(i))then
b1(j)=p4(i)
b2(j)=p5(i)
b3(j)=p6(i)
end if
end do
if((b1(j).eq.0d0).and.(b3(j).ne.0d0))then
write(22,*) a1(j),a2(j),a3(j),a4(j),a5(j),a6(j),a7(j),a8(j)
& ,a9(j),a10(j),a11(j),a12(j),a13(j),a14(j),a15(j)
& ,b3(j),0.2
else if((b3(j).eq.0d0).and.(b1(j).ne.0d0))then
write(22,*) a1(j),a2(j),a3(j),a4(j),a5(j),a6(j),a7(j)
& ,a8(j),a9(j),a10(j),a11(j),a12(j),a13(j)
& ,a14(j),a15(j),b1(j),b2(j)
end if
end do
end
fortran gfortran fortran77
Welcome. You are talking about fixed form code. In which column is the&
?
– albert
Nov 23 '18 at 9:32
Always use tagfortran
for more attention. Pity you are using this old standard and not a newer one.
– albert
Nov 23 '18 at 9:35
Thank you for your comment.It is at column 6 and the code starts from column 7 :(
– guitae
Nov 23 '18 at 9:51
Reading the error message looks like something strange at column 72 (looks OK though). Can you create a Minimal, Complete, and Verifiable example? Please also specify the compilation command.
– albert
Nov 23 '18 at 9:58
1
As the error message saysfinal.f:59:72
you should check that all your lines are of suitable length.
– francescalus
Nov 23 '18 at 10:28
|
show 15 more comments
I have been using fortran 77 for several months and line continuation character doesn't work sometimes.
if((b1(j).eq.0d0).and.(b3(j).ne.0d0))then
write(22,*) a1(j),a2(j),a3(j),a4(j),a5(j),a6(j),a7(j),a8(j),
& a9(j),a10(j),a11(j),a12(j),a13(j),a14(j),a15(j),
& b3(j),0.2
else if((b3(j).eq.0d0).and.(b1(j).ne.0d0))then
write(22,*) a1(j),a2(j),a3(j),a4(j),a5(j),a6(j),a7(j),
& a8(j),a9(j),a10(j),a11(j),a12(j),a13(j),
& a14(j),a15(j),b1(j),b2(j)
end if
This is the code and when I compile it, the compiler says that '&' is a invalid character. What I am really curious is that sometimes it works and sometimes it does not. Probably I have a basic misunderstanding in fortran syntax.
final.f:59:72: Error: Expected expression in WRITE statement at (1)
final.f:60:9:
& b3(j),0.2
1
Error: Invalid character in name at (1)
final.f:63:72: Error: Expected expression in WRITE statement at (1)
final.f:64:9:
& a14(j),a15(j),b1(j),b2(j)
1
Error: Invalid character in name at (1)
Anybody can help me?
parameter(m=813,n=616)
real*8 a5(m),a6(m),a7(m),a8(m),a9(m),a10(m),a11(m),a12(m),a13(m)
integer*8 a1(m),a2(m),a3(m),a4(m),p1(n)
real*8 p2(n),p3(n),p4(n),p5(n),p6(n),a14(m),a15(m)
real*8 b1(m),b2(m),b3(m)
character skip80*80
open(11,file='dist.dat')
open(12,file='mksa.dat')
open(13,file='mksb.dat')
open(14,file='mksc.dat')
open(15,file='mksi.dat')
open(22,file='ksaf.dat')
open(23,file='ksbf.dat')
open(24,file='kscf.dat')
open(25,file='ksif.dat')
read(12,*)skip80
do i=1,m
read(12,*) a1(i),a2(i),a3(i),a4(i),a5(i),a6(i),a7(i),
& a8(i),a9(i),a10(i),a11(i),a12(i),a13(i),a14(i),a15(i)
end do
do i=1,n
read(11,*) p1(i),p2(i),p3(i),p4(i),p5(i),p6(i)
end do
do j=1,m
do i=1,n
if(a1(j).eq.p1(i))then
b1(j)=p4(i)
b2(j)=p5(i)
b3(j)=p6(i)
end if
end do
if((b1(j).eq.0d0).and.(b3(j).ne.0d0))then
write(22,*) a1(j),a2(j),a3(j),a4(j),a5(j),a6(j),a7(j),a8(j)
& ,a9(j),a10(j),a11(j),a12(j),a13(j),a14(j),a15(j)
& ,b3(j),0.2
else if((b3(j).eq.0d0).and.(b1(j).ne.0d0))then
write(22,*) a1(j),a2(j),a3(j),a4(j),a5(j),a6(j),a7(j)
& ,a8(j),a9(j),a10(j),a11(j),a12(j),a13(j)
& ,a14(j),a15(j),b1(j),b2(j)
end if
end do
end
fortran gfortran fortran77
I have been using fortran 77 for several months and line continuation character doesn't work sometimes.
if((b1(j).eq.0d0).and.(b3(j).ne.0d0))then
write(22,*) a1(j),a2(j),a3(j),a4(j),a5(j),a6(j),a7(j),a8(j),
& a9(j),a10(j),a11(j),a12(j),a13(j),a14(j),a15(j),
& b3(j),0.2
else if((b3(j).eq.0d0).and.(b1(j).ne.0d0))then
write(22,*) a1(j),a2(j),a3(j),a4(j),a5(j),a6(j),a7(j),
& a8(j),a9(j),a10(j),a11(j),a12(j),a13(j),
& a14(j),a15(j),b1(j),b2(j)
end if
This is the code and when I compile it, the compiler says that '&' is a invalid character. What I am really curious is that sometimes it works and sometimes it does not. Probably I have a basic misunderstanding in fortran syntax.
final.f:59:72: Error: Expected expression in WRITE statement at (1)
final.f:60:9:
& b3(j),0.2
1
Error: Invalid character in name at (1)
final.f:63:72: Error: Expected expression in WRITE statement at (1)
final.f:64:9:
& a14(j),a15(j),b1(j),b2(j)
1
Error: Invalid character in name at (1)
Anybody can help me?
parameter(m=813,n=616)
real*8 a5(m),a6(m),a7(m),a8(m),a9(m),a10(m),a11(m),a12(m),a13(m)
integer*8 a1(m),a2(m),a3(m),a4(m),p1(n)
real*8 p2(n),p3(n),p4(n),p5(n),p6(n),a14(m),a15(m)
real*8 b1(m),b2(m),b3(m)
character skip80*80
open(11,file='dist.dat')
open(12,file='mksa.dat')
open(13,file='mksb.dat')
open(14,file='mksc.dat')
open(15,file='mksi.dat')
open(22,file='ksaf.dat')
open(23,file='ksbf.dat')
open(24,file='kscf.dat')
open(25,file='ksif.dat')
read(12,*)skip80
do i=1,m
read(12,*) a1(i),a2(i),a3(i),a4(i),a5(i),a6(i),a7(i),
& a8(i),a9(i),a10(i),a11(i),a12(i),a13(i),a14(i),a15(i)
end do
do i=1,n
read(11,*) p1(i),p2(i),p3(i),p4(i),p5(i),p6(i)
end do
do j=1,m
do i=1,n
if(a1(j).eq.p1(i))then
b1(j)=p4(i)
b2(j)=p5(i)
b3(j)=p6(i)
end if
end do
if((b1(j).eq.0d0).and.(b3(j).ne.0d0))then
write(22,*) a1(j),a2(j),a3(j),a4(j),a5(j),a6(j),a7(j),a8(j)
& ,a9(j),a10(j),a11(j),a12(j),a13(j),a14(j),a15(j)
& ,b3(j),0.2
else if((b3(j).eq.0d0).and.(b1(j).ne.0d0))then
write(22,*) a1(j),a2(j),a3(j),a4(j),a5(j),a6(j),a7(j)
& ,a8(j),a9(j),a10(j),a11(j),a12(j),a13(j)
& ,a14(j),a15(j),b1(j),b2(j)
end if
end do
end
fortran gfortran fortran77
fortran gfortran fortran77
edited Nov 23 '18 at 10:24
guitae
asked Nov 23 '18 at 7:59
guitaeguitae
63
63
Welcome. You are talking about fixed form code. In which column is the&
?
– albert
Nov 23 '18 at 9:32
Always use tagfortran
for more attention. Pity you are using this old standard and not a newer one.
– albert
Nov 23 '18 at 9:35
Thank you for your comment.It is at column 6 and the code starts from column 7 :(
– guitae
Nov 23 '18 at 9:51
Reading the error message looks like something strange at column 72 (looks OK though). Can you create a Minimal, Complete, and Verifiable example? Please also specify the compilation command.
– albert
Nov 23 '18 at 9:58
1
As the error message saysfinal.f:59:72
you should check that all your lines are of suitable length.
– francescalus
Nov 23 '18 at 10:28
|
show 15 more comments
Welcome. You are talking about fixed form code. In which column is the&
?
– albert
Nov 23 '18 at 9:32
Always use tagfortran
for more attention. Pity you are using this old standard and not a newer one.
– albert
Nov 23 '18 at 9:35
Thank you for your comment.It is at column 6 and the code starts from column 7 :(
– guitae
Nov 23 '18 at 9:51
Reading the error message looks like something strange at column 72 (looks OK though). Can you create a Minimal, Complete, and Verifiable example? Please also specify the compilation command.
– albert
Nov 23 '18 at 9:58
1
As the error message saysfinal.f:59:72
you should check that all your lines are of suitable length.
– francescalus
Nov 23 '18 at 10:28
Welcome. You are talking about fixed form code. In which column is the
&
?– albert
Nov 23 '18 at 9:32
Welcome. You are talking about fixed form code. In which column is the
&
?– albert
Nov 23 '18 at 9:32
Always use tag
fortran
for more attention. Pity you are using this old standard and not a newer one.– albert
Nov 23 '18 at 9:35
Always use tag
fortran
for more attention. Pity you are using this old standard and not a newer one.– albert
Nov 23 '18 at 9:35
Thank you for your comment.It is at column 6 and the code starts from column 7 :(
– guitae
Nov 23 '18 at 9:51
Thank you for your comment.It is at column 6 and the code starts from column 7 :(
– guitae
Nov 23 '18 at 9:51
Reading the error message looks like something strange at column 72 (looks OK though). Can you create a Minimal, Complete, and Verifiable example? Please also specify the compilation command.
– albert
Nov 23 '18 at 9:58
Reading the error message looks like something strange at column 72 (looks OK though). Can you create a Minimal, Complete, and Verifiable example? Please also specify the compilation command.
– albert
Nov 23 '18 at 9:58
1
1
As the error message says
final.f:59:72
you should check that all your lines are of suitable length.– francescalus
Nov 23 '18 at 10:28
As the error message says
final.f:59:72
you should check that all your lines are of suitable length.– francescalus
Nov 23 '18 at 10:28
|
show 15 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53442690%2fline-continuation-character-is-not-working%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53442690%2fline-continuation-character-is-not-working%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Welcome. You are talking about fixed form code. In which column is the
&
?– albert
Nov 23 '18 at 9:32
Always use tag
fortran
for more attention. Pity you are using this old standard and not a newer one.– albert
Nov 23 '18 at 9:35
Thank you for your comment.It is at column 6 and the code starts from column 7 :(
– guitae
Nov 23 '18 at 9:51
Reading the error message looks like something strange at column 72 (looks OK though). Can you create a Minimal, Complete, and Verifiable example? Please also specify the compilation command.
– albert
Nov 23 '18 at 9:58
1
As the error message says
final.f:59:72
you should check that all your lines are of suitable length.– francescalus
Nov 23 '18 at 10:28