Page 1 of 1

Passing WORKSTN File as Parm

Posted: Fri Jun 26, 2015 9:17 am
by rmullis99
I have defined my WORKSTN file globally as a template and then use LIKEFILE to define it locally in my main procedure and as parms on procedures I pass it to. I am having trouble getting the HANDLER keyword specified and the program to compile. Do I specify it at the global or local level? Does anyone have an example they can share.

FYI, I am using full free form RPG (dcl-f).

Re: Passing WORKSTN File as Parm

Posted: Fri Jun 26, 2015 9:58 am
by Glenn
Would it be possible for you to share the compiler listing?

Glenn

Re: Passing WORKSTN File as Parm

Posted: Fri Jun 26, 2015 10:26 am
by rmullis99
Here is the compile listing. I hope this helps. I am about to pull out what is left of my hair.

Re: Passing WORKSTN File as Parm

Posted: Fri Jun 26, 2015 10:53 am
by Scott Klement
Unfortunately, IBM has not added support to RPG that allows the HANDLER and LIKEFILE keywords to be used together. This is documented in the ILE RPG Reference manual here:
http://www-01.ibm.com/support/knowledge ... erules.htm
6-26-2015 9-51-34 AM.png
6-26-2015 9-51-34 AM.png (8.67 KiB) Viewed 421 times
If IBM ever adds support for this to RPG, Profound Logic will support it. (In fact, most likely, it'll "just work".)

Re: Passing WORKSTN File as Parm

Posted: Fri Jun 26, 2015 11:03 am
by rmullis99
If I understand this correctly then, the WORKSTN file can only be defined globally when the HANDLER is used.

Re: Passing WORKSTN File as Parm

Posted: Fri Jun 26, 2015 11:14 am
by Scott Klement
Robert, it doesn't have to be defined globally -- you can use it in a subprocedure as well. You just can't use it with LIKEFILE.

Re: Passing WORKSTN File as Parm

Posted: Fri Jun 26, 2015 11:22 am
by rmullis99
Right Scott, but I wouldn't be able to pass the WORKSTN file as parameter to other procedures if I can't define the TEMPLATE globally and use LIKEFILE. Or am I missing something?

Re: Passing WORKSTN File as Parm

Posted: Fri Jun 26, 2015 11:24 am
by Scott Klement
Correct, you cannot pass it as a parameter.