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.
The data in the fields START-DATE and END-DATE is stored in the format YYYYMMDD which is difficult to read at a glance (you can confirm this by adding a report using the file SAG-TOURS-E-CRUISE which has the selection criteria AA and the display fields START-DATE and END-DATE). The following is an example where Y = year, M= month and D = day:
The report requires that the date be presented with the format DD.MM.YY.
To do this, you must create three user fields from the field
START-DATE: one with the year information, one with the
month information and one with the day information. You then join the user
fields together in the order day, month, year with periods (.) using the
Joining Fields (Concatenation)
function in the
Calculation Editor as shown in the following diagram:
You then do the same for the field END-DATE.
Primary File | SAG-TOURS-E-CRUISE |
User Fields | MY-START-DATE MY-START-YEAR MY-START-MONTH MY-START-DAY MY-END-DATE MY-END-YEAR MY-END-MONTH MY-END-DAY |
Display Fields | 1: CRUISE-ID 2: START-HARBOR 3: DESTINATION-HARBOR 4A: MY-START-DATE 4B: MY-END-DATE |
Selection Criteria | CHARTER-YACHT-TYPE = 'ATLANTIC 29' |
CalculationStatement | MY-START-DATE=MY-START-DAY!'.'!MY-START-MONTH!'.'!MY-START-YEAR MY-END-DATE=MY-END-DAY!'.'!MY-END-MONTH!'.'!MY-END-YEAR |
Logical Conditions Statement | 1 I < START-DATE GT 19910701 1 T < MY-START-DATE = 'TOO LATE 1 T < MY-END-DATE = ' ' |
This section covers the following topics:
To add a transaction
Issue the ADD TRANSACTION SAMPLE3
command.
The Add Transaction window appears.
Type "User Fields and Editors" in the Description field (optional).
To Choose a File
The report requires data from the file SAG-TOURS-E-CRUISE.
Type SAG-TOURS-E-CRUISE in the File Name field.
Press Enter.
The Worksheet appears.
To Choose Fields
The report requires data stored in the fields CRUISE-ID, START-HARBOR and DESTINATION-HARBOR.
Type CRUISE-ID, 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 of the section Sample
1.
To Determine Display Sequence for Horizontal Output
Type "1" in the Sequence column next to the field CRUISE-ID.
Type "2" in the Sequence column next to the field START-HARBOR.
Type "3" in the Sequence column next to the field DESTINATION-HARBOR.
To Define User Fields
The report requires the following user fields as described at the beginning of this section: - MY-START-DATE - MY-START-YEAR - MY-START-MONTH - MY-START-DAY - MY-END-DATE - MY-END-YEAR - MY-END-MONTH - MY-END-DAY
Enter MY-START-DATE in the Field Name column.
The Define User Field window appears.
Type "A" in the Format field.
Type "8" in the Length field:
11:35 ***** Super Natural ***** 1998-02-09 SAMPLE3 - Worksheet - SN3011 Ref DB Field Name +-----------------Define User Field-----------------+ AA 1K CRUISE-ID ..... ! Field: MY-START-DATE ! AJ 1K START-HARBOR .. ! ! AK 1K DESTINATION-HAR ! Name or value .. MY-START-DATE___________________ ! BE my-start-date__ ! Format ......... a ! BF _______________ ! Length ......... 8__ ! BG _______________ ! Dec. places .... ! BH _______________ ! Subfield of .... ________________________________ ! BI _______________ ! Offset ......... ___ ! BJ _______________ ! Dynamic input .. _ ! BK _______________ ! ! BL _______________ +---------------------------------------------------+ |
Press Enter.
The user field MY-START-DATE is created.
Enter MY-START-YEAR in the Field Name column.
The Define User Field window appears.
Type "A" in the Format field.
Type "2" in the Length field:
This user field is going to take part of the value of the database field START-DATE.
Type START-DATE in the Subfield Of field.
This user field is going to take the third (3rd) and fourth (4th) characters of the field START-DATE, so you must tell Super Natural to ignore the first two characters.
Type " 2" in the Offset field.
11:50 ***** Super Natural ***** 1998-02-09 SAMPLE3 - Worksheet - SN3011 Ref DB Field Name +-----------------Define User Field-----------------+ AA 1K CRUISE-ID ..... ! Field: MY-START-YEAR ! AJ 1K START-HARBOR .. ! ! AK 1K DESTINATION-HAR ! Name or value .. MY-START-YEAR___________________ ! BE U MY-START-DATE . ! Format ......... a ! BF my-start-year__ ! Length ......... 2__ ! BG _______________ ! Dec. places .... _ ! BH _______________ ! Subfield of .... start-date______________________ ! BI _______________ ! Offset ......... 2__ ! BJ _______________ ! Dynamic input .. _ ! BK _______________ ! ! BL _______________ +---------------------------------------------------+ |
Press Enter.
The user field MY-START-YEAR is created.
Enter MY-START-MONTH in the Field Name column.
The Define User Field window appears.
Type "A" in the Format field.
Type "2" in the Length field:
This user field is also going to take part of the value of the database field START-DATE.
Type START-DATE in the Subfield Of field.
This user field is going to take the fifth (5th) and sixth (6th) characters of the field START-DATE, so you must tell Super Natural to ignore the first four characters.
Type " 4" in the Offset field.
11:54 ***** Super Natural ***** 1998-02-09 SAMPLE3 - Worksheet - SN3011 Ref DB Field Name +-----------------Define User Field-----------------+ AA 1K CRUISE-ID ..... ! Field: MY-START-MONTH ! AJ 1K START-HARBOR .. ! ! AK 1K DESTINATION-HAR ! Name or value .. MY-START-MONTH__________________ ! BE U MY-START-DATE . ! Format ......... a ! BF U MY-START-YEAR . ! Length ......... 2__ ! BG my-start-month_ ! Dec. places .... _ ! BH _______________ ! Subfield of .... start-date_____________________ ! BI _______________ ! Offset ......... 4__ ! BJ _______________ ! Dynamic input .. _ ! BK _______________ ! ! BL _______________ +---------------------------------------------------+ |
Press Enter.
The user field MY-START-MONTH is created.
Enter MY-START-DAY in the Field Name column.
The Define User Field window appears.
Type "A" in the Format field.
Type " 2" in the Length field:
This user field is also going to take part of the value of the database field START-DATE.
Type START-DATE in the Subfield Of field.
This user field is going to take the seventh (7th) and eighth (8th) characters of the field START-DATE, so you must tell Super Natural to ignore the first six characters.
Type "6" in the Offsetfield.
11:59 ***** Super Natural ***** 1998-02-09 SAMPLE3 - Worksheet - SN3011 Ref DB Field Name +-----------------Define User Field-----------------+ AA 1K CRUISE-ID ..... ! Field: MY-START-DAY ! AJ 1K START-HARBOR .. ! ! AK 1K DESTINATION-HAR ! Name or value .. MY-START-DAY____________________ ! BE U MY-START-DATE . ! Format ......... a ! BF U MY-START-YEAR . ! Length ......... 2__ ! BG U MY-START-MONTH ! Dec. places .... _ ! BH my-start-day___ ! Subfield of .... start-date______________________ ! BI _______________ ! Offset ......... 6__ ! BJ _______________ ! Dynamic input .. _ ! BK _______________ ! ! BL _______________ +---------------------------------------------------+ |
Press Enter.
The user field MY-START-DAY is created.
Create the other user fields as shown in the table below:
Field | Format | Length | Subfield Of | Offset |
---|---|---|---|---|
MY-END-DATE | A | 8 | ||
MY-END-YEAR | A | 2 | END-DATE | 2 |
MY-END-MONTH | A | 2 | END-DATE | 4 |
MY-END-DAY | A | 2 | END-DATE | 6 |
To Determine Display Sequence for Vertical Output
The field MY-START-DATE is to be displayed above the field MY-END-DATE and to the right of the other display fields.
Type "4A" in the Sequence column next to the field MY-START-DATE.
Type "4B" in the Sequence column next to the field MY-END-DATE.
To Change Header of Vertical Output Column
Enter "OD" in the Definition (Def) column next to the fieldMY-START-DATE.
The Define User Field Output window appears.
Enter "Cruise From To" in the Heading fields as shown in the following diagram:
14:01 ***** Super Natural ***** 1998-02-09 SAMPLE3 - Worksheet - SN3011 Ref DB Field Na +-----------------Define User Field Output-----------------+ AA 1K CRUISE-I ! Field: MY-START-DATE ! AE 1K 2 START-DA ! ! AH 1K 2 END-DATE ! Format/Length ....... A8 ! AJ 1K START-HA ! Numeric sign ........ _ (Y/N) ! AK 1K DESTINAT ! Output length ....... 8__ ! AP 1 2 CHARTER- ! dec. places .. _ ! BE U MY-START ! Heading ............. CRUISE________________________ ! BF U MY-START ! FROM________________________ ! BG U MY-START ! TO__________________________ ! BH U MY-START ! Edit mask ! BI U MY-END-D ! ______________________________________________________ ! BJ U MY-END-Y ! Suppress identical values .. _ (Y/N) ! BK U MY-END-M ! Print zero values .......... _ (Y/N) ! BL U MY-END-D ! ! +----------------------------------------------------------+ |
The Worksheet now has the following entries:
13:25 ***** Super Natural ***** 1998-02-09 SAMPLE3 - Worksheet - SN3011 Ref DB Field Name Seq S/C Func Def Info Del AA 1K CRUISE-ID ...................... 1__ ___ __ __ __ __ AJ 1K START-HARBOR ................... 2__ ___ __ __ __ __ AK 1K DESTINATION-HARBOR ............. 3__ ___ __ __ __ __ BE U MY-START-DATE .................. 4A_ ___ __ __ __ __ BF U MY-START-YEAR .................. ___ ___ __ __ __ __ BG U MY-START-MONTH ................. ___ ___ __ __ __ __ BH U MY-START-DAY ................... ___ ___ __ __ __ __ BI U MY-END-DATE .................... 4B_ ___ __ __ __ __ BJ U MY-END-YEAR .................... ___ ___ __ __ __ __ BK U MY-END-MONTH ................... ___ ___ __ __ __ __ BL U MY-END-DAY ..................... ___ ___ __ __ __ __ BM ________________________________ ___ ___ __ __ __ __ BN ________________________________ ___ ___ __ __ __ __ BO ________________________________ ___ ___ __ __ __ __ 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 |
Notice that the user fields are marked with a 'U' in the DB Column.
To Define Selection Criteria
The report requires data for cruises of charter yacht type ATLANTIC 29.
Issue the SELECTION
command.
You can abbreviate this command to
SEL
.
The Selection Editor appears.
Enter "CHARTER-YACHT-TYPE = 'ATLANTIC 29'" in the editor area.
Note:
The field CHARTER-YACHT-TYPE now appears in
the Field Name column of the Worksheet.
To Present Start Date and End Date of Cruise in the Format DD.MM.YY.
Issue the CALCULATION
command. You can
abbreviate this command to CAL
.
The Calculation Editor appears. The first result field in the editor
area will be the user field MY-START-DATE and will be
composed of the user fields MY-START-YEAR,
MY-START-MONTH and MY-START-DAY
separated by periods (.). You use the Joining Fields
(concatenation)
function to join the fields and periods.
Type "MY-START-DATE = MY-START-DAY".
Type the Joining Fields operator valid for your site.
If you do not know which operator to use, ask your Super Natural administrator.
Or:
Issue the CONTINUE
command. This command
is allocated to PF10.
The Fields - Operators window appears.
Select Select Operator.
14:24 ***** Super Natural ***** 1998-02-10 SAMPLE3 - Calculation Editor - SNZUL-C +---Fields - Operators---+ 1 < MY-START-DATE=MY-START-DAY ! ! 2 < ! _ Invoke Field List ! 3 < ! _ ROUNDED ! 4 < ! _ Define User Field ! 5 < ! x Select Operator ! 6 < ! ! 7 < ! Mark to replace: ! 8 < ! ! 9 < +------------------------+ |
Press Enter.
The Joining Fields window appears.
Select the joining fields operator.
12:09 ***** Super Natural ***** 1998-05-24 SAMPLE3 - Calculation Editor - SNZUL-C +---------Joining Field----------+ 1 < MY-START-DATE=MY-START-DAY ! ! 2 < ! _ ! Joining Field Operator ! 3 < ! ! 4 < ! Mark to replace: _ ! 5 < ! ! 6 < +--------------------------------+ 7 < ! Mark to replace: ! 8 < ! ! 9 < +------------------------+ |
Press Enter.
The joining fields operator valid at your site is entered at the end of the calculation statement.
Issue the CONTINUE
command. This command
is allocated to PF10.
The Field or Value window appears.
Select Alphanumeric Constant.
14:34 ***** Super Natural ***** 1998-02-09 SAMPLE3 - Calculation Editor - SNZUL-C +---------Field or Value----------+ 1 < MY-START-DATE = MY-START-DAY ! ! ! 2 < ! X Alphanumeric Constant ! 3 < ! _ Hex Constant ! 4 < ! _ Define Dynamic Input Field ! 5 < ! _ Invoke Field List ! 6 < ! ! 7 < +---------------------------------+ |
Press Enter.
Enter a period (.) in the Alphanumeric Constant window which appears.
A period (.) is entered in quotation marks (' ') at the end of the calculation statement.
For further information on constants see Constants in Fields in the User's Guide.
Type the rest of the calculation statement as shown in the following
diagram using the joining fields
operator valid
at your site.
14:06 ***** Super Natural ***** 1998-02-09 SAMPLE3 - Calculation Editor - SNZUL-C 1 < MY-START-DATE=MY-START-DAY!'.'!MY-START-MONTH!'.'! > 1 2 < MY-START-YEAR > 2 3 < MY-END-DATE=MY-END-DAY!'.'!MY-END-MONTH!'.'! > 3 4 < MY-END-YEAR > 4 5 < > 5 6 < > 6 7 < > 7 8 < > 8 9 < > 9 10 < > 10 11 < > 11 12 < > 12 13 < > 13 14 < > 14 15 < > 15 Command ===> Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12--- Help Next Exit Field Check Flip - + Cont Run Canc |
For further information on joining fields and the joining fields operator, see Joining Fields in Editors in the User's Guide.
To Define Logical Conditions
The report requires that the text 'Too Late' be displayed in the Cruise/To/From column for cruises which start later than July 1st 1991.
Issue the LOGIC
command. You can
abbreviate this command to LOG
.
The Logical Conditions Editor appears.
Type "START-DATE GT 19910701" in the IF line.
The field START-DATE now appears in the Field Name column in the Worksheet.
Type "MY-START-DATE = 'TOO LATE'" in the THEN line.
Tab to the Clause Type column (on the right).
Overtype the E
which is already there
with a T
to create a new THEN line.
Press Enter.
Type "MY-END-DATE = ' '" in the new THEN line.
The Logical Conditions Editor now contains the following entries:
16:11 ***** Super Natural ***** 1998-02-09 SAMPLE3 - Logical Conditions Editor - SNZUL-L 1 I < START-DATE GT 19910701 > I 1 1 T < MY-START-DATE = 'TOO LATE' > T 1 1 T < MY-END-DATE = ' ' > T 1 < > _ < > _ < > _ < > _ < > _ < > _ < > _ < > _ < > _ < > _ < > _ < > _ Define logic conditions 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 |
To Run the Transaction
Run the transaction as described in Step 6 of the section Sample 1 earlier in this section.
The report is generated. Part of the resulting report is shown below:
16:16:05 CHARTER-YACHT-TYPE = 'ATLANTIC 29' 1998-02-09 ISAMPLE3 4 CRUISE-ID START-HARBOR DESTINATION-HARBOR CRUISE FROM TO --------- -------------------- -------------------- -------- 97 KIEL KIEL 8.6.91 22.6.91 98 KIEL KIEL 22.6.91 29.6.91 99 KIEL KIEL 29.6.91 10.8.91 100 KIEL KIEL TOO LATE 101 KIEL KIEL TOO LATE 102 KIEL KIEL TOO LATE Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12--- Print Exit Flip + Canc |