Schedule Launch Batch Application

charles

Active Member
I'd wirte a mini tools launchube.exe .It have 5 arguments.
userid
password
environment
reportname
reportversion
.
If you need schedule a batch application run at local You can use system "at" command and set these parameters.(But you need set special batch application ocm mapping is
 

Attachments

  • 55589-LaunchUbe.exe
    52 KB · Views: 602
This would be a great tool to eliminate several problems we're having now (we're an AS/400 shop with a need for such a program)! Any chance you could email me the source code - it would greatly help Senior Management at our JDE shop breathe much easier if we're able to analyze what this modified launchube program is doing.
 
Here is a cut-out of the source code of an application I wrote a few years ago.

The original code would run on a PC as a service, read a data queue for instructions and launch programs based on what was written in that queue.

I left the part where the environment is initialised and the jdeLaunchUBEEx is called. You will have to adapt the code to your needs. Good luck!

#include <stdio.h>
#include "jde.h"


int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{


HENV hEnv ;
HUSER hUser;
LPBHVRCOM lpBhvrCom = NULL;
LPCG_BHVR lpVoid = NULL;
LPVOID lpDS = NULL;
ERROR_EVENT_KEY EventKeyLocal;
struct tagUBEVAR dsUbeStructure = { 0 };
ID idJDBReturn = JDEDB_PASSED;
unsigned int rc; /* Used to hold the return code. */
JDEDB_RESULT rcode= JDEDB_PASSED;

rcode = JDB_InitEnvOvr(&hEnv, "PD7333", "JDE", "JDEPASSWORD");

if (rcode == JDEDB_PASSED)
{
rcode = JDB_InitUser(hEnv, &hUser, "APPLNAME",JDEDB_COMMIT_AUTO );
}

if (rcode != JDEDB_PASSED)
{
// Perform error processing here
}
else
{
/* Set up the lpBhvrCom amd lpVoid objects for business function call */
jdeCreateBusinessFunctionParms(hUser, &lpBhvrCom,(LPVOID*) &lpVoid);
if ((void *)lpBhvrCom->lpObj== NULL )
{
//
return 0;
}

lpVoid->lpHdr = jdeErrorInitializeEx();
lpVoid->lpErrorEventKey = (LPERROR_EVENT_KEY) jdeAlloc(COMMON_POOL, sizeof(ERROR_EVENT_KEY), MEM_ZEROINIT | MEM_FIXED);
lpVoid->lpHdr->nCurDisplayed = -1;
lpBhvrCom->lpObj->lpFormHdr = lpVoid->lpHdr;
EventKeyLocal.hwndCtrl = NULL;
EventKeyLocal.iGridCol = 0;
EventKeyLocal.iGridRow = 0;
EventKeyLocal.wEvent = 1;
lpBhvrCom->lpEventKey = (LPVOID)&EventKeyLocal;

/*-------------------------------------------------------------------------------------------*/
// Launch the report

dsUbeStructure.bPreview = FALSE;
strcpy((char *)dsUbeStructure.szReport,"R01012");
strcpy((char *)dsUbeStructure.szVersion, "ZJDE0001");
strcpy((char *)dsUbeStructure.szJobQueue, "QBATCH");
strcpy(dsUbeStructure.szMachineKey,"SERVER_NAME");
dsUbeStructure.idRunTime = (GLRTID)lpBhvrCom->hDlg << 16;
dsUbeStructure.bSynchFlag = FALSE;
dsUbeStructure.bBatchFlag = TRUE;

/* Call Launch UBE API */
idJDBReturn = jdeLaunchUBEEx((HUSER)hUser,
(PUBEVAR)&dsUbeStructure,
NULL,
(LPBHVRCOM) lpBhvrCom);
if(idJDBReturn != JDEDB_PASSED)
{
//Error processing here - Send message to QSYSOPR?
}
// End - Disconnect from OneWorld
if (lpVoid)
{
jdeFree(((LPCG_BHVR)(lpVoid))->lpErrorEventKey);
jdeErrorTerminateEx(((LPCG_BHVR)(lpVoid))->lpHdr);
jdeFreeBusinessFunctionParms(((LPBHVRCOM)(lpBhvrCom)),(LPCG_BHVR)(lpVoid));
lpBhvrCom = NULL;
lpVoid = NULL;
}

if (hUser )
{
JDB_FreeUser(hUser);
hUser = NULL;
}

if (hEnv)
{
JDB_FreeEnv(hEnv);
hEnv = NULL;
}

// End - Launch UBE
/*-------------------------------------------------------------------------------------------*/
}
}
 
Brother
i saw n download your schedulelaunch but,please can you guide me how ican use this one, cos as per instruction u didnt mention about the timings....
 
Back
Top