Sample 4: Modes and User File

Task: Show all cruises which use a yacht of charter yacht type ATLANTIC 29 listed in order of cruise starting date. Show how many cruises there are in each month.

  1. Present the data in a list

  2. Present the data with one record on each page

  3. Summarize the data

  4. Create a user file containing the data

This transaction uses the Selection Editor, a control field, a system function and special break conditions to select the data required. The transaction uses different transaction modes to present data as required and to create a user file which contains the report data.

The steps in this transaction are performed in a logical order. The order in which the steps are carried out is different to the order in the previous sample transactions.

Transaction Specification

Primary File SAG-TOURS-E-CRUISE
Display Fields 1: CRUISE-ID
2: START-HARBOR
3: DESTINATION-HARBOR
4: START-DATE
Selection Criteria CHARTER-YACHT-TYPE = 'ATLANTIC 29'
Control Field START-DATE
Special Break Conditions First 'n' characters: 6
System Functions Count CRUISE-ID

This section covers the following topics:


To create the transaction SAMPLE4:

Start of instruction setTo Add a Transaction

  1. Issue the ADD TRANSACTION SAMPLE4 command.

    The Add Transaction window appears.

  2. Type "Modes and User File" in the Description field (optional).

Start of instruction setTo Choose a File

The report requires data from the file SAG-TOURS-E-CRUISE.

  1. Type SAG-TOURS-E-CRUISE in the File Name field.

  2. Press Enter.

    The Worksheet appears.

Start of instruction setTo Choose Fields

The report requires data stored in the fields CRUISE-ID, START-DATE, START-HARBOR and DESTINATION-HARBOR.

  • Type CRUISE-ID, START-DATE, START-HARBOR and DESTINATION-HARBOR beneath each other in the Field Name column..

    Or:
    Choose the fields using the Asterisk List function as described in Step 3 in Sample 1.

Start of instruction setTo Determine Display Sequence for Horizontal Output

  1. Type "1" in the Sequence column next to the field CRUISE-ID.

  2. Type "2" in the Sequence column next to the field START-HARBOR.

  3. Type "3" in the Sequence column next to the field DESTINATION-HARBOR.

  4. Type " 4" in the Sequence column next to the field START-DATE.

Start of instruction setTo Define Control Break Processing

The report requires all cruises which use a yacht of charter yacht type ATLANTIC 29 listed in order of cruise starting date. The number of cruises per month is to be displayed.

  1. Type "C1" in the Sort/Control (S/C) column next to the field START-DATE.

    The cruises will be listed in order of their starting date.

    The data in the field START-DATE is stored in the format YYYYMMDD where the first four characters show the year, the third (3rd) and fourth (4th) the month and the fifth (5th) and sixth (6th) the day. You can use the Special Break Conditions function to define a control break when the first six characters of the field START-DATE change.

  2. Enter "CB" in the Function (Func) column next to the field START-DATE.

    The Special Break Conditions window appears.

  3. Enter "6" in the First 'n' Characters field.

     11:14                      ***** Super Natural *****                 1998-02-18
     SAMPLE4                          - Worksheet -                           SN3011
                                                                                    
     Ref DB    Field Name              +---------Special Break Conditions----------+
     AA  1K    CRUISE-ID ............. ! Field: START-DATE                         !
     AE  1K 2  START-DATE ............ !                                           !
     AJ  1K    START-HARBOR .......... ! Format .. N                               !
     AK  1K    DESTINATION-HARBOR .... ! Length .. 8                               !
     BE        _______________________ !                                           !
     BF        _______________________ ! Perform control break after change of the !
     BG        _______________________ ! first 'n' field characters.               !
     BH        _______________________ ! Do not enter any value if the complete    !
     BI        _______________________ ! length should be taken.                   !
     BJ        _______________________ !                                           !
     BK        _______________________ ! First 'n' characters: 6_                  !
     BL        _______________________ !                                           !
     BM        _______________________ +-------------------------------------------+
     
    

    A control break is defined when the month value of the field START-BREAK changes.

  4. Enter "SF " in the Function (Func) column next to the field CRUISE-ID.

    The Specify System Functions window appears.

  5. Mark the field next to the field START-DATE and below the field Cnt.

     11:14                      ***** Super Natural *****                 1998-02-18
     SAMPLE4                          - Worksheet -                           SN3011
                                                                                    
     +--------------------------Specify System Functions---------------------------+
     ! Field: CRUISE-ID                                                            !
     !                                                                  N   N   N  !
     ! Level  Control Field                    Cnt Tot Sum Avg Max Min Cnt Avg Min !
     ! Grand  End of Report                     _   _   _   _   _   _   _   _   _  !
     !     1  START-DATE                        X   _   _   _   _   _   _   _   _  !
     !                                          _   _   _   _   _   _   _   _   _  !
     !                                          _   _   _   _   _   _   _   _   _  !
     !                                          _   _   _   _   _   _   _   _   _  !
     !                                          _   _   _   _   _   _   _   _   _  !
     !                                          _   _   _   _   _   _   _   _   _  !
     !                                          _   _   _   _   _   _   _   _   _  !
     !                                          _   _   _   _   _   _   _   _   _  !
     !                                          _   _   _   _   _   _   _   _   _  !
     !                                                                             !
     +-----------------------------------------------------------------------------+
    
    
  6. Press Enter.

    The system function Count is carried out for the field CRUISE-ID at each control break of the field START-DATE.

Start of instruction setTo Define Selection Criteria

The report requires data for cruises of charter yacht type ATLANTIC 29.

  1. Enter SEL in the command line.

    The Selection Editor appears.

  2. Enter "CHARTER-YACHT-TYPE = 'ATLANTIC 29'" in the editor area.

Start of instruction setTo Present the Data in a List

  • Press PF11 (RUN).

    The report is generated. Part of the resulting report is shown below:

     11:21:10  CHARTER-YACHT-TYPE = 'ATLANTIC 29'                         1998-02-18
     ISAMPLE4                                                               3       
                                                                                    
          CRUISE-ID     START-HARBOR      DESTINATION-HARBOR  START-DATE            
          --------- -------------------- -------------------- ----------            
                                                                                    
                 85 KIEL                 KIEL                   19910622            
                 99 KIEL                 KIEL                   19910629            
                111 KIEL                 KIEL                   19910629            
     ** Control Break (1) **                                                        
          START-DATE :   19910629                                                   
     Cnt         9                                                                  
                                                                                    
                112 KIEL                 KIEL                   19910713            
                113 KIEL                 KIEL                   19910720            
                 86 KIEL                 KIEL                   19910727            
     ** Control Break (1) **                                                        
          START-DATE :   19910727                                                   
     Cnt         3                                                                  
                                                                                    
                114 KIEL                 KIEL                   19910803            
                                                                                    
     Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
                 Print Exit              Flip        +                       Canc   
    

    The field CHARTER-YACHT-TYPE now appears in the Field Name column of the Worksheet.

    The Worksheet now has the following entries:

     11:15                      ***** Super Natural *****                 1998-02-18
     SAMPLE4                          - Worksheet -                           SN3011
                                                                                    
     Ref DB    Field Name                         Seq   S/C  Func Def  Info Del     
     AA  1K    CRUISE-ID ......................   1__   ___   >_   __   __   __     
     AE  1K 2  START-DATE .....................   4__   C1_   >_   __   __   __     
     AJ  1K    START-HARBOR ...................   2__   ___   __   __   __   __     
     AK  1K    DESTINATION-HARBOR .............   3__   ___   __   __   __   __     
     AP  1  2  CHARTER-YACHT-TYPE .............   ___   ___   __   __   __   __     
     BE        ________________________________   ___   ___   __   __   __   __     
     BF        ________________________________   ___   ___   __   __   __   __     
     BG        ________________________________   ___   ___   __   __   __   __     
     BH        ________________________________   ___   ___   __   __   __   __     
     BI        ________________________________   ___   ___   __   __   __   __     
     BJ        ________________________________   ___   ___   __   __   __   __     
     BK        ________________________________   ___   ___   __   __   __   __     
     BL        ________________________________   ___   ___   __   __   __   __     
     BM        ________________________________   ___   ___   __   __   __   __     
                                                                                    
                                                                                    
     System functions have been updated                                             
     Command ===>                                                                   
     Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
           Help  Next  Exit  Field Incl  Flip  -     +           Sel   Run   Canc   
    

Start of instruction setTo Present the Data with One Record on Each Page.

You use the transaction mode Report Type VERTICAL LIST to present data with one record on each page as the report requires.

  1. Press PF8 (EXIT) to leave the report.

    The Worksheet appears.

  2. Issue the MODES command.

    The Transaction Modes Reporting window appears.

  3. Enter "V" in the Report Type field as in the following example:

     11:39                      ***** Super Natural *****                 1998-02-18
     SAMPLE4                          - Worksheet -                           SN3011
                                                                                    
     Ref DB    Field Name                     +----Transaction Modes Reporting-----+
     AA  1K    CRUISE-ID .................... !                                    !
     AE  1K 2  START-DATE ................... ! Data Selection .. F  Full-screen   !
     AJ  1K    START-HARBOR ................. !                                    !
     AK  1K    DESTINATION-HARBOR ........... ! Data Change ..... N  None          !
     AP  1  2  CHARTER-YACHT-TYPE ........... !                                    !
     BE        ______________________________ ! Report Type ..... V  Vertical list !
     BF        ______________________________ ! Report Level .... D  Detailed      !
     BG        ______________________________ !                                    !
     BH        ______________________________ ! Destination ..... S  Screen        !
     BI        ______________________________ !                                    !
     BJ        ______________________________ ! Run Mode ........ O  Online        !
     BK        ______________________________ !                                    !
     BL        ______________________________ ! Batch printer ... 0  (0 - 31)      !
     BM        ______________________________ ! RJE available ... N  (Y/N)         !
                                              !                                    !
                                              +------------------------------------+
     
    
  4. Press PF11 (RUN).

    The report is generated. Part of the resulting report is shown below:

     11:22:00  CHARTER-YACHT-TYPE = 'ATLANTIC 29'                         1998-02-18
     ISAMPLE4                                                               1       
                                                                                    
     CRUISE-ID ...................... 79                                            
     START-HARBOR ................... KIEL                                          
     DESTINATION-HARBOR ............. KIEL                                          
     START-DATE ..................... 19910330                                      
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
     Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
                 Print Exit              Flip        +                       Canc   
    

Start of instruction setTo Summarize the Data

You can just display the results of the system functions which are carried out at control breaks using the Report Level SUMMARY.

  1. Press PF2 (EXIT) to leave the report.

    The Worksheet appears.

  2. Issue the MODES command.

    The Transaction Modes Reporting window appears.

  3. Enter "L" in the Report Type field.

  4. Enter "S" in the Report Level field as in the following example:

     11:39                      ***** Super Natural *****                 1998-02-18
     SAMPLE4                          - Worksheet -                           SN3011
                                                                                    
     Ref DB    Field Name                     +----Transaction Modes Reporting-----+
     AA  1K    CRUISE-ID .................... !                                    !
     AE  1K 2  START-DATE ................... ! Data Selection .. F  Full-screen   !
     AJ  1K    START-HARBOR ................. !                                    !
     AK  1K    DESTINATION-HARBOR ........... ! Data Change ..... N  None          !
     AP  1  2  CHARTER-YACHT-TYPE ........... !                                    !
     BE        ______________________________ ! Report Type ..... L  List          !
     BF        ______________________________ ! Report Level .... S  Summary       !
     BG        ______________________________ !                                    !
     BH        ______________________________ ! Destination ..... S  Screen        !
     BI        ______________________________ !                                    !
     BJ        ______________________________ ! Run Mode ........ O  Online        !
     BK        ______________________________ !                                    !
     BL        ______________________________ ! Batch printer ... 0  (0 - 31)      !
     BM        ______________________________ ! RJE available ... N  (Y/N)         !
                                              !                                    !
                                              +------------------------------------+
     
    

    You cannot have Report Level SUMMARY with Report Type VERTICAL.

  5. Press PF11 (RUN).

    The report is generated. Part of the resulting report is shown below:

     11:18:21  CHARTER-YACHT-TYPE = 'ATLANTIC 29'                         1998-02-18
     ISAMPLE4                                                               1       
                                                                                    
          CRUISE-ID     START-HARBOR      DESTINATION-HARBOR  START-DATE            
          --------- -------------------- -------------------- ----------            
                                                                                    
     ** Control Break (1) **                                                        
          START-DATE :   19910330                                                   
     Old        106 KIEL                 KIEL                   19910330            
     Cnt         3                                                                  
                                                                                    
     ** Control Break (1) **                                                        
          START-DATE :   19910427                                                   
     Old         98 KIEL                 KIEL                   19910427            
     Cnt         4                                                                  
                                                                                    
     ** Control Break (1) **                                                        
          START-DATE :   19910525                                                   
     Old         96 KIEL                 KIEL                   19910525            
     Cnt         5                                                                  
                                                                                    
                                                                                    
     Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
                 Print Exit              Flip        +                       Canc   
    

    The lines Old display the values in the last record found before the control break.

Start of instruction setTo Create a User File to Store the Report Data

You can create a user file to contain the report data by using the Report Destination USERFILE.

  1. Press PF2 (EXIT) to leave the report.

    The Worksheet appears.

  2. Issue the MODES command.

    The Transaction Modes Reporting window appears.

  3. Enter "U" in the Report Destination field as in the following example:

     11:39                      ***** Super Natural *****                 1998-02-18
     SAMPLE4                          - Worksheet -                           SN3011
                                                                                    
     Ref DB    Field Name                     +----Transaction Modes Reporting-----+
     AA  1K    CRUISE-ID .................... !                                    !
     AE  1K 2  START-DATE ................... ! Data Selection .. F  Full-screen   !
     AJ  1K    START-HARBOR ................. !                                    !
     AK  1K    DESTINATION-HARBOR ........... ! Data Change ..... N  None          !
     AP  1  2  CHARTER-YACHT-TYPE ........... !                                    !
     BE        ______________________________ ! Report Type ..... L  List          !
     BF        ______________________________ ! Report Level .... S  Summary       !
     BG        ______________________________ !                                    !
     BH        ______________________________ ! Destination ..... U  User file     !
     BI        ______________________________ !                                    !
     BJ        ______________________________ ! Run Mode ........ O  Online        !
     BK        ______________________________ !                                    !
     BL        ______________________________ ! Batch printer ... 0  (0 - 31)      !
     BM        ______________________________ ! RJE available ... N  (Y/N)         !
                                              !                                    !
                                              +------------------------------------+
     
    
  4. Press Enter.

    The Destination User File window appears with a default user file name and description as in the following example:

     11:22                      ***** Super Natural *****                 1998-02-18
     SAMPLE4                          - Worksheet -                           SN3011
                                                                                    
     Ref DB    Fi +----------------------Destination Userfile----------------------+
     AA  1K    CR !                                                                !
     AE  1K 2  ST ! Userfile name .. SAMPLE4_____________                          !
     AJ  1K    ST ! Description                                                    !
     AK  1K    DE !   CREATED BY: SAMPLE4 (98-02-18 11:28)________________________ !
     AP  1  2  CH !                                                                !
     BE        __ +----------------------------------------------------------------+
     BF        ________________________________ ! Report Level .... S  Summary     !
    
  5. Modify user file name and description (optional).

  6. Press Enter.

    The Key column has been added to the worksheet. You must now mark at least one alphanumeric field of a length between 1 and 29 to make it a key field in the user file.

  7. Mark the Key column next to the field DESTINATION-HARBOR.

    The Worksheet now has the following entries:

     18:02                      ***** Super Natural *****                 1998-02-26
     SAMPLE4                          - Worksheet -                           SN3011
                                                                                    
     Ref DB    Field Name                         Seq  S/C  Key  Func Def  Info Del 
     AA  1K    CRUISE-ID ......................   1__  ___   __   >_   __   __   __ 
     AE  1K 2  START-DATE .....................   4__  C1_   __   >_   __   __   __ 
     AJ  1K    START-HARBOR ...................   2__  ___   __   __   __   __   __ 
     AK  1K    DESTINATION-HARBOR .............   3__  ___   X_   __   __   __   __ 
     AP  1  2  CHARTER-YACHT-TYPE .............   ___  ___   __   __   __   __   __ 
     BE        ________________________________   ___  ___   __   __   __   __   __ 
     BF        ________________________________   ___  ___   __   __   __   __   __ 
     BG        ________________________________   ___  ___   __   __   __   __   __ 
     BH        ________________________________   ___  ___   __   __   __   __   __ 
     BI        ________________________________   ___  ___   __   __   __   __   __ 
     BJ        ________________________________   ___  ___   __   __   __   __   __ 
     BK        ________________________________   ___  ___   __   __   __   __   __ 
     BL        ________________________________   ___  ___   __   __   __   __   __ 
     BM        ________________________________   ___  ___   __   __   __   __   __ 
                                                                                    
                                                                                    
     Fill in required definitions                                                   
     Command ===>                                                                   
     Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
           Help  Next  Exit  Field Incl  Flip  -     +           Sel   Run   Canc   
    
  8. Press PF11 (RUN).

    The report is generated. A user file is created. The user file now appears in the User File List screen.

    For further information on user files, see User Files in the User's Guide.