I use an externally described data structure (EDS) when I want to pass a lot of data between two programs, such as in a client-server design. Rather than pass 50 parameters, I pass a single data structure with all the parameters. And rather than trying to keep those two data structures in sync through double maintenance or a /COPY, I find an externally described data structure to be a simple, easy way to do it. For your particular question, yes, you could use a EDS. You could perform an EVAL of the EDS for file A into the EDS of file B. An EVAL moves from left to right, so as long as file B was EXACTLY the same as file A (not just field lengths, but types as well - packed vs. zoned especially) you could then set the additional fields in file B and you would be fine. The problem is that if either file chnaged, your program would break. At best, you'd get decimal data errors and at worst you'd corrupt your database. More than once I've wished that RPG had an opcode like COBOL's MOVE CORRESPONDING, but since the compiler folks think we're too stupid to handle a simple MOVE opcode, it's unilkely we'll get something as sophisticated as MOVE CORRESPONDING. Joe

Reply With Quote
If you were the only person writing and maintaining the program or procedures were in place for code review at your organization (and how many places do that) then it may be something you might consider.
