I'd like to initialize a long string in Fortran 77 in a DATA statement, like this:
DATA Lipsum /
*'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendi
*sse tincidunt, velit id hendrerit bibendum, erat nisl dignissim ar
*cu'/
but the internal policy of the program I'm contributing to does not like it as it prohibits lines with an odd number of quote marks.
I can "fool" the policy checker by using double quotes instead, or using ' as the continuation character (in the first and last line), but I'd like to know if there is some other way to have long strings in DATA statements, where the concatenation operator // does not seem to be allowed.
one approach is to declare an array of short strings and equivalence to your long one:
character*63 cshort(3)/
*'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspen',
*'disse tincidunt, velit id hendrerit bibendum, erat nisl digniss',
*'im arcu'/
character*180 clong
equivalence (cshort,clong)
For this to work you need to count the characters and be sure each line but the last has the exact length of the short string. Note 63 is the max string length that will fit in 72 columns along with the quotes and comma.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With