Page 1 of 1

How to Pass Variables to IBMi

Posted: Mon Dec 12, 2011 4:11 pm
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>