Some instances of CHARACTER*4 IOPSY2 being compared to truncated strings

Open
#2 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
fortran

Research direction

Start by checking Fortran character comparison rules and the IOPSY2 definition in DPCOHO.INC. Review the three comparisons in dp16.F and dp32.F, then investigate the assignments in dp1.F and edmai2.F. Done means confirming the intended four-character behavior and correcting any affected cases without changing unrelated logic.

Written by the indexing model from the issue text.

Description

IOPSY2 is defined in DPCOHO.INC as being 4 characters in size:

DPCOHO.INC:      CHARACTER*4 IOPSY2

Most of the checks for the value of IOPSY2 compare the variable to a 4 character constant, like this:

dp14.F:            IF(IOPSY2.EQ.'MAC ')THEN

But there are three instances where IOPSY2 is compared to a value less than 4 characters long, which I believe will prevent the desired .EQ. comparisons from doing what is expected.

dp16.F:        ELSEIF(IOPSY2.EQ.'MAC')THEN
dp16.F:        ELSEIF(IOPSY2.EQ.'MAC')THEN
dp32.F:        ELSEIF(IOPSY2.EQ.'MAC')THEN

There are also three instances where IOPSY2 might be set to a value less than 4 characters long, but I don't know if those are significant:

dp1.F:       IOPSY2='8'
dp1.F:      IOPSY2='8'
edmai2.F:         IOPSY2=' '

My last FORTRAN programming was in the 1980s, so I apologize if I'm misunderstanding how a CHARACTER*4 variable holding a 4 character value would be compared to a 3 character constant. Maybe 3 character constants are automatically padded with a space to be 4 characters in length. If that's the case, please feel free to close this issue with no reply.

Until today, the last time I looked over the DATAPLOT code base was when I did a port of DATAPLOT to a Prime minicomputer for the New York State Agricultural Experiment Station in Geneva, NY. Many of their faculty got much use from DATAPLOT in preparing graphs and charts for publications and presentations. Thank you very much for the large contributions that DATAPLOT made to those faculty's research. And I personally derived much satisfaction in helping the faculty move well beyond character-based plots and charts.

Dominant language
Fortran
Stars
43
Forks
7
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from usnistgov/dataplot

All issues in usnistgov/dataplot

Similar issues

More Data Visualization issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.