Retrieving the library that contains the currently running program [email protected] (Simon Hutchinson)

​[[{“value”:”The idea for this post came from a question. The questioner had a situation where, due to a mixed-up library list, someone had run the wrong version of a program from another library. They already had the program’s name on their display files, and they asked was it possible to retrieve the library the current executing program is in, and add that to the their display files.
After some discussion we decided that any change would be needed in both RPG and CL programs. Fortunately, this is simple in both languages.
Before I start explaining my RPG and CL code I need to have a display file within which are fields for the program and the program’s library. I created a simple display file to do this, called TESTDSPF:

01 A DSPSIZ(24 80 *DS3)
02 A R SCREEN
03 A 3 2’Program name . :’
04 A PGMNAME 10 O 3 20
05 A 4 2’Program library :’
06 A PGMLIB R O 4 20REFFLD(PGMNAME *SRC)

Read more »”}]] Read More 

Leave a Reply

Verified by MonsterInsights