Informix 4gl 7.30 on AIX - problem with "PUT" statement
Posted in 2000
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL, Platform-Specific Issues
Problem with 'c4gl/esqlc' and the 'PUT' statement on AIX 4.3.
Would be very interested if anyone else can reproduce on other platforms--
Informix 4gl 7.30.UC1
Will compile (notice only two fields):
=================================================================
MAIN
DEFINE m RECORD
doc_a INTEGER, doc_b SMALLINT
END RECORD
DEFINE scratch CHAR(2047)
LET scratch="INSERT INTO putest (m.doc_a, m.doc_b) VALUES (?,?)"
PREPARE d_stmt FROM scratch
DECLARE d_insert CURSOR FOR d_stmt
PUT d_insert FROM m.doc_a, m.doc_b
END MAIN
=================================================================
$ c4gl -keep cmd2.4gl
Won't compile (three fields):
=================================================================
MAIN
DEFINE m RECORD
doc_a INTEGER, doc_b SMALLINT, doc_c SMALLINT
END RECORD
DEFINE scratch CHAR(2047)
LET scratch="INSERT INTO putest (m.doc_a, m.doc_b, m.doc_c) VALUES
(?,?,?)"
PREPARE d_stmt FROM scratch
DECLARE d_insert CURSOR FOR d_stmt
PUT d_insert FROM m.doc_a, m.doc_b, m.doc_c
END MAIN
=================================================================
$ c4gl -keep cmd2.4glesqlc: "cmd2.ec", line 65: Error -33051: Syntax error on identifier or
symbol '$'.
1 error(s) found
I do not know if my notes are pointing up errors or typos in relating
the problem to us, but here goes anyway.
Thomas Smith wrote:
>
> Problem with 'c4gl/esqlc' and the 'PUT' statement on AIX 4.3.
>
> Would be very interested if anyone else can reproduce on other platforms--
> Informix 4gl 7.30.UC1
>
> Will compile (notice only two fields):
>
> =================================================================
> MAIN
> DEFINE m RECORD
> doc_a INTEGER, doc_b SMALLINT
> END RECORD
> DEFINE scratch CHAR(2047)
>
> LET scratch="INSERT INTO putest (m.doc_a, m.doc_b) VALUES (?,?)"
No "m." the statement should be, assuming the puttest table has columns
doc_a, and doc_b:
LET scratch="INSERT INTO putest (doc_a, doc_b) VALUES (?,?)"
Don't know why it compiles at all in this case either unless the 'm.'
is a typo.
> PREPARE d_stmt FROM scratch
> DECLARE d_insert CURSOR FOR d_stmt
> PUT d_insert FROM m.doc_a, m.doc_b
If you do not "FLUSH d_insert" or "CLOSE d_insert" the rows will NEVER
be flushed out of the library's buffer into the database.
> END MAIN
> =================================================================
>
> $ c4gl -keep cmd2.4gl>
> Won't compile (three fields):
>
> =================================================================
> MAIN
> DEFINE m RECORD
> doc_a INTEGER, doc_b SMALLINT, doc_c SMALLINT
> END RECORD
> DEFINE scratch CHAR(2047)
>
> LET scratch="INSERT INTO putest (m.doc_a, m.doc_b, m.doc_c) VALUES
> (?,?,?)"
Again should be:
LET scratch="INSERT INTO putest (doc_a, doc_b, doc_c) VALUES (?,?,?)"
> PREPARE d_stmt FROM scratch
> DECLARE d_insert CURSOR FOR d_stmt
> PUT d_insert FROM m.doc_a, m.doc_b, m.doc_c
> END MAIN
> =================================================================
>
> $ c4gl -keep cmd2.4gl> esqlc: "cmd2.ec", line 65: Error -33051: Syntax error on identifier or
> symbol '$'.
> 1 error(s) found
This error points to the 'm.' as more than a transcription typo.
Art S. Kagel
Thomas Smith wrote:
> Problem with 'c4gl/esqlc' and the 'PUT' statement on AIX 4.3.
>
> Would be very interested if anyone else can reproduce on other platforms--
> Informix 4gl 7.30.UC1
>
> Will compile (notice only two fields):
>
> =================================================================
> MAIN
> DEFINE m RECORD
> doc_a INTEGER, doc_b SMALLINT
> END RECORD
> DEFINE scratch CHAR(2047)
>
> LET scratch="INSERT INTO putest (m.doc_a, m.doc_b) VALUES (?,?)"
> PREPARE d_stmt FROM scratch
> DECLARE d_insert CURSOR FOR d_stmt
> PUT d_insert FROM m.doc_a, m.doc_b
> END MAIN
> =================================================================
m. is a program record variable, in fact it should read like
INSERT INTO <Table> (<columns>, <columns>, ....) VALUES (?,
?,....);
Even though compilation is through, but you will hit runtime error.
You need FLUSH after PUT in order to flush from the buffer to the database
table.
In fact both the examples should not give you any compilation error. Error
will surface
at runtime.
ON HP-UX 10.20 running IDS.2000, I have no problems compiling.
>
> $ c4gl -keep cmd2.4gl>
> Won't compile (three fields):
>
> =================================================================
> MAIN
> DEFINE m RECORD
> doc_a INTEGER, doc_b SMALLINT, doc_c SMALLINT
> END RECORD
> DEFINE scratch CHAR(2047)
>
> LET scratch="INSERT INTO putest (m.doc_a, m.doc_b, m.doc_c) VALUES
> (?,?,?)"
> PREPARE d_stmt FROM scratch
> DECLARE d_insert CURSOR FOR d_stmt
> PUT d_insert FROM m.doc_a, m.doc_b, m.doc_c
> END MAIN
> =================================================================
>
> $ c4gl -keep cmd2.4gl> esqlc: "cmd2.ec", line 65: Error -33051: Syntax error on identifier or
> symbol '$'.
> 1 error(s) found