Simple question for all you QTP Guru's ?
Latimer, Richard
richard.latimer@airways.co.nz
Fri, 3 May 2002 08:58:05 +1200
Margaret,
a somewhat voluminous example follows - we use this technique in several
places but this example is the simplest!
This one uses a subfile but it can be used with any output statement to a
file or combination of files. We are 6.07 on AS/400 but as far as I am am
aware it works on all versions.
The key to the technique is the timing of the item statements in relation to
the output (or subfile statement). I was also told when I was shown this
technique that it can accidentally cause some really bizarre bugs when
people who don't understand the PH processing model litter "items" and
"defines" around without thinking !!
Drop me a note off list if you want more explanation!
good luck
Richard Latimer
Airways New Zealand
Ph +64 4 471 4744
Fax +64 4 471 0395
cancel clear
set default
set verify
;------------------------------------------------------------
;/T/ Build subfile for Duplicate Reporting DUP002
;/A/
;/P/ Richard Latimer
;/Q/ QTP
;
;/D/ Description: Subfiles all current (ie not transferred) records
;/D/ in flight data for duplicate flight reporting. Each
;/D/ subfiled record has the time difference between
;/D/ itself and the previous record to allow selection
;/D/ by related quiz reports dup002a and dup002b
;/D/ dup002c and dup002d
;
;Date Written: 18/02/97
;
;Modification History:
;Date Prog Reason
;----------------------------------------------------------------
;28/05/97 RAL Added airport of departure to sort statement
;05/03/98 RAL Added procstatus of 'PN', formatting, layout,
; subfile location
;================================================================
SET PROCESS NOLIMIT
ACCESS flight_data
; only interested in current flights, history is gone!!
CHOOSE ind_procstatus "" "PN" "PR" "AR"
; the following defined and temporary items are the basis of the
; process as by they enable us to compare values on the current
; record with those on the previous record.
; these temp items relate to the 'previous' record
TEMPORARY t_prev_idy_mov FLOAT SIZE 8 ;mov't ID
TEMPORARY t_prev_dte_mov DATE ;mov date
TEMPORARY t_prev_tme_mov INT SIGN SIZE 4 ;mov time
TEMPORARY t_prev_num_movday ZONED SIZE 6 ;mov date in days
TEMPORARY t_prev_num_movsec ZONED SIZE 6 ;mov time in secs
; these defined items relate to the 'current' record
DEFINE t_dte_mov DATE = dte_arr if dte_arr <> 0 else dte_dep
DEFINE t_tme_mov NUM*6 = tme_ata if dte_arr <> 0 else tme_atd
DEFINE t_num_movday NUM*6 = days(t_dte_mov)
DEFINE t_num_movsec NUM*6 = &
((FLOOR(t_tme_mov/10000)) * 3600) + &
(((FLOOR(t_tme_mov/100)) - &
((FLOOR(t_tme_mov/10000)) * 100)) * 60) &
+ (t_tme_mov - &
((FLOOR(t_tme_mov/100)) * 100))
; this is the time difference between current and previous and will
; be used by subsequent quiz reports to evaluate whether a flight
; is or isn't a duplicate
DEFINE t_diff NUM*10 = &
ABSOLUTE &
(((t_num_movday*86400) + t_num_movsec) &
-((t_prev_num_movday*86400) + t_prev_num_movsec))
; the sort statement brings records together such that we are
; able to compare the time difference between flights. It is
; assumed that they will be in the system in something approaching
; chronological order. Quiz selections will take care of airport
; pairs
SORT ON idy_flt ON idy_addep ON t_dte_mov ON t_tme_mov
SUBFILE dup002 KEEP ON ERRORS REPORT &
INCLUDE idy_mov, t_prev_idy_mov, t_diff
; these items are initialised in the output phase so they are
; available for use in the input phase of the next record.
ITEM t_prev_idy_mov = idy_mov
ITEM t_prev_dte_mov = dte_arr if dte_arr <> 0 else dte_dep
ITEM t_prev_tme_mov = tme_ata if dte_arr <> 0 else tme_atd
ITEM t_prev_num_movday = days(t_dte_mov)
ITEM t_prev_num_movsec = &
((FLOOR(t_TME_mov/10000)) * 3600) + &
(((FLOOR(t_tme_mov/100)) - &
((FLOOR(t_tme_mov/10000)) * 100)) * 60) &
+ (t_tme_mov - &
((FLOOR(t_tme_mov/100)) * 100))
BUILD dup002
-----Original Message-----
From: mjohns@accubanc.com [mailto:mjohns@accubanc.com]
Sent: Friday, 3 May 2002 3:24 a.m.
To: Deskin, Bob
Cc: PowerHouse List (E-mail)
Subject: Simple question for all you QTP Guru's ?
Is there a way to retrieve the previous record to compare to the current,
if so what is the syntax.
running Vax alpha
Q U I Z (7.10.G1)
Copyright 1998 COGNOS INC. (ALPHA)
thanks
Margaret Johns
Group Lead Accutrac Development
Information Services (Dallas)
National City / Accubanc
Telephone: 972-982-7236
Fax: 972-982-7290
E-mail: mjohns@accubanc.com
= = = = = = = = = = = = = = = = = = = = = = = = = = = =
Mailing list: powerh-l@lists.swau.edu
Subscribe: "subscribe" in message body to powerh-l-request@lists.swau.edu
Unsubscribe: "unsubscribe" in message body to
powerh-l-request@lists.swau.edu
http://lists.swau.edu/mailman/listinfo/powerh-l
This list is closed, thus to post to the list you must be a subscriber.
**********************************************************************
This electronic message together with any attachments is confidential. If
you receive it in error: (i) you must not use, disclose, copy or retain
it; (ii) please contact the sender immediately by reply email and then
delete the emails. Views expressed in this email may not be those of the
Airways Corporation of New Zealand Limited
**********************************************************************