There are many ways to share the information between two programs such as passing parameters, data area, data queues
etc., but there is another way to effectively and efficiently share the information -- use EXPORT and IMPORT keywords. In this example, we are going to share the variable "Wk_Global".
PGM1 ---- DAddNum PR 3 0 D Num1 2 0 D Num2 2 0 * D Wk_Global S 3S 0 EXPORT * C Z-Add 10 A 2 0 C Z-Add 11 B 2 0 C Z-Add 0 C 3 0 C Eval C = AddNum(A:B) C Z-Add C Wk_Global C CallB 'PGM2' * C Seton Lr * PAddNum B D PI 3 0 D NumX 2 0 D NumY 2 0 * C Seton Lr * PAddNum B D PI 3 0 D NumX 2 0 D NumY 2 0 * C Z-Add 0 Answer 3 0 C Eval Answer = NumX + NumY C Return Answer P E PGM2 ---- D Wk_Global S 3S 0 IMPORT C Wk_Global Dsply C Return
MORE INFORMATION ON THIS TOPIC
The Best Web Links: tips, tutorials and more.
Ask your programming questions--or help out your peers by answering them--in our live discussion forums.
Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.