Start of change

DCLOPT(*NOCHGDSLEN)

The DCLOPT keyword specifies options related to declarations.

The parameter must be *NOCHGDSLEN.

When DCLOPT(*NOCHGDSLEN) is specified, you can use %SIZE with a data structure parameter in a free-form File or Definition statement if the following conditions are met:
The following additional rules apply:
In the following example,
  1. Keyword DCLOPT(*NOCHGDSLEN) is specified in the Control statement.
  2. The data structure MYDS is defined without an explicit length.
  3. Subfield DATA is defined like LINE.
  4. The first file declaration is not valid because the value of %SIZE(MYDS) is not yet known.
  5. When field LINE is defined, all the subfields of MYDS are defined, and due to the presence of DCLOPT(*NOCHGDSLEN) in the Control statement, data structure MYDS is defined and its size is known.
  6. The second file declaration is valid because the value of %SIZE(MYDS) is known.

Without DCLOPT(*NOCHGDSLEN), neither file declaration would be valid because the size of MYDS would not be known until the compiler had processed all the statements of the procedure.

ctl-opt dclopt(*nochgdslen); // 1 

dcl-ds myDs; // 2 
  seq zoned(6:2);
  dat zoned(6);
  data like(line); // 3 
end-ds;

dcl-f myfile1 disk(%size(myDS)); // 4 

dcl-s line char(100); // 5 

dcl-f myfile2 disk(%size(myDS)); // 6 
End of change