Copybook Example| RPG Copybook Example| AS400 Copybook Example
This example consists of three source codes.
- A simple RPGLE program without any copybook.
- The copybook.
- RPGLE program using the copybook.
RPGLE program without copybook.
DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords++++
D Entry S 10A
**
C Entry Dsply
C Return
This is a very simple program which displays the entry parameter. We can call this program with a parameter from command line and it will display the passed parameter.
The source code of the copybook.
We decide that we will put the declaration of the Entry parameter in the copybook. So, the copybook contains just one line
DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords++++
D Entry S 10A
We put this RPGLE member in QCPYLESRC and name it QBC.
The RPG program with copybook declaration
DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords++++
/Copy QCPYLESRC,QBC
C *Entry PList
C Parm Entry
**
C Entry Dsply
C Return
Now compile this program and call it with a parameter. And lo, it works!
Sample run of this program when I called with 'CALL COPYBOOK1 'TutorialIndia'
DSPLY TutorialIn
Next we will learn what is actually happening behind the scene.
- 3119 reads
