Differences between fixed-form and free-form to be aware of

Update-capable files are not automatically delete-capable

If you specify U in the File-Type entry for a fixed-form file definition, the file is opened to allow both update and delete operations. You must explicitly specify USAGE(*DELETE) for a free-form file definition, if you want the file to be opened to allow delete operations.

Unquoted names for the EXTNAME and EXTFLD keywords

The interpretation of an unquoted name is different in fixed form and free form.

  • In fixed form, an unquoted name is interpreted as the external name.
  • In free form, an unquoted name is interpreted as a named constant.
Tip: If you have a mixture of fixed-form and free-form code, consider changing the EXTNAME and EXTFLD keywords in fixed-form to use a literal rather than a name. For example change EXTNAME(myfile) to EXTNAME('MYFILE') and change EXTFLD(myextfld) to EXTFLD('MYEXTFLD').
Unquoted names for the DTAARA keyword

The interpretation of an unquoted name in the first operand is different in fixed form and free form.

  • In fixed form, if the first operand of DTAARA is a name, such as DTAARA(myDtaaara), the operand is interpreted as the name of the data area on the system,*LIBL/MYDTAARA.
  • In free form, if the first operand of DTAARA is a name, such as DTAARA(myDtaaara), the operand is interpreted as the name of a character field or a named constant containing the name of the data area. To specify the data area name directly, enclose it in quotes: DTAARA('MYDTAARA').
Tip: If you have a mixture of fixed-form and free-form code, consider changing the DTAARA keywords in fixed-form to use a literal rather than a name. Change DTAARA(myDtaara) to DTAARA('MYDTAARA').
Requirement to code END-DS, END-PI, and END-PR

For a data structure that allows subfields to be coded (any data structure that does not have the LIKEDS or LIKEREC keyword), you must remember to specify END-DS, either as a separate statement, or at the end of the DCL-DS statement, if you do not code any subfields.

For a procedure interface, you must remember to specify END-PI, either as a separate statement, or at the end of the DCL-PI statement, if you do not code any parameters.

For a prototype, you must remember to specify END-PR, either as a separate statement, or at the end of the DCL-PR statement, if you do not code any parameters.

Ellipsis at the end of definition names

If you are accustomed to coding an ellipsis at the end of the names in Definition or Procedure specifications, and then specifying the rest of the statement on the next specification, that will not be possible in free-form. If the name ends with an ellipsis, then the first keyword on the next line will be interpreted as part of the name.

Example Valid Field name Explanation

dcl-s name...
    char(10);
No NAMECHAR The programmer does not intend the name to be continued on the second line, but the compiler assumes that CHAR is part of the name. The field name is NAMECHAR and the (10) is considered to be a syntax error.

dcl-s name
    char(10);
Yes NAME The name is coded without the ellipsis, so the compiler does not search for the end of the name on the next line.

dcl-s continued...
   name char(10);
Yes CONTINUEDNAME The ellipsis at the end of "continued" is valid since the name is continued on the following line.