הקוד של הפרוצדורה שבניתי:
<p dir="ltr" style="text-align: left;">LINK VIKA_JOBCANDIDATES TO :$.PAR;
ERRMSG 10 WHERE :RETVAL <= 0;
/************************* INPUT *********************************/
SELECT VIKA_JOB,VIKA_IDNUMBER
FROM VIKA_JOBCANDIDATES
WHERE VIKA_JOB <> 0
TABS ADDTO 'C:\TMP\NASTIA.TXT';
/*****************************************************************/
:VIKUSERB = ";
:USERID = 0;
:EMPLOYEEFLAG = '\0';
SELECT VIKA_JOBCANDIDATES.VIKA_IDNUMBER,USERSB.USERID,
USERSTATUSES.EMPLOYEEFLAG
INTO :VIKUSERB, :USERID,:EMPLOYEEFLAG
FROM VIKA_JOBCANDIDATES, USERSB,USERSTATUSES
WHERE USERSB.USERB <> 0
AND USERSB.USERSTATUS = USERSTATUSES.USERSTATUS
AND VIKA_JOBCANDIDATES.VIKA_IDNUMBER = USERSB.IDNUMBER
AND VIKA_JOBCANDIDATES.VIKA_USERSTATUS=USERSTATUSES.USERSTATUS;
UNLINK VIKA_JOBCANDIDATES;
SELECT :VIKUSERB, :USERID,:EMPLOYEEFLAG
FROM DUMMY
TABS ADDTO 'C:\TMP\TANIA.TXT';
ERRMSG 1 WHERE :USERID > 0 ;
ERRMSG 4 WHERE :EMPLOYEEFLAG <> 'Y';
ERRMSG 3 WHERE :INACTIVE = 'Y' ;
/**************UPD STATUS AND USERID********************/
:USERSTATUS = 0 ;
SELECT USERSBSTAT INTO :USERSBSTAT
FROM USERSBSTATS WHERE INITSTATFLAG = 'Y' ;
UPDATE USERSB SET USERID = :USERID, –
השלב שלא עובד
USERSBSTAT = (:USERSBSTAT <> 0 ? :USERSBSTAT : USERSBSTAT)
WHERE USERID = :USERID;
WRNMSG 2 WHERE EXISTS ( SELECT 'X' FROM USERSB
WHERE USERB = :USERB AND USERID > 0);
</p>