Version 8.2.3
 —  Tutorial  —

Sample 9: RPC Service in Context Mode with Primary, Secondary and Lookup files

Task: Generate an RPC service based on the travelling information to process on your PC via Excel.

The RPC Generation is executed in Context mode.

Prerequisites

Your administrator has to set the Service Type of the Service Generation Options in you user profile to R.

If you Server is running under Natural Security, you have to set up your RPC example client to run this example correctly.

Start of instruction setTo set up the RPC sample client for Natural Security

  1. Execute the Program USR1071P from the system library SYSEXT in your Natural for Windows.

  2. Fill the following fields in the appearing screens as follows:

Transaction Specification

Primary File SAG-TOURS-E-YACHT
Secondary File SAG-TOURS-E-CRUISE
Link field in primary file YACHT-ID
Link field in secondary file ID-YACHT
Lookup File SAG-TOURS-E-PERSON
Link field in secondary file ID-SKIPPER
Link field in lookup file PERSON-ID
Display Fields 1: YACHT-NAME
2: YACHT-ID
3: START-DATE
4: START-HARBOR
5: DESTINATION-HARBOR
6: FIRST-NAME-1
7: SURNAME
8: COUNTRY
Selection Criteria YACHT-ID EQ 140 THRU 180 AND ID-SKIPPER GT 0

This section covers the following topics:


Create the Transaction SAMPLE9

Start of instruction setTo Add a Transaction

  1. Issue the ADD TRANSACTION SAMPLE9 command.

    The Add Transaction window appears with the transaction name already entered in the Transaction IDfield.

  2. Type the description "Context Mode with Primary, Secondary and Lookup Files" in the Description field (optional).

Start of instruction setTo Choose Primary File

The report requires data from the fileSAG-TOURS-E-YACHT.

  1. Type the file name SAG-TOURS-E-YACHT in the File Name field. You can alternatively use the Asterisk (*) List function.

  2. Press Enter.

    The Worksheet appears.

Start of instruction setTo Choose Secondary File

  1. Issue the INCLUDE command

    The Include Files window appears.

  2. Enter SAG-TOURS-E-CRUISE in the Secondary File field.

     17:31                      ***** Super Natural *****                  2000-10-13
     SAMPLE9                          - Worksheet -                           SN3011
                                                                                    
     Ref DB    Field Name    +--------------------Include Files--------------------+
     BE        _____________ !                                                     !
     BF        _____________ ! Primary File ..... SAG-TOURS-E-YACHT ______________ !
     BG        _____________ ! Secondary File ... sag-tours-e-cruise______________ !
     BH        _____________ !                                                     !
     BI        _____________ ! Add Lookup File .. ________________________________ !
     BJ        _____________ ! Process Lookups .. _                                !
     BK        _____________ !                                                     !
     BL        _____________ +-----------------------------------------------------+
     BM        ________________________________   ___   ___   __   __   __   __     
     BN        ________________________________   ___   ___   __   __   __   __     
     BO        ________________________________   ___   ___   __   __   __   __     
     BP        ________________________________   ___   ___   __   __   __   __     
     BQ        ________________________________   ___   ___   __   __   __   __     
     BR        ________________________________   ___   ___   __   __   __   __     
                                                                                    
                                                                                    
     Fill in required definitions                                                   
     Command ===>                                                                   
     Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
           Help        Exit              Flip                                Canc   
    

    Note:
    You can also use the Asterisk (*) List function.

    The Define File Link window appears.

  3. Type YACHT-ID in the Link Field in Primary File field.

  4. Type ID-YACHT in the Link Field in Secondary File field.

     17:31                      ***** Super Natural *****                   2000-10-13
     SAMPLE9                          - Worksheet -                           SN3011
                                                                                    
     Ref DB    Field Name    +--------------- +----------Define File Link----------+
     BE        _____________ !                !                                    !
     BF        _____________ ! Primary File . ! Primary File                       !
     BG        _____________ ! Secondary File !   SAG-TOURS-E-YACHT                !
     BH        _____________ !                ! Link field in primary file         !
     BI        _____________ ! Add Lookup Fil !   yacht-id________________________ !
     BJ        _____________ ! Process Lookup ! From position .. ...               !
     BK        _____________ !                !   to position .. ...               !
     BL        _____________ +--------------- !                                    !
     BM        ______________________________ ! Secondary File                     !
     BN        ______________________________ !   SAG-TOURS-E-CRUISE               !
     BO        ______________________________ ! Link field in secondary file       !
     BP        ______________________________ !   id-yacht________________________ !
     BQ        ______________________________ !                                    !
     BR        ______________________________ +------------------------------------+
     
    

    Note:
    You can also use the Asterisk (*) List function to review the field list for each file.

  5. Press Enter.

    The Define File Link window closes.

  6. Press Enter.

    The Include Files window closes.

Start of instruction setTo Choose Lookup File

  1. Issue the INCLUDE command.

    The Include Files window appears.

  2. Enter SAG-TOURS-E-PERSON in the Add Lookup File field.

    Note:
    You can also use the Asterisk (*) List function.

    The Define File Lookup window appears.

  3. Type ID-SKIPPER in the Lookup Link File field.

  4. Type PERSON-ID in the Lookup Field in Lookup File.

    Note:
    You can also use the Asterisk (*) List function to review the field list for each file.

  5. Press Enter.

    Because the Select Lookup Display Fields field is marked by default, the Field Selection List window for the lookup file appears.

  6. Mark the fields SURNAME, FIRST-NAME-1 and COUNTRY to select them.

Start of instruction setTo Choose Fields

The report requires data stored in the fields YACHT-ID, YACHT-NAME, START-DATE, START-HARBOR, DESTINATION-HARBOR, ID-YACHT, ID-SKIPPER, PERSON-ID, SURNAME, FIRST-NAME-1, COUNTRY.

Start of instruction setTo Determine Display Sequence

  1. Type "1" in the Sequence column next to the field YACHT-NAME.

  2. Type "2" in the Sequence column next to the field YACHT-ID.

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

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

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

  6. Type "6" in the Sequence column next to the field FIRST-NAME-1.

  7. Type "7" in the Sequence column next to the field SURNAME.

  8. Type "8" in the Sequence column next to the field COUNTRY.

    Now your worksheet looks as follows:

     18:27                      ***** SUPER NATURAL *****                 2000-09-29
     SAMPLE9                          - Worksheet -                           SN3011
    
     Ref DB    Field Name                         Seq   S/C  Func Def  Info Del
     AA  1K    YACHT-ID .......................   2__   ___   __   __   __
     AB  1K    YACHT-NAME .....................   1__   ___   __   __   __
     AS  2K 2  START-DATE .....................   3__   ___   __   __   __
     AX  2K    START-HARBOR ...................   4__   ___   __   __   __
     AY  2K    DESTINATION-HARBOR .............   5__   ___   __   __   __
     AZ  2K    ID-YACHT .......................   ___   ___   __   __   __
     BG  2K 2  ID-SKIPPER .....................   ___   ___   __   __   __
     BS  LK 3  PERSON-ID ......................                    __   __
     BT  L  3  SURNAME ........................   7__   ___   __   __   __
     BU  L  3  FIRST-NAME-1 ...................   6__   ___   __   __   __
     BX  L  3  COUNTRY ........................   8__   ___   __   __   __
     BY        ________________________________
     BZ        ________________________________
     CA        ________________________________
    
    
     Transaction SAMPLE9 successfully executed
     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 Define Selection Criteria

The report requires information on the Yacht-IDs and the Skipper-IDs.

  1. Press PF10.

    The SELECTION command is issued and the Selection Editor appears.

  2. Enter "YACHT-ID EQ 140 THRU 180 AND ID-SKIPPER GT 0" in the editor area.

    The Selection Editor has the following content:

     18:19                      ***** SUPER NATURAL *****                 2000-09-29
     SAMPLE9                       - Selection Editor -                      SNZUL-S
    
    
           1  < YACHT-ID EQ 140 THRU 180 AND ID-SKIPPER GT 0                 >    1
           2  <                                                              >    2
           3  <                                                              >    3
           4  <                                                              >    4
           5  <                                                              >    5
           6  <                                                              >    6
           7  <                                                              >    7
           8  <                                                              >    8
           9  <                                                              >    9
          10  <                                                              >   10
          11  <                                                              >   11
          12  <                                                              >   12
          13  <                                                              >   13
          14  <                                                              >   14
          15  <                                                              >   15
    
     Define selection lines or use CONTINUE
     Command ===>
     Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
           Help  Next  Exit  Field Check Flip    -     +         Cont  Run   Canc

Note:
You can use the CHECK command to prompt you through defining the dynamic input fields.

Start of instruction setTo Run the Transaction

  1. Issue the RUN command. This command is allocated to PF11.

  2. Press Enter.

    The report is displayed:

     2000-09-29  YACHT-ID EQ 140 THRU 180 AND ID-SKIPPER GT 0                  1
     18:25:10
     ISAMPLE9
               YACHT-NAME           YACHT-ID  START-DATE     START-HARBOR      DESTI
     ------------------------------ --------- ---------- -------------------- ------
    
     FLYING DUTCHMAN                      144   19911012 ELBA                 ALGHER
     FLYING DUTCHMAN                      144   19911026 ALGHERO              PALMA
     FLYING DUTCHMAN                      144   19911109 PALMA                ANDRAI
     FLYING DUTCHMAN                      144   19911123 ANDRAITX             ALICAN
     FLYING DUTCHMAN                      144   19911207 ALICANTE             MALAGA
     FLYING DUTCHMAN                      144   19911221 MALAGA               VILAMO
     FLYING DUTCHMAN                      144   19920104 VILAMOURA            HUELVA
     FLYING DUTCHMAN                      144   19920118 HUELVA               CADIZ
     FLYING DUTCHMAN                      144   19920201 CADIZ                VILAMO
     FLYING DUTCHMAN                      144   19920215 VILAMOURA            HUELVA
     FLYING DUTCHMAN                      144   19920229 HUELVA               JOSE B
     CUCA RACHA                           145   19911019 KORFU                KALAMA
     CUCA RACHA                           145   19911005 AQUILEIA             KORFU
     CUCA RACHA                           145   19911102 KALAMATA             HERAKL
     CUCA RACHA                           145   19911116 HERAKLEION           HERAKL
    
     Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
                 Print Exit              Flip          +   Posi    <     >   Canc
    
     2000-09-29  YACHT-ID EQ 140 THRU 180 AND ID-SKIPPER GT 0                  15
     18:27:14
     ISAMPLE9
               YACHT-NAME           YACHT-ID  START-DATE     START-HARBOR      DESTI
     ------------------------------ --------- ---------- -------------------- ------
    
      *** End of report ***
    
      Number of records processed: = 196
    
    
    
  3. Press PF3.

    The Worksheet appears:

     18:27                      ***** SUPER NATURAL *****                 2000-09-29
     SAMPLE9                          - Worksheet -                           SN3011
    
     Ref DB    Field Name                         Seq   S/C  Func Def  Info Del
     AA  1K    YACHT-ID .......................   2__   ___   __   __   __
     AB  1K    YACHT-NAME .....................   1__   ___   __   __   __
     AS  2K 2  START-DATE .....................   3__   ___   __   __   __
     AX  2K    START-HARBOR ...................   4__   ___   __   __   __
     AY  2K    DESTINATION-HARBOR .............   5__   ___   __   __   __
     AZ  2K    ID-YACHT .......................   ___   ___   __   __   __
     BG  2K 2  ID-SKIPPER .....................   ___   ___   __   __   __
     BS  LK 3  PERSON-ID ......................                    __   __
     BT  L  3  SURNAME ........................   7__   ___   __   __   __
     BU  L  3  FIRST-NAME-1 ...................   6__   ___   __   __   __
     BX  L  3  COUNTRY ........................   8__   ___   __   __   __
     BY        ________________________________
     BZ        ________________________________
     CA        ________________________________
    
    
     Transaction SAMPLE9 successfully executed
     Command ===>
     Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
           Help  Next  Exit  Field Incl  Flip    -     +         Sel   Run   Canc

Top of page

Generate the RPC Service

Start of instruction setTo generate the RPC Service for the transaction SAMPLE9

  1. Issue the command GENERATE RPC in the Worksheet of the transaction SAMPLE9 and press Enter.

    The following window appears:

     18:27                      ***** SUPER NATURAL *****                 2000-09-29
     SAMPLE9                          - Worksheet -                           SN3011
                                         !-------------------------------------------!   
     Ref DB    Field Name                !          RPC-Service Generation           !
     AA  1K    YACHT-ID ................ !                                           !
     AB  1K    YACHT-NAME .............. !  The RPC Service will be stored with      !
     AS  2K 2  START-DATE .............. !      Object Name ..............           !
     AX  2K    START-HARBOR ............ !      in Library ...............           !
     AY  2K    DESTINATION-HARBOR ...... !      with Generation Mode ..... Context   !
     AZ  2K    ID-YACHT ................ !      and Result Record Limit .. 1092      !
     BG  2K 2  ID-SKIPPER .............  !                                           !
     BS  LK 3  PERSON-ID ............... !    _  Generate with these options         !
     BT  L  3  SURNAME ................. !    X  Change options before generation    !
     BU  L  3  FIRST-NAME-1 ............ !    _  Modify Transaction                  !
     BX  L  3  COUNTRY ................. !-------------------------------------------!
     BY        _________________________
     BZ        ________________________________
     CA        ________________________________
    
    
    
     Command ===>
     Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
                                         Flip                                Canc
  2. Mark the option Change options before generation and press Enter.

    The following window appears:

     19:49                      ***** SUPER NATURAL *****                 2000-10-17
     SAMPLE9                          - Worksheet -                           SN3011
                                     !----------------------------------------------!
     Ref DB    Field Name            !   RPC-Service - Modify Generation Options    !
     AA  1K    YACHT-ID ...........  !                                              !
     AB  1K    YACHT-NAME .........  !  RPC Service Object Name ........            !
     AS  2K 2  START-DATE .........  !              Library ............            !
     AX  2K    START-HARBOR .......  !                                              !
     AY  2K    DESTINATION-HARBOR .  !  Generation Mode ................ C  Context !
     AZ  2K    ID-YACHT ...........  !  Limit of Result Records ........ 1092___    !
     BG  2K 2  ID-SKIPPER .........  !  (Max. possible Result Records .. 1092    )  !
     BS  LK 3  PERSON-ID ..........  !----------------------------------------------!
     BT  L  3  SURNAME ............        	!                          !
     BU  L  3  FIRST-NAME-1 ............    ! _  Modify Transaction    !
     BX  L  3  COUNTRY .................    !--------------------------!
     BY        _________________________
     BZ        ________________________________
     CA        ________________________________
    
    
    
     Command ===>
     Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
                                         Flip                                Canc
  3. Specify the RPC Service Object Name "RPCSMPL1" and the Library "NSNSAMPL" to generate the RPC Service.

  4. Select Generation Mode Context.

  5. Delete the Record Limit and press Enter to receive the recommended record limit for the generation.

  6. Press Enter.

    The RPC Service is generated. You can view it by logging on to the respective library and choosing the RPC Service Object. You will find the description of the source in the Administration documentation.

Top of page

Proceed the data on your PC

Start of instruction setTo proceed the data on your PC

Before you can work with the generated RPC Service, you have to set up your Natural environment and load the example data from the Documentation CD to your Natural for Windows environment. You will find the description how to set up your environment for the RPC Service in the Setting up Super Natural documentation.

  1. Open your Natural for Windows.

  2. Execute User Libraries > NSNSAMPL > Dialogs > Menu by using the Execute button in the symbol list.

    The following dialog appears:

    graphics/9nat1.gif

  3. Select Sample 1 (Context Area) in the Data Retrieval field.

  4. Choose Get Data to load the sample data.

    Now you can browse the data.

  5. In order to proceed with this data on your PC, send it to Excel by selecting the Send to Excel button.

    The data is sent to Excel and inserted into a table.

Top of page