From: Fortran_follower on
Hello friends,

Below is the type of data I am working with.
I need some help in creating an array to read this data.
What I mean is:

100 format (a3,i2,i2,a1,i2,2x,a1,i3,26(1x,i3))

Can any one help me for the above format, how do I write the read
statement.
like:
read(10,100,END=2222)s,y,m,e,d,k,b,a, 26(.........))

NGK0104X12 I220 183 350 399 382 385 400 425 417 410 412 405 403 400
397 415 421 437 445 449 449 450 453 454 453 454 419
NGK0104X13 I220 183 454 454 455 456 461 465 463 457 461 456 375 408
462 443 434 446 471 476 466 462 456 458 472 471 453
NGK0104X14 I220 183 467 480 479 482 474 477 471 465 465 455 442 448
458 461 455 456 471 479 490 484 484 484 488 496 471
NGK0104X15 I220 183 491 489 486 474 485 480 472 459 448 444 449 451
456 469 489 489 483 483 491 511 506 495 492 491 479
NGK0104X16 I220 183 491 490 484 476 477 477 471 467 466 468 468 477
480 487 485 489 494 494 490 491 486 485 488 503 483
NGK0104X17 I220 183 493 480 480 482 484 490 488 475 467 466 469 468
474 480 489 489 495 499 495 490 488 491 496 486 484
NGK0104X18 I220 183 494 554 508 505 516 465 418 423 423 418 415 422
428 432 443 453 458 455 470 464 470 468 469 474 460
NGK0104X19 I220 183 473 462 463 471 475 472 458 443 439 444 453 458
470 473 476 478 481 483 488 488 488 487 492 481 471
NGK0104X20 I220 183 481 480 490 484 478 484 480 472 471 471 472 470
468 472 481 483 485 491 490 492 494 494 496 496 482
NGK0104X21 I220 183 496 491 492 489 494 494 487 473 463 463 471 476
484 491 496 495 522 508 510 515 516 509 511 512 494

Thanking you in advance.
From: feenberg on
On Jan 15, 7:28 am, Fortran_follower <ezeepravee...(a)gmail.com> wrote:
> Hello friends,
>
> Below is the type of data I am working with.
> I need some help in creating an array to read this data.
> What I mean is:
>
> 100 format  (a3,i2,i2,a1,i2,2x,a1,i3,26(1x,i3))
>
> Can any one help me for the above format, how do I write the read
> statement.
> like:
> read(10,100,END=2222)s,y,m,e,d,k,b,a, 26(.........))
>
> NGK0104X12  I220 183 350 399 382 385 400 425 417 410 412 405 403 400
> 397 415 421 437 445 449 449 450 453 454 453 454 419
> NGK0104X13  I220 183 454 454 455 456 461 465 463 457 461 456 375 408
> 462 443 434 446 471 476 466 462 456 458 472 471 453
> NGK0104X14  I220 183 467 480 479 482 474 477 471 465 465 455 442 448
> 458 461 455 456 471 479 490 484 484 484 488 496 471
> NGK0104X15  I220 183 491 489 486 474 485 480 472 459 448 444 449 451
> 456 469 489 489 483 483 491 511 506 495 492 491 479
> NGK0104X16  I220 183 491 490 484 476 477 477 471 467 466 468 468 477
> 480 487 485 489 494 494 490 491 486 485 488 503 483
> NGK0104X17  I220 183 493 480 480 482 484 490 488 475 467 466 469 468
> 474 480 489 489 495 499 495 490 488 491 496 486 484
> NGK0104X18  I220 183 494 554 508 505 516 465 418 423 423 418 415 422
> 428 432 443 453 458 455 470 464 470 468 469 474 460
> NGK0104X19  I220 183 473 462 463 471 475 472 458 443 439 444 453 458
> 470 473 476 478 481 483 488 488 488 487 492 481 471
> NGK0104X20  I220 183 481 480 490 484 478 484 480 472 471 471 472 470
> 468 472 481 483 485 491 490 492 494 494 496 496 482
> NGK0104X21  I220 183 496 491 492 489 494 494 487 473 463 463 471 476
> 484 491 496 495 522 508 510 515 516 509 511 512 494
>
> Thanking you in advance.

Something like this:

read(10,100,END=2222)s,y,m,e,d,k,b,a,(x(ii),ii=1,26)

should work if all the variables are declared correctly. YOu want to
study
"Implied do-loops" in any FORTRAN textbook.

Daniel Feenberg
From: Richard Maine on
feenberg <feenberg(a)gmail.com> wrote:

> On Jan 15, 7:28 am, Fortran_follower <ezeepravee...(a)gmail.com> wrote:

> > 100 format (a3,i2,i2,a1,i2,2x,a1,i3,26(1x,i3))
> >
> > Can any one help me for the above format, how do I write the read
> > statement.
> > like:
> > read(10,100,END=2222)s,y,m,e,d,k,b,a, 26(.........))

> Something like this:
>
> read(10,100,END=2222)s,y,m,e,d,k,b,a,(x(ii),ii=1,26)
>
> should work if all the variables are declared correctly.

Or, more simply, just

read(10,100,END=2222)s,y,m,e,d,k,b,a,x

provided that x is dimensioned to exactly size 26.

--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain