ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

fields

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • fields

    Hi,

    can we rename fields (with suffix not the prefix) if two physical files are having same field names?

    If Yes, then how can we rename these fields inside RPGLE program?


    Thanks...

  • #2
    Not sure why prefix is not an option but ...

    The best way, and the way I would handle the requirement is to use qualified data structures and do the I/O directly from/to them. That way the field names are the same and the qualification makes it obvious which one you are dealing with. Doesn't give you a suffix but frankly I can't see what that buys you. There's a reason why RPG implemented prefixing ...

    Only other way I know of - as long as you don't mind going back to fixed form coding and confusing the heck out of any future RPGers who have to maintain the code - it to resort to I-specs and rename the fields. But that is so hokey I'd avoid it like the plague personally.

    Comment


    • #3
      from I spec how can we rename fields ,just found this link https://www.ibm.com/docs/en/i/7.4?to...al-description
      but it's using same field name again after renaming the fields but how can we keep their names different in same program while using two different physical files with same fields name in same program?

      Thanks...

      Comment


      • #4
        The link you shared does just that - it just happens to change the name to be the same. So instead of the new name being ITEM in both cases the first one could be ITEM1 and the second ITEM2.

        BUT ... I-specs are effectively deprecated and I can't remember the last time I saw one in a new program - they are a legacy feature and should be avoided.

        As I said before you would be better to use DS I/O with externally described Data Structures. If you still insist on having suffixed names rather than just rely on the more obvious qualified name, then use EXTFLD to rename the individual fields.

        Comment

        Working...
        X