Subroutines for Each Field

Adopt a common subroutine model for each field, which uses parameters to set the field location, and returns an exitcode. This allows the special details of the field to be kept together with the field, while still allowing you to adjust the inter-field behavior at the level above, or even to use the same field editing/display code in different contexts. For example, rather than the traditional AlphaACCOUNTING model:

FIELD1:

<set INFLD parameters>

xcall INFLD, ...

IF INXCTL OR CNGCTL GOTO ANYCNG

FIELD2:

<set INFLD parameters>

xcall INFLD, ...

IF INXCTL OR CNGCTL GOTO ANYCNG

etc.

Break the above monolith into individual fields and move the interfield logic to a higher level, i.e.:

DO'FIELDS:   ! caller sets OPCODE=1 for input, 2 for display

ON FNO CALL FIELD1,FIELD2,FIELD3,...

<check exitcodes, set next FNO accordingly>

IF NOT DONE GOTO DO'FIELDS

ANYCNG:

<confirm record update>

FIELD1:

<set INFLD parameters>

xcall INFLD, ...

RETURN

FIELD2:

<set INFLD parameters>

xcall INFLD, ...

RETURN