IBM Books

Net.Data Administration and Programming Guide for OS/400

System Language Environment Example

The following example shows a macro that contains a function definition with three parameters, P1, P2, and P3. P1 is an input (IN) parameter and P2 and P3 are output (OUT) parameters. The function invokes a program, UPDPGM, which updates the parameter P2 with the value of P1 and sets P3 to a character string. Prior to processing the statement in the %EXEC block, the DTW_SYSTEM language environment stores P1 and the corresponding value in the environment space.

%DEFINE {
   MYPARM2 	= "ValueOfParm2"
   MYPARM3 	= "ValueOfParm3"
 %}
 %FUNCTION(DTW_SYSTEM) sys1 (IN P1, OUT P2, P3) {
   %EXEC {
      /QSYS.LIB/NETDATA.LIB/UPDPGM.PGM
   %}
 %}
 
 %HTML(upd1) {
 <P>
 Passing data to a program.  The current value 
 of MYPARM2 is "$(MYPARM2)", and the current value of MYPARM3 is
 "$(MYPARM3)".  Now we invoke the Web macro function.
 
 @sys1("ValueOfParm1", MYPARM2, MYPARM3)  
 
 <P>
 After the function call, the value of MYPARM2 is "$(MYPARM2)", 
 and the value of MYPARM3 is "$(MYPARM3)".
 %}

Assuming that the Web macro is stored in library NETDATA, file SYSMAC, and member SYS1, the macro is reference by loading the following URL from a browser:

http://hostname/cgi-bin/db2www/qsys.lib/netdata.lib/sysmac.file/
  sys1.mbr/upd1


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]