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

NameList question

lklawrie1
Beginner
632 Views
Suppose I have 3 namelist "groups": A, B, and C.
And I read them in this order:
A
B
C
Can they be listed in the file in this order:
C
A
B
What happens if B is entirely missing in the first example? Will C still be read properly?
Linda
0 Kudos
7 Replies
Steven_L_Intel1
Employee
632 Views
You can read them in any order, in any combination, omitting variables as you choose - omitted variables will keep their values.
0 Kudos
lklawrie1
Beginner
632 Views
That answer, of course, brings me to my counter example where it didn't seem to work that way. If I can illustrate, I will submit to support. If only in CVF, can I still submit (though I would guess it won't be fixed)?
Linda
0 Kudos
Steven_L_Intel1
Employee
632 Views
I'd like to see a counter-example. There's really no point to submitting to CVF support... As you know, nothing will come of that. But if I can reproduce it in Intel Fortran, that will be useful. I will say that I use NAMELIST a lot and have never seen any problems with the order or omission of variables.
0 Kudos
lklawrie1
Beginner
632 Views
Issue submitted to Intel Support Linda
0 Kudos
lklawrie1
Beginner
632 Views
Support has validated this as an issue. "Reproduced and escalated". I guess my work around for CVF is to rewind after every read (have not verified that this will work, however).
Linda
0 Kudos
lklawrie1
Beginner
632 Views
Steve, others,
After quite a while in the support issue area, including being "validated", I'm told this is an expected result of using namelists -- that the order of the namelist reads must correspond to the namelist entries in the file UNLESS you (like I have) choose to rewind after every read -- thus assuring yourself that users may put those namelists in in any order they choose.
Fields within the name list do not apparently matter as to order -- you can continue to have them in any order.
Linda
0 Kudos
Steven_L_Intel1
Employee
632 Views
Linda,

This is my fault. I misread your original post. I thought you were asking about the order of variables WITHIN a nameslist, and not the groups themselves. Indeed, the file is read sequentially and there is no backtracking unless you do so with a REWIND. My apologies for wasting your time with misdirection.
0 Kudos
Reply