|
Don't tell me that the RPG Pre-compiler has absolutely no knowledge of global and local variables (there are other procedures present all using the same parameter names).
Sorry, but that's exactly the problem. You can use local variables, but they have to be unique or they have to be defined the same as any other occurrences.
From the v5r3 manual:
Names in ILE RPG for iSeries applications that use SQL Any valid ILE RPG for iSeries variable name can be used for a host variable with the following restrictions. - Do not use host variable names or external entry names that begin with the characters 'SQ', 'SQL', 'RDI', or 'DSN'. These names are reserved for the database manager. - The length of host variable names is limited to 64. v The names of host variables should be unique within the program. If the same name is used for more than one variable and the data types are different, the data type of the host variable is unpredictable.
From the v5r4 manual:
Names in ILE RPG applications that use SQL Any valid ILE RPG variable name can be used for a host variable with the following restrictions. - Do not use host variable names or external entry names that begin with the characters SQ, SQL, RDI, or DSN. These names are reserved for the database manager. - The length of host variable names is limited to 64. v The names of host variables must be unique within the program. The one exception is that if a stand-alone field, parameter, or both, are defined exactly the same as another stand-alone field, parameter, or both, the duplicated name is accepted. - If a host variable is a duplicated name and does not belong to the exceptional category mentioned in the previous item, but does have the same type, the precompiler issues SQL0314 as a severity 11 error instead of its normal severity of 35. If you want to ignore these severity 11 errors, change the GENLVL parameter value on the CRTSQLRPGI command to be 11 or higher. Also, note that in your code you're attempting to use a CONST parm as a host variable. Even if you satisfied the SQL pre-compiler, the RPG complier would complain since you'd be attempting to change the value of a CONST parameter. HTH, Charles Wilt -- iSeries Systems Administrator / Developer Mitsubishi Electric Automotive America ph: 513-573-4343 fax: 513-398-1121
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.