The BOTH Option

When you specify BOTH, two type definition structures are generated:
  • One type definition contains all fields defined as INPUT or BOTH; the other contains all fields defined as OUTPUT, or BOTH.
  • One type definition structure is generated for each format that is specified when all fields are defined as BOTH, and a separate indicator area is not specified.
Note: Option and response indicators are included in the type definition structures only if the DDS keyword INDARA is not specified in the external file description.

If you are including the external file description for only one record format, a type definition union is automatically created containing the two type definitions. The name of this type definition union is LIBRARY_FILE_FMT_both_t. If you specify a union-type-name on the #pragma mapinc directive, the name that is generated is union-type-name_t.

C++ language onlyC++ users must use the GENCSRC utility for type definitions.

C language onlyC users can use either the GENCSRC utility or the #pragma mapinc directive for type definitions.

Note: For more information on the differences between the GENCSRC utility and the #pragma mapinc directive, see The GENCSRC Utility and the #pragma mapinc Directive.
Figure 1. DDS Source for a Device File
      A                                      INDARA
      A          R FMT
      A                                      CF01(50)
      A                                      CF02(51)
      A                                      CF03(99 'EXIT')
      A                                  1 35'PHONE BOOK'
      A                                      DSPATR(HI)
      A                                  7 28'Name:'
      A            NAME          11A  I  7 34
      A                                  9 25'Address:'
      A            ADDRESS       20A  O  9 34
      A                                 11 25'Phone #:'
      A            PHONE_NUM      8A  O 11 34
      A                                 23 34'F3 - EXIT'
C language onlyWhen the DDS shown above is included in your ILE C program, the following structure is generated:
#pragma mapinc("example/screen1","example/test(fmt)","both","d")
#include "example/screen1"
Figure 2. Structure Definitions for a Device File
/* -----------------------------------------------------------------
/* DEVICE FILE: EXAMPLE/TEST
/* FILE CREATION DATE: 93/09/01
/* RECORD FORMAT: FMT
/* FORMAT LEVEL IDENTIFIER: 371E00A681EA7
/* -----------------------------------------------------------------
/* INDICATORS FOR FORMAT FMT
/*   INDICATOR   50
/*   INDICATOR   51
/*   INDICATOR   99
/* -----------------------------------------------------------------
typedef struct {
   char NAME[11];
}EXAMPLE_TEST_FMT_i_t;
typedef struct {
   char ADDRESS[20];
   char PHONE_NUM[8];
}EXAMPLE_TEST_FMT_o_t;
typedef union {
   EXAMPLE_TEST_FMT_i_t    EXAMPLE_TEST_FMT_i;
   EXAMPLE_TEST_FMT_o_t    EXAMPLE_TEST_FMT_o;
}EXAMPLE_TEST_FMT_both_t;

This shows the structure definitions that are created when the format FMT in the device file EXAMPLE⁄TEST is included in your program. The external file description contains three indicators IN50, IN51, and IN99, and the DDS keyword INDARA. The indicators will appear as comments and will not be included in the structure because the option INDICATOR was not specified in the #pragma mapinc directive.