Path: utzoo!attcan!uunet!samsung!know!zaphod.mps.ohio-state.edu!wuarchive!decwrl!nsc!pyramid!infmx!randall From: randall@informix.com (Randall Rhea) Newsgroups: comp.databases Subject: Re: Informix 4GL CONSTRUCT question Message-ID: <1990Oct4.235559.22686@informix.com> Date: 4 Oct 90 23:55:59 GMT References: <59771@bbn.BBN.COM> <1990Oct4.141922.5268@informix.com> Sender: news@informix.com (Usenet News) Distribution: na Organization: Informix Software, Inc. Lines: 88 In article <1990Oct4.141922.5268@informix.com> davek@informix.com (David Kosenko) writes: >In article <59771@bbn.BBN.COM> eboneste@BBN.COM (Liz Bonesteel) writes: >> ascertain which form is open >> CONSTRUCT the query on that form >> close the form and open the next form >> CONSTRUCT the query on that form >> concatenate the queries and PREPARE the select statement >> >>The program compiles, but when I try to run it I get an error: >> >> An illegal character has been found in this statement. >> >>This error occurs in the PREPARE statement. >> I have done this before in 4GL, so as Dave Kosenko points out, there is nothing inherently wrong with the CONSTRUCT statement. Have you looked at the strings that the CONSTRUCT is producing? Perhaps some strange characters are getting into them. Something like this should work: CONSTRUCT [BY NAME] p_text1 ....... ... CONSTRUCT [BY NAME] p_text2 ...... LET p_text3 = p_text1 CLIPPED, " AND ", p_text2 CLIPPED I would look at the string "p_text3" for weird characters. A simple C function can be compiled into your 4GL program to dump a string into a file on the disk: #include #include outfile(nargs) int nargs; { char filestr[256]; char filecpy[256]; FILE *fopen(), *fp; int len, i; if(nargs != 1) { fprintf(stderr,"usage: outfile(string)"); exit(1); } for(i=0;i<256;i++){ filestr[i] = NULL; filecpy[i] = NULL; } popquote(filecpy,255); len = strlen(filecpy); strncpy(filestr,filecpy,len); len = strlen(filestr); filestr[len]=NULL; /* create file for writing */ if((fp = fopen("outfile.4go","w")) == NULL){ fprintf(stderr,"outfile(): cannot create outfile.4go"); exit(1); } /* put the string into the file */ if((fputs(filestr,fp)) == EOF){ fprintf(stderr,"outfile(): cannot write to outfile.4go"); exit(1); } fclose(fp); } In your 4GL program, you could then have: CALL outfile(p_text3) You can then look at the contents of "outfile.4go" to see the string. The above function is for UNIX, of course ... I'm not sure how it would work in VMS. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Randall Rhea Informix Software, Inc. Senior Programmer/Analyst, MIS uunet!pyramid!infmx!randall **** THE ABOVE IS NOT ENDORSED OR SUPPORTED BY INFORMIX SOFTWARE, INC. ****** -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Randall Rhea Informix Software, Inc. Senior Programmer/Analyst, MIS uunet!pyramid!infmx!randall