[comp.databases] EQUEL/C ## replace --- IIsyncup

marcusen@oodis01.ARPA (Marcusen) (11/03/88)

I am having a problem getting a replace statement to work in equel/c.
I believe that my syntax and logic are sound for two reasons: one, a
retrieve statement with the exact same conversions, range variable, and where
clause works; second, the replace statement works as is in ingres terminal 
monitor mode.

The problem manifests itself by performing the getrow, the writedb's, but
bombs on the IIsyncup.  By bombing I mean that it kicks out to the unix
prompt.

We are running: INGRES OSx Release 5.0/04 (pyr.u42/02) 


QUESTION
*******************************************
Can anyone help me find a flaw in my logic?
Can anyone identify know problems with IIsyncup as it is expanded by an
	ingres equel replace statement?
*******************************************


*******************************************
EQUEL CODE
*******************************************

##		activate menuitem "Save":
##		{
			while (frs_lastrow) {
##				getrow delete_auth2 mrt2 frs_lastrow(_flag=flag,
##	_mrt2._mpcn=mpcn,_mrt2._qtr0=qtr0,_mrt2._qtr1=qtr1,
##	_mrt2._qtr2=qtr2,_mrt2._qtr3=qtr3,_mrt2._qtr4=qtr4)

sprintf(wh_clause3," m.mpcn=\"%s\" and m.current=\"[4567]\" ",_mrt2._mpcn);
					switch(_flag[0]){
						case 'D':
						case 'd':

##	retrieve (_mrt._current=ascii(int2(m.current)-4)) where wh_clause3
##	replace m(current=ascii(int2(m.current)-4)) where wh_clause3

							break;
						case 'C':
						case 'c':
							break;
						default:
							break;
					}
				frs_lastrow--;
			}
##		}

*******************************************
C CODE GENERATED BY INGRES
*******************************************

/* # line 133 "delete_auth.qc" */	/* host code */
sprintf(wh_clause3," m.mpcn=\"%s\" and m.current=\"[4567]\" ",_mrt2._mpcn);
					switch(_flag[0]){
						case 'D':
						case 'd':
/* # line 138 "delete_auth.qc" */	/* retrieve */
                  {
                    IIwritedb("retrieve(current=ascii(int2(m.current)-");
                    IIwritedb("4))where ");
                    IIwritedb(wh_clause3);
                    IIretinit((char *)0,0);
                    if (IIerrtest() != 0) goto IIrtE3;
IIrtB3:
                    while (IInextget() != 0) {
                      IIretdom(1,32,0,_mrt._current);
                      if (IIerrtest() != 0) goto IIrtB3;
                    } /* IInextget */
                    IIflush((char *)0,0);
IIrtE3:;
                  }
/* # line 139 "delete_auth.qc" */	/* replace */
                  {
                    IIwritedb("replace m(current=ascii(int2(m.current)");
                    IIwritedb("-4))where ");
                    IIwritedb(wh_clause3);
                    IIsyncup((char *)0,0);
                  }
/* # line 141 "delete_auth.qc" */	/* host code */
							break;
						case 'C':
						case 'c':
							break;
						default:
							break;
					}
				frs_lastrow--;
			}
                }

Please respond to marcusen@oodis01.arpa
THANKS