Integrating CA 2E with Existing Applications
CA 2E Track
Darryl Millington, HawkBridge Pty Ltd (Australia)
This session will provide an under the covers look at how HawkBridge have integrated their Freedom suite of products with the internal data model files. All of the Freedom tools have been developed using a common CA 2E data model where the internal database files of CA 2E have been imported so that new functions can be created over them using CA 2E itself. Catch a sneak preview of the Freedom/Pre-Compiler – which provides the changes to generated CA 2E source to enable the integration to be performed using existing CA 2E physical and logical files.
Session Abstract
Darryl MillingtonHawkBridge Pty Ltd
Darryl has worked as a CA 2E developer since 1988 travelling extensively as an independent consultant throughout Australia, New Zealand, USA, UK and Asia
He is a regular speaker at CA conferences and has been speaking on CA 2E-related topics since 1991
Speaker Bio
Introduction Using Keyed Physical Files Using Multi-Format Logical Files Invoking Freedom/Pre-Compiler Freedom/Pre-Compiler Commands Questions
Agenda
How can you use CA 2E to integrate non-CA 2E applications?– Especially where database is not “pure” CA 2E
Freedom tools do just that– CA 2E internal data model files are not “pure” CA 2E
Freedom tools use the existing CA 2E physical and logical files– Including keyed physicals and multi-format logical files– With no need for additional logical files to be created– Although additional CA 2E internal objects are required
Freedom/Pre-Compiler enables this– Automatically fine tunes generated CA 2E source
Introduction
Review and assess file and database relations– Draw a quick diagram of the files and relationships
CA 2E functions will use dummy access paths Determine if a new access path can be easily supported
– Object management may be of concern– Field names may be different if file was assimilated– No additional index is created as it will share the keyed physical index
If yes, generate and compile the new access path– Use the new access path in place of the keyed physical
If no, use pre-compile processing to override file– We will address this in a later section
Y2ABDAP is a keyed physical file in CA 2E
Using Keyed Physical Files
Review the file definitionYDOCF FILE(Y2ABDAP)
Note the keyed access and unique sequence information
Note the key fields
Check database relations for other database filesDSPDBR FILE(Y2ABDAP) and YDOCF FILE(Y2ABDAP0)
Existing PHY will not have key fields– Do not generate or use!
Functions need to be based on default UPD and RTV– Do not generate UPD and RTV– Adjust generated source to use correct
file, format and field names
Need a new RSQ– Select correct key order and sequence– Ignore Select/Omit– Do not generate RSQ– Adjust generated source to use correct
format and field names
Y2ABDAP (*PF)Format: @ACDAYQAccess: *KEYEDSequence: *UNIQUE
K1 – AAABCD K2 – AACESQ K3 – AAAFSQ K4 – AAACCN K5 – AAACSQ
Y2ABDAP0 (*LF)Format: @ACDAYQAccess: *KEYEDSequence: *FIFO
K1 – AAABCD K2 – AAACCDK3 – AAACSQSelect – AAACCN > +0Omit – *ALL
Depends on
Based on
Import physical file and define primary keyYRTVPFMDL FILE(Y2ABDAP) RMVFLDPFX(*NO)
Define the primary key sequence by changing Has to
Known-by relationships
Review file entriesE=Edit File Entries
Note the assigned DDS names for the fields which differ from the physical file format entries
Setup dummy access pathsZ=Edit File Details
Use the UPD and RTV as dummies for the physical file, and create a new RSQ dummy
for the logical file
Notice that UPD and RTV have new implementation names,
and RSQ uses the logical implementation name
Setup dummy access path key sequenceZ+Z=Edit Access Path Format Entries
Setup the correct key sequence for the logical file
Setup Pre-Compile Processing Directive
Insert call to EXCUSRSRC in any function based on associated
dummy ACP
Call the Pre-Compile Processing Program that will
adjust generated source
Create one EXCUSRSRC function for each dummy ACP that needs to be adapted for use within CA 2E functions
Generated source before and after changes
0000.30 >>>>>Y* CALL HPRCPREDIR (UUAHUFR &C &M &F &L) CHG 0000.30 <<<<<** CALL HPRCPREDIR (UUAHUFR &C &M &F &L)
0002.50 FY2ABDAPU UF A E K DISKCHG 0002.50 <<<<<FY2ABDAP UF A E K DISKINS 0002.51 <<<<<F RENAME(@ACDAYQ:@ACDAYQU)
0004.30 D QY2AB1 E DS EXTNAME(Y2ABDAPU) CHG 0004.30 <<<<<D QY2AB1 E DS EXTNAME(Y2ABDAP)
0004.40 * UPD : Training Enironment - Act Update index 0004.50 * Renamed input format fields 0004.60 D WAADCD E EXTFLD(ACADCD)CHG 0004.60 <<<<<D WAADCD E EXTFLD(AAABCD) (24 other fields changed as above)
0010.10 I@ACDAYQU 0010.20 * Training Enironment - Act Update index 0010.30 * Renamed input format fields 0010.40 I ACADCD WAADCD CHG 0010.40 <<<<<I AAABCD WAADCD (24 other fields changed as above)
Ensure pre-processor is only executed once by changing
command line
1
23
4
5
6
Generated source before and after changes
0000.30 >>>>>Y* CALL HPRCPREDIR (UUAHUFR &C &M &F &L) CHG 0000.30 <<<<<** CALL HPRCPREDIR (UUAHUFR &C &M &F &L)
0002.50 FY2ABDAPU UF A E K DISKCHG 0002.50 <<<<<FY2ABDAP UF A E K DISKINS 0002.51 <<<<<F RENAME(@ACDAYQ:@ACDAYQU)
0004.30 D QY2AB1 E DS EXTNAME(Y2ABDAPU) CHG 0004.30 <<<<<D QY2AB1 E DS EXTNAME(Y2ABDAP)
0004.40 * UPD : Training Enironment - Act Update index 0004.50 * Renamed input format fields 0004.60 D WAADCD E EXTFLD(ACADCD)CHG 0004.60 <<<<<D WAADCD E EXTFLD(AAABCD) (24 other fields changed as above)
0010.10 I@ACDAYQU 0010.20 * Training Enironment - Act Update index 0010.30 * Renamed input format fields 0010.40 I ACADCD WAADCD CHG 0010.40 <<<<<I AAABCD WAADCD (24 other fields changed as above)
1
23
4
5
6
Change file name to use the physical file and rename the
format to use the CA 2E internal format name
Generated source before and after changes
0000.30 >>>>>Y* CALL HPRCPREDIR (UUAHUFR &C &M &F &L) CHG 0000.30 <<<<<** CALL HPRCPREDIR (UUAHUFR &C &M &F &L)
0002.50 FY2ABDAPU UF A E K DISKCHG 0002.50 <<<<<FY2ABDAP UF A E K DISKINS 0002.51 <<<<<F RENAME(@ACDAYQ:@ACDAYQU)
0004.30 D QY2AB1 E DS EXTNAME(Y2ABDAPU) CHG 0004.30 <<<<<D QY2AB1 E DS EXTNAME(Y2ABDAP)
0004.40 * UPD : Training Enironment - Act Update index 0004.50 * Renamed input format fields 0004.60 D WAADCD E EXTFLD(ACADCD)CHG 0004.60 <<<<<D WAADCD E EXTFLD(AAABCD) (24 other fields changed as above)
0010.10 I@ACDAYQU 0010.20 * Training Enironment - Act Update index 0010.30 * Renamed input format fields 0010.40 I ACADCD WAADCD CHG 0010.40 <<<<<I AAABCD WAADCD (24 other fields changed as above)
1
23
4
5
6
Change external name to the physical file name
Generated source before and after changes
0000.30 >>>>>Y* CALL HPRCPREDIR (UUAHUFR &C &M &F &L) CHG 0000.30 <<<<<** CALL HPRCPREDIR (UUAHUFR &C &M &F &L)
0002.50 FY2ABDAPU UF A E K DISKCHG 0002.50 <<<<<FY2ABDAP UF A E K DISKINS 0002.51 <<<<<F RENAME(@ACDAYQ:@ACDAYQU)
0004.30 D QY2AB1 E DS EXTNAME(Y2ABDAPU) CHG 0004.30 <<<<<D QY2AB1 E DS EXTNAME(Y2ABDAP)
0004.40 * UPD : Training Enironment - Act Update index 0004.50 * Renamed input format fields 0004.60 D WAADCD E EXTFLD(ACADCD)CHG 0004.60 <<<<<D WAADCD E EXTFLD(AAABCD) (24 other fields changed as above)
0010.10 I@ACDAYQU 0010.20 * Training Enironment - Act Update index 0010.30 * Renamed input format fields 0010.40 I ACADCD WAADCD CHG 0010.40 <<<<<I AAABCD WAADCD (24 other fields changed as above)
1
23
4
5
6
Change external field names to the physical file format
entry names
Generated source before and after changes
0000.30 >>>>>Y* CALL HPRCPREDIR (UUAHUFR &C &M &F &L) CHG 0000.30 <<<<<** CALL HPRCPREDIR (UUAHUFR &C &M &F &L)
0002.50 FY2ABDAPU UF A E K DISKCHG 0002.50 <<<<<FY2ABDAP UF A E K DISKINS 0002.51 <<<<<F RENAME(@ACDAYQ:@ACDAYQU)
0004.30 D QY2AB1 E DS EXTNAME(Y2ABDAPU) CHG 0004.30 <<<<<D QY2AB1 E DS EXTNAME(Y2ABDAP)
0004.40 * UPD : Training Enironment - Act Update index 0004.50 * Renamed input format fields 0004.60 D WAADCD E EXTFLD(ACADCD)CHG 0004.60 <<<<<D WAADCD E EXTFLD(AAABCD) (24 other fields changed as above)
0010.10 I@ACDAYQU 0010.20 * Training Enironment - Act Update index 0010.30 * Renamed input format fields 0010.40 I ACADCD WAADCD CHG 0010.40 <<<<<I AAABCD WAADCD (24 other fields changed as above)
1
23
4
5
6
Change external field names to the physical file format
entry names
Freedom/Pre-Compiler commands
19
(23 other fields changed as above using Scan command)
(23 other fields changed as above using Forward and Update commands)
1
2
34
6
5
Freedom/Pre-Compiler command details
Review and assess file and database relations– Draw a quick diagram of the files and relationships
A separate access path is created for each format– CA 2E functions cannot process multi-format logical files
Apart from EDTTRN and DSPTRN functions
Determine if a new access path can be easily supported– If yes, generate and compile the RTV or RSQ access path– If no, use pre-compile processing to override file
YMSGACT01L is a multi-format logical file in CA 2E– Based on the same physical file
YOBJDTA01L is a multi-format logical file in CA 2E– Based on different physical files
Using Multi-Format Logical Files
Review the file definitionYDOCF FILE(YOBJDTA01L)
Note the key fields
Note the format name and based on file
Note the next and subsequent formats that will be ignored
Note the keyed access and unique sequence information
Check database relations for other database filesDSPDBR FILE(YOBJDTA01L) and YDOCF FILE(YMSGDTARFP)
Need a new RTV– Could use default RTV– Do not generate RTV
Functions need to be based on RTV– Adjust generated source to use correct
file, format and field names
Existing PHY, UPD and RTV are not required– Do not generate or use!
YOBJDTA01L(*LF)Format: @MSGDTAAccess: *KEYEDSequence: *UNIQUE
K1 – @@MSG
YMSGDTARFP (*PF)Format: @MSGDTAAccess: *ARRIVALSequence: N/A
Based on
Depends on
Import physical file and define primary key YRTVPFMDL FILE(YMSGDTARFP) RMVFLDPFX(*NO)
Define the primary key sequence by changing Has to
Known-by relationshipsNote that on refresh the fields
will re-sequence so that primary key is at the top
Review file entries E=Edit File Entries
Note the assigned DDS names for the fields which differ from the physical file format entries
and sequence of @@MSG
Setup dummy access pathsZ=Edit File Details
Create a new RTV dummy for the logical file formatNote the RTV implementation
name is not changed
Setup Pre-Compile Processing Directive
Call the Pre-Compile Processing Program that will
adjust generated source
Insert call to EXCUSRSRC in any function based on associated
dummy ACP
Create one EXCUSRSRC function for each dummy ACP that needs to be adapted for use within CA 2E functions
Generated source before and after changes
0000.30 >>>>>Y* CALL HPRCPREDIR (UUANUFR &C &M &F &L)CHG 0000.30 <<<<<** CALL HPRCPREDIR (UUANUFR &C &M &F &L)
0002.50 FYMSGDTL2 IF E K DISK CHG 0002.50 <<<<<FYOBJDTA01LIF E K DISKINS 0002.51 <<<<<F RENAME(@MSGDTA:@SGDTAJ)INS 0002.52 <<<<<F IGNORE(@MSGAUX) (14 other formats ignored as above)
0010.10 I@SGDTAJ 0010.20 * MDL Message YOBJDTA01L @MSGDTA 0010.30 * Renamed input format fields 0010.40 I ADAHNB WAAHNB CHG 0010.40 <<<<<I @@MSG WAAHNB (24 other fields changed as above)
1
234
5
Freedom/Pre-Compiler commands
(13 other formats ignored as above using Insert command)
(23 other fields changed as above using Forward and Update commands)
1234
5
Global Pre-Compile Exit Program– CHGDTAARA DTAARA(YBRTPXA (1 20)) VALUE(‘HPRCPREPGM')
Source Member Pre-Compile Exit Program– P* CALL HPRCPREPGM
Source Member Pre-Compile Directive– Y* CALL HPRCPREDIR (xxxxxxxxxx &C &M &F &L)
Source Member Compiler Directive– Z* ...
Source Member Post-Compile Directive– Y* CALL HPRCPSTDIR (xxxxxxxxxx &C &M &F &L)
Source Member Post-Compile Exit Program– P* CALL HPRCPSTPGM
Global Post-Compile Exit Program– CHGDTAARA DTAARA(YBRTPXA (21 20)) VALUE('HPRCPSTPGM')
Invoking the Freedom/Pre-Compiler
Freedom/Pre-Compiler Commands
InsString– Inserts a named variable into current line
OnErr...ElseOnErr...EndOnErr– Conditional error processing
Quit– Stops processing and exits normally
RstSeq– Reposition cursor to a saved source line
SavSeq– Saves current line sequence number
Scan– Searches for matching source line
SubString– Save string to a named variable
Update– Change current source line
Abort– Stops processing and exits abnormally
Backward– Move cursor specified lines backwards
Delete– Delete current source line
Execute– Runs the specified command
Forward– Move cursor specified lines forward
If...ElseIf...EndIf– Conditional processing
Include– Process another command group
Insert– Create source line after current line
Freeware version limitations:– Only the Source Member Pre-Compile Directive can be used
Y* CALL HPRCPREDIR (xxxxxxxxxx &C &M &F &L)– Only the first 9 commands per group accepted by processor
Freeware comments imbedded into source member Implicit Quit command executed after 9th command
– Include and Execute commands will be ignored by processor
Licensed version is unlimited and allows all source compiled objects to be processed– Commands, Programs, Device Files, Physical Files and Logical Files
Further information available online:– http://www.hawkbridge.com.au/html/products/freedompcp.aspx
Freedom/Pre-Compiler
Questions?