RPG: Is it possible to redefine an array in a file?

344855 pts.
Tags:
COBOL
RPG III
I'm using RPG III and I need to store a big array in a file. It says the maximum fieldlength is 256 so I defined the file with 16 fields of 250 characters long for each. Can I put the 1000 values of an array into the 16 fields without moving? Just like REDEFINES in COBOL?

Thanks for all the help!

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta

    No. There is no "redefines" capability for an array in RPG III. You can have up tp 9999 entries in your array, but the elements are essentially all going to be separate.

    There should be no reason to use RPG III in this century unless your OS is version 3 or earlier. If you need the capability, convert the program source to RPG IV.

    Tom

    125,585 pointsBadges:
    report
  • WoodEngineer
    The closest you can come to COBOL REDEFINES is an RPG data structure.  If RPG III supports externally-defined data structures, you can basically redefine the record using arrays.  It can be a little messy but it does work.
    6,435 pointsBadges:
    report
  • TomLiotta
    RPG III doesn't have 'D'-specs, so there is no DIM() keyword for an array. I suppose you could define a data structure on an 'I'-spec. But it's not clear what would be done with fields with the 256-char length limit and a 9999-char limit on the DS. Data manipulation would be field by field. A Multi-Occurrence Data Structure (MODS) might give some help, but I'd hate to see the code. The obvious solution is simply RPG IV. (Or COBOL.) -- Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following