Skip to content

Retrieve data from a data area and use it in a project

Looking for an example project to get you started?
  • Support_Duane Offline
  • Support Specialist
  • Posts: 66
  • Joined: Thu Mar 05, 2009 3:49 pm

Retrieve data from a data area and use it in a project

Post by Support_Duane »

There are two sets of code here, one for a CL program that will retrieve a value from a data area and place that value into a variable, the second is the XML for a project that will call the program and retrieve the value stored in the variable.

Code: Select all

/*********************************************************************/
/* Description.. This program performs the following function:       */
/*               1) Retrieves a value from a data area               */
/* Program name. RTVDADTA                                            */
/* Authored by.. Linoma Software                                     */
/* Date/time.... 06/17/10                                            */
/*                                                                   */
/*********************************************************************/
                                                                       
           PGM PARM(&value)                                            
                                                                       
             DCL VAR(&VALUE) TYPE(*CHAR) LEN(25)                       
                                                                       
/* get the data from the data area                                   */
             RTVDTAARA  DTAARA(DJOHNSON/DAVALUE) RTNVAR(&VALUE)        
                                                                       
/* we're done now                                                    */
 @ENDPGM:                                                              
           ENDPGM                                                      

Code: Select all

<project name="Retrieve value from DataArea" mainModule="Main" version="1.0">
	<module name="Main">
		<exec400 version="1.0" resourceId="Dev61">
			<program name="rtvdadta" library="djohnson">
				<parameter dataType="text" length="25" usage="out" outputVariable="value" />
			</program>
		</exec400>
		<print version="1.0">
			<![CDATA[the value in the data area was "${value}"]]>
		</print>
	</module>
</project>
You will, of course, need to make changes to fit your situation.