Contenu connexe
Similaire à Application Tuning for CA Datacom Environments Part II (20)
Plus de CA Technologies (20)
Application Tuning for CA Datacom Environments Part II
- 9. 9 © 2016 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Sequential Read Ahead (cont’d)
§ Cons
– Significant possibility for application program to misuse the
functionality
§ Getting lots of data rows that are never actually read in the program
§ Typical when not reading the key range from beginning to end
§ For non-Ideal, be sure to specify the key range end value
– Getting lots of data rows and holding them under exclusive control
§ If URT has UPDATE=YES all rows passed in Block GETxx buffer are locked
§ Can be minimized by using smaller GBMAXR and/or GETBLK (e.g.
GBMAXR=10)
Simplified view
- 19. 19 © 2016 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
CBS - Building a temporary index
Mixed ORDER BY with both ascending and descending
FOR FIRST PRICE-LIST-R001
WHERE EFCTV-DATE = W.EFCTV-DATE
AND FGI-ID = W.FGI-ID
AND PRICE-CLS-ID = W.PRICE-CLS-ID
AND ALWN-BRCKT-CDE GT $SPACES
ORDERED BY EFCTV-DATE FGI-ID PRICE-CLS-ID
DESCENDING ALWN-BRCKT-CDE
FOR FIRST PRICE-LIST-R001
WHERE EFCTV-DATE = W.EFCTV-DATE
AND FGI-ID = W.FGI-ID
AND PRICE-CLS-ID = W.PRICE-CLS-ID
AND ALWN-BRCKT-CDE GT $SPACES
ORDERED BY DESCENDING EFCTV-DATE
FGI-ID
PRICE-CLS-ID
ALWN-BRCKT-CDE
Before After
All the “ascending” columns in the ORDER BY are specified as
equalities in the WHERE clause, so the ORDER BY can be changed
without impacting the program
- 21. 21 © 2016 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
CBS - Determining the best key to use for CBS
§ CBS dynamically chooses the best key to use based on
information in the where and order by clauses
§ Be careful when trying to second-guess CBS
– Run a CBS trace to check that your assumption was correct
– With two similar candidate keys, Statistical Population Counting can
change the key selection at runtime
§ In the following example
– The ORDER BY matches the native key
– But a better key matches the WHERE clause
- 22. 22 © 2016 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
CBS - Determining the best key to use for CBS (cont’d)
Order by determines the key – but is not the best choice
FOR FIRST SALES-EST-PD
WHERE MARKET-CODE EQ W.MARKET-CODE
AND SOURCE-CODE EQ $SPACES
AND CURRENT-WEEK EQ W-WEEK
AND CPCK-ITEM-CODE EQ $SPACES
AND SETUP-WEEK-10 GE SETUP-DATE
ORDERED BY MARKET-CODE
SOURCE-CODE
CURRENT-WEEK
SETUP-WEEK-10
FOR FIRST SALES-EST-PD
WHERE MARKET-CODE EQ W.MARKET-CODE
AND SOURCE-CODE EQ $SPACES
AND CURRENT-WEEK EQ W-WEEK
AND CPCK-ITEM-CODE EQ $SPACES
AND SETUP-WEEK-10 GE SETUP-DATE
ORDERED BY MARKET-CODE
CURRENT-WEEK
SOURCE-CODE :Moved
CPCK-ITEM-CODE :Inserted
SETUP-WEEK-10
Before After
Statistical Population Counting and a Temporary Index Now a direct selection
- 24. 24 © 2016 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
SQL
§ Agile/DevOps - Quick to develop/maintain
§ All joins/aggregation/formatting done in MUF
– Available for zIIP processing
– Keeps the application small/simple/efficient
§ Minimizes communications overhead
– SQL pre-fetch works for CICS requests too
§ If there is syntax/functionality you need…
– Submit your enhancement “Ideas”
Industry standard syntax
- 31. 31 © 2016 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Ideal programming gotchas - $SUBSTR
§ $SUBSTR is one of the most CPU-intensive functions of CA
Ideal
– Never code a $SUBSTR with fixed values for both START= and LEN=
– Break the target field into a group field and reference the data directly
as a simple field
§ Don’t repeat the same $SUBSTR function unnecessarily
– SET the result into a simple field and then reference that field in
subsequent statements
Ideal is a powerful language but some processes can be expensive to use
- 33. 33 © 2016 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Ideal programming gotchas - $STRING
§ $STRING is one of the most CPU-intensive functions of CA
Ideal
– Data is copied to a temporary work area, appended and then copied to
the target area
– Where appropriate, use the new Ideal 15.0 DOCUMENT feature with
variable-length fields to accomplish the task
§ Don’t repeat the same $STRING function unnecessarily
– Set the result into a simple field and then reference that field in
subsequent statements
Ideal is a powerful language but some processes can be expensive to use
- 35. 35 © 2016 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Ideal programming gotchas - $STRING
§ While we are here what else can we improve?
– Avoid looping through the whole array
§ In this case, all 640 entries are searched if the incoming item is NOT
a duplicate
§ Store the “maximum entry#” value when the array is built and use
that value to terminate the loop
– Avoid re-testing the “terminator” value on each iteration of the loop
Ideal is a powerful language but some processes can be expensive to use
- 37. 37 © 2016 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Ideal programming gotchas - $STRING (cont’d)
Ideal is a powerful language but some processes can be expensive to use
SET W.DUPLICATE = FALSE
LOOP
VARYING W.SUB2 FROM 1 BY 1
UNTIL W.DUPLICATE
OR W.SUB2 = 640
IF DUP-PGM-DVW(W.SUB2) =
$STRING(RPT.PROGRAM,
RPT.STATUS,
RPT.DATAVIEW)
SET W.DUPLICATE = TRUE
ENDIF
ENDLOOP
Before
SET W.DUPLICATE = FALSE
SET NEW-PGM-DVW = $STRING(RPT.PROGRAM,
RPT.STATUS,RPT.DATAVIEW)
<<SEARCH-PGM-DVW>>
LOOP
VARYING W.SUB2 FROM 1 BY 1 UP THRU W.DVW-MAX
IF DUP-PGM-DVW(W.SUB2) = NEW-PGM-DVW
SET W.DUPLICATE = TRUE
QUIT SEARCH-PGM-DVW
ENDIF
ENDLOOP
After
SET NEW-PGM-DVW = $STRING(RPT.PROGRAM,
RPT.STATUS,RPT.DATAVIEW)
LOOP
VARYING W.SUB2 FROM 1 BY 1 UP THRU W.DVW-MAX
UNTIL DUP-PGM-DVW(W.SUB2) = NEW-PGM-DVW
ENDLOOP
IF W.SUB2 > W.SUB
SET W.DUPLICATE = FALSE
ELSE
SET W.DUPLICATE = TRUE
ENDIF
After
If you really hate QUIT
- 38. 38 © 2016 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Ideal programming gotchas – Internal sorting
§ AVOID unnecessary internal sorts
– Use SQL to join/aggregate/sort data into required sequence
§ Move work to MUF where zIIP CPU can be used
– Use the sorted report facility of CA Ideal instead, if appropriate
– If internal sort is the only option, avoid repeatedly calculating the index
subscript
§ Calculate the “subscript – 1” once and use that in all subsequent statements
§ Use group field to move whole array “row” at once
Ideal is a powerful language but some processes can be expensive to use
- 39. 39 © 2016 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
If internal sort is the only option, avoid repeatedly
calculating the index subscript
LOOP VARYING W.SUB FROM W.ENTRIES BY -1 DOWN THRU 1
IF W.CURR-KEY < W.PREV-KEY
SET WT.PROD-CD = W.PROD-CD(W.SUB)
SET WT.CUST-CD = W.CUST-CD(W.SUB)
SET WT.EFCT-DT = W.EFCT-DT(W.SUB)
SET WT.TERM-DT = W.TERM-DT(W.SUB)
SET W.PROD-CD(W.SUB) = W.PROD-CD(W.SUB - 1)
SET W.CUST-CD(W.SUB) = W.CUST-CD(W.SUB - 1)
SET W.EFCT-DT(W.SUB) = W.EFCT-DT(W.SUB - 1)
SET W.TERM-DT(W.SUB) = W.TERM-DT(W.SUB - 1)
SET W.PROD-CD(W.SUB - 1) = WT.PROD-CD
SET W.CUST-CD(W.SUB - 1) = WT.CUST-CD
SET W.EFCT-DT(W.SUB - 1) = WT.EFCT-DT
SET W.TERM-DT(W.SUB - 1) = WT.EFCT-DT
ENDIF
ENDLOOP
Before
LOOP VARYING W.SUB
FROM W.ENTRIES BY -1 DOWN THRU 1
IF W.CURR-KEY < W.PREV-KEY
SET W.SUB2 = W.SUB - 1
SET WT.ARRAY-ROW =
W.ARRAY-ROW(W.SUB) BY POSITION
SET W.ARRAY-ROW(W.SUB) =
W.ARRAY-ROW(W.SUB2) BY POSITION
SET W.ARRAY-ROW(W.SUB2) =
WT.ARRAY-ROW BY POSITION
ENDIF
ENDLOOP
After
- 40. 40 © 2016 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Ideal programming gotchas - $TRIM
§ $TRIM is one of the most CPU-intensive functions of CA Ideal
– When building output text strings
§ Avoid repeatedly trimming trailing blanks and so on from the same input
strings
– If repeatedly referencing fixed-length input
§ Convert to variable-length working data field with $TRIM just once and
reference that
Ideal is a powerful language but some processes can be expensive to use
- 56. 56 © 2016 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Recommended Sessions
SESSION # TITLE DATE/TIME
MFX92S Strategy and Vision for CA Datacom and CA Ideal 11/16/2016 at 12:45 pm
MFX93S What’s new in CA Datacom 11/16/2016 at 1:45 pm
MFX94S Reducing TCO with Datacom Compression (Presspack) 11/16/2016 at 3:00 pm
MFX95SA Modernizing the CA Datacom data – SQL Access Part I 11/16/2016 at 3:45 pm
MFX95SB Modernizing the CA Datacom data – SQL Access Part II 11/16/2016 at 4:30 pm
MFX96S CA Datacom/AD Installation/Upgrade and Maintenance 11/17/2016 at 12:45 pm
MFX97S
CA Datacom/AD Report Utilization, and
information gather for Support
11/17/2016 at 1:45 pm
MFX98S
Using Sysview to monitor and measure your CA Datacom
environment – AD and DB
11/17/2016 at 3:00 pm
MFX99S Birds of a Feather/Stump the Techie! 11/17/2016 at 3:45 pm