• Introducing Dark Mode! Switch by clicking on the lightbulb icon next to Search or by clicking on Default style at the bottom left of the page!

E9.1 jdeLaunchUBEEx2 - UBE submit with status W

Davide

Member
Hi,

I've written a BSFN to submit a UBE (R43500).
When tested locally the ube is submitted correctly and processes the data nicely.
When the same test is done on the server the ube is submitted with status 'W' (waiting) indefinitely.

I've tried several changes to the parameters to try and resolve the issue, unsuccessfully.
Server logs doesn't show any errors.

The only difference I can think of: Fatclient is windows, server is AS/400, but what should be done differently to make it work on the server.

Below is my code:

/*===== Set up PUBEVar data structure =====*/
dsUbeStructure.bPreview = FALSE;

/*===== PrintImmediate=TRUE =====*/
dsUbeStructure.zReportFlags |= eDRRPTPrintImmediate;

/*===== SaveOutput=TRUE =====*/
dsUbeStructure.zReportFlags |= eDRRPTSaveOutput;

dsUbeStructure.idRunTime = (GLRTID)lpI->sys.lpBhvrCom->hDlg << 16;

/*===== Run the UBE Synchronously with this Bs Fn (i.e. wait until UBE is complete before executing next line of code). =====*/
dsUbeStructure.bSynchFlag = FALSE;

/*===== Run the UBE Without Any Prompting (i.e. Batch Mode). =====*/
dsUbeStructure.bBatchFlag = TRUE;

jdeGetHostName(dsUbeStructure.szMachineKey, DIM(dsUbeStructure.szMachineKey), 1);
GetLocalEnvironmentName(dsUbeStructure.szEnhv, DIM(dsUbeStructure.szEnhv));

/*===== Get Report PO =====*/
jdeStrcpy(dsF983051Keys.vrpid , lpI->ube.szBatchProgram);
jdeStrcpy(dsF983051Keys.vrvers , lpI->ube.szBatchVersion);

lpI->var.cErrorCode = i5643E82_TableSelect(lpI, AUTO_FETCH, NID_F983051, ID_F983051_PRIMARY, &dsF983051Keys, 2, &dsF983051Cols);

if (lpI->var.cErrorCode != _J('1')) {
jdeStrcpy(dsUbeStructure.szPOTemplateName, lpI->ube.szPOTemplate);

/*===== Populate Keyfields for RD fetch =====*/
jdeStrcpy(dsF983052Keys.vtpid , lpI->ube.szBatchProgram);
jdeStrcpy(dsF983052Keys.vtvers , lpI->ube.szBatchVersion);
dsF983052Keys.vtrisflg = _J('2');

lpI->ube.cVersionIndicator = _J('2');

lpI->var.cErrorCode = i5643E82_TableSelect(lpI, AUTO_FETCH, NID_F983052, ID_F983052_PID_VERS_RISFLG_FUSZ2, &dsF983052Keys, 3, &dsF983052Cols);

/*===== Call Launch UBE API =====*/
if (IS_VALID(lpI->var.cErrorCode)){
if (!jdeIsBlankOrNull(lpI->ube.szDefaultReportDefName)){
jdeNIDcpy(dsUbeStructure.szReport , lpI->ube.szBatchProgram);
jdeNIDcpy(dsUbeStructure.szVersion , lpI->ube.szBatchVersion);

idJDBReturn = jdeLaunchUBEEx2(lpI->sys.hUserManual, &dsUbeStructure, &dsReportInterconnect, lpI->sys.lpBhvrCom, _J('1'), _J('0'), lpI->ube.szDefaultReportDefName);
}
}

Any assistance would be greatly appreciated.

kind regards,
David T.

E9.10
Tools: 9.2.1.9
 

BOster

Legendary Poster
Don't know offhand. Only thing I see different from what I do is I use a HUSER opened as auto commit and I pass _J('0') for the 5th param. Off the top of my head I can't remember what the 5th and 6th params even mean. Anyway here is an example:

Code:
    jdeGetHostName(szLocalComputerName, DIM(szLocalComputerName), 0); 
    GetLocalEnvironmentName(szEnvironmentName, DIM(szEnvironmentName));

    jdeNIDcpy(ube.szReport,            _J("R46150"));
    jdeNIDcpy(ube.szVersion,        lpDS->szVersion);
    jdeStrcpy(ube.szMachineKey,    szLocalComputerName);
    jdeStrcpy(ube.szEnhv,            szEnvironmentName);
    ube.bPreview                        = FALSE;
    ube.bBatchFlag                        = TRUE;
    ube.idRunTime                        = (GLRTID)(lpBhvrCom->hDlg)<<16;
    ube.bSynchFlag                        = FALSE;

    /* launch the ube and exit */
    jdeLaunchUBEEx2(hUser, &ube, &ri, lpBhvrCom, _J('0'), _J('0'), NULL);
 

Kim Schmidt

Active Member
Also check what AS400 job queue your job is being submitted to, and make sure the queue exists and is not in hold status. You can change the version's job queue when you check out the version in OMW. Since Windows does not have native job queues like the AS400 does, your fat client probably disregards that setting when running locally. By the way, the version job queue setting is kept in the TAM specs, not in any of the version tables' blob fields.
Regards, K
 

Davide

Member
Don't know offhand. Only thing I see different from what I do is I use a HUSER opened as auto commit and I pass _J('0') for the 5th param. Off the top of my head I can't remember what the 5th and 6th params even mean. Anyway here is an example:

Code:
    jdeGetHostName(szLocalComputerName, DIM(szLocalComputerName), 0);
    GetLocalEnvironmentName(szEnvironmentName, DIM(szEnvironmentName));

    jdeNIDcpy(ube.szReport,            _J("R46150"));
    jdeNIDcpy(ube.szVersion,        lpDS->szVersion);
    jdeStrcpy(ube.szMachineKey,    szLocalComputerName);
    jdeStrcpy(ube.szEnhv,            szEnvironmentName);
    ube.bPreview                        = FALSE;
    ube.bBatchFlag                        = TRUE;
    ube.idRunTime                        = (GLRTID)(lpBhvrCom->hDlg)<<16;
    ube.bSynchFlag                        = FALSE;

    /* launch the ube and exit */
    jdeLaunchUBEEx2(hUser, &ube, &ri, lpBhvrCom, _J('0'), _J('0'), NULL);

Hi Brian,

Thanks for your reply.

Parameter 5 indicates wether UBE needs to be submitted RD or not, in my case it needs to be submitted with RD as I expect an xml to be generated.
Parameter 6 indicates wether UBE allows user to get a prompt to select RD to be used, in my case it needs to be completely automated so no prompt allowed.

I'll try changin the user with AUTO COMMIT and see if that resolves the issue.

kind regards
David
 
Call Orchestrations From Excel – The Easy Way to Make the Orchestrator Work for You.

Davide

Member
Hi,

Issue has been resolved.
Rout cause was the hUser initialization.

I was doing some Table I/O's stuff as well, I initialized my hUser with (JDEDB_COMMIT_MANUAL), this caused the UBE to be called with status W.
Once I changed it to JDEDB_COMMIT_AUTO, issue was resolved and it worked as expected.

Thank you for pointing me in the right direction.

kind reagrds,
David
 

BOster

Legendary Poster
Hi Brian,

Thanks for your reply.

Parameter 5 indicates wether UBE needs to be submitted RD or not, in my case it needs to be submitted with RD as I expect an xml to be generated.
Parameter 6 indicates wether UBE allows user to get a prompt to select RD to be used, in my case it needs to be completely automated so no prompt allowed.

I'll try changin the user with AUTO COMMIT and see if that resolves the issue.

kind regards
David
I believe we submit UBEs via jdeLaunchUBEEx2 that use BIP and we simply let the version dictate all that and pass _J('0'), _J('0') for param 5 and 6.
 
Top