All system components supplied with the 32-bit development system support FCD 2 and FCD 3. System components supplied with the 64-bit development system only support FCD 3; no system components can support FCD 2, due to the incompatibilities in pointer size. 32-bit and 64-bit system components are single sourced, meaning that the components work with FCD 3 on 64-bit systems if compiled with P64, or work with both FCD 2 and FCD 3 on 32-bit systems if compiled with NOP64. We recommend that you take this single-sourcing approach when developing your own applications.
Because the development system supports FCDs in both formats, your applications can use one of the following:
If you can solely use either FCD 3 or FCD 2 in your application, you need make no other provisions to handle the extended FCD structure.
However, some programs in your application might provide interfaces to other components in your application, and these interfaces might include FCD structures. In this case you might need to provide gradual transition to full FCD 3 support; at run time, therefore, your program will need to accept both FCD 2 and FCD 3 formats, and to distinguish them as necessary. For example, if there are few references to FCD fields within your code, the following source code model might be suitable:
linkage section. 01 fcd-user pic x. 01 fcd2. copy "xfhfcd2". 01 fcd3. copy "xfhfcd3". procedure division using fcd-user. set address of fcd3 to address of fcd-user if fcd-version of fcd3 = 0 *> Dealing with FCD2.. $if P64 set display "Error: cannot accept FCD2 on 64 bit platform" exit program $end set address of fcd2 to address of fcd-user end-if
Every time a field of the FCD is referenced you must add code that does something like the following:
if ( fcd-version of fcd3 not = 0 and fcd--line-sequential of fcd3) or ( not fcd-version of fcd3 = 0 and fcd--line-sequential of fcd2 ) *> Do line sequential manipulation end-if
If, however, the bulk of the code in your component directly references the FCD structure, you could internally use only the FCD 3 structure and, if necessary, establish mappings, to and from FCD 2 at entry and exit gateways to the component. For example:
working-storage section. 78 78-fcd3-map-to-fcd3 value 0. 78 78-fcd3-map-from-fcd3 value 1. 78 78-fcd3-map-error-none value 0. 78 78-fcd3-map-error-64bit value -1. 78 78-fcd3-map-error-func value -2. 78 78-fcd3-map-error-reladdr value -3. 01 fcd3-work. copy "xfhfcd3". linkage section. 01 fcd-user pic x. procedure division using fcd-user. *> Entry Gate map FCD2 (if necessary) to FCD3 call 'fcd3map' using fcd-user fcd3-work by value 78-fcd3-map-to-fcd3 size 1 if return-code not = 0 display "Error: cannot convert FCD formats" exit program end-if *> Operate on the FCD as FCD3 only *> .... *> Exit Gate map FCD3 (if necessary) to FCD2 call 'fcd3map' using fcd-user fcd3-work by value 78-fcd3-map-from-fcd3 size 1 exit program.