Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.
Forgive me, I haven't worked on green screens for a very long time, and may never see one again. Wasn't very good at it when I did. Nevertheless, I want to RI a field on error in an old program. I have a field defined in DDS thusly:
A CTRTYP 2Y 0I 7 10DSPATR(HI)
A N40 DSPATR(ND)
So I add a line:
A CTRTYP 2Y 0I 7 10DSPATR(HI)
A N40 DSPATR(ND)
A 99 DSPATR(RI)
And on error I turn *in99 on, and GOTO (I know, I know) to right before the WRITE/EXFMT, which is just a few lines previous. And the field refuses to display at all. Verified in debug that *in40 is still on, and I can't find anything else that should impact the display of that field. Am I doing something obviously wrong? Code looks like this:
C $ADRECS BEGSR
C #redisp TAG
C 77 SETON 51
C SETON 405254
C WRITE FORMAT2
C EXFMT CONTROL1
/free
here I'm checking for error, which would be duplicates found, in numrecs
/end-free
C if numrecs > 0
C eval *in99 = *on
C goto #redisp
C else
C eval *in99 = *off
C endif
Simple, RI, HI and UL = ND
You have DSPATR(RI)
You have DSPATR(HI)
and by default all input or "both" fields are DSPATR(UL)
hence, RI+HI+UL = ND always has, always will
Use CHGINPDFT at the record-level and it will work.
Optionally, change it so that DSPATR(HI) doesn't show up when your DSPATR(RI) is being used (looks bad anyway).
Ah, thank you Mr. Cozzi.
If you have other I or B fields, you might want to do the CHGINPDFT at field level.
A CTRTYP 2Y 0I 7 10 CHGINPDFT
A N40 DSPATR(ND)
A N99 DSPATR(HI UL)
A 99 DSPATR(RI)
There's another thing that looks odd here. DSPATR(ND) is conditioned; you always allow them to type in the field, but it's only hidden some of the time. Should it be DSPATR(ND PR)? If you do protect it when hidden, you may want to remove the other formatting by adding ' 40' to the conditions.