Free-format mode can be selected for either numeric fields or numeric-edited fields or both. This can be done using Adiscf.
During data entry into a free-format field, the field is treated as an alphanumeric field of the appropriate length. It is only when the user leaves the field that it is reformatted to comply with the picture string. Any characters other than the digits, the sign character and the decimal point character are discarded.
Fields occupy the same number of characters on the screen as they do bytes in memory, with the exception that an additional character is allocated for implied signs and decimal points. Therefore, a data item defined as PIC S99V99 occupies six characters on the screen in free-format mode as opposed to four characters in Fixed-format mode.
It is advisable to compile the program with the DE-EDIT"1" Compiler directive set, since free-format allows data that does not conform to the screen item's PICTURE clause; with DE-EDIT"2" this is interpreted as zeros when moved to the USING or TO data item.
Data entry is the same as for alphanumeric fields.
If an enhanced ACCEPT statement is being used, the clauses SPACE-FILL, ZERO-FILL, LEFT-JUSTIFY, RIGHT-JUSTIFY and TRAILING-SIGN are applicable only to free-format non-edited fields (and are ignored with fixed format fields).
Below is an example of code in free-format.
123456$set sourceformat(free) $set nsymbol(national) working-storage section. 1 data-1 pic n(10) value n”ABCDEF”. procedure division * comment line move "x" to data-1 *> in line comment goback. | +-Column 1 indicator area <-Columns 2 to 255 source code area ------->