IBMi (AS400) fans only : RPG Free Format: Procedure with a parameter and return value






#IBMiSample

AS5502.RPGLE - Procedure with a parameter and return value



      **FREE
         Ctl-Opt DFTACTGRP(*No);

         Dcl-S gMyVar Char(13) Inz('<---Hello--->');
         Dcl-S pValue2 Char(3);
         Dcl-S pValue3 Char(3);

         Dsply gMyVar;
         pValue2='!__';
         pValue3='__!';
         gMyVar = MyProc('Goodbye':pValue2:pValue3);
         Dsply gMyVar;
         *InLR = *On;
       Return;

       Dcl-Proc MyProc;
         Dcl-Pi *N Char(13); // Char(13) the length of returned                                   // parameter. It is like gMyVar Char(13)
         pValue1 Char(7) Const;
         pValue2 Char(3) Const;
         pValue3 Char(3) Const;
         END-PI;
         Return pValue2 + pvalue1 + pvalue3;
       END-PROC;

I appreciate all the comments made on this blog.

Comments

Popular posts from this blog

(IBM i fans only) Efficient WRKSPLF with WSF - How to Search string into spooled files, Sort, and Generate PDFs on IBMi

(IBM i fans only) Detecting and Handling Non-Printable Characters in DB2 SQL Using LOCATE() and REPLACE() Functions

(IBM i fans only) How to Sniff User Access