WHEN TITLE IS NOT A QUESTION N O ‘WE CAN’ WHEN TITLE IS NOT A QUESTION N O ‘WE CAN’ WHEN TITLE IS NOT A QUESTION N O ‘WE CAN’ CA 2E r8.5 – An Overview SAM April 16, 2012 Rory Hewitt – CA Technologies
SAM2012: April 16, 2012 Copyright © 2012 CA Technologies. About the Speaker — Rory Hewitt − Software Architect for 2E team − Software developer for 17 years (14 with 2E development team) − Helped design some of the largest features in recent 2E history RPGIV generator, function wrappering & duplicate parameters, triggers − Competition-level snowboarder, boxer and karateka 2
SAM2012: April 16, 2012 Copyright © 2012 CA Technologies. overview of r8.5 new functionality at r8.5 — Default templating — Trigger functions — Service program support questions agenda 3
SAM2012: April 16, 2012 Copyright © 2012 CA Technologies. — Available since 2009 — Major release — Significant take-up by customer base — Most common release in use by far — 1 service pack available (8.5 SP1) plus multiple fixes overview of release 8.5 4
Default templating 5SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.
— Allows automatic use of a *Template function − New functions copied from *Template function — Include standard functionality on a function-type basis − Standard *MOVE ALL's in RTVOBJ (DB1.*ALL->PAR.*ALL) etc. − Common initialization functionality — Standardize parameters for function types − Include extra parameters by default − Use RCD instead of KEY for DBF functions (CHG/CRT/DLT/RTV) − Call another function within a CHGOBJ to load a field default templating 6
SAM2012: April 16, 2012 Copyright © 2012 CA Technologies. Default RTVOBJ parameters – where are the non-key fields? 7
SAM2012: April 16, 2012 Copyright © 2012 CA Technologies. Default RTVOBJ parameters - have to be changed for every RTVOBJ :( 8
SAM2012: April 16, 2012 Copyright © 2012 CA Technologies. Create a RTVOBJ over the *Template file 9
Create some 'sensible' parameters (like the whole record format)... SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.10
...and return the non- key fields SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.11
Add in the standard *MOVE ALL's for 'record not found'... SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.12
...and 'record found' SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.13
...and set the 'Default prototype function' flag to 'Y'... SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.14
...(not forgetting to read what it does, of course!)... SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.15
Now create a new RTVOBJ function over your file... SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.16
...and note the new completion message (same as if F21 was used)... SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.17
...and see that the parameters are more useful... SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.18
...and correctly return the fields you want... SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.19
Trigger functions 20 SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.
— External 2E functions of type TRGFUN − Predefined parameters based on owning file − No default Action diagram code (like EXCEXTFUN) — 'Endpoint' for CA 2E trigger framework − Invoked when owning database file is updated by application Called directly in updating job (synchronous) Called via data queue server (asynchronous) — Can contain any processing (except updating owning file) trigger functions 21
...Create a trigger function (TRGFUN) over any file... SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.22
...and view the parameters (which are all read-only)... SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.23
1. *Trigger control data SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.24
SAM2012: April 16, 2012 Copyright © 2012 CA Technologies 'Old' record format
SAM2012: April 16, 2012 Copyright © 2012 CA Technologies 'New' record format
...and add some code to the function itself
SAM2012: April 16, 2012 Copyright © 2012 CA Technologies. — Define triggering conditions for each Trigger function − Event (Insert, Delete, Update) − Time (After or before record update) − Commitment level — Use YCVTTRGDTA command to convert − Trigger control information converted to external (non-2E) format − Triggers added to *FILE object − Specify CA 2E Trigger Router (YTRIGGER) as trigger program — External trigger-related objects exist outside 2E model − Either *GENLIB or separate library trigger functions 28
Specify triggering conditions for each Trigger function... SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.29
...then convert trigger data to external format... SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.30
...then edit converted external trigger data and add triggers to PF(s) automatically SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.31
All 2E triggers call same 'trigger program', called YTRIGGER... SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.32
SAM2012: April 16, 2012 Copyright © 2012 CA Technologies. — At runtime, file is updated by application program — OS Database Manager calls YTRIGGER (Trigger Router) — Trigger Router determines 2E Trigger function(s) to call — Either − Trigger Router calls 2E Trigger function(s) directly (synchronous) — Or − Trigger Router sends transaction information to Trigger Server − Trigger Server calls 2E Trigger function(s) (asynchronous) trigger functions 33
trigger functions – synchronous processing SAM2012: April 16, 2012 Copyright © 2012 CA Technologies. Application Program Trigger Router TRGFUN *FILE File 1.Application program updates file 2.Database Manager (operating system) calls Trigger Router 3.Trigger Router calls 2E Trigger function(s)
SAM2012: April 16, 2012 Copyright © 2012 CA Technologies. — Synchronous processing − Default option — Benefits − Can be used where application program should know about errors − Easy to debug (in same job as application program) − Simplest way to add functionality − Program-to-program call – less likelihood of problems — Drawbacks − Long-running processing will 'lock' application program trigger functions – synchronous processing 35
trigger functions – asynchronous processing SAM2012: April 16, 2012 Copyright © 2012 CA Technologies. TRGUN Trigger Server 1.Application program updates file 2.DBM (OS) calls Trigger Router 3.Trigger Router sends data to Trigger Server (in different job) 4.Trigger Server calls 2E TRGFUN(s) Application Program Trigger Router *FILE File
SAM2012: April 16, 2012 Copyright © 2012 CA Technologies. — Asynchronous processing − Non-default option – must be specifically chosen — Benefits − Can 'offload' long-running processing to separate job − Allows application program to continue − Least chance of problems showing up in application program − Can 'save' trigger processing for later time/date — Drawbacks − Errors in trigger function don't signal application program − Complex to test trigger functions – asynchronous processing 37
Service program support 38 SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.
Existing ILE Support ILE support prior to r8.5 — Some ILE support prior to r8.5 — Generation of ILE languages − RPGLE (introduced in Release 7.0) − CBLLE (introduced in Release 8.0) — Can define functions as PGM (*PGM) or MOD (*MODULE) — Modules not directly 'callable' − Must be 'bound' into calling program SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.39
PGM Function MOD Function calls *PGM objects gives us EditCustomerEditAccountEditVendor PromptDataValidateData ILE support prior to r8.5 EditCustomer PromptData ValidateData EditVendor PromptData ValidateData EditAccount PromptData SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.40
— Each *PGM contains a copy of each *MODULE it needs − Bind-by-copy — Benefits − Fewer runtime *PGM objects − Bound calls are quicker than program calls — Drawbacks − Large stand-alone multi-*MODULE *PGM objects − Change to bound module requires program update ILE support prior to r8.5 SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.41
— Ability to create service programs (*SRVPGM) − Consist of one or more modules − Accessed at runtime by programs — Programs no longer 'contain' modules − Bind-by-reference — Bound calls still faster than program calls — Module change only requires service program update − No change required to calling programs service program functionality at r8.5 SAM2012: April 16, 2012 Copyright © 2012 CA Technologies. 42
PGM Function MOD Function calls gives us *PGM objects EditCustomerEditVendorEditAccount *SRVPGM object EditCustomerEditAccountEditVendor PromptDataValidateData DataFunctions PromptData ValidateData service program functionality at r8.5 SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.43
SAM2012: April 16, 2012 Copyright © 2012 CA Technologies. Enhanced ILE Support — New "Service program" function type − Can be created over any model file — Fully integrated with existing model functionality − Impact Analysis − Change Management − Model Documentation — Uses same 2E 'look and feel' − Intuitive and easy for long-time 2E developers 44
SAM2012: April 16, 2012 Copyright © 2012 CA Technologies. Service Program Creation — *SRVPGM's are not 'typical' source-based objects… — …but we found a way to do it − One source member per *SRVPGM Generation control information Creation options (used by Toolkit compile preprocessor) Export list − Allows full integration with change management tools Source control, security, promotion, rollback etc. − Same *DSNR/*PGMR/*USER authority as elsewhere 45
Service Program Creation — Multiple signature options − System-generated, hard-coded or *SRVPGM name − Allows better control of runtime objects — Can also bind modules created outside CA 2E model − Use 2E model as 'placeholder' for external *SRVPGM's − Puts under source control, versioning etc. − Stores complex CRTSRVPGM command etc. 46SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.
New 'Service program' (SRVPGM) function type 47
Object type is 'SPG' Object attribute is 'BND' New 'M' and 'P' selection options Service program signature SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.48
Use F9 to change signature SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.49
SAM2012: April 16, 2012 Copyright © 2012 CA Technologies. SERVICE PROGRAM MODULES lists modules that comprise the service program Standard options can be used against any modules from the CA 2E model 50
SAM2012: April 16, 2012 Copyright © 2012 CA Technologies. SELECT MODULE screen allows user to add modules from the CA 2E model to the service program 51
Option G generates source into member in QSRVSRC source file SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.52 Generated source consists of two 'sections'…
Compilation instructions Z* and Y* lines used by the CA 2E Toolkit compile preprocessor to create the service program SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.53
Export definition list List of procedures and data exported by the service program, along with the signature definition SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.54
Impact Analysis New *BNDMOD reason code for bound modules SAM2012: April 16, 2012 Copyright © 2012 CA Technologies.55
SAM2012: April 16, 2012 Copyright © 2012 CA Technologies. Summary — Simplifies application development process — Uses new 1E compile preprocessor functionality — Allows users to move fully to an ILE environment 56
questions ?