Output Phase reading - 1 more tip
Ken Langendock
ken.langendock at rogers.com
Wed Aug 19 10:46:29 CDT 2009
I forgot to mention one other trick I learned over the years. OUTPUT PHASE READING AT FINAL.
Let’s say you are creating a QTP extract that has multiple parts/requests. After each request you end up with more fields added to the subfile read in until you get to the final subfile you want.
In this case you would do something like this (Simple view NOT A REAL WORLD EXAMPLE):
REQUEST 1
ACCESS Orders
; do something
SUBFILE sf001 include Orders
REQUEST 2
ACCESS *sf001 link to OrderDetails
SUBFILE sf002 include sf001, fields from OrderdDetails
REQUEST 3
ACCESS *sf002 link to Products
SUBFILE sf003 include sf002, fields from Products
This method of coding has performance issues. Every time you read a file and output another one, there is more activity with the O/S, Buffers, etc.
BUT, if you take an OUTPUT PHASE READ approach and put all the fields in the first subfile and then each request just updates the fields it needs to you get better performance again (Marginal, but I have proven this back in the 80’s):
REQUEST 1
ACCESS Orders
; the following two statements open the files with nothing in it at the beginning of the output phase ONCE!!!!.
OUTPUT OrderDetails ADD UPDATE NOITEMS AT FINAL
OUTPUT Products ADD UPDATE NOITEMS AT FINAL
SUBFILE sf001 include Orders, fields from OrderDetails, fields from Products
REQUEST 2
ACCESS *sf001 link to OrderDetails
OUTPUT sf001
ITEM fields OF sf001 FINAL fields of OrderdDetails
REQUEST 3
ACCESS *sf001 link to Products
OUTPUT sf001
ITEM fields OF sf001 FINAL fields of Products
Some people will say “I can just create TEMPS to do that”, but if you are reporting the contents of this subfile in QUIZ, you have to add all the attributes to the columns in your REPORT and FOOTING statements. This way all the attributes come with the subfile. I try to NEVER create a TEMPORARY item that will be included in a subfile if I can.
Again, you know your data and your programs, this just makes the extracts run faster.
Ken
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.sowder.com/pipermail/powerh-l/attachments/20090819/0d614308/attachment.htm
More information about the powerh-l
mailing list