Creating a Map for WRITE and Copying Field Definitions

#### Search Results

Search

# Creating a Map for WRITE and Copying Field Definitions

In this session, you will create a map by copying the field definitions from a DDM (data definition module). In addition, you will change the map setting so that you can use the `WRITE USING MAP` statement.

To create a map from DDM fields

1. At the program editor's command prompt, enter the following:

       EDIT MAP

   The Edit Map menu appears.

2. Execute the Initialize new Map function to create a map with the name `MAP002`.

   The Define Map Settings For MAP screen appears.

3. Change Page Size to `60`. Mark WRITE Statement by typing in an `X` in the input field next to it. Unmark INPUT Statement by removing the `X` next to it with SPACEBAR.

4. Press ENTER.

   The WRITE Statement option is marked, which means that this map can only be invoked from a program with a `WRITE USING MAP` statement.

5. Press ENTER twice.

   The map editing screen appears.

6. Next to the Ob input fields at the top of the screen, enter the following:

       V EMPLOYEES

7. Press ENTER.

   The fields definitions of the DDM EMPLOYEES are listed:

       Ob V EMPLOYEES                          Ob D CLS ATT  DEL    CLS ATT  DEL
       1 PERSONNEL-ID              A8          .     T  D    Blnk    T  I    ?
       . FULL-NAME                 *G1         .     A  D    _       A  I    )
       2 FIRST-NAME                A20         .     A  N    ¬       M  D    &
       3 MIDDLE-I                  A1          .     M  I    :       O  D    +
       4 NAME                      A20         .     O  I    (
       5 MIDDLE-NAME               A20         .
       001   --010---+----+----+---030---+----+----+---050---+----+----+---070---+----

       Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
             Help  Mset  Exit  Test  Edit  --    -     +     Full  <     >     Let

8. In the editing area, enter the following:

       Ob V EMPLOYEES                          Ob D CLS ATT  DEL    CLS ATT  DEL
       1 PERSONNEL-ID                    A8    .     T  D    Blnk    T  I    ?
       . FULL-NAME                       *G1   .
       2 FIRST-NAME                      A20   .
       3 MIDDLE-I                        A1    .                     O  D    +
       4 NAME                            A20   .     O  I    (
       5 MIDDLE-NAME                     A20   .
       001   --010---+----+----+---030---+----+----+---050---+----+----+---070---+----
       NAME:(4
       (2

       Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
             Help  Mset  Exit  Test  Edit  --    -     +     Full  <     >     Let

   This defines two fields for the map, whose definitions are to be copied from the DDM: the sequential number 4 entered will copy the definition of the corresponding field `NAME`, and number 2 will copy the definition of the corresponding field `FIRST-NAME`.

9. Press ENTER.

   The field definitions in the DDM are copied into the map:

       Ob V EMPLOYEES                          Ob D CLS ATT  DEL    CLS ATT  DEL
       1 PERSONNEL-ID                    A8    .     T  D    Blnk    T  I    ?
       . FULL-NAME                       *G1   .
       2 FIRST-NAME                      A20   .
       3 MIDDLE-I                        A1    .                     O  D    +
       4 NAME                            A20   .     O  I    (
       5 MIDDLE-NAME                     A20   .
       001   --010---+----+----+---030---+----+----+---050---+----+----+---070---+----
       NAME:(XXXXXXXXXXXXXXXXXXXX
       (XXXXXXXXXXXXXXXXXXXX

       Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
             Help  Mset  Exit  Test  Edit  --    -     +     Full  <     >     Let

10. Use the field command `.M` to move the field positioned in the second line of the editing area to the position shown below:

        Ob V EMPLOYEES                          Ob D CLS ATT  DEL    CLS ATT  DEL
        1 PERSONNEL-ID              A8          .     T  D    Blnk    T  I    ?
        . FULL-NAME                 *G1         .
        2 FIRST-NAME                A20         .
        3 MIDDLE-I                  A1          .                     O  D    +
        4 NAME                      A20         .     O  I    (
        5 MIDDLE-NAME               A20         .
        001   --010---+----+----+---030---+----+----+---050---+----+----+---070---+----
        NAME:(XXXXXXXXXXXXXXXXXXXX(XXXXXXXXXXXXXXXXXXXX

        Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
              Help  Mset  Exit  Test  Edit  --    -     +     Full  <     >     Let

11. In the Ob input fields, replace the `V` by a plus sign (+) and press ENTER.

    The next page of field definitions is displayed.

12. Repeat the previous step until the field `CITY` appears in the list. Replace the `V` by a minus sign (-) if you need to scroll up one page in the list.

13. Enter `CITY:(2` as shown below:

        Ob V EMPLOYEES                          Ob D CLS ATT  DEL    CLS ATT  DEL
        . FULL-ADDRESS              *G1         .     T  D    Blnk    T  I    ?
        1 ADDRESS-LINE              A20         .     A  D    _       A  I    )
        2 CITY                      A20         .     A  N    ¬       M  D    &
        3 ZIP                       A10         .     M  I    :       O  D    +
        4 POST-CODE                 A10         .     O  I    (
        5 COUNTRY                   A3          .
        001   --010---+----+----+---030---+----+----+---050---+----+----+---070---+----
        NAME:(XXXXXXXXXXXXXXXXXXXX(XXXXXXXXXXXXXXXXXXXX CITY:(2

        Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
              Help  Mset  Exit  Test  Edit  --    -     +     Full  <     >     Let

14. Press ENTER.

    The screen now look as follows:

        Ob V EMPLOYEES                          Ob D CLS ATT  DEL    CLS ATT  DEL
        . FULL-ADDRESS              *G1         .     T  D    Blnk    T  I    ?
        1 ADDRESS-LINE              A20         .     A  D    _       A  I    )
        2 CITY                      A20         .     A  N    ¬       M  D    &
        3 ZIP                       A10         .     M  I    :       O  D    +
        4 POST-CODE                 A10         .     O  I    (
        5 COUNTRY                   A3          .
        001   --010---+----+----+---030---+----+----+---050---+----+----+---070---+----
        NAME:(XXXXXXXXXXXXXXXXXXXX(XXXXXXXXXXXXXXXXXXXX CITY:(XXXXXXXXXXXXXXXXXXXX

        Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
              Help  Mset  Exit  Test  Edit  --    -     +     Full  <     >     Let

15. Press PF3.

    The Edit Map menu appears.

16. `STOW` map MAP002 by using the appropriate menu function.

You can now proceed with Reusing the Layout of a Map.