Wednesday, November 11, 2015

Keeping the Process in Sleep mode until other Process Success.

This code written in the Application engine (Process to wait) at the beginning

SQLExec("SELECT PRCSINSTANCE  FROM PSPRCSRQST WHERE PRCSNAME ='XYZ'  AND RUNSTATUS IN(5 ,6,7)  AND OPRID =:1 AND RUNCNTLID =:2 ", &oprid, &runcntlid, &ProcInst); /* getting the process instance of process to get success */

&RunStatus = 5;  /* status in queued state */
If All(&ProcInst) Then
   /*This loop will be executed still process went to success*/
   While &RunStatus <> 9
    
      GetJavaClass("java.lang.Thread").sleep(60000);  /* milliseconds */ 
    
      &ret = SQLExec("select RUNSTATUS from PSPRCSRQST where PRCSINSTANCE = :1", &ProcInst, &RunStatus);
   End-While; 
Else
End-If;

No comments:

Post a Comment