What is the maximum number of variables that you may define using the DCL command in a CL program on an IBM i version 6.1 system?
Also: Where is this documented, if you know? I couldn't find it in the online help, Information Center, or CL Programming PDF.
Thanks!
Software/Hardware used:
ASKED:
January 22, 2009 10:27 PM
UPDATED:
April 19, 2010 3:53 PM
Are you really looking for the maximum DCLs? Or do you need to know the maximum number of parameters (which must be DCL’d)?
Maximum parameters would make more sense — 255, as far as I know.
As others have noted, maximum number of DCL’d variables is probably in the thousands. I’ve also never heard of anyone running out.
Since every DCL would have to have some additional statement such as a CHGVAR in order to make use of the variable and CLLE can’t have more than 255 PARM() variables, you could start by checking what the maximum number of statements is that a CLLE can have. Just keep doubling your CHGVARs until the compiler hurls. (Just repeat the same ones.)
Then see if adding new DCLs pushes you past the limit.
Tom
I doubt (which means I don’t know for sure) that there is a fixed maximum to the number of DCLs within a CL program. All language compilers run through a common, system provided, back end which generates the actual program. This back end would have maximums based on the control structures being used to identify variables within the generated program.
This system maximum however would NOT be tied to the number of DCLs you declare. The CL compiler would, based on the CL commands and built-ins you use in the running of the program, also be declaring internal, temporary variables. I would expect that it’s the sum of your explicit DCLs and the compilers implicit declares (both of which would appear as variable declares to the back end) that would run into this maximum. As the compilers do not document their use of temporary variables you don’t have a good way to determine how many “left-over” variables you might be able to declare explicitly.
As Tom suggested, the number of DCLs you can use is undoubtedly in the thousands (and I would expect — at least for ILE — in the tens of thousands as I found hints in OPM of back end support for a bit over 65.000 — though again this number would include compiler generated variables).
Bruce VIning