Tuesday, September 25, 2007

Passing Subfile Records to a Called Program:

You can make subfile records available in a called program by defining the same display file in both the calling and called programs and sharing the open data path (ODP).

For example, suppose PgmA, which uses display file DspA, calls PgmB.

To make DspA's subfile records available to PgmB, define file DspA in PgmB. Then issue the command OVRDSPF FILE(DspA) SHARE(*YES) before calling PgmA. When PgmA calls PgmB, the ODP is shared and PgmB can read records from DspA. You don't need to write any of DspA's record formats from PgmB. However, for PgmB to compile, you need to reference at least one of them. Simply write an EXFMT statement and condition it so that it will never be executed.

No comments: