Skip to content

How to Pass Variables to IBMi

Looking for an example project to get you started?
  • User avatar
  • Support_Julie Offline
  • Support Specialist
  • Posts: 91
  • Joined: Thu Mar 05, 2009 3:49 pm
  • Location: Ashland, NE USA
  • Contact:

How to Pass Variables to IBMi

Post by Support_Julie »

This is an example of how to pass a variable or value back to the IBMi from a GoAnywhere Director Project:

Code: Select all

<project name="How to Pass data back to IBMi" mainModule="Main" version="2.0">
	<!-- Passed Parameters -->
	<variable name="UserName" value="" />

	<module name="Main">

		<timestamp label="Create Timestamp Variable" version="1.0">
			<format outputVariable="Todays_Date" pattern="yyyy-MM-dd" />
			<format outputVariable="Two_Weeks_Ago" pattern="yyyy-MM-dd" dayOfMonth="-14" />
		</timestamp>

		<if label="Get UserName" condition="${ UserName eq &apos;&apos; }">

			<setVariable label="Set UserName" name="UserName" value="${system.user.name}" version="2.0" />

		</if>

		<exec400 label="Write Parms to DataArea" resourceId="Dev53" version="1.0">
			<command>
				<![CDATA[CRTDTAARA DTAARA(QGPL/GAPARMS) 
                        TYPE(*CHAR) 
                          LEN(250) 
                        TEXT('Parameters from GoAnywhere')                                                       
                                ]]>
				<monmsg messageID="CPF1023" action="continue" />
			</command>
			<command>
				<![CDATA[CHGDTAARA DTAARA(QGPL/GAPARMS (1 10)) VALUE('${UserName}')]]>
			</command>
			<command>
				<![CDATA[CHGDTAARA DTAARA(QGPL/GAPARMS (11 15)) VALUE('${Todays_Date}')]]>
			</command>
			<command>
				<![CDATA[CHGDTAARA DTAARA(QGPL/GAPARMS (26 15)) VALUE('${Two_Weeks_Ago}')]]>
			</command>
		</exec400>

	</module>

</project>
Julie Rosenbaum
Sr Support Analyst
e. [email protected]
p. 1.800.949.4696
w. HelpSystems.com