In this session, you will create and execute the example program PROG002
                      to test the effects of the WRITE USING MAP statements, which
                      invoke the maps MAP002 and MAP003.
               
To create PROG002
In the command line of the Edit Map menu, enter the following:
EDIT PROG002
The program editor is invoked and the source code of PROG002 is displayed in the editing area.
At the program editor's command prompt, enter the following:
SAVE PROG002
A copy of program PROG001 is saved as a source object under the name PROG002 in the current Natural library in the current system file.
At the program editor's command prompt, enter the following:
READ PROG002
The source code of program PROG002 is displayed in the editing area of the program editor.
Replace the DISPLAY statements with the source code lines
                               shown in boldface below:
                     
** Example 'PROG002': Example program for the Map Tutorial              
************************************************************************
DEFINE DATA LOCAL                                                       
01 PERS-VIEW VIEW OF EMPLOYEES                                          
  02 NAME                                                               
  02 FIRST-NAME                                                         
  02 CITY                                                               
*                                                                       
01 #NAME (A20)                                                          
01 #CITY (A20)                                                          
END-DEFINE                                                              
*                                                                       
REPEAT                                                                  
  /*                                                                    
  INPUT USING MAP 'MAP001'                                              
  /*                                                                    
  IF #CITY NE ' ' AND #NAME NE ' '                                      
    FIND PERS-VIEW WITH NAME = #NAME AND CITY = #CITY                   
      IF NO RECORDS FOUND                                               
        REINPUT 'NO ONE BY THIS NAME LIVING IN THIS CITY.'
                MARK *#CITY                         
      END-NOREC                                     
      /*                                            
      AT START OF DATA                              
        WRITE 'THE FOLLOWING EMPLOYEES LIVE IN' CITY
      END-START                                     
      WRITE USING MAP 'MAP003'                      
      /*                                            
    END-FIND                                        
  ELSE                                              
    IF #NAME NE ' '                                 
      FIND PERS-VIEW WITH NAME = #NAME              
        IF NO RECORDS FOUND                         
          REINPUT 'PLEASE TRY ANOTHER NAME.'        
        END-NOREC                                   
        /*                                          
        WRITE USING MAP 'MAP002'                    
        /*                                          
      END-FIND                                      
    END-IF
  END-IF  
  /*      
END-REPEAT
END 
                           
                         When you have made all changes, at the program editor's prompt, enter the following:
STOW
The source of PROG002 is updated and a cataloged object is created and stored in the current Natural library in the current system file.
To execute PROG002
At the program editor's command prompt, enter the following:
PROG002
The program starts to execute and MAP001 appears.
Enter the name JONES and leave the second input field
                               empty. 
                     
Press ENTER.
The list produced by the program now uses MAP002:
Page      1                                                  07-12-14  17:12:41
                                                                               
NAME: JONES                VIRGINIA             CITY: TULSA                    
NAME: JONES                MARSHA               CITY: MOBILE                   
NAME: JONES                ROBERT               CITY: MILWAUKEE                
NAME: JONES                LILLY                CITY: BEVERLEY HILLS           
NAME: JONES                EDWARD               CITY: CAMDEN                   
NAME: JONES                MARTHA               CITY: KALAMAZOO                
NAME: JONES                LAUREL               CITY: BALTIMORE                
NAME: JONES                KEVIN                CITY: DERBY                    
NAME: JONES                GREGORY              CITY: NOTTINGHAM               
                                                                          
 | 
                        
Press ENTER.
MAP001 appears.
Leave the name JONES and enter the city
                               DERBY.
                     
Press ENTER.
The list produced by the program now uses MAP003:
Page      2                                                  07-12-14  17:15:18
                                                                               
THE FOLLOWING EMPLOYEES LIVE IN DERBY                                          
NAME: JONES                FIRST NAME:  KEVIN                                  
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
 | 
                        
Press ENTER.
MAP001 appears.
In the first position of the NAME input field, enter a
                               period (.).
                     
The Edit Map menu appears.
You have successfully completed this tutorial.