### simple code with error: If the new Open SQL syntax is used,

Posted:

**Wed Nov 15, 2017 12:12 am**If the new Open SQL syntax is used, it must be used throughout. This includes using @ to escape host variables.

code:

TABLES SBOOK.

DATA: AACOUNT TYPE I,AASUM TYPE P DECIMALS 2,AAAVG TYPE F.

DATA: CONNID LIKE SBOOK-CONNID.

SELECT CONNID, COUNT(*), SUM(LUGGWEIGHT), AVG(LUGGWEIGHT) INTO (CONNID,AACOUNT,AASUM,AAAVG)

FROM SBOOK

WHERE

CARRID = 'LH' AND FLDATE = '19590228'

GROUP BY CONNID.

WRITE: / CONNID,AACOUNT,AASUM,AAAVG.

CHECK AASUM > 10.

WRITE: / ' THE SUM WEITHT>10'.

ENDSELECT .

code:

TABLES SBOOK.

DATA: AACOUNT TYPE I,AASUM TYPE P DECIMALS 2,AAAVG TYPE F.

DATA: CONNID LIKE SBOOK-CONNID.

SELECT CONNID, COUNT(*), SUM(LUGGWEIGHT), AVG(LUGGWEIGHT) INTO (CONNID,AACOUNT,AASUM,AAAVG)

FROM SBOOK

WHERE

CARRID = 'LH' AND FLDATE = '19590228'

GROUP BY CONNID.

WRITE: / CONNID,AACOUNT,AASUM,AAAVG.

CHECK AASUM > 10.

WRITE: / ' THE SUM WEITHT>10'.

ENDSELECT .