How to find and return the job number assigned by GoAnywhere

View some of the Frequently Asked Questions to our support staff. Included are some tips and tricks making this forum ideal for users getting started with GoAnywhere Director. Note: Users can reply to existing topics but only our support staff can add new topics to this forum.

How to find and return the job number assigned by GoAnywhere

Postby Support_Mary » Thu Dec 30, 2010 3:23 pm

How to find and return the job number assigned by GoAnywhere to a project called from a CL program?

The job number is printed in the job log. You will need to do a receive message in your CL (RCVMSG) to get the number.
Here is a sample of the message:
The job number is: 1292948216324.
[2006 - Runtime] Project '/test' not found
Project failed. Review JOB LOG.

Another option would be to add a variable to the project. In the project you can place the ${system.job.number} variable into a data area. Then pick it up in the CL program. See example below:

There are two sets of code here, one for a CL program that deletes then creates a data area then calls a GoAnywhere Director Project and changes the data are to the job number. The CL program also monitors for GoAnywhere error messages if the project should fail. The second is the XML for the project being called.

CL example
*************** Beginning of data ************************************
01.00
02.00 DCL VAR(&MESSAGE) TYPE(*CHAR) LEN(80)
03.00 DCL VAR(&DTAARA) TYPE(*CHAR) LEN(2000)
04.00 QSYS/DLTDTAARA DTAARA(WMWISE/PROJECT)
05.00 DATAAREA: QSYS/CRTDTAARA DTAARA(WMWISE/PROJECT) TYPE(*CHAR) +
06.00 LEN(2000) VALUE(NONE) TEXT('PROJECT JOB +
07.00 NUMBER')
08.00 GoAnywhere/RUNPROJECT PROJECT('/mwtest/system i retrieve job d +
09.00 info 3')
10.00 QSYS/RTVDTAARA DTAARA(WMWISE/PROJECT) RTNVAR(&DTAARA)
11.00 SNDMSG (&DTAARA) TOMSGQ(QSYSOPR)
12.00 MONMSG MSGID(GAE1002 GAE1003) EXEC(DO)
13.00 RCVMSG RMV(*NO) MSG(&MESSAGE)
14.00 SNDMSG (&MESSAGE) TOMSGQ(QSYSOPR)
15.00 ENDDO
****************** End of data *******************************************



Project XML
***********************************************************************
<project name="system i retrieve job d info 3" mainModule="Main" version="1.0" logLevel="normal">
<variable name="PROJECTJOBNUMBER" value="NONE" description="PROJECT JOB NUMBER ASSIGNED WHEN PROJECT IS CALLED FROM A CL " />

<module name="Main">

<setVariable label="Project job Number " version="2.0" name="PROJECTJOBNUMBER" value="${system.job.id}" />


<exec400 label="change data area " version="1.0" resourceId="your iSeries server">
<command threadSafe="true">
<![CDATA[CHGDTAARA DTAARA(WMWISE/PROJECT) VALUE('${PROJECTJOBNUMBER}')

]]>
</command>
</exec400>


<print version="1.0">
<![CDATA[project job number ${PROJECTJOBNUMBER}]]>
</print>

</module>

<description>get project job info when it is called from a CL</description>
</project>

***********************************************************************
You will, of course, need to make changes to fit your situation.
Support_Mary
Support Specialist
 
Posts: 9
Joined: Tue Feb 09, 2010 11:16 am

Return to Knowledge Center

Who is online

Users browsing this forum: No registered users and 0 guests