In ILE RPG, INCLUDE SQLDA declarations are equivalent to the following:
D* SQL Descriptor area D SQLDA DS D SQLDAID 1 8A D SQLDABC 9 12B 0 D SQLN 13 14B 0 D SQLD 15 16B 0 D SQL_VAR 80A DIM(SQL_NUM) D 17 18B 0 D 19 20B 0 D 21 32A D 33 48* D 49 64* D 65 66B 0 D 67 96A D* D SQLVAR DS D SQLTYPE 1 2B 0 D SQLLEN 3 4B 0 D SQLRES 5 16A D SQLDATA 17 32* D SQLIND 33 48* D SQLNAMELEN 49 50B 0 D SQLNAME 51 80A D* D SQLVAR2 DS D SQLLONGL 1 4B 0 D SQLRSVDL 5 32A D SQLDATAL 33 48* D SQLTNAMELN 49 50B 0 D SQLTNAME 51 80A D* End of SQLDA
The user is responsible for the definition of SQL_NUM. SQL_NUM must be defined as a numeric constant with the dimension required for SQL_VAR.
Since RPG does not support structures within arrays, the SQLDA generates three data structures. The second and third data structures are used to setup/reference the part of the SQLDA which contains the field descriptions.
To set the field descriptions of the SQLDA the program sets up the field description in the subfields of SQLVAR (or SQLVAR2) and then does a MOVEA of SQLVAR (or SQLVAR2) to SQL_VAR, n where n is the number of the field in the SQLDA. This is repeated until all the field descriptions are set.
When the SQLDA field descriptions are to be referenced the user does a MOVEA of SQL_VAR, n to SQLVAR (or SQLVAR2) where n is the number of the field description to be processed.
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.