Ruwan…
The only way I know to do this is to issue an SQL “CONNECT” statement to attach to the remote database. This can be done within an SQLRPG pgm, but you will need to compile the program against the remote database (see the compile prompts). You may want to do this in a separate module from your main program… You will also need to define the remote database using the WRKRDBDIRE command.
===================================================
Nobody ever “needs” to access a DDM file via SQLRPG. The problem is stated incorrectly. A more likely situation is that the system has a DDM file that accesses a remote file and the OP needs to use SQL in RPG to access the same remote file. Why “need” to use the intermediate DDM file when you can connect directly… especially when the intermediate form of access isn’t supported?
Just connect to the remote database and access the file.
Tom
Discuss This Question: