Silverfrost Forums

Welcome to our forums

Data Initialization

20 Dec 2010 2:51 #7262

I have the following problem: the statement

   DATA  (a(i),i= 1,2 )/ 1., 2. /

works well, whereas the statement

    DATA  (a(1:2)      )/ 1., 2. /

fails with the comment:

*** Not enough items after '=' in implied-DO loop *** Compilation abandoned

Is this correct?

Best regards,

Klaus Lassmann

      Winapp

      Program Test53

        Implicit None

        Real , Dimension (10) :: a

!       Integer :: i

!       DATA  (a(i),i= 1,2 )/ 1., 2. /
        DATA  (a(1:2)      )/ 1., 2. /

        write (*,*) a(1:2)

      End Program Test53
21 Dec 2010 12:00 #7264

The alternatives I have listed appear to work. There is a problem with the extra brackets. I'm not sure why. Program Test53

        Implicit None 

        Real , Dimension (10) :: a 

!       Integer :: i 

!       DATA  (a(i),i= 1,2 )/ 1., 2. /  ! ok
!       DATA  (a(1:2)      )/ 1., 2. /  !   extra brackets fail
        DATA  a(1:2)        / 1., 2. /  ! ok 
!       DATA  a(1), a(2)    / 1., 2. /  ! ok 

        write (*,*) a(1:2) 

      End Program Test53 
21 Dec 2010 9:09 #7265

I guess the answer is that it has the form of an implied DO loop but is incomplete.

21 Dec 2010 10:19 #7266

Paul, thank you very much for your quick reply. The solution helps me a lot.

Klaus

Please login to reply.