Sample 8: Dynamic Input Fields

#### Search Results

Search

# Sample 8: Dynamic Input Fields

#### Task: Find the start date, end date and number of bunks of cruises whose start harbor begins with D or E and for cruises whose start harbor begins with U, V or W.

This transaction uses dynamic input fields to enable you to view different ranges of data each time you run it. The transaction uses the Layout Editor to show the range you are currently viewing in the title of the report.

#### Transaction Specification

Primary File | SAG-TOURS-E-CRUISE
Display Fields | 1: START-HARBOR 2: START-DATE 3: END-DATE 4: BUNK-NUMBER
Dynamic Input Fields | HARBOR1 HARBOR2
Selection Criteria | START-HARBOR = HARBOR1 THRU HARBOR2

This section covers the following topics:

- Create the Transaction SAMPLE8

## Create the Transaction SAMPLE8

To Add a Transaction

1. Issue the `ADD TRANSACTION SAMPLE8` command.

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

2. Type the description "Dynamic Input Fields" in the Description field (optional).

To Choose File

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

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

2. Press Enter.

   The Worksheet appears.

To Choose Fields

The report requires data stored in the fields START-HARBOR, START-DATE, END-DATE and BUNK-NUMBER.

1. Enter an "asterisk (*)" in the first position of the Field Name column.

   The Field Selection List window appears.

2. Mark the fields START-HARBOR, START-DATE, END-DATE and BUNK-NUMBER.

   You must use PF2 to page forward to BUNK-NUMBER.

        16:10                      ***** Super Natural *****                 1998-03-15
        SAMPLE8                          - Worksheet -                           SN3011

        Ref DB    Field Name     +----------------Field Selection List----------------+
        BE        *_____________ !     Field Name                        Format  Info !
        BF        ______________ !  _  ID-SUCCESSOR                      N8      __   !
        BG        ______________ !  _  CHARTER-CRUISE                    *G1     __   !
        BH        ______________ !  _  CHARTER-YACHT-TYPE                A30     __   !
        BI        ______________ !  _  ID-CHARTER-BASE                   A8      __   !
        BJ        ______________ !  _  SAILING-CRUISE                    *G1     __   !
        BK        ______________ !  _  ID-SKIPPER                        N8      __   !
        BL        ______________ !  _  CRUISE-PRICE                      P10.3   __   !
        BM        ______________ !  x  BUNK-NUMBER                       P3      __   !
        BN        ______________ !  _  SAILOR                            *G2     __   !
        BO        ______________ !  _  AGE                               P2      __   !
        BP        ______________ !  _  NAME                              A30     __   !
        BQ        ______________ !  _  EXPERIENCE                        A1      __   !
        BR        ______________ !  _  LANGUAGES                         A3      __   !
                                 !                                                    !
                                 +More: - +-------------------------------------------+

3. Press Enter.

   The fields appear in the Field Name column of the Worksheet.

   You can also enter the names directly into the Field Name column.

To Determine Display Sequence

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

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

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

4. Type "4" in the Sequence column next to the field BUNK-NUMBER.

To Define Selection Criteria

The report requires information for cruises with a range of start harbors. You must define two dynamic input fields in which you can enter the first value of the field START-HARBOR you want to see and the last value you want to see when the transaction is run.

1. Press PF10.

   The `SELECTION` command is issued and the Selection Editor appears.

2. Enter "START-HARBOR =" in the editor area.

3. Press PF10.

   The `CONTINUE` command is issued and the Value window appears.

4. Select "Define Dynamic Input Field".

5. Press Enter.

   The Define User Field window appears.

6. Type "Start1" in the Name or Value field.

7. Overtype the existing entry in the Length field with 5.

        17:15                      ***** Super Natural *****                 1998-03-15
        SAMPLE8                       - Selection Editor -                      SNZUL-S

                                  +-----------------Define User Field-----------------+
              1  < START-HARBOR = ! Field:                                            !
              2  <                !                                                   !
              3  <                ! Name or value .. start1__________________________ !
              4  <                ! Format ......... A                                !
              5  <                ! Length ......... 5_                               !
              6  <                ! Dec. places .... _                                !
              7  <                ! Subfield of .... ________________________________ !
              8  <                ! Offset ......... ___                              !
              9  <                ! Dynamic input .. #                                !
             10  <                !                                                   !
             11  <                +---------------------------------------------------+

   The Dynamic Input field is already marked.

8. Press Enter.

   The field name `START1` appears in the first editor line.

9. Type the logical operator `THRU` after `START1`.

10. Press PF10.

    The `CONTINUE` command is issued and the Value window appears.

11. Select " Define Dynamic Input Field".

12. Press Enter.

    The Define User Field window appears.

13. Type "Start2" in the Name or Value field.

14. Overtype the existing entry in the Length field with 5.

15. Press Enter.

    The Selection Editor has the following content:

         17.46                      ***** Super Natural *****                 1998-03-15
         SAMPLE8                       - Selection Editor -                      SNZUL-S

               1  < START-HARBOR = START1 THRU START2                            >    1
               2  <                                                              >    2
               3  <                                                              >    3
               4  <                                                              >    4
               5  <                                                              >    5

Note
You can also enter "START-HARBOR =START1 THRU START2" directly in the editor area and use the `CHECK` command to prompt you through defining the dynamic input fields.

To Edit the Title Element

1. Issue the `LAYOUT` command. You can abbreviate this command to `LA`.

   The Natural Report Manager Layout Overview screen appears:

        10:36                   *** NATURAL REPORT MANAGER ***               1998-03-16
        Layout LSAMPLE8               - Layout Overview -                       NRMPAGE

                            +------------------------------------+
                            I               Title                I
                            +------------------------------------+
                            +------------------------------------+
                            I               Header               I
                            I                                    I
                            +------------------------------------+
                            +------------------------------------+
                            I                List                I
                            I                                    I
                            I                                    I
                            I                                    I
                            I                                    I
                            I                                    I
                            I                                    I
                            I                                    I
                            +------------------------------------+

        Command ===>
        Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
              Help  Set   Exit  Field Edit  Flip              Tech              Canc

2. Position the cursor in the Title layout element.

3. Press PF9.

   The Layout Editor appears with the default Title element in the editor area.

4. Enter the line command `..D3` in the first line of the editor area.

   The editor area is now empty.

5. Position the cursor in information section A where the transaction fields are displayed.

6. Press PF2 until the fields *DATX and *TIMX are displayed.

        11:50                   *** NATURAL REPORT MANAGER ***               1998-03-16
        Layout LSAMPLE8                - Layout Editor -                        NRMEDIT
                                                                          More:       >
          Transaction Fields                      Delimiter Class    Attrib.  Color
        1 START1                         A5       Blank     Text     Default
        2 START2                         A5       _         Text     Intens.
        3 *TIMX                          T        (         Output   Default
        4 *DATX                          D        )         Output   Intens.
        5 *PROGRAM                       A8
        6 *PAGE-NUMBER                   P5.0     Escape Char. = .   Header Char. = &
        All   ---010---+----+----+---030-- ( Title ) +---050---+----+----+---070--- Typ
                                                                                    ___
                                                                                    ___
                                                                                    ___
                                                                                    ___
                                                                                    ___
                                                                                    ___
                                                                                    ___
                                                                                    ___
                                                                                    ___

        Command ===>
        Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
              Help  Set   Exit  Field Edit  Flip  -     +     Tech  <     >     Canc

7. Type "Run" on at position 10 in the second editor line.

8. Type the output delimiter for default output - here the open bracket character "(" followed by the number "4"to position the *DATX field after the text.

9. Press Enter.

10. Type at at position 26.

11. Type the output delimiter for default output - here the open bracket character "(" followed by the number "3"to position the *TIMX field after the text.

12. Type the text "Start harbors starting at position 10"in the third editor line.

13. Position the field Start1 with the output delimiter for intensified output - here the close bracket character ")"- at position 23.

14. Type the text up to but not including starting at position 30 in the third editor line.

15. Position the field Start2 with the output delimiter for intensified output - here the close bracket character " )" - at position 53.

16. Enter the line command `..I` in the third line of the editor area to insert an empty line after the title text.

    The editor area has the following content:

         10:46                   *** NATURAL REPORT MANAGER ***               1998-03-17
         Layout LSAMPLE8                - Layout Editor -                        NRMEDIT
                                                                           More:       >
           Transaction Fields                      Delimiter Class    Attrib.  Color
         1 CRUISE-ID                      N8.0     Blank     Text     Default
         2 CRUISE-TYPE                    A1       _         Text     Intens.
         3 CRUISE-STATUS                  A1       (         Output   Default
         . START                          *G1      )         Output   Intens.
         4 START-DATE                     N8.0
         5 START-TIME                     N6.0     Escape Char. = .   Header Char. = &
         All   ---010---+----+----+---030-- ( Title ) +---050---+----+----+---070--- Typ
                                                                                     Ttl
                   Run on(XXXXXXXX at(XXXXXXXX                                       Ttl
                   Start harbors)XXXXX up to but not including)XXXXX                 Ttl
                                                                                     Ttl
                                                                                     ___
                                                                                     ___
                                                                                     ___
                                                                                     ___
                                                                                     ___

         Command ===>
         Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
               Help  Set   Exit  Field Edit  Flip  -     +     Tech  <     >     Canc

To Run the Transaction

1. Press PF2.

   The Layout Overview screen appears.

2. Press PF8.

   The Worksheet appears:

        15:16                      ***** Super Natural *****                 1998-03-16
        SAMPLE8                          - Worksheet -                           SN3011

        Ref DB    Field Name                         Seq   S/C  Func Def  Info Del
        AE  1K 2  START-DATE .....................   L__   ___   __   __   __   __
        AH  1K 2  END-DATE .......................   L__   ___   __   __   __   __
        AJ  1K    START-HARBOR ...................   L__   ___   __   __   __   __
        AU  1  2  BUNK-NUMBER ....................   L__   ___   __   __   __   __
        BE   #    START1 .........................   L__   ___   __   __   __   __
        BF   #    START2 .........................   L__   ___   __   __   __   __
        BK   V    *DATX ..........................   L__   ___   __   __   __   __
        BL   V    *TIMX ..........................   L__   ___   __   __   __   __
        BM        ________________________________   ___   ___   __   __   __   __
        BN        ________________________________   ___   ___   __   __   __   __
        BO        ________________________________   ___   ___   __   __   __   __
        BP        ________________________________   ___   ___   __   __   __   __
        BQ        ________________________________   ___   ___   __   __   __   __
        BR        ________________________________   ___   ___   __   __   __   __

        Layout has been successfully modified
        Command ===>
        Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
              Help  Next  Exit  Field Incl  Flip    -     +         Sel   Run   Canc

   You can now either save the transaction and execute it later or you can run it to see the report immediately.

3. Issue the `RUN` command. This command is allocated to PF11.

   You can also issue the `RUN` command directly from the Layout Editor.

   The Dynamic Input Value window appears:

        15:16                      ***** Super Natural *****                   1998-03-16
        SAMPLE8                          - Worksheet -                           SN3011

        Ref DB    Field Name                         Seq    +-- Dynamic Input Value --+
        AE  1K 2  START-DATE .....................   L__    !  Transaction:  ISAMPLE8 !
        AH  1K 2  END-DATE .......................   L__    !                         !
        AJ  1K    START-HARBOR ...................   L__    ! START1 .. _____         !
        AU  1  2  BUNK-NUMBER ....................   L__    ! START2 .. _____         !
        BE   #    START1 .........................   L__    +-------------------------+

4. Type "D" in the Start1 field.

5. Type "F" in the Start2 field.

   This will find start harbors which begin with `D` or `E`. If there is a start harbor with the name `F`, it will also be displayed.

6. Press Enter.

   The report is generated:

                 Run on 1998-03-17 at 11:45:03

                 Start harbors D     up to but not including F

            START-HARBOR     START-DATE END-DATE  BUNK-NUMBER
        -------------------- ---------- --------- -----------

        DAKKAR                 19910818  19910921           5
        DUBROVNIK              19910406  19910419           7
        EL SALVADOR            19920412  19920425           4
        ELBA                   19911012  19911025           6
        ELBA                   19910915  19910928           4
        ELBA                   19910907  19910920           6
        ESPIRITO SANTO         19911020  19911109           5

        Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
                    Print Exit              Flip          +                     Canc

                 Run on 1998-03-17 at 11:45:03

                 Start harbors D     up to but not including F

            START-HARBOR     START-DATE END-DATE  BUNK-NUMBER
        -------------------- ---------- --------- -----------

         *** End of report ***

         Number of records processed: = 7

7. Press Enter.

   The Worksheet appears.

8. Press PF11

   The Dynamic Input Value window appears.

9. Type "U" in the Start1 field.

10. Type "W" in the Start2 field.

11. Press Enter.

    The report is generated:

                  Run on 1998-03-17 at 11:58:04

                  Start harbors U     up to but not including W

             START-HARBOR     START-DATE END-DATE  BUNK-NUMBER
         -------------------- ---------- --------- -----------

         VALENCIA               19920516  19920529           4
         VALENCIA               19911005  19911018           6
         VILAMOURA              19920104  19920117           6
         VILAMOURA              19920215  19920228           6
         VILAMOURA              19920404  19920417           4
         VIRGIN ISLANDS         19920405  19920418           6
         VIRGIN ISLANDS         19920419  19920509           6
         VIRGIN ISLANDS         19910209  19910223           6

         Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
                     Print Exit              Flip          +                     Canc

                  Run on 1998-03-17 at 11:58:04

                  Start harbors U     up to but not including W

             START-HARBOR     START-DATE END-DATE  BUNK-NUMBER
         -------------------- ---------- --------- -----------

          *** End of report ***

          Number of records processed: = 8

Note
Notice the new data in the title.