Page 1 of 1

RPG concept rich displays not used command SBMJOB to QBATCH

Posted: Wed Mar 18, 2020 6:35 am
by iclassic
Error used command SBMJOB to qbatch

Re: RPG concept rich displays not used command SBMJOB to QBATCH

Posted: Wed Mar 18, 2020 11:05 am
by Scott Klement
You haven't provided much information, here... and your question doesn't appear to have anything to do with Rich Displays. (The SBMJOB command is an IBM command, it is not part of Profound UI.)

View the job log, it'll tell you what is causing the error.

Re: RPG concept rich displays not used command SBMJOB to QBATCH

Posted: Wed Mar 18, 2020 4:05 pm
by DanD
FWIW - I have a few programs that submit jobs, albeit not to QBATCH.

I have a service program which contains procedure "sbmjob". I'm simply returning if there was an error when issuing the command - you can go much further & look @ the PSSR

When submitting, from the Rich Display program RPG source, my code looks similar to this (note that "Button_OK" is a procedure inside a service program that displays a rich display window):
RPG CODE
if sbmjob('cmd(call pgm(myprogram) parm(''' + %trim(Parameter1) + ''' ''' + %trim(Parameter2) + ''')) +
         job(myjob) jobq(qusrnomax)');
   Button_OK('Error submitting My Program');
else;
   Button_OK('My Program submitted');
endif;

RPG CODE
//***********************************************************************
dcl-proc sbmjob export;                    // sbmjob

dcl-pi *n ind;
   qcmd  char(5120) options(*varsize) const;
end-pi;

monitor;
   qcmdexc('sbmjob ' + qcmd: %len(qcmd));
on-error;
   return *on;
endmon;

return *off;

end-proc;
As Scott alluded to, please post your job log - or a code snippet.

Re: RPG concept rich displays not used command SBMJOB to QBATCH

Posted: Thu Mar 19, 2020 12:38 am
by iclassic
Successful, thank you for your support.

Re: RPG concept rich displays not used command SBMJOB to QBATCH

Posted: Thu Mar 19, 2020 12:43 am
by iclassic
Scott Klement wrote:You haven't provided much information, here... and your question doesn't appear to have anything to do with Rich Displays. (The SBMJOB command is an IBM command, it is not part of Profound UI.)

View the job log, it'll tell you what is causing the error.

Successful, thank you Scott for your support.

Re: RPG concept rich displays not used command SBMJOB to QBATCH

Posted: Thu Mar 19, 2020 10:24 am
by DanD
I'm glad that you got this to work.

I noticed a flaw in the logic that I was using (it worked, but I'm unsure how). The command length wasn't taking into consideration the "sbmjob ' prefix.

Code has been modified as follows:
RPG CODE
//***********************************************************************
dcl-proc sbmjob export;                    // sbmjob

dcl-pi *n ind;
   qcmd  char(5120) options(*varsize) const;
end-pi;

dcl-s sbm_qcmd like(qcmd);

sbm_qcmd = 'sbmjob ' + qcmd;
monitor;
   qcmdexc(sbm_qcmd: %len(sbm_qcmd));
on-error;
   return *on;
endmon;

return *off;

end-proc;