I thought I would start a new thread - as a follow-up to some discussions in another thread (and some confusion in that thread).
The 2002 ISO Standard introduces "free form reference format". So let's talk about "fixed format reference format" first - which is the ONLY *standard* definitiion before 2002.
In that format there were 4 "things" of interest:
1) Columns 1 - 6
- up until the '85 Standard this was for sequence numbers and needed to be numeric (in ascending order). In the '85 Standard this was expanded to allow any alphanumeric character.
2) Column 7
- this was the "indicator" area and allowed
- space (doing nothing special)
- * (for a comment)
- D (for a debugging line)
- / (for a listing page break)
- - (for a continuation line)
3) Columns 8-11
- This was for the A-Area. In a STANDARD CONFORMING compiler certain "structures" must start in this column (e.g. paragraph names, 01 levels, etc) - while other items must NOT start in this area (e.g. procedure division statements, 02-49 levels, etc)
4) Column 12 - ANYWHERE THE IMPLEMENT SAID
NOTE WELL: the end of this area was NOT specified to be column 72 - and at least some compilers supported column 80 - and there was no restriciton on where it was.
- This is the B-AREA. The "position specifing the ending" was called the "R-Margin". Any "syntax" (unless required to be in the A-area) could be in this area.
NOTE WELL:
There was some confusion whether "conforming" implementations could or could not allow "comments" between the R-margin and the "end-of-line". IBM's mainframe compiler (for example) allowed "comments" in columns 73-80.
NOTE WELL 2:
For implementations with "line sequential" type source code, allowing the "end-of-line" indicator in the middle of alphanumeric literals was a "real problem". Most (all?) conforming compilers had SOME "option" to allow this, but it was rarely the default. The '85 (and earlier) Standards *assumed* a "record sequential" type source code - which caused some problems for non-COBOL oriented (source code) text editors.
***
Various "'85 Standard compilers" (and earlier) allowed:
- data in columns 1-7
- A-/B-area "confusion"
but this was always an EXTENSION and when "standard conformance flagging" was turned on, a message needed to be issued. There was NO consistancy in implementations with these extensions - especially when it came to comments and continuations.
***
In the 2002 Standard, the "free form reference format" introduces
A) the ability to have up to 255 CHARACTERS (not columns) per line.
B) New "indicators" and "directives" to handle what used to be dealt with in column 7, i.e.
>>PAGE
*> comment lines
>>D debugging lines
new types of literal continuations
NOTE WELL:
These new indicators/directives are ALSO allowed in fixed form reference format.
C) removal of all A-/B-area restrictions. (For implementations - such as IBM's mainframe compiler - that used to allow the period at the end of paragraphs to be optional, this will now need to be removed.)
D) A directive to "switch" between fixed and free form reference format in the middle of a source program.
Bill Klein
The 2002 ISO Standard introduces "free form reference format". So let's talk about "fixed format reference format" first - which is the ONLY *standard* definitiion before 2002.
In that format there were 4 "things" of interest:
1) Columns 1 - 6
- up until the '85 Standard this was for sequence numbers and needed to be numeric (in ascending order). In the '85 Standard this was expanded to allow any alphanumeric character.
2) Column 7
- this was the "indicator" area and allowed
- space (doing nothing special)
- * (for a comment)
- D (for a debugging line)
- / (for a listing page break)
- - (for a continuation line)
3) Columns 8-11
- This was for the A-Area. In a STANDARD CONFORMING compiler certain "structures" must start in this column (e.g. paragraph names, 01 levels, etc) - while other items must NOT start in this area (e.g. procedure division statements, 02-49 levels, etc)
4) Column 12 - ANYWHERE THE IMPLEMENT SAID
NOTE WELL: the end of this area was NOT specified to be column 72 - and at least some compilers supported column 80 - and there was no restriciton on where it was.
- This is the B-AREA. The "position specifing the ending" was called the "R-Margin". Any "syntax" (unless required to be in the A-area) could be in this area.
NOTE WELL:
There was some confusion whether "conforming" implementations could or could not allow "comments" between the R-margin and the "end-of-line". IBM's mainframe compiler (for example) allowed "comments" in columns 73-80.
NOTE WELL 2:
For implementations with "line sequential" type source code, allowing the "end-of-line" indicator in the middle of alphanumeric literals was a "real problem". Most (all?) conforming compilers had SOME "option" to allow this, but it was rarely the default. The '85 (and earlier) Standards *assumed* a "record sequential" type source code - which caused some problems for non-COBOL oriented (source code) text editors.
***
Various "'85 Standard compilers" (and earlier) allowed:
- data in columns 1-7
- A-/B-area "confusion"
but this was always an EXTENSION and when "standard conformance flagging" was turned on, a message needed to be issued. There was NO consistancy in implementations with these extensions - especially when it came to comments and continuations.
***
In the 2002 Standard, the "free form reference format" introduces
A) the ability to have up to 255 CHARACTERS (not columns) per line.
B) New "indicators" and "directives" to handle what used to be dealt with in column 7, i.e.
>>PAGE
*> comment lines
>>D debugging lines
new types of literal continuations
NOTE WELL:
These new indicators/directives are ALSO allowed in fixed form reference format.
C) removal of all A-/B-area restrictions. (For implementations - such as IBM's mainframe compiler - that used to allow the period at the end of paragraphs to be optional, this will now need to be removed.)
D) A directive to "switch" between fixed and free form reference format in the middle of a source program.
Bill Klein