How to determine the job name/user/number for a CL program c
Posted: Thu Dec 02, 2010 10:05 am
How to determine the job name/user/number for a CL program called by a GoAnywhere Project.
This sample project XML will allow you to get the user and job name as well as the job number from your called CL program.
<project name="system i retrieve job d info " mainModule="Main" version="1.0" logLevel="normal">
<variable name="JOBNAME" value="none" />
<variable name="USERNAME" value="none" />
<variable name="JOBNBR" value="none" />
<module name="Main">
<exec400 label="Connect to System i" version="1.0" resourceId="DEV 54">
<program name="badcl" library="wmwise">
<parameter label="JOBNAME " dataType="text" length="10" usage="out" outputVariable="JOBNAME" />
<parameter label="USERNAME" dataType="text" length="10" usage="out" outputVariable="USERNAME" />
<parameter label="JOBNBR" dataType="text" length="6" usage="out" outputVariable="JOBNBR" />
</program>
</exec400>
<print version="1.0">
<![CDATA[JOB Description from CL program ${JOBNAME} ${USERNAME} ${JOBNBR}
]]>
</print>
</module>
</project>
You will need to add a line something like this to your CL program:
0006.00 JOBINFO: RTVJOBA JOB(&JOBNAME) USER(&USERNAME) NBR(&JOBNBR)
You can retrieve additional information using any of the parameters available in the Retrieve Job Attribute (RTVJOBA) command. More information on the RTVJOBA command is available from IBM.
This sample project XML will allow you to get the user and job name as well as the job number from your called CL program.
<project name="system i retrieve job d info " mainModule="Main" version="1.0" logLevel="normal">
<variable name="JOBNAME" value="none" />
<variable name="USERNAME" value="none" />
<variable name="JOBNBR" value="none" />
<module name="Main">
<exec400 label="Connect to System i" version="1.0" resourceId="DEV 54">
<program name="badcl" library="wmwise">
<parameter label="JOBNAME " dataType="text" length="10" usage="out" outputVariable="JOBNAME" />
<parameter label="USERNAME" dataType="text" length="10" usage="out" outputVariable="USERNAME" />
<parameter label="JOBNBR" dataType="text" length="6" usage="out" outputVariable="JOBNBR" />
</program>
</exec400>
<print version="1.0">
<![CDATA[JOB Description from CL program ${JOBNAME} ${USERNAME} ${JOBNBR}
]]>
</print>
</module>
</project>
You will need to add a line something like this to your CL program:
0006.00 JOBINFO: RTVJOBA JOB(&JOBNAME) USER(&USERNAME) NBR(&JOBNBR)
You can retrieve additional information using any of the parameters available in the Retrieve Job Attribute (RTVJOBA) command. More information on the RTVJOBA command is available from IBM.