0% found this document useful (0 votes)
149 views100 pages

PMOV Functional Decomposition Analysis

Karna resume Karunakaran P - Resume (1) Karna resume Karunakaran P - Resume (1) go di di to go go go goKarna resume Karunakaran P - Resume (1) Karna resume Karunakaran P - Resume (1) go di di to go go go goKarna resume Karunakaran P - Resume (1) Karna resume Karunakaran P - Resume (1) go di di to go go go goKarna resume Karunakaran P - Resume (1) Karna resume Karunakaran P - Resume (1) go di di to go go go go.

Uploaded by

rajeshmsit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
149 views100 pages

PMOV Functional Decomposition Analysis

Karna resume Karunakaran P - Resume (1) Karna resume Karunakaran P - Resume (1) go di di to go go go goKarna resume Karunakaran P - Resume (1) Karna resume Karunakaran P - Resume (1) go di di to go go go goKarna resume Karunakaran P - Resume (1) Karna resume Karunakaran P - Resume (1) go di di to go go go goKarna resume Karunakaran P - Resume (1) Karna resume Karunakaran P - Resume (1) go di di to go go go go.

Uploaded by

rajeshmsit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 100

Protect PMOV

Functional Decomposition Analysis

Mark A. Norrie
Actuarial Infrastucture
Contents
TABLES ......................................................................................................................... 1
PROCESSES .................................................................................................................... 2
COMPLEX ........................................................................................................................2
C01 UWC_PNCB Fix Overlap Inforce Period ..........................................................................2
C02 UWC PNCH Building PMOV .........................................................................................4
C03 UWC Policy Fix .......................................................................................................8
C04 UWC_PNCB_Premtran ..............................................................................................9
C05 UWC Fix overlap dates and filter unwanted products ..................................................... 10
C06 SAS Extract - Change pcode from Num to Char .............................................................. 11
SIMPLE ........................................................................................................................ 12
SAS Extract .............................................................................................................. 12
P01 ...................................................................................................................... 12
P04 ...................................................................................................................... 12
P15 ...................................................................................................................... 13
P21 ...................................................................................................................... 15
P27 ...................................................................................................................... 16
P28 ...................................................................................................................... 16
P29 ...................................................................................................................... 17
P31 ...................................................................................................................... 17
P32 ...................................................................................................................... 18
SPD Server Loader ...................................................................................................... 19
P02 ...................................................................................................................... 19
P12 ...................................................................................................................... 19
P23 ...................................................................................................................... 21
P25 ...................................................................................................................... 23
P35 ...................................................................................................................... 25
Extract Source Data Required cols .................................................................................. 31
P03 ...................................................................................................................... 31
P19 ...................................................................................................................... 32
P24 ...................................................................................................................... 32
SQL Join .................................................................................................................. 33
P05 ...................................................................................................................... 33
P06 ...................................................................................................................... 38
P09 ...................................................................................................................... 43
P33 ...................................................................................................................... 48
P34 ...................................................................................................................... 55
Lookup .................................................................................................................... 61
P07 ...................................................................................................................... 61
P08 ...................................................................................................................... 65
P10 ...................................................................................................................... 70
P13 ...................................................................................................................... 74
P30 ...................................................................................................................... 81
SAS Splitter .............................................................................................................. 83
P11 ...................................................................................................................... 83
P14 ...................................................................................................................... 84
P17 ...................................................................................................................... 84
P22 ...................................................................................................................... 85
Append ................................................................................................................... 85
P16 ...................................................................................................................... 85
Table Loader ............................................................................................................ 86
P18 ...................................................................................................................... 86
P36 ...................................................................................................................... 92
P37 ...................................................................................................................... 96
User Defined Summary Statistics .................................................................................... 96
P20 ...................................................................................................................... 96
User Written Code ...................................................................................................... 98
P26 ...................................................................................................................... 98
Tables
T01 PREMTRAN
T02 POLICY
T03 ITEM
T04 ITEMRI
T05 Staging Niche PI – Hx Ret Prem Dtls
T06 POLICYTH
T07 Staging Niche PI – Hx Co-ins Prem Dtls
T08 PROPOSAL
T09 ADDRESS
T10 AGENT
T11 AGTGRP
T12 AUTINDEX
T13 Staging Niche PI – Hx Reversed Txns
T14 CLASSTYP
T15 COMSCALE
T16 Protect Niche PI – Hx Policy Movt
T17 Error PI – Hx Error Terms
T18 Staging Niche PI – Generic HX Cov Dtls
T19 Protect Niche PI – Hx Master Key

Protect PMOV - Functional Decomposition Analysis PAGE 1


Processes
Complex
C01 UWC_PNCB Fix Overlap Inforce Period
/*============================================================================*
* Step: UWC_PNCB_Fix_Overlap_Inforce_Period A55NWR2B.BI00K7NT *
* Transform: User Written Code *
* Description: Fix Overlap inforce Period *
* *
* Source Table: SQL Target - spdswork.W5J17JAU A55NWR2B.BL00A9M6 *
* Target Table: User Written Code Target - A55NWR2B.BL00A9M7 *
* spdswork.W5J4DH4Z *
* *
* User Written: UWC_PNCB_Fix_Overlap_Inforce_Period A55NWR2B.AF00OCL2 *
* Fix Overlap inforce Period *
*============================================================================*/

%let SYSLAST = %nrquote(spdswork.W5J17JAU);

%let transformID = %quote(A55NWR2B.BI00K7NT);

%let trans_rc = 0;

%let _OUTPUT = %nrquote(spdswork.W5J4DH4Z);


/*---- Start of User Written Code ----*/

/* Need this as SYSLAST will be reset to _premtranAtrnType if not doing this */


%LET _SYSLAST = &SYSLAST.;

/* make sure the code generates in the required order i.e. work.W5J1AM3C was created
before this */
/* Get tran type from PREMTRAN */
DATA _premtranAtrnType (KEEP= company product policy itemNo trancnt atrnType
INDEX=(key1=(company product policy itemNo trancnt) ));
SET work.W5J1AM3C;

RUN;
DATA spdswork._premtranAtrnType1;
SET &_SYSLAST.;
SET _premtranAtrnType KEY=key1 / UNIQUE;
IF _ERROR_ THEN DO;
_ERROR_ = 0;
atrnType = ' ';
END;
RUN;

/* Modify termIncep (covRenewedDate) to be fixed for the duration of the term */


/* Fix case when there is a new term then reverse then continue with the previous term
eg pol 120258220 */
DATA spdswork._premtranAtrnType2(DROP=termIncep atrntype RENAME=(_termIncep=termIncep));
SET spdswork._premtranAtrnType1;
BY company product policy itemNo termIncep DESCENDING trancnt;
ATTRIB
modified LENGTH=8 FORMAT=BINARY10. LABEL='Flag to identify User
Modifications - Binary 0000000000'
;
modified = 0;
RETAIN _termincep 0;
IF FIRST.itemNo THEN DO;
_termIncep = termIncep;
END;
/* Update termincep only for NB, RE */
IF (atrnType IN ('NB','RE')) OR (atrnType = ' ' AND LAST.itemNo) THEN DO;
_termIncep = termIncep;
END;
IF termIncep NE _termIncep THEN modified = modified + 512;
RUN;
/* Clear up some spaces */
PROC DATASETS LIBRARY=spdswork NOLIST;
DELETE W5J17JAU _premtranAtrnType1 ;
QUIT;

Protect PMOV - Functional Decomposition Analysis PAGE 2


/* Modified Lapsed policies and activto date field when there is an overlap in inforce
period */
/* As Protect defined Lapsed policies as current term with Effective Date of next term
and Expiry date the same as Effective Date */
/* also for some policies that have effective one year after termincept and expired two
years after termincept then mannually change */
/* the termIncep to Effective date */

/* Output temp to SPDS so no need to sort */


DATA spdswork._fixpmv0;
SET spdswork._premtranAtrnType2;
BY company product policy itemno DESCENDING termIncep DESCENDING effectDte trancnt;
/* Convert to SAS date and rename similiar to Cogen date fields */
%convertdate(termincep,covRenewedDate);
%convertdate(effectdte,covChgEffDate);
%convertdate(effectdte,inforceIncDate);
IF activto = 99999999 THEN activto = duedate;
%convertdate(activto,inforceExpDate);
%convertdate(duedate,covChgExpDate);
%convertdate(trandate,transactionDate);
%convertdate(inception,policyInceptDate);

/* As Protect defined Lapsed policies as current term with Effective Date of next term
and Expiry date the same as Effective Date */
/* This code is used to redefine Lapsed as similar to GIO Cogen */
IF INTCK('DAY',covRenewedDate,covChgEffDate) IN (365,366) AND itemAtrnType IN
('CN','LP') THEN DO;
modified = modified + 2; /* 0000000010 - Identify lapsed transactions that should
be for next term hence change date fields accordingly */
covRenewedDate = covChgEffDate;
covChgExpDate = INTNX('MONTH',covChgEffDate,12,'SAMEDAY');
inforceExpDate = covCHgExpdate;
IF itemAtrnType = 'CN' THEN DO;
itemAtrnType = 'LP';
modified = modified + 4; /*0000000100 - Identify Item transaction type
changed from CN to LP */
END;
END;
ELSE IF INTCK('DAY',covRenewedDate,covChgEffDate) IN (365,366) AND itemAtrnType = ' '
THEN DO;
covRenewedDate = covChgEffDate;
modified = modified + 32; /*0000100000 - Identify covRenewedDate change to
CovChgEffDate for none lapsed/cancel transactions that has effective date more than a
year from covRenewedDate */
END;

DROP termincep effectdte activto duedate trandate inception;


RUN;

/* Back-dated change the duedate for all transactions that have the same effective date
usng the latest transaction within the same effective date */
/* This is due to DUE DATE ALTERATION transactions that lead to incorrect earned premium
calculation */
DATA spdswork._fixpmv1;
SET spdswork._fixpmv0;
BY company product policy itemno covRenewedDate covChgEffDate trancnt;
ATTRIB _covChgExpDate LENGTH=5 FORMAT=DATE9. ;
RETAIN _covChgExpDate 0;
IF FIRST.covChgEffDate THEN DO;
_covChgExpDate = covChgExpDate;
END;
/* Identify change to the duedate */
IF _covChgExpDate NE covChgExpDate THEN modified = modified + 256;
DROP covChgExpDate;
RENAME _covChgExpDate = covChgExpDate;
RUN;

DATA &_OUTPUT. / VIEW=&_OUTPUT.;


SET spdswork._fixpmv1;
BY company product policy itemno DESCENDING covRenewedDate DESCENDING covChgEffDate /*
DESCENDING inforceExpDate */ trancnt;

RETAIN join_dt ;

IF FIRST.itemNo THEN DO;


inforceExpDate = covChgExpDate;
join_dt = 0;
END;
ELSE DO;

Protect PMOV - Functional Decomposition Analysis PAGE 3


IF inforceExpDate NE join_dt THEN DO;
modified = 1; /* 0000000001 - Identify change to system activto that cause the
overlap of inforce period */
inforceExpDate = join_dt;
END;
END;
join_dt = covChgEffDate - 1;

DROP join_dt;
RUN;

/* Clear up some spaces */


PROC DATASETS LIBRARY=spdswork NOLIST;
DELETE W5J17JAU ;
QUIT;

/*---- End of User Written Code ----*/

%rcSet(&syserr);
%rcSet(&sqlrc);

C02 UWC PNCH Building PMOV


/*============================================================================*
* Step: UWC_PNCH_Building_Pmov A55NWR2B.BI00K7OA *
* Transform: User Written Code *
* Description: Final Step in creating PMOV *
* *
* Source Table: Lookup Target - spdswork.W5JEML2D A55NWR2B.BL00A9MF *
* Target Table: MAIN - spdswork.W5J4GJL1 A55NWR2B.BL00A9MG *
* *
* User Written: UWC_PNCH_pmov A55NWR2B.AF00OCOQ *
* Final step in creating PMOV *
*============================================================================*/

%let SYSLAST = %nrquote(spdswork.W5JEML2D);

%let transformID = %quote(A55NWR2B.BI00K7OA);

%let trans_rc = 0;

%let _OUTPUT = %nrquote(spdswork.W5J4GJL1);

/*---- Start of User Written Code ----*/

/*DATA &_OUTPUT. / VIEW= &_OUTPUT.;*/

DATA spdswork.Bef_CovKey;
ATTRIB
/* coverageKey LENGTH=8 LABEL='Coverage Key' */
company LABEL='Company'
product LABEL='Product'
class LABEL='Class'
subclass LABEL='Subclass'
policy LABEL='Policy Number'
seqPolicy LABEL='Sequence Policy
Number'
itemNo LABEL='Item No'
termIdent LENGTH=$3 LABEL='Term Identification'
trancnt LABEL='Transaction Count'
orgTrncnt LENGTH=4 LABEL='Original Transaction
Count being Reversed'
reverseTrncnt LENGTH=4 LABEL='This trans has been
Reversed By this Transaction Count'
covRenewedDate LENGTH=5 format=DATE9. LABEL='Coverage Renew Date'
covChgEffDate LENGTH=5 format=DATE9. LABEL='Coverage Change
Effective Date'
covChgExpDate LENGTH=5 format=DATE9. LABEL='Coverage Change Expiry
Date'
policyInceptDate LENGTH=5 format=DATE9. LABEL='Policy Inception Date'
transactionDate LENGTH=5 format=DATE9. LABEL='Transaction Date'
trantime LENGTH=4 LABEL='Transaction Time'
glDate LENGTH=5 format=DATE9. LABEL='General Ledger Date'
inforceIncDate LENGTH=5 FORMAT=DATE9. LABEL='In Force Inception
Date'
inforceExpDate LENGTH=5 FORMAT=DATE9. LABEL='In Force Expiry Date'

Protect PMOV - Functional Decomposition Analysis PAGE 4


tranInforce LENGTH=3 LABEL='Inforce Transaction
1(Yes)/0(No)'
itmstatus LABEL='Item Status -
V(void)/blank(current)'
reasoncde LABEL='Reason Code for
Cancellation Of Item'
transactionType LENGTH=$2 LABEL='User Defined -
Transaction Type'
newRenew LENGTH=$1 LABEL='New(N)/Renewal(R)
Risk'
itemAtrnType LABEL='Item - Transaction
Type'
atrnType LABEL='Premtran - Transaction
Type'

incGrossPrem LENGTH=5 FORMAT=12.2 LABEL='Transaction Basic


Premium'
cumGrossPrem LENGTH=5 FORMAT=12.2 LABEL='Cummulative Premium
Amount'
incStatutCharges LENGTH=4 FORMAT=10.2 LABEL='Transaction Charges'
cumStatutCharges LENGTH=4 FORMAT=10.2 LABEL='Cummulative Statutory
Charges'
stampDuty LENGTH=4 FORMAT=10.2 LABEL='Transaction Stamp
Duty'
cumStampDuty LENGTH=4 FORMAT=10.2 LABEL='Cummulative Stamp Duty
Amount'
incCommission1 LENGTH=4 FORMAT=10.2 LABEL='Transaction
Commission'
cumCommission1 LENGTH=4 FORMAT=10.2 LABEL='Cummulative Commission
Amount'
incGst LENGTH=4 FORMAT=10.2 LABEL='Amount of GST on
Transaction Premium'
cumGST LENGTH=4 FORMAT=10.2 LABEL='Cummulative GST
Amount'
incCommGst LENGTH=4 FORMAT=10.2 LABEL='Amount of GST on
Transaction Commision'
cumCommGst LENGTH=4 FORMAT=10.2 LABEL='Cummulative GST on
Transaction Commision'
tranEarnPremPerDay LENGTH=5 FORMAT=8.5 LABEL='Trans Earned Premium
Per Day'
tranEarnCommPerDay LENGTH=5 FORMAT=8.5 LABEL='Trans Earned
Commission Per Day'
cumEarnPremPerDay LENGTH=5 FORMAT=8.5 LABEL='Cummulative Earned
Premium Per day'
cumEarnCommPerDay LENGTH=5 FORMAT=8.5 LABEL='Cummulative Earned
Commission Per day'

coinsPrem LENGTH=5 FORMAT=12.2 LABEL='Coinsurance Premium'


retRiPrem LENGTH=5 FORMAT=12.2 LABEL='Retained Premium'
qsPrem LENGTH=5 FORMAT=12.2 LABEL='Quota Share Premium'
catPrem LENGTH=5 FORMAT=12.2 LABEL='Catastrophe Premium'
eolprem LENGTH=5 FORMAT=12.2 LABEL='Excess Of Loss
Premium'
specPrem LENGTH=5 FORMAT=12.2 LABEL='Special Premium'

modified LENGTH=8 FORMAT=BINARY10. LABEL='Flag to identify User


Modifications in Binary 0000000000'
;
SET &SYSLAST.;
BY company product policy itemno covRenewedDate inforceIncdate inforceExpDate
DESCENDING trancnt;

/* Define termIdent for ease of grouping */


RETAIN _termIdent 0;
IF FIRST.itemNo THEN DO;
_termIdent = 0;
END;
IF FIRST.covRenewedDate THEN _termIdent = _termIdent + 1;
termIdent = PUT(_termIdent,z3.);

/* Define coverageKey - Vero Protect niche Company specific start with 1100000000, 1st
digit for system 2nd digit for company */
/*RETAIN coverageKey 1100000000;
RETAIN coverageKey 0;
IF FIRST.trancnt THEN coverageKey+1;
*/
/* 0000001000 - Flag to identify that all financial fields from ITEM are set to zero
as there are no corresponding records in PREMTRAN */
IF premtranTranDate = . THEN DO;
modified = modified + 8;

Protect PMOV - Functional Decomposition Analysis PAGE 5


incGrossPrem = 0;
incStatutCharges = 0;
stampDuty = 0;
incCommission1 = 0;
incGst = 0;
incCommGst = 0;
glDate = .;
END;
ELSE DO;
/* Derive GLdate for use in reconcilliation financial transactions with GL , set
default to the END of the month */
_glDate =
PUT(PUT(company,z3.)||PUT(coyissued,z3.)||PUT(state,z2.)||PUT(branch,z4.)||PUT(premtranT
ranDate,YYMMDDN8.),?? gldates.) || '01';
glDate = INTNX('MONTH',INPUT(_gldate, ?? YYMMDD8.),0,'E');
END;

/* Define user transaction type base on PREMTRAN transaction type and ITEM transaction
Type and ITEM status */
SELECT;
when(atrnType = 'RV') transactionType = 'RV';
when(itemAtrnType = 'LP' AND itmStatus = 'V') transactionType = 'LP';
when(itemAtrnType = 'CN' AND itmStatus = 'V') transactionType = 'CN';
when(atrnType = 'NB') transactionType = 'NB';
when(atrnType = 'RE') transactionType = 'RE';
when(atrnType = 'RP') transactionType = 'RP';
when(atrnType = 'EP') transactionType = 'EP';
when(atrnType = 'CN') transactionType = 'CN';
otherwise transactionType = 'EN';
END;
/* As lookup for POLICYTH was done for all transactions instead of only 'RV' in
previous step so this is */
/* to reset these values for none RV transactions */
IF atrnType NE 'RV' THEN DO;
orgTrncnt = 0;
END;

RETAIN cumGrossPrem cumStatutCharges cumstampDuty cumCommission1 cumGst cumCommGst


cumEarnPremPerDay cumEarnCommPerDay 0 newRenew ;

/* Calculate the earned premium/commission per day for each transaction and
accummulate within the same term;*/
IF (covChgExpDate - covChgEffDate) = 0 THEN DO;
tranEarnPremPerDay = 0;
tranEarnCommPerDay = 0;
END;
ELSE DO;
tranEarnPremPerDay = incGrossPrem / (covChgExpDate - covChgEffDate);
tranEarnCommPerDay = incCommission1 / (covChgExpDate - covChgEffDate);
END;

IF FIRST.covRenewedDate THEN DO;


cumEarnPremPerDay = 0;
cumEarnCommPerDay = 0;
cumGrossPrem = 0;
cumStatutCharges = 0;
cumStampDuty = 0;
cumCommission1 = 0;
cumGst = 0;
cumCommGst = 0;

/* Identify new or renew business;*/


IF covReneweddate = policyInceptdate THEN newRenew = 'N';
ELSE newRenew = 'R';

END;

/* Identify reversal of New Business/ Renewal */


/* Identify reversal of Cancellation */
/* Identify reversal of Returned Premium Endorsement */
/* Identify reversal of Extra Premium Endorsement */

/* Cummulative financial fields */


cumGrossPrem = cumGrossPrem + incGrossPrem;
cumStatutCharges = cumStatutCharges + incStatutCharges;
cumstampDuty = cumstampDuty + stampDuty;
cumCommission1 = cumCommission1 + incCommission1;
cumGst = cumGst + incGst;
cumCommGst = cumCommGst + incCommGst;

Protect PMOV - Functional Decomposition Analysis PAGE 6


cumEarnPremPerDay = cumEarnPremPerDay + tranEarnPremPerDay;
cumEarnCommPerDay = cumEarnCommPerDay + tranEarnCommPerDay;

/* Define valid transaction types for inforce - NEED MORE WORK HERE in term of
REVERSAL ???? */
tranInforce = NOT (transactionType IN ('LP','CN') OR itmStatus = 'V' OR
(transactionType = 'RV' AND cumGrossPrem = 0)
);

/* Identify when extra,return premium effected 1,2 or 3 days before it expired and the
Abolute value of premium is more than $2 i.e. +/- $2 */
IF cumGrossPrem - incGrossPrem NE 0 THEN DO;
IF INTCK('DAY',inforceIncDate,inforceExpDate) IN (1,2,3) AND ABS(INT(incGrossPrem))
> 2 THEN DO;
modified = modified + 16;/* 0000010000 - Flag to identify the above case */
END;
END;

/* Modify the tranInforce for the last transaction of the last term to see if they are
endorsements and CUMGROSSPREM = 0 and */
/* currently flag as inforced which might not be correct as the risk has not being
renewed -> the reason was by default all */
/* endorsement transactions except Cancel / Lapse has been set as inforced transaction
*/
IF LAST.itemNo AND transactionType NOT IN ('NB','RE','LP','CN') AND INT(cumGrossPrem) =
0 AND tranInforce THEN DO;
modified = modified + 64;
tranInforce = 0;
END;
/*Unique coveragekey
coverageKey=MONOTONIC() + 5000000000; */
RUN;

PROC SQL NOPRINT;


SELECT max(coveragekey) format best. INTO :maxCovKey
FROM mbpnchht.MASTERKEY_PI
;
%PUT Maximum Coveragekey = &maxCovKey;
QUIT;

/*Logic to build unique coveragekey*/

DATA &_OUTPUT.(drop=row_insert_dt) dbpnchpl.MASTERKEY_PI(keep= coveragekey row_insert_dt


company product policy itemno trancnt);
ATTRIB
coverageKey1 LENGTH=8 LABEL='Coverage Key 1'
coverageKey LENGTH=8 LABEL='Coverage Key'
row_insert_dt LENGTH = 8 format = DATETIME20. LABEL = 'Date rows are inserted'
;
MERGE spdswork.Bef_CovKey(in = a)
mbpnchht.MASTERKEY_PI(in = b rename =(coverageKey =CK_old) )
;
BY company product policy itemno trancnt;
RETAIN coveragekey1 &maxCovKey.;
row_insert_dt=datetime();

IF a=b THEN
DO;
coverageKey = CK_old;
output &_OUTPUT.;
END;
ELSE IF a then DO;
coveragekey1+1;
coverageKey =coveragekey1;
output &_OUTPUT.;
output dbpnchpl.MASTERKEY_PI;
END;
drop coverageKey1;
RUN;

/*---- End of User Written Code ----*/


%rcSet(&syserr);
%rcSet(&sqlrc);

Protect PMOV - Functional Decomposition Analysis PAGE 7


C03 UWC Policy Fix
/*============================================================================*
* Step: UWC_Policy_Fix A55NWR2B.BI00K7N9 *
* Transform: User Written Code *
* Description: Take care of cases where recent transactions has the same *
* effective period with previous transactions *
* *
* Source Table: Extract_Source_Data_With_TimeStamp_reqdc A55NWR2B.BL00A9LS *
* ols - spdswork.W66COZ5U *
* Target Table: User Written Code Target - A55NWR2B.BL00A9LT *
* spdswork.W5J583L8 *
* *
* User Written: UWC_PNCB_Policy_Fix A55NWR2B.AF00OCJP *
* Fix effective period within POLICY table *
*============================================================================*/

%let SYSLAST = %nrquote(spdswork.W66COZ5U);

%let transformID = %quote(A55NWR2B.BI00K7N9);

%let trans_rc = 0;

%let _OUTPUT = %nrquote(spdswork.W5J583L8);

/*---- Start of User Written Code ----*/

%let tmp_table=%SYSFUNC(SUBSTR(&SYSLAST., %SYSFUNC(INDEX("&SYSLAST.",.))));

/*DATA &_OUTPUT. / VIEW= &_OUTPUT.;*/


DATA &_OUTPUT. ;
SET &SYSLAST. END=eof;
BY company product policy DESCENDING effectdte DESCENDING activto trancnt;
RETAIN joinDt prevEffectDte prevActivto _lapsedCnt 0;
%convertdate(effectdte,_effectdte);
IF activto = 99999999 THEN _activto = '31Dec9999'd;
ELSE DO;
%convertdate(activto,_activto);
END;
IF FIRST.policy THEN DO;
joinDt = _effectdte - 1;
prevEffectDte = .;
prevActivTo = .;
END;
ELSE DO;
/* The older transactions has effective period already covered in the previous
transaction */
IF _effectDte >= prevEffectDte AND _activto <= prevActivTo THEN DELETE;

IF _activto NE joinDt THEN DO;


/* about 287 transactions for company 3 that fall into this */
_activto = joinDt;
_lapsedCnt = _lapsedCnt + 1;
/* also delete if happen after adjust the _activto */
IF _effectDte >= prevEffectDte AND _activto <= prevActivTo THEN DELETE;
activto = INPUT(PUT(_activto,YYMMDDN8.),8.);
END;
END;
joinDt = _effectdte - 1;
prevEffectDte = _effectDte;
prevActivTo = _activto;

IF eof THEN DO;


PUT '*******Number of records that have wrong inforce periods in POLICY table ==> '
_lapsedCnt;
END;

DROP _: joinDt prevEffectDte prevActivto ;


RUN;

/* Free up temp spaces */


PROC DATASETS LIBRARY=spdswork NOLIST;
DELETE &tmp_table.;
QUIT;
/*---- End of User Written Code ----*/

%rcSet(&syserr);

Protect PMOV - Functional Decomposition Analysis PAGE 8


%rcSet(&sqlrc);

C04 UWC_PNCB_Premtran
/*============================================================================*
* Step: UWC_PNCB_Premtran A55NWR2B.BI00K7N8 *
* Transform: User Written Code *
* Description: As in Premtran there are cases when multiple records *
* within each COMPANY+PRODUCT+POLICY+ITEMNO+TRANCNT , there *
* isa need to accumulate the premium amounts but keep the *
* TRANDATE of the latest record. *
* *
* Source Table: test1 - spdswork.W5J1AN5G A55NWR2B.BL00A9LQ *
* Target Table: User Written Code Target - work.W5J1AM3C A55NWR2B.BL00A9LR *
* *
* User Written: Extract PremTran A55NWR2B.AF00OCJO *
* Extract PremTran *
*============================================================================*/

%let SYSLAST = %nrquote(spdswork.W5J1AN5G);

%let transformID = %quote(A55NWR2B.BI00K7N8);

%let trans_rc = 0;

%let _OUTPUT = %nrquote(work.W5J1AM3C);

/*---- Start of User Written Code ----*/

/* Get rid of duplicate records within the same trancnt with premium = 0 */
/*DATA _premtran1;*/
DATA spdswork._premtran1;
SET &SYSLAST.;
BY company product policy itemno trancnt trandate;
IF NOT (FIRST.trancnt AND LAST.trancnt) AND tbasicprm = 0 THEN DELETE;
RUN;

/* Free up temp spaces


PROC DATASETS LIBRARY=work NOLIST;
DELETE W5J1AN5G;
QUIT;
*/
/* Free up temp spaces */
PROC DATASETS LIBRARY=spdswork NOLIST;
DELETE W5J1AN5G;
QUIT;

/* Cummulative premium for each trancnt */


/*DATA OUTPUTxx(DROP=tbasicprm trandate RENAME=(cumTbasicprm=premtranTbasicPrm ));*/
/*SET _premtran1;*/

DATA &_OUTPUT.(DROP=tbasicprm trandate RENAME=(cumTbasicprm=premtranTbasicPrm ));


SET spdswork._premtran1;
BY company product policy itemno trancnt tranDate;
ATTRIB
cumtbasicprm LENGTH=5 FORMAT=comma12.2 LABEL= 'Transaction Premium -
PREMTRAN'
premtranTranDate LENGTH=5 FORMAT=DATE9. LABEL= 'Transaction Date -
PREMTRAN'
;
%convertdate(tranDate,premtranTranDate);

RETAIN cumtbasicprm 0;
IF FIRST.trancnt THEN DO;
cumtbasicprm = 0;
END;
cumtbasicprm = cumtbasicprm + tbasicprm;
IF LAST.trancnt ;
RUN;

/*proc sort data=OUTPUTxx out=&_OUTPUT. nodupkey;


BY company product policy itemno trancnt;
run;
*/
/* Free up temp spaces
PROC DATASETS LIBRARY=work NOLIST;
DELETE _premtran1 OUTPUTxx;

Protect PMOV - Functional Decomposition Analysis PAGE 9


QUIT;
*/

/* Free up temp spaces */


PROC DATASETS LIBRARY=spdswork NOLIST;
DELETE _premtran1 ;
QUIT;

/*---- End of User Written Code ----*/

%rcSet(&syserr);
%rcSet(&sqlrc);

C05 UWC Fix overlap dates and filter unwanted products


/*============================================================================*
* Step: UWC - Fix Overlap Dates and Filter A55NWR2B.BI00K7NP *
* unwanted products *
* Transform: User Written Code *
* Description: UWC - Fix Overlap Dates and Filter unwanted products like *
* Quotes, Cover Notes *
* *
* Source Table: PNCH_PROPOSAL - dbpncstg.PNCH_PROPOSAL A55NWR2B.BX001CW3 *
* Target Table: User Written Code Target - A55NWR2B.BL00A9M3 *
* spdswork.W65KH115 *
* *
* User Written: UWC_Fix_Overlap_Date A55NWR2B.AF00OCKE *
* Fix Overlap dates *
*============================================================================*/

/* Access the data for SPDS Work Library */


LIBNAME spdswork SASSPDS TEMP=YES GROUP='Production' user="&uid" passwd ="&pw"
schema="SPDSWORK" HOST='sasap2' Serv='5090' ;
%rcSet(&syslibrc);

%let SYSLAST = %nrquote(dbpncstg.PNCH_PROPOSAL);

%let transformID = %quote(A55NWR2B.BI00K7NP);

%let trans_rc = 0;

%let _OUTPUT = %nrquote(spdswork.W65KH115);

/*---- Start of User Written Code ----*/

DATA &_OUTPUT.;
SET &SYSLAST.( keep= company product policy effectdte activto trancnt
rec_type_cd imageFlag MPDISC PRVINSCOY CPBUSSRC CAMPCODE PRVINSIND PRVINSPOL LOYDATE
WHERE=((PUT(COMPANY, ? z2.) in ('01','02','04','05','11')
OR (PUT(COMPANY, ? z2.) = '03' AND put(PRODUCT,$CIA_PDS1a. ) NE 'CI'))
AND product NOT IN ('CVN','QTE')
AND (rec_type_cd NE 3)
AND imageFlag IN (' ','I'))) end=eof;
BY company product policy DESCENDING effectdte DESCENDING activto trancnt ;
ATTRIB
_effectdte LENGTH=5 FORMAT=DATE9. LABEL= 'Effective Date'
_activto LENGTH=5 FORMAT=DATE9. LABEL= 'Active To Date'
;
IF activto = 99999999 AND effectdte < 20000101 THEN DELETE;
RETAIN joinDt prevEffectDte prevActivto _lapsedCnt 0;
%convertdate(effectdte,_effectdte);
IF activto = 99999999 THEN _activto = '31Dec9999'd;
ELSE DO;
%convertdate(activto,_activto);
END;
IF FIRST.policy THEN DO;
joinDt = _effectdte - 1;
prevEffectDte = .;
prevActivTo = .;
END;
ELSE DO;
/* The older transactions has effective period already covered in the
previous transaction */
IF _effectDte >= prevEffectDte AND _activto <= prevActivTo THEN DELETE;

IF _activto NE joinDt THEN DO;


/* about 254 transactions for company 3 that fall into this */

Protect PMOV - Functional Decomposition Analysis PAGE 10


_activto = joinDt;
_lapsedCnt = _lapsedCnt + 1;
/* also delete if happen after adjust the _activto */
IF _effectDte >= prevEffectDte AND _activto <= prevActivTo THEN DELETE;
activto = INPUT(PUT(_activto,YYMMDDN8.),8.);
END;
END;
joinDt = _effectdte - 1;
prevEffectDte = _effectDte;
prevActivTo = _activto;

IF eof THEN DO;


PUT "*******Number of records in PNCH_PROPOSAL that have wrong inforce
periods ==> " _lapsedCnt;
END;

DROP _lapsedCnt effectdte activto joinDt prevEffectDte prevActivto rec_type_cd


;
RENAME _effectdte = effectDte _activto=activTo ;
RUN;

/*---- End of User Written Code ----*/

%rcSet(&syserr);
%rcSet(&sqlrc);

C06 SAS Extract - Change pcode from Num to Char


/*============================================================================*
* Step: SAS Extract - Change POSTCODE from num to A55NWR2B.BI00K7OB *
* char *
* Transform: Extract *
* Description: *
* *
* Source Table: PNCH_ADDRESS - dbpncstg.PNCH_ADDRESS A55NWR2B.BX001CTQ *
* Target Table: Extract Target - work.W65KIXJX A55NWR2B.BL00A9MC *
*============================================================================*/

/* Access the data for Protect Niche - Daily Staging Library */


LIBNAME dbpncstg SASSPDS user="&uid" passwd = "&pw" GROUP='production'
schema="D_B_PNCH_STAGING" HOST='sasap2' Serv='5090' ;
%rcSet(&syslibrc);

%let SYSLAST = %nrquote(dbpncstg.PNCH_ADDRESS);

%let transformID = %quote(A55NWR2B.BI00K7OB);

%let trans_rc = 0;

proc datasets lib = work nolist nowarn memtype = (data view);


delete W65KIXJX;
quit;

proc sql;
create table work.W65KIXJX as
select ADDRREF length = 8 label = 'Address Reference Number',
(case when length(left(put(POSTCODE,6.)))< 4 then left(put(POSTCODE,z4.))
else left(put(POSTCODE,6.)) end) as POSTCODE length = 6,
CITY length = 40 label = 'City/Town/Suburb Name',
md5_key length = 32 label = 'Natural key indentified by MD5 hash of the
concatenation of business keys',
rec_type_cd length = 8 label = 'Record type code sourced from the extract
identifying whether the record is new (1), modified (2), delete (3) or snapshot (4).',
batch_key length = 8 label = 'Key to Programme Register identifying the
details of the batch run which populated the record.',
run_reg_key length = 8 label = 'Key to Run Register identifying the details
of the etl_process run which populated the record.',
row_insert_dt length = 8 label = 'Timestamp identifying when the record was
inserted in the SRC table.',
row_effective_dt length = 8 label = 'Timestamp identifying records effective
date/time from operational system if available.',
audit_flag length = 1 label = 'Flag indicating whether the record is
operational (O) or maintenance (M) as a consequence of a data audit process.',
STREETNO length = 8 label = 'Street Number',
STREETIND length = 1 label = 'Code To Distinguish Within Street Number',
ADDRIND1 length = 1 label = 'Fflu -Indicator 1',
ADDRNO1 length = 8 label = 'Number Relating To The First Address Code',
ADDRIND2 length = 1 label = 'Fflu -Indicator 2',
ADDRNO2 length = 8 label = 'Number Relating To The Second Address Code',

Protect PMOV - Functional Decomposition Analysis PAGE 11


CITY_PREFIX length = 8 label = 'City/Town/Suburb Name Prefix',
STREET_PREFIX length = 8 label = 'Street Name Prefix',
STREET length = 40 label = 'Street Name',
ADDRFREE_PREFIX length = 8 label = 'Free Format Address Prefix',
ADDRFREE length = 30 label = 'Free Format Address'
from &SYSLAST
where rec_type_cd NE 3;
quit;

%let SYSLAST = work.W65KIXJX;

%rcSet(&sqlrc);

Simple
SAS Extract

P01
/*============================================================================*
* Step: SAS Extract A55NWR2B.BI00K7NC *
* Transform: Extract *
* Description: *
* *
* Source Table: PNCH_PREMTRAN - dbpncstg.PNCH_PREMTRAN A55NWR2B.BX001CW2 *
* Target Table: Extract Target - work.W66IEP17 A55NWR2B.BL00A9LU *
* *
* User Written: Not Used A55NWR2B.AF00OCJQ *
*============================================================================*/

%let SYSLAST = %nrquote(dbpncstg.PNCH_PREMTRAN);

%let transformID = %quote(A55NWR2B.BI00K7NC);

%let trans_rc = 0;

%let _OUTPUT = %nrquote(work.W66IEP17);

/*---- Start of User Written Code ----*/

/*---- End of User Written Code ----*/

%rcSet(&syserr);
%rcSet(&sqlrc);

P04
/*============================================================================*
* Step: ITEM Extract A55NWR2B.BI00K7NR *
* Transform: User Written Code *
* Description: Extract ITEM records based on the user defined format that *
* define how many years of data to retain. *
* *
* Source Table: Extract_Source_Data_With_TimeStamp_reqdc A55NWR2B.BL00A9M4 *
* ols - spdswork.W66CP32B *
* Target Table: User Written Code Target - A55NWR2B.BL00A9M5 *
* spdswork.W5J4C0T7 *
* *
* User Written: Item Cutoff A55NWR2B.AF00OCKG *
* Extract ITEM records base on the no of years being *
* retained *
*============================================================================*/

%let SYSLAST = %nrquote(spdswork.W66CP32B);

%let transformID = %quote(A55NWR2B.BI00K7NR);

%let trans_rc = 0;

%let _OUTPUT = %nrquote(spdswork.W5J4C0T7);


/*---- Start of User Written Code ----*/

%let tmp_table=%SYSFUNC(SUBSTR(&SYSLAST., %SYSFUNC(INDEX("&SYSLAST.",.))));

Protect PMOV - Functional Decomposition Analysis PAGE 12


/* For each company||product||class||Subclass combination , user can define a specific
cutoff dates */
/* to enable to creation of basedata that cover the required number of years */
/* This is applied to PMOV, COVDTLS, MASTERKEY and then flow through to others */

DATA _NULL_;
ATTRIB dt1 LENGTH=5 FORMAT=DATE9. ;
/*dt1 = INTNX('SEMIYEAR',INTNX('YEAR',"&SYSDATE."d,-
INPUT(PUT(&para_comp.,1.),pnchcutoff.)),1);*/
dt1 = INTNX('SEMIYEAR',INTNX('YEAR',"&SYSDATE."d,-8),1);

CALL SYMPUT('cutoffDt',dt1);
RUN;
/*** Added COMPANY 11 for Insure policies***/
/*DATA &_OUTPUT. / VIEW=&_OUTPUT.;*/

DATA &_OUTPUT. ;
SET &SYSLAST.(WHERE=((PUT(COMPANY, ? z2.) in ('01','02','04','05','11') OR
(PUT(COMPANY, ? z2.) = '03' AND
put(COMPRESS(product)||COMPRESS(class)||COMPRESS(subclass), $CIA_PDS1a. ) NE 'CI')) AND
INPUT(PUT(termincep,8.), ? yymmdd8.) >= &cutoffDt. ));
/* SET &SYSLAST.(WHERE=((PUT(COMPANY, ? z2.) in ('01','02','04','05') OR (PUT(COMPANY,
? z2.) = '03' AND put(COMPRESS(product)||COMPRESS(class)||COMPRESS(subclass),
$CIA_PDS1a. ) = 'PI')) AND INPUT(PUT(termincep,8.), ? yymmdd8.) >= &cutoffDt. ));*/
/* change cancellation date to 1 day after the Total Loss claims as currently system
generate cancel date the same day as total loss occur */
_effectDate = effectDte;
IF reasoncde = '14' AND effectdte < duedate THEN DO;
%convertdate(effectdte,_EffectDate1);
_effectDate = INPUT(PUT(INTNX('DAY',_effectDate1,1), YYMMDDN8.), 8.);
END;
DROP _EffectDate1 effectDte;
RENAME _effectDate = effectDte;
RUN;

/* this code use when cutoff date definition extent to product,class,subclass from
existing company */
/*
DATA &_OUTPUT. / VIEW=&_OUTPUT.;
SET &SYSLAST.(WHERE=(PUT(company, ? z2.)="&para_comp." ));
IF INPUT(PUT(termincep,8.), ?? yymmdd8.) >=
INTNX('SEMIYEAR',INTNX('YEAR',"&SYSDATE."d,-
(INPUT(COMPRESS(put(company,1.))||COMPRESS(product)||COMPRESS(class)||COMPRESS(subclass)
,pnchcutoff.))),1);
RUN;
*/

/* Free up temp spaces */


PROC DATASETS LIBRARY=spdswork NOLIST;
DELETE &tmp_table.;
QUIT;
/*---- End of User Written Code ----*/

%rcSet(&syserr);
%rcSet(&sqlrc);

P15
/*============================================================================*
* Step: SAS Extract A55NWR2B.BI00K7O2 *
* Transform: Extract *
* Description: *
* *
* Source Table: Splitter Target 1 - work.W66O0OT3 A55NWR2B.BL00A9MH *
* Target Table: Extract Target - work.W66O1GOS A55NWR2B.BL00A9MJ *
*============================================================================*/

%let SYSLAST = %nrquote(work.W66O0OT3);

%let transformID = %quote(A55NWR2B.BI00K7O2);


%let trans_rc = 0;

proc datasets lib = work nolist nowarn memtype = (data view);

Protect PMOV - Functional Decomposition Analysis PAGE 13


delete W66O1GOS;
quit;

proc sql;
create view work.W66O1GOS as
select FIREBRIG length = 1 label = 'FIREBRIG',
COYISSUED length = 8 label = 'COYISSUED',
itemNo length = 8 label = 'Item No',
modified length = 8 label = 'Flag to identify User Modifications in Binary
00000000',
GRPNAME length = 60 label = 'Group Name',
MANCOMRTE length = 8 label = 'MANCOMRTE',
POLSTATUS length = 1 label = 'POLSTATUS',
PREMREASA length = 2 label = 'PREMREASA',
inforceIncDate length = 5 label = 'In Force Inception Date',
incCommission1 length = 4 label = 'Transaction Commission',
RCOMMISN length = 8 label = 'RCOMMISN',
incGrossPrem length = 5 label = 'Transaction Basic Premium',
reverseTrncnt length = 8 label = 'Transaction Count',
BRCHRESP length = 8 label = 'BRCHRESP',
CUSTREF length = 14 label = 'CUSTREF',
LOCKUSER length = 8 label = 'LOCKUSER',
CITY length = 40 label = 'City/Town/Suburb Name',
covRenewedDate length = 5 label = 'Coverage Renew Date',
incCommGst length = 4 label = 'Amount of GST on Transaction Commision',
OCCUPATN length = 4 label = 'OCCUPATN',
cumEarnPremPerDay length = 5 label = 'Cummulative Earned Premium Per day',
coinsPrem length = 8 label = 'Coinsurance Premium',
AGENTSTATE length = 8 label = 'State Code',
subclass length = 3 label = 'Subclass',
ORGTRNCNT length = 8 label = 'ORGTRNCNT',
COMPLTIND length = 1 label = 'COMPLTIND',
RGST length = 8 label = 'RGST',
SPCLSIND length = 1 label = 'SPCLSIND',
STATE length = 8 label = 'STATE',
CAMPCODE length = 10 label = 'CAMPCODE',
BRANCH length = 8 label = 'BRANCH',
covChgEffDate length = 5 label = 'Coverage Change Effective Date',
DISTRICT length = 2 label = 'DISTRICT',
CANCDECLN length = 1 label = 'CANCDECLN',
STISSUED length = 2 label = 'STISSUED',
tranEarnPremPerDay length = 5 label = 'Trans Earned Premium Per Day',
INDEXIND length = 1 label = 'INDEXIND',
tranEarnCommPerDay length = 5 label = 'Trans Earned Commission Per Day',
EXCESS length = 8 label = 'EXCESS',
CPBUSSRC length = 10 label = 'Corporate Partners Source Of Business',
qsPrem length = 5 label = 'Quota Share Premium',
FIELD04 length = 4 label = 'Reserved For Future Use',
NTCETYPE length = 1 label = 'NTCETYPE',
cumEarnCommPerDay length = 5 label = 'Cummulative Earned Commission Per
day',
GSTEXCLUD length = 2 label = 'Gst Exclusion',
SDEXCLUD length = 2 label = 'Stamp Duty Exclusion Code.',
COMREAS length = 2 label = 'COMREAS',
atrnType length = 2 label = 'Premtran - Transaction Type',
REP length = 8 label = 'REP',
CHGEXCLUD length = 2 label = 'Code For Reason Of Exclusion Of Charges',
NTCEPROD length = 1 label = 'NTCEPROD',
glDate length = 5 label = 'General Ledger Date',
COINSPC length = 8 label = 'COINSPC',
incGst length = 4 label = 'Amount of GST on Transaction Premium',
stampDuty length = 4 label = 'Transaction Stamp Duty',
tranInforce length = 3 label = 'Inforce Transaction 1(Yes)/0(No)',
BUSDESC length = 1 label = 'BUSDESC',
cumGrossPrem length = 5 label = 'Cummulative Premium Amount',
policy length = 8 label = 'Policy Number',
cumStampDuty length = 4 label = 'Cummulative Stamp Duty Amount',
covChgExpDate length = 5 label = 'Coverage Change Expiry Date',
policyInceptDate length = 5 label = 'Policy Inception Date',
cumCommission1 length = 4 label = 'Cummulative Commission Amount',
PRVINSPOL length = 14 label = 'Previous Policy Code',
premtranTRANDATE length = 5 label = 'Transaction Date',
REVIEWIND length = 1 label = 'REVIEWIND',
RISKSTATE length = 2 label = 'RISKSTATE',
AGTGROUP length = 8 label = 'Agent Group Number',
DISCREAS length = 2 label = 'DISCREAS',
REBATEPC length = 8 label = 'REBATEPC',
itemAtrnType length = 2 label = 'Item - Transaction Type',
AGTCLUSTR length = 4 label = 'Agent Cluster',
EXCESSTYP length = 1 label = 'EXCESSTYP',

Protect PMOV - Functional Decomposition Analysis PAGE 14


RCOMMGST length = 8 label = 'RCOMMGST',
MPDISC length = 1 label = 'Multi Policy Discount',
RSTMPDUTY length = 8 label = 'RSTMPDUTY',
BUSNESSRC length = 4 label = 'BUSNESSRC',
SUMINS length = 8 label = 'SUMINS',
PRVINSIND length = 1 label = 'Previous Insurance',
termIdent length = 3 label = 'Term Identification',
cumGST length = 4 label = 'Cummulative GST Amount',
GSTORIDE length = 1 label = 'GSTORIDE',
LOADREAS length = 2 label = 'LOADREAS',
PREMREAST length = 2 label = 'PREMREAST',
CLIENT length = 8 label = 'CLIENT',
cumCommGst length = 4 label = 'Cummulative GST on Transaction Commision',
RNWALTERM length = 8 label = 'RNWALTERM',
NTCETO length = 1 label = 'NTCETO',
IMAGEFLAG length = 1 label = 'IMAGEFLAG',
MINPRMIND length = 1 label = 'MINPRMIND',
incStatutCharges length = 4 label = 'Transaction Charges',
LOCATNREF length = 8 label = 'LOCATNREF',
cumStatutCharges length = 4 label = 'Cummulative Statutory Charges',
itmstatus length = 1 label = 'Item Status - V(void)/blank(current)',
transactionDate length = 5 label = 'Transaction Date',
coverageKey length = 8 label = 'Coverage Key',
trancnt length = 8 label = 'Transaction Count',
eolprem length = 5 label = 'Excess Of Loss Premium',
PRVINSCOY length = 4 label = 'Previous Insurer',
seqPolicy length = 8 label = 'Sequence Policy Number',
product length = 3 label = 'Product',
DISCGRP length = 1 label = 'DISCGRP',
RBASICPRM length = 8 label = 'RBASICPRM',
inforceExpDate length = 5 label = 'In Force Expiry Date',
MSGIND length = 1 label = 'MSGIND',
reasoncde length = 2 label = 'Reason Code for Cancellation Of Item',
PRVPOLREF length = 14 label = 'PRVPOLREF',
company length = 8 label = 'Company',
CLAUSEIND length = 1 label = 'CLAUSEIND',
COMSCALE length = 8 label = 'Commission Scale',
POSTCODE length = 6 label = 'Postcode',
premtranTbasicPrm length = 8 label = 'Transaction Basic Premium',
newRenew length = 1 label = 'New(N)/Renewal(R) Risk',
AGENT length = 8 label = 'AGENT',
LOADINGPC length = 8 label = 'LOADINGPC',
class length = 3 label = 'Class',
IMPEXCESS length = 1 label = 'IMPEXCESS',
TAILORGRP length = 2 label = 'TAILORGRP',
RCHARGES length = 8 label = 'RCHARGES',
retRiPrem length = 5 label = 'Retained Premium',
TYPEOFPOL length = 1 label = 'TYPEOFPOL',
catPrem length = 5 label = 'Catastrophe Premium',
SUMINSCDE length = 3 label = 'SUMINSCDE',
transactionType length = 2 label = 'User Defined - Transaction Type',
INDEXPERC length = 6 label = 'INDEX PERC',
INSTALFRQ length = 1 label = 'INSTALFRQ',
MANRIIND length = 1 label = 'MANRIIND',
specPrem length = 5 label = 'Special Premium',
(0) as NBRATE length = 8,
(0) as RENRATE length = 8,
(0) as NOMRATENB length = 8,
(0) as NOMRATEREN length = 8,
LOYDATE length = 8 label = 'LOYDATE',
RISKNO length = 6 label = 'Number To Identify Risk Group'
from &SYSLAST;
quit;

%let SYSLAST = work.W66O1GOS;

%rcSet(&sqlrc);

P21
/*============================================================================*
* Step: SAS Extract - ITEMRI A55NWR2B.BI00K7NJ *
* Transform: Extract *
* Description: Get Coinsurance and RI Premium *
* *
* Source Table: PNCH_ITEMRI - dbpncstg.PNCH_ITEMRI A55NWR2B.BX001CVA *
* Target Table: Extract Target - work.W5JR5REU A55NWR2B.BL00A9LL *
*============================================================================*/

Protect PMOV - Functional Decomposition Analysis PAGE 15


%let SYSLAST = %nrquote(dbpncstg.PNCH_ITEMRI);

%let transformID = %quote(A55NWR2B.BI00K7NJ);

%let trans_rc = 0;

proc datasets lib = work nolist nowarn memtype = (data view);


delete W5JR5REU;
quit;

proc sql;
create table work.W5JR5REU as
select COMPANY length = 8 format = 6. informat = 6. label = 'COMPANY',
PRODUCT length = 3 format = $3. informat = $3. label = 'PRODUCT',
POLICY length = 8 format = 11. informat = 11. label = 'POLICY',
ITEMNO length = 8 format = 6. informat = 6. label = 'ITEMNO',
TRANCNT length = 8 format = 6. informat = 6. label = 'TRANCNT',
RITYPE length = 1 format = $1. informat = $1. label = 'RITYPE',
(SUM(PREMIUM)) as retRiPrem length = 8 format = 13.2 informat = 13.2,
(SUM(QSPREM)) as QSPREM length = 8 format = 13.2 informat = 13.2,
(SUM(CATPREM)) as CATPREM length = 8 format = 13.2 informat = 13.2,
(SUM(EOLPREM)) as EOLPREM length = 8 format = 13.2 informat = 13.2,
(SUM(SPECPREM)) as SPECPREM length = 8 format = 13.2 informat = 13.2
from &SYSLAST
where (PUT(COMPANY, ? z2.) in ('01','02','04','05','11') OR (PUT(COMPANY, ?
z2.) = '03' AND put(PRODUCT,$CIA_PDS1a. ) NE 'CI')) AND PRODUCT NOT IN ('QTE','CVN')
AND RITYPE IN ('R','P') AND STATUSIND IN ('S','C') AND rec_type_cd NE 3
group by COMPANY, PRODUCT, POLICY, ITEMNO, TRANCNT, RITYPE;
quit;
%let SYSLAST = work.W5JR5REU;

%rcSet(&sqlrc);

P27
/*============================================================================*
* Step: SAS Extract A55NWR2B.BI00K7N7 *
* Transform: Extract *
* Description: *
* *
* Source Table: PNCH_AGTGRP - D_S_PNCH.PNCH_AGTGRP A55NWR2B.BX0002BT *
* Target Table: AGTGRP - work.W667I6HD A55NWR2B.BL00A9LP *
*============================================================================*/

%let SYSLAST = %nrquote(D_S_PNCH.PNCH_AGTGRP);

%let transformID = %quote(A55NWR2B.BI00K7N7);

%let trans_rc = 0;

proc datasets lib = work nolist nowarn memtype = (data view);


delete W667I6HD;
quit;

proc sql;
create table work.W667I6HD as
select COMPANY length = 8 format = 6. informat = 6. label = 'Company Code',
AGTGROUP length = 8 label = 'Agent Group Number',
AGTCLUSTR length = 4 label = 'Agent Cluster',
GRPNAME length = 60 label = 'Group Name'
from &SYSLAST
where (PUT(COMPANY, ? z2.) in ('01','02','03','04','05','11')) and STATUS <>
'V' and ACTIVTO = 99999999 and rec_type_cd NE 3;
quit;

%let SYSLAST = work.W667I6HD;

%rcSet(&sqlrc);

P28
/*============================================================================*
* Step: SAS Extract A55NWR2B.BI00K7NE *
* Transform: Extract *
* Description: *
* *
* Source Table: User Written Code Target - work.W667HWHQ A55NWR2B.BL00A9LV *

Protect PMOV - Functional Decomposition Analysis PAGE 16


* Target Table: Extract Target - work.W667HY6U A55NWR2B.BL00A9LW *
*============================================================================*/

%let SYSLAST = %nrquote(work.W667HWHQ);

%let transformID = %quote(A55NWR2B.BI00K7NE);

%let trans_rc = 0;

proc datasets lib = work nolist nowarn memtype = (data view);


delete W667HY6U;
quit;

proc sql;
create table work.W667HY6U as
select COMPANY length = 4 label = 'Company Code',
AGENT length = 6 label = 'Agent Number For Database Access',
AGTGROUP length = 6 label = 'Broker Group Number',
COMSCALE length = 4 label = 'Commission Scale',
STATE as AGENTSTATE length = 8 label = 'State Code'
from &SYSLAST
where PUT(COMPANY, ? z2.) in ('01','02','03','04','05','11') and rec_type_cd
NE 3;
quit;

%let SYSLAST = work.W667HY6U;

%rcSet(&sqlrc);

P29
/*============================================================================*
* Step: SAS Extract A55NWR2B.BI00K7NM *
* Transform: Extract *
* Description: *
* *
* Source Table: PNCH_AUTINDEX - D_S_PNCH.PNCH_AUTINDEX A55NWR2B.BX003LMQ *
* Target Table: AUTINDEX - work.W667HQLA A55NWR2B.BL00A9M1 *
*============================================================================*/

%let SYSLAST = %nrquote(D_S_PNCH.PNCH_AUTINDEX);

%let transformID = %quote(A55NWR2B.BI00K7NM);

%let trans_rc = 0;

proc datasets lib = work nolist nowarn memtype = (data view);


delete W667HQLA;
quit;

proc sql;
create table work.W667HQLA as
select COMPANY length = 8 format = 6. informat = 6. label = 'COMPANY',
PRODUCT length = 3 label = 'PRODUCT',
STATE length = 8 format = 6. informat = 6. label = 'STATE',
CLASS length = 3 format = $3. informat = $3. label = 'CLASS',
SUBCLASS length = 3 format = $3. informat = $3. label = 'SUB CLASS',
INDEXPERC length = 6 label = 'INDEX PERC'
from &SYSLAST
where (PUT(COMPANY, ? z2.) in ('01','02','04','05','11') OR ( PUT(COMPANY, ?
z2.) = '03' AND put(PRODUCT,$CIA_PDS1a. ) NE 'CI')) AND PRODUCT NOT IN ('QTE','CVN')
and rec_type_cd NE 3 and ACTIVTO = 99999999;
quit;

%let SYSLAST = work.W667HQLA;

%rcSet(&sqlrc);

P31
/*============================================================================*
* Step: SAS Extract A55NWR2B.BI00K7NH *
* Transform: Extract *
* Description: *
* *
* Source Table: PNCH_CLASSTYP - D_S_PNCH.PNCH_CLASSTYP A55NWR2B.BX0002C2 *
* Target Table: Extract Target - work.W66NJTRK A55NWR2B.BL00A9LZ *
*============================================================================*/

Protect PMOV - Functional Decomposition Analysis PAGE 17


%let SYSLAST = %nrquote(D_S_PNCH.PNCH_CLASSTYP);

%let transformID = %quote(A55NWR2B.BI00K7NH);

%let trans_rc = 0;

proc datasets lib = work nolist nowarn memtype = (data view);


delete W66NJTRK;
quit;

proc sql;
create view work.W66NJTRK as
select COMPANY length = 4 informat = IB002. label = 'COMPANY',
STATE length = 4 informat = IB002. label = 'STATE',
CLASS length = 3 informat = $EBCDIC003. label = 'CLASS',
SUBCLASS length = 3 informat = $EBCDIC003. label = 'SUBCLASS',
COMPRODCT length = 1 informat = $EBCDIC001. label = 'COMPRODCT',
COMSUBCLS length = 1 informat = $EBCDIC001. label = 'COMSUBCLS'
from &SYSLAST
where COMPANY in (3, 5) and rec_type_cd ne 3;
quit;

%let SYSLAST = work.W66NJTRK;

%rcSet(&sqlrc);

P32
/*============================================================================*
* Step: SAS Extract A55NWR2B.BI00K7NO *
* Transform: Extract *
* Description: *
* *
* Source Table: PNCH_COMSCALE - D_S_PNCH.PNCH_COMSCALE A55NWR2B.BX0002DD *
* Target Table: Extract Target - work.W667ICOF A55NWR2B.BL00A9M2 *
*============================================================================*/

/* Access the data for Daily Protect Niche Source Layer Data */
LIBNAME D_S_PNCH SASSPDS GROUP='production' user="&uid" passwd ="&pw"
schema="D_S_PNCH" HOST='sasap2' Serv='5090' ;
%rcSet(&syslibrc);

%let SYSLAST = %nrquote(D_S_PNCH.PNCH_COMSCALE);

%let transformID = %quote(A55NWR2B.BI00K7NO);

%let trans_rc = 0;

proc datasets lib = work nolist nowarn memtype = (data view);


delete W667ICOF;
quit;

proc sql;
create view work.W667ICOF as
select COMPANY length = 8 label = 'COMPANY',
STATE length = 8 label = 'STATE',
PRODUCT length = 3 label = 'PRODUCT',
CLASS length = 3 label = 'CLASS',
SCALE length = 8 label = 'SCALE',
(case when ACTIVFROM = 20100229 then "28FEB2010"D
else INPUT(PUT(ACTIVFROM ,8.) ,?YYMMDD8.) end) as ACTIVFROM length = 8
format = DATE9.,
(case when ACTIVTO = 20100229 then "28FEB2010"D
when ACTIVTO = 99999999 then "31DEC2099"D
else INPUT(PUT(ACTIVTO ,8.) ,?YYMMDD8.) END) as ACTIVTO length = 8 format =
DATE9.,
NBRATE length = 8 label = 'NBRATE',
RENRATE length = 8 label = 'RENRATE',
NOMRATENB length = 8 label = 'NOMRATENB',
NOMRATEREN length = 8 label = 'NOMRATEREN',
SUBCLASS length = 3 informat = $EBCDIC3. label = 'SUBCLASS'
from &SYSLAST
where PUT(COMPANY, ? z2.) in ('03','05') AND rec_type_cd ne 3
order by COMPANY, STATE, PRODUCT, CLASS, SCALE, ACTIVFROM, ACTIVTO desc;
quit;

%let SYSLAST = work.W667ICOF;

Protect PMOV - Functional Decomposition Analysis PAGE 18


%rcSet(&sqlrc);

SPD Server Loader

P02
/*============================================================================*
* Step: SPD Server Loader A55NWR2B.BI00K7ND *
* Transform: SPD Server Table Loader *
* Description: *
* *
* Source Table: Extract Target - work.W66IEP17 A55NWR2B.BL00A9LU *
* Target Table: PNCH_ITEM - dbpncstg.PNCH_ITEM A55NWR2B.BX001CV9 *
* *
* User Written: Not Used A55NWR2B.AF00OCJR *
*============================================================================*/

%let SYSLAST = %nrquote(work.W66IEP17);

%let transformID = %quote(A55NWR2B.BI00K7ND);

%let trans_rc = 0;

%let _OUTPUT = %nrquote(dbpncstg.PNCH_ITEM);

/*---- Start of User Written Code ----*/

/*---- End of User Written Code ----*/

%rcSet(&syserr);
%rcSet(&sqlrc);

P12
/*============================================================================*
* Step: SPD Server Loader A55NWR2B.BI00K7N6 *
* Transform: SPD Server Table Loader *
* Description: *
* *
* Source Table: Splitter Target 2 - work.W5JEMGHM A55NWR2B.BL00A9LO *
* Target Table: Staging Niche PI - Reversed Transactions A55NWR2B.BX004XHA *
* - dbnchpis.REVERSETRANS_PI *
*============================================================================*/

%let SYSLAST = %nrquote(work.W5JEMGHM);

%let transformID = %quote(A55NWR2B.BI00K7N6);

%let trans_rc = 0;

%global etls_tableExist;
%global etls_numIndex;
%global etls_lastTable;
%let etls_tableExist = -1;
%let etls_numIndex = -1;
%let etls_lastTable = &SYSLAST;

/*---- Define load data macro ----*/


%macro etls_loader;

/* Setting up macro variables for SPD Server Loader */


%let SYSOPT = ;

/* Determine if the target table exists */


%let etls_tableExist = %eval(%sysfunc(exist(dbnchpis.REVERSETRANS_PI, DATA)) or
%sysfunc(exist(dbnchpis.REVERSETRANS_PI, VIEW)));

/*---- Drop a table ----*/


%put %str(NOTE: Dropping table ...);
proc datasets lib = dbnchpis nolist nodetails;
delete REVERSETRANS_PI;
quit;
%rcSet(&syserr);

%let etls_tableExist = 0;

Protect PMOV - Functional Decomposition Analysis PAGE 19


/*---- Create a new table ----*/
%if (&etls_tableExist eq 0) %then
%do; /* if table does not exist */

%put %str(NOTE: Creating table ...);

data dbnchpis.REVERSETRANS_PI
(label = 'Staging Niche PI - Reversed Transactions');
attrib COMPANY length = 8 format = 6. informat = 6.
label = 'Company';
attrib PRODUCT length = $3 format = $3. informat = $3.
label = 'Product';
attrib POLICY length = 8 format = 11. informat = 11.
label = 'Policy Number';
attrib ITEMNO length = 8 format = 6. informat = 6.
label = 'Item No';
attrib reverseTrncnt length = 8 format = 6. informat = 6.
label = 'Transaction Count';
attrib trancnt length = 8 format = 6. informat = 6.
label = 'ORGTRNCNT';
stop;
run;

%rcSet(&syserr);

%end; /* if table does not exist */

/*---- Create the indexes in parallel for a table ----*/


/* recreate indexes was selected */
%put %str(NOTE: Creating indexes in Parallel...);
proc datasets lib = dbnchpis nolist;
modify REVERSETRANS_PI (asyncindex=YES);
index create key1 = (COMPANY PRODUCT POLICY ITEMNO trancnt);
quit;

%rcSet(&syserr);

/*---- Map the columns ----*/


proc datasets lib = work nolist nowarn memtype = (data view);
delete mapped;
quit;

%put %str(NOTE: Mapping columns ...);


proc sql;
create view work.mapped as
select COMPANY length = 8,
PRODUCT length = 3,
POLICY length = 8,
ITEMNO length = 8,
TRANCNT as reverseTrncnt length = 8,
ORGTRNCNT as trancnt length = 8
from &etls_lastTable;
quit;

%let SYSLAST = work.mapped;

%let etls_lastTable = &SYSLAST;


%let SYSOPT = ;

/*---- Append new data ----*/


%put %str(NOTE: Appending data ...);

/* Get number of records in table */


%let etls_recordsBefore = 0;
%macro etls_recordCheck;
%let etls_recCheckExist = %eval(%sysfunc(exist(dbnchpis.REVERSETRANS_PI, DATA)) or
%sysfunc(exist(dbnchpis.REVERSETRANS_PI, VIEW)));

%if (&etls_recCheckExist) %then


%do;
proc contents data = dbnchpis.REVERSETRANS_PI out = work.etls_contents(keep =
nobs) noprint;
run;
data _null_;
set work.etls_contents (obs = 1);
call symput("etls_recordsBefore", left(put(nobs,32.)));
run;

Protect PMOV - Functional Decomposition Analysis PAGE 20


proc datasets lib = work nolist nowarn memtype = (data view);
delete etls_contents;
quit;

%end;
%mend etls_recordCheck;
%etls_recordCheck;

%let etls_table = %nrquote(Staging Niche PI - Reversed Transactions);


%let etls_lib = %nrquote(Protect Niche PI - Daily Staging Library);

proc append base = dbnchpis.REVERSETRANS_PI


data = &etls_lastTable (&SYSOPT) force;
run;

%rcSet(&syserr);

/* Get number of records in table */


%let etls_recordsAfter = 0;
%macro etls_recordCheck;
%let etls_recCheckExist = %eval(%sysfunc(exist(dbnchpis.REVERSETRANS_PI, DATA)) or
%sysfunc(exist(dbnchpis.REVERSETRANS_PI, VIEW)));

%if (&etls_recCheckExist) %then


%do;
proc contents data = dbnchpis.REVERSETRANS_PI out = work.etls_contents(keep =
nobs) noprint;
run;
data _null_;
set work.etls_contents (obs = 1);
call symput("etls_recordsAfter", left(put(nobs,32.)));
run;

proc datasets lib = work nolist nowarn memtype = (data view);


delete etls_contents;
quit;

%end;
%mend etls_recordCheck;
%etls_recordCheck;

proc datasets lib = work nolist nowarn memtype = (data view);


delete mapped;
quit;

%mend etls_loader;
%etls_loader;

P23
/*============================================================================*
* Step: SPD Server Loader A55NWR2B.BI00K7NB *
* Transform: SPD Server Table Loader *
* Description: *
* *
* Source Table: Splitter Target 1 - work.W5JR5N1P A55NWR2B.BL00A9LM *
* Target Table: Staging Niche PI -Retained Premium A55NWR2B.BX004XHB *
* Details - dbnchpis.RETPREM_PI *
*============================================================================*/

/* Access the data for Protect Niche PI - Daily Staging Library */


LIBNAME dbnchpis SASSPDS GROUP='production' user="&uid" passwd ="&pw"
schema="D_B_PNCHPI_STAGING" HOST='sasap2' Serv='5090' ;
%rcSet(&syslibrc);

%let SYSLAST = %nrquote(work.W5JR5N1P);

%let transformID = %quote(A55NWR2B.BI00K7NB);

%let trans_rc = 0;

%global etls_tableExist;
%global etls_numIndex;
%global etls_lastTable;
%let etls_tableExist = -1;
%let etls_numIndex = -1;
%let etls_lastTable = &SYSLAST;

Protect PMOV - Functional Decomposition Analysis PAGE 21


/*---- Define load data macro ----*/
%macro etls_loader;

/* Setting up macro variables for SPD Server Loader */


%let SYSOPT = ;

/* Determine if the target table exists */


%let etls_tableExist = %eval(%sysfunc(exist(dbnchpis.RETPREM_PI, DATA)) or
%sysfunc(exist(dbnchpis.RETPREM_PI, VIEW)));

/*---- Drop a table ----*/


%put %str(NOTE: Dropping table ...);
proc datasets lib = dbnchpis nolist nodetails;
delete RETPREM_PI;
quit;

%rcSet(&syserr);

%let etls_tableExist = 0;

/*---- Create a new table ----*/


%if (&etls_tableExist eq 0) %then
%do; /* if table does not exist */

%put %str(NOTE: Creating table ...);

data dbnchpis.RETPREM_PI
(label = 'Staging Niche PI -Retained Premium Details');
attrib company length = 8 format = 6. informat = 6.
label = 'Company';
attrib product length = $3 format = $3. informat = $3.
label = 'Product';
attrib policy length = 8 format = 11. informat = 11.
label = 'Policy Number';
attrib itemNo length = 8 format = 6. informat = 6.
label = 'Item No';
attrib trancnt length = 8 format = 6. informat = 6.
label = 'Transaction Count';
attrib retRiPrem length = 8 format = 12.2
label = 'Retained Premium';
attrib qsPrem length = 8 format = 12.2
label = 'Quota Share Premium';
attrib catPrem length = 8 format = 12.2
label = 'Catastrophe Premium';
attrib eolprem length = 8 format = 12.2
label = 'Excess Of Loss Premium';
attrib specPrem length = 8 format = 12.2
label = 'Special Premium';
stop;
run;

%rcSet(&syserr);

%end; /* if table does not exist */

/*---- Map the columns ----*/


proc datasets lib = work nolist nowarn memtype = (data view);
delete mapped;
quit;

%put %str(NOTE: Mapping columns ...);


proc sql;
create view work.mapped as
select COMPANY as company length = 8,
PRODUCT as product length = 3,
POLICY as policy length = 8,
ITEMNO as itemNo length = 8,
TRANCNT as trancnt length = 8,
retRiPrem length = 8 format = 12.2,
QSPREM as qsPrem length = 8 format = 12.2,
CATPREM as catPrem length = 8 format = 12.2,
EOLPREM as eolprem length = 8 format = 12.2,
SPECPREM as specPrem length = 8 format = 12.2
from &etls_lastTable;
quit;
%let SYSLAST = work.mapped;

%let etls_lastTable = &SYSLAST;

Protect PMOV - Functional Decomposition Analysis PAGE 22


%let SYSOPT = ;

/*---- Append new data ----*/


%put %str(NOTE: Appending data ...);

/* Get number of records in table */


%let etls_recordsBefore = 0;
%macro etls_recordCheck;
%let etls_recCheckExist = %eval(%sysfunc(exist(dbnchpis.RETPREM_PI, DATA)) or
%sysfunc(exist(dbnchpis.RETPREM_PI, VIEW)));

%if (&etls_recCheckExist) %then


%do;
proc contents data = dbnchpis.RETPREM_PI out = work.etls_contents(keep = nobs)
noprint;
run;

data _null_;
set work.etls_contents (obs = 1);
call symput("etls_recordsBefore", left(put(nobs,32.)));
run;

proc datasets lib = work nolist nowarn memtype = (data view);


delete etls_contents;
quit;

%end;
%mend etls_recordCheck;
%etls_recordCheck;
%let etls_table = %nrquote(Staging Niche PI -Retained Premium Details);
%let etls_lib = %nrquote(Protect Niche PI - Daily Staging Library);

proc append base = dbnchpis.RETPREM_PI


data = &etls_lastTable (&SYSOPT) force;
run;

%rcSet(&syserr);

/* Get number of records in table */


%let etls_recordsAfter = 0;
%macro etls_recordCheck;
%let etls_recCheckExist = %eval(%sysfunc(exist(dbnchpis.RETPREM_PI, DATA)) or
%sysfunc(exist(dbnchpis.RETPREM_PI, VIEW)));

%if (&etls_recCheckExist) %then


%do;
proc contents data = dbnchpis.RETPREM_PI out = work.etls_contents(keep = nobs)
noprint;
run;

data _null_;
set work.etls_contents (obs = 1);
call symput("etls_recordsAfter", left(put(nobs,32.)));
run;

proc datasets lib = work nolist nowarn memtype = (data view);


delete etls_contents;
quit;

%end;
%mend etls_recordCheck;
%etls_recordCheck;

proc datasets lib = work nolist nowarn memtype = (data view);


delete mapped;
quit;

%mend etls_loader;
%etls_loader;

P25
/*============================================================================*
* Step: SPD Server Loader A55NWR2B.BI00K7NA *
* Transform: SPD Server Table Loader *
* Description: *
* *
* Source Table: Splitter Target 2 - work.W5JR5N1Z A55NWR2B.BL00A9LN *

Protect PMOV - Functional Decomposition Analysis PAGE 23


* Target Table: Staging Niche PI - Coinsurance Premium A55NWR2B.BX004XH3 *
* Details - dbnchpis.COINS_PREM_PI *
*============================================================================*/

%let SYSLAST = %nrquote(work.W5JR5N1Z);

%let transformID = %quote(A55NWR2B.BI00K7NA);

%let trans_rc = 0;

%global etls_tableExist;
%global etls_numIndex;
%global etls_lastTable;
%let etls_tableExist = -1;
%let etls_numIndex = -1;
%let etls_lastTable = &SYSLAST;

/*---- Define load data macro ----*/


%macro etls_loader;

/* Setting up macro variables for SPD Server Loader */


%let SYSOPT = ;

/* Determine if the target table exists */


%let etls_tableExist = %eval(%sysfunc(exist(dbnchpis.COINS_PREM_PI, DATA)) or
%sysfunc(exist(dbnchpis.COINS_PREM_PI, VIEW)));

/*---- Drop a table ----*/


%put %str(NOTE: Dropping table ...);
proc datasets lib = dbnchpis nolist nodetails;
delete COINS_PREM_PI;
quit;

%rcSet(&syserr);

%let etls_tableExist = 0;

/*---- Create a new table ----*/


%if (&etls_tableExist eq 0) %then
%do; /* if table does not exist */

%put %str(NOTE: Creating table ...);

data dbnchpis.COINS_PREM_PI
(label = 'Staging Niche PI - Coinsurance Premium Details');
attrib company length = 8 format = 6. informat = 6.
label = 'Company';
attrib product length = $3 format = $3. informat = $3.
label = 'Product';
attrib policy length = 8 format = 11. informat = 11.
label = 'Policy Number';
attrib itemNo length = 8 format = 6. informat = 6.
label = 'Item No';
attrib trancnt length = 8 format = 6. informat = 6.
label = 'Transaction Count';
attrib coinsPrem length = 8 format = 12.2
label = 'Coinsurance Premium';
stop;
run;

%rcSet(&syserr);

%end; /* if table does not exist */

/*---- Map the columns ----*/


proc datasets lib = work nolist nowarn memtype = (data view);
delete mapped;
quit;

%put %str(NOTE: Mapping columns ...);


proc sql;
create view work.mapped as
select COMPANY as company length = 8,
PRODUCT as product length = 3,
POLICY as policy length = 8,
ITEMNO as itemNo length = 8,
TRANCNT as trancnt length = 8,
coinsPrem length = 8 format = 12.2
from &etls_lastTable;
quit;

Protect PMOV - Functional Decomposition Analysis PAGE 24


%let SYSLAST = work.mapped;

%let etls_lastTable = &SYSLAST;


%let SYSOPT = ;

/*---- Append new data ----*/


%put %str(NOTE: Appending data ...);

/* Get number of records in table */


%let etls_recordsBefore = 0;
%macro etls_recordCheck;
%let etls_recCheckExist = %eval(%sysfunc(exist(dbnchpis.COINS_PREM_PI, DATA)) or
%sysfunc(exist(dbnchpis.COINS_PREM_PI, VIEW)));

%if (&etls_recCheckExist) %then


%do;
proc contents data = dbnchpis.COINS_PREM_PI out = work.etls_contents(keep =
nobs) noprint;
run;

data _null_;
set work.etls_contents (obs = 1);
call symput("etls_recordsBefore", left(put(nobs,32.)));
run;

proc datasets lib = work nolist nowarn memtype = (data view);


delete etls_contents;
quit;
%end;
%mend etls_recordCheck;
%etls_recordCheck;

%let etls_table = %nrquote(Staging Niche PI - Coinsurance Premium Details);


%let etls_lib = %nrquote(Protect Niche PI - Daily Staging Library);

proc append base = dbnchpis.COINS_PREM_PI


data = &etls_lastTable (&SYSOPT) force;
run;

%rcSet(&syserr);

/* Get number of records in table */


%let etls_recordsAfter = 0;
%macro etls_recordCheck;
%let etls_recCheckExist = %eval(%sysfunc(exist(dbnchpis.COINS_PREM_PI, DATA)) or
%sysfunc(exist(dbnchpis.COINS_PREM_PI, VIEW)));

%if (&etls_recCheckExist) %then


%do;
proc contents data = dbnchpis.COINS_PREM_PI out = work.etls_contents(keep =
nobs) noprint;
run;

data _null_;
set work.etls_contents (obs = 1);
call symput("etls_recordsAfter", left(put(nobs,32.)));
run;

proc datasets lib = work nolist nowarn memtype = (data view);


delete etls_contents;
quit;

%end;
%mend etls_recordCheck;
%etls_recordCheck;

proc datasets lib = work nolist nowarn memtype = (data view);


delete mapped;
quit;

%mend etls_loader;
%etls_loader;

P35
/*============================================================================*
* Step: SPD Server Loader A55NWR2B.BI00K7NG *

Protect PMOV - Functional Decomposition Analysis PAGE 25


* Transform: SPD Server Table Loader *
* Description: *
* *
* Source Table: SAS Splitter - work.W5JTEW9L A55NWR2B.BL00A9LY *
* Target Table: Error PI - Daily Error Terms - A55NWR2B.BX004XIJ *
* dbnchpie.ERR_TERM_PI *
*============================================================================*/

/* Access the data for Protect Niche PI - Daily Error Library */


LIBNAME dbnchpie SASSPDS GROUP='production' user="&uid" passwd ="&pw"
schema="D_B_PNCHPI_ERR" HOST='sasap2' Serv='5090' ;
%rcSet(&syslibrc);

%let SYSLAST = %nrquote(work.W5JTEW9L);

%let transformID = %quote(A55NWR2B.BI00K7NG);

%let trans_rc = 0;

%global etls_tableExist;
%global etls_numIndex;
%global etls_lastTable;
%let etls_tableExist = -1;
%let etls_numIndex = -1;
%let etls_lastTable = &SYSLAST;

/*---- Define load data macro ----*/


%macro etls_loader;

/* Setting up macro variables for SPD Server Loader */


%let SYSOPT = ;

/* Determine if the target table exists */


%let etls_tableExist = %eval(%sysfunc(exist(dbnchpie.ERR_TERM_PI, DATA)) or
%sysfunc(exist(dbnchpie.ERR_TERM_PI, VIEW)));

/*---- Drop a table ----*/


%put %str(NOTE: Dropping table ...);
proc datasets lib = dbnchpie nolist nodetails;
delete ERR_TERM_PI;
quit;

%rcSet(&syserr);

%let etls_tableExist = 0;

/*---- Create a new table ----*/


%if (&etls_tableExist eq 0) %then
%do; /* if table does not exist */

%put %str(NOTE: Creating table ...);

data dbnchpie.ERR_TERM_PI
(label = 'Error PI - Daily Error Terms');
attrib coverageKey length = 8
label = 'Coverage Key';
attrib company length = 3 format = 6. informat = 6.
label = 'Company';
attrib product length = $3 format = $3. informat = $3.
label = 'Product';
attrib class length = $3 format = $3. informat = $3.
label = 'Class';
attrib subclass length = $3 format = $3. informat = $3.
label = 'Subclass';
attrib policy length = 8 format = 11. informat = 11.
label = 'Policy Number';
attrib seqPolicy length = 8 format = 11. informat = 11.
label = 'Sequence Policy Number';
attrib itemNo length = 3 format = 6. informat = 6.
label = 'Item No';
attrib termIdent length = $3
label = 'Term Identification';
attrib trancnt length = 4 format = 6. informat = 6.
label = 'Transaction Count';
attrib orgtrncnt length = 4
label = 'Original Trans Count being Reversed';
attrib reversedTrncnt length = 4
label = 'This trans has been reversed by this Trans Count';
attrib covRenewedDate length = 5 format = DATE9.
label = 'Coverage Renew Date';

Protect PMOV - Functional Decomposition Analysis PAGE 26


attrib covChgEffDate length = 5 format = DATE9.
label = 'Coverage Change Effective Date';
attrib covChgExpDate length = 5 format = DATE9.
label = 'Coverage Change Expiry Date';
attrib policyInceptDate length = 5 format = DATE9.
label = 'Policy Inception Date';
attrib transactionDate length = 5 format = DATE9.
label = 'Transaction Date';
attrib glDate length = 5 format = DATE9.
label = 'General Ledger Date';
attrib inforceIncDate length = 5 format = DATE9.
label = 'In Force Inception Date';
attrib inforceExpDate length = 5 format = DATE9.
label = 'In Force Expiry Date';
attrib tranInforce length = 3
label = 'Inforce Transaction 1(Yes)/0(No)';
attrib itmstatus length = $1 format = $1. informat = $1.
label = 'Item Status - V(void)/blank(current)';
attrib reasoncde length = $2 format = $2. informat = $2.
label = 'Reason Code for Cancellation Of Item';
attrib transactionType length = $2
label = 'User Defined - Transaction Type';
attrib newRenew length = $1
label = 'New(N)/Renewal(R) Risk';
attrib itemAtrnType length = $2 format = $2. informat = $2.
label = 'Item - Transaction Type';
attrib atrnType length = $2 format = $2. informat = $2.
label = 'Premtran - Transaction Type';
attrib incGrossPrem length = 5 format = 12.2 informat = 13.2
label = 'Transaction Basic Premium';
attrib cumGrossPrem length = 5 format = 12.2
label = 'Cummulative Premium Amount';
attrib incStatutCharges length = 4 format = 10.2 informat = 13.2
label = 'Transaction Charges';
attrib cumStatutCharges length = 4 format = 10.2
label = 'Cummulative Statutory Charges';
attrib stampDuty length = 4 format = 10.2 informat = 13.2
label = 'Transaction Stamp Duty';
attrib cumStampDuty length = 4 format = 10.2
label = 'Cummulative Stamp Duty Amount';
attrib incCommission1 length = 4 format = 10.2 informat = 13.2
label = 'Transaction Commission';
attrib cumCommission1 length = 4 format = 10.2
label = 'Cummulative Commission Amount';
attrib incGst length = 4 format = 10.2 informat = 13.2
label = 'Amount of GST on Transaction Premium';
attrib cumGST length = 4 format = 10.2
label = 'Cummulative GST Amount';
attrib incCommGst length = 4 format = 10.2 informat = 13.2
label = 'Amount of GST on Transaction Commision';
attrib cumCommGst length = 4 format = 10.2
label = 'Cummulative GST on Transaction Commision';
attrib tranEarnPremPerDay length = 5 format = 8.5
label = 'Trans Earned Premium Per Day';
attrib tranEarnCommPerDay length = 5 format = 8.5
label = 'Trans Earned Commission Per Day';
attrib cumEarnPremPerDay length = 5 format = 8.5
label = 'Cummulative Earned Premium Per day';
attrib cumEarnCommPerDay length = 5 format = 8.5
label = 'Cummulative Earned Commission Per day';
attrib coinsPrem length = 5 format = 12.2
label = 'Coinsurance Premium';
attrib retRiPrem length = 5 format = 12.2
label = 'Retained Premium';
attrib qsPrem length = 5 format = 12.2
label = 'Quota Share Premium';
attrib catPrem length = 5 format = 12.2
label = 'Catastrophe Premium';
attrib eolprem length = 5 format = 12.2
label = 'Excess Of Loss Premium';
attrib specPrem length = 5 format = 12.2
label = 'Special Premium';
attrib modified length = 8 format = BINARY10.
label = 'Flag to identify User Modifications in Binary 00000000';
attrib RISKSTATE length = $2 format = $2. informat = $2.
label = 'RISKSTATE';
attrib LOCATNREF length = 8 format = 11. informat = 11.
label = 'LOCATNREF';
attrib STATE length = 8 format = 6. informat = 6.
label = 'STATE';

Protect PMOV - Functional Decomposition Analysis PAGE 27


attrib BRANCH length = 8 format = 6. informat = 6.
label = 'BRANCH';
attrib COYISSUED length = 8 format = 6. informat = 6.
label = 'COYISSUED';
attrib STISSUED length = $2 format = $2. informat = $2.
label = 'STISSUED';
stop;
run;

%rcSet(&syserr);

%end; /* if table does not exist */

/*---- Create the indexes in parallel for a table ----*/


/* recreate indexes was selected */

%put %str(NOTE: Creating indexes in Parallel...);


proc datasets lib = dbnchpie nolist;
modify ERR_TERM_PI (asyncindex=YES);
index create coverageKey ;
index create key1 = (company product policy itemNo trancnt);
quit;

%rcSet(&syserr);

/*---- Map the columns ----*/


proc datasets lib = work nolist nowarn memtype = (data view);
delete mapped;
quit;
%put %str(NOTE: Mapping columns ...);
proc sql;
create view work.mapped as
select coverageKey length = 8,
(company) as company length = 3 format = 6. informat = 6.,
product length = 3,
class length = 3,
subclass length = 3,
policy length = 8,
seqPolicy length = 8,
(itemNo) as itemNo length = 3 format = 6. informat = 6.,
termIdent length = 3,
(trancnt) as trancnt length = 4 format = 6. informat = 6.,
(ORGTRNCNT) as orgtrncnt length = 4,
(reverseTrncnt) as reversedTrncnt length = 4,
covRenewedDate length = 5,
covChgEffDate length = 5,
covChgExpDate length = 5,
policyInceptDate length = 5,
transactionDate length = 5,
glDate length = 5,
inforceIncDate length = 5,
inforceExpDate length = 5,
tranInforce length = 3,
itmstatus length = 1,
reasoncde length = 2,
transactionType length = 2,
newRenew length = 1,
itemAtrnType length = 2,
atrnType length = 2,
incGrossPrem length = 5,
cumGrossPrem length = 5,
incStatutCharges length = 4,
cumStatutCharges length = 4,
stampDuty length = 4,
cumStampDuty length = 4,
incCommission1 length = 4,
cumCommission1 length = 4,
incGst length = 4,
cumGST length = 4,
incCommGst length = 4,
cumCommGst length = 4,
tranEarnPremPerDay length = 5,
tranEarnCommPerDay length = 5,
cumEarnPremPerDay length = 5,
cumEarnCommPerDay length = 5,
(coinsPrem) as coinsPrem length = 5 format = 12.2,
retRiPrem length = 5,
qsPrem length = 5,
catPrem length = 5,

Protect PMOV - Functional Decomposition Analysis PAGE 28


eolprem length = 5,
specPrem length = 5,
modified length = 8,
RISKSTATE length = 2,
LOCATNREF length = 8,
STATE length = 8,
BRANCH length = 8,
COYISSUED length = 8,
STISSUED length = 2
from &etls_lastTable;
quit;

%let SYSLAST = work.mapped;

%let etls_lastTable = &SYSLAST;


%let SYSOPT = ;

/*---- Append new data ----*/


%put %str(NOTE: Appending data ...);

/* Get number of records in table */


%let etls_recordsBefore = 0;
%macro etls_recordCheck;
%let etls_recCheckExist = %eval(%sysfunc(exist(dbnchpie.ERR_TERM_PI, DATA)) or
%sysfunc(exist(dbnchpie.ERR_TERM_PI, VIEW)));

%if (&etls_recCheckExist) %then


%do;
proc contents data = dbnchpie.ERR_TERM_PI out = work.etls_contents(keep = nobs)
noprint;
run;

data _null_;
set work.etls_contents (obs = 1);
call symput("etls_recordsBefore", left(put(nobs,32.)));
run;

proc datasets lib = work nolist nowarn memtype = (data view);


delete etls_contents;
quit;

%end;
%mend etls_recordCheck;
%etls_recordCheck;

%let etls_table = %nrquote(Error PI - Daily Error Terms);


%let etls_lib = %nrquote(Protect Niche PI - Daily Error Library);

proc append base = dbnchpie.ERR_TERM_PI


data = &etls_lastTable (&SYSOPT) force;
run;

%rcSet(&syserr);

/* Get number of records in table */


%let etls_recordsAfter = 0;
%macro etls_recordCheck;
%let etls_recCheckExist = %eval(%sysfunc(exist(dbnchpie.ERR_TERM_PI, DATA)) or
%sysfunc(exist(dbnchpie.ERR_TERM_PI, VIEW)));

%if (&etls_recCheckExist) %then


%do;
proc contents data = dbnchpie.ERR_TERM_PI out = work.etls_contents(keep = nobs)
noprint;
run;

data _null_;
set work.etls_contents (obs = 1);
call symput("etls_recordsAfter", left(put(nobs,32.)));
run;

proc datasets lib = work nolist nowarn memtype = (data view);


delete etls_contents;
quit;

%end;
%mend etls_recordCheck;
%etls_recordCheck;

proc datasets lib = work nolist nowarn memtype = (data view);

Protect PMOV - Functional Decomposition Analysis PAGE 29


delete mapped;
quit;

%mend etls_loader;
%etls_loader;

data _null_;
call symput('etls_endTime',put(datetime(),datetime.));
run;

/*---- Job status macro ----*/


%macro etls_sendJobStatus(libref=, dataset=, metauser=);

%local dsid etls_etvarnum etls_stvarnum etls_stfmt etls_etfmt;


%let dsid=%sysfunc(open(&libref..&dataset,i));
%if &dsid %then
%do;
%let etls_stvarnum=%sysfunc(varnum(&dsid,STTIME));
%if (&etls_stvarnum gt 0) %then
%let etls_stfmt=%sysfunc(varfmt(&dsid,&etls_stvarnum));

%let etls_etvarnum=%sysfunc(varnum(&dsid,ENDTIME));
%if (&etls_etvarnum gt 0) %then
%let etls_etfmt=%sysfunc(varfmt(&dsid,&etls_etvarnum));

%let rc=%sysfunc(close(&dsid));
%end;

%if ("&etls_stfmt" eq "") %then


%let etls_stfmt = datetime18.;
%if ("&etls_etfmt" eq "") %then
%let etls_etfmt = datetime18.;

data work.etls_tempData;

attrib user length = $32


label = "User ID";
attrib rbefore length = 8
label = "No. Records Before";
attrib rafter length = 8
label = "No. Records After";
attrib etl_table length = $32
label = "Table Name";
attrib lib length = $32
label = "Library";
attrib jobname length = $80
label = "Job Name";
attrib jobstat length = $80
label = "Job Status";
attrib job_rc length = 8
label = "Job Return Code";
attrib sttime length = 8 format = &etls_stfmt.
label = "Job Start Time";
attrib endtime length = 8 format = &etls_etfmt.
label = "Job End Time";

user = "&sysuserid";
rbefore = &etls_recordsBefore;
rafter = &etls_recordsAfter;
etl_table = "&etls_table";
lib = "&etls_lib";
jobname = "&etls_jobName";
job_rc = &job_rc;

if job_rc = 0 then
jobstat = "Job Successful";
else if job_rc = 4 then
jobstat = "Job Ended with Warnings";
else if job_rc > 4 then
jobstat = "Job Ended with Errors";

sttime = "&etls_startTime"dt;
endtime = "&etls_endTime"dt;

run;
proc append base=&libref..&dataset data=work.etls_tempData force;
run;

proc datasets lib = work nolist;

Protect PMOV - Functional Decomposition Analysis PAGE 30


delete etls_tempData;
quit;

%mend etls_sendJobStatus;
%etls_sendJobStatus
(libref = %str(dbnchpis),
Dataset = %str(ACTBASE_JOB_STATUS));

Extract Source Data Required cols

P03
/*============================================================================*
* Step: Extract_Source_Data_reqdcols A55NWR2B.BI00K7NQ *
* Transform: Extract_Source_Data_reqdcols *
* Description: Process to extract source data & reqd cols *
* *
* Source Table: PNCH_ITEM - dbpncstg.PNCH_ITEM A55NWR2B.BX001CV9 *
* Target Table: Extract_Source_Data_With_TimeStamp_reqdc A55NWR2B.BL00A9M4 *
* ols - spdswork.W66CP32B *
*============================================================================*/

%let SYSLAST = %nrquote(dbpncstg.PNCH_ITEM);

%let transformID = %quote(A55NWR2B.BI00K7NQ);

%let trans_rc = 0;

/* Source table(s)/view(s) */
%let _INPUT0 = dbpncstg.PNCH_ITEM;

/* Target table/view(s) */
%let _OUTPUT = spdswork.W66CP32B;
%let _OUTPUT0 = spdswork.W66CP32B;

/* Delete target table(s) */


proc datasets lib=spdswork nolist nowarn memtype = (data view);
delete W66CP32B;
quit;

/* Options */
%let _renameVar = ;
%let Extract = %nrquote(where = %(rec_type_cd NE 3 and %(COMPANY in %(1,2,4,5,11%) OR
%(COMPANY=3 AND
put%(COMPRESS%(product%)||COMPRESS%(class%)||COMPRESS%(subclass%),$CIA_PDS1a.%) NE
%'CI%'%)%) AND PRODUCT NOT IN %(%'QTE%',%'CVN%'%)%));

/* List of target columns to keep */


%let keep = COMPANY PRODUCT POLICY ITEMNO EFFECTDTE ACTIVTO TRANCNT ITMSTATUS
REASONCDE CLASS SUBCLASS RISKSTATE OCCUPATN SUMINS EXCESS DISTRICT
INDEXIND FIREBRIG TBASICPRM TCHARGES TSTMPDUTY TCOMMISN MINPRMIND
LOCATNREF TAILORGRP TRANDATE DUEDATE TYPEOFPOL COINSPC ATRNTYPE
TERMINCEP MANRIIND TGST TCOMMGST GSTORIDE RBASICPRM RSTMPDUTY RGST
RCHARGES RCOMMISN RCOMMGST SUMINSCDE EXCESSTYP REBATEPC LOADINGPC
PREMREASA PREMREAST IMAGEFLAG MANCOMRTE DISCREAS LOADREAS FIELD04
COMREAS CHGEXCLUD SDEXCLUD GSTEXCLUD rec_type_cd RISKNO;

%LET Extract = %UNQUOTE(&Extract);

%MACRO extract_srcdata;

*** Extract source data ***;


DATA &_OUTPUT0.;
*** Delete - Delete - Record type ***;
SET &_INPUT0. (&Extract. keep= &keep.);
RUN;

%mend;

%extract_srcdata;

%rcSet(&syserr);
%rcSet(&sysrc);
%rcSet(&sqlrc);

Protect PMOV - Functional Decomposition Analysis PAGE 31


P19
/*============================================================================*
* Step: Extract_Source_Data_reqdcols A55NWR2B.BI00K7NI *
* Transform: Extract_Source_Data_reqdcols *
* Description: Process to extract source data & reqd cols *
* *
* Source Table: PNCH_POLICY - dbpncstg.PNCH_POLICY A55NWR2B.BX001CW0 *
* Target Table: Extract_Source_Data_With_TimeStamp_reqdc A55NWR2B.BL00A9LS *
* ols - spdswork.W66COZ5U *
*============================================================================*/

%let SYSLAST = %nrquote(dbpncstg.PNCH_POLICY);

%let transformID = %quote(A55NWR2B.BI00K7NI);

%let trans_rc = 0;

/* Source table(s)/view(s) */
%let _INPUT0 = dbpncstg.PNCH_POLICY;

/* Target table/view(s) */
%let _OUTPUT = spdswork.W66COZ5U;
%let _OUTPUT0 = spdswork.W66COZ5U;

/* Delete target table(s) */


proc datasets lib=spdswork nolist nowarn memtype = (data view);
delete W66COZ5U;
quit;

/* Options */
%let _renameVar = ;
%let Extract = %nrquote(where = %(rec_type_cd NE 3 and %(COMPANY in %(1,2,4,5,11%) OR
%(COMPANY=3 AND put%(PRODUCT,$CIA_PDS1a.%) NE %'CI%'%)%) AND PRODUCT NOT IN
%(%'QTE%',%'CVN%'%) AND IMAGEFLAG IN %(%' %',%'I%'%)%));

/* List of target columns to keep */


%let keep = COMPANY PRODUCT POLICY TRANCNT IMAGEFLAG CLIENT STATE BRANCH EFFECTDTE
ACTIVTO INCEPTION REP AGENT RNWALTERM REVIEWIND NTCETO NTCEPROD NTCETYPE
CLAUSEIND SPCLSIND MSGIND BUSNESSRC COYISSUED STISSUED INSTALFRQ
CANCDECLN IMPEXCESS BRCHRESP BUSDESC SEQPOLICY DISCGRP PRVPOLREF
COMPLTIND CUSTREF POLSTATUS LOCKUSER rec_type_cd;

%LET Extract = %UNQUOTE(&Extract);

%MACRO extract_srcdata;

*** Extract source data ***;


DATA &_OUTPUT0.;
*** Delete - Delete - Record type ***;
SET &_INPUT0. (&Extract. keep= &keep.);
RUN;

%mend;

%extract_srcdata;

%rcSet(&syserr);
%rcSet(&sysrc);
%rcSet(&sqlrc);

P24
/*============================================================================*
* Step: Extract_Source_Data_reqdcols A55NWR2B.BI00K7NL *
* Transform: Extract_Source_Data_reqdcols *
* Description: Process to extract source data & reqd cols *
* *
* Source Table: PNCH_POLICYTH - dbpncstg.PNCH_POLICYTH A55NWR2B.BX001CW1 *
* Target Table: Extract_Source_Data_With_TimeStamp_reqdc A55NWR2B.BL00A9M0 *
* ols - work.W66CPRB4 *
*============================================================================*/

%let SYSLAST = %nrquote(dbpncstg.PNCH_POLICYTH);

Protect PMOV - Functional Decomposition Analysis PAGE 32


%let transformID = %quote(A55NWR2B.BI00K7NL);

%let trans_rc = 0;

/* Source table(s)/view(s) */
%let _INPUT0 = dbpncstg.PNCH_POLICYTH;

/* Target table/view(s) */
%let _OUTPUT = work.W66CPRB4;
%let _OUTPUT0 = work.W66CPRB4;

/* Delete target table(s) */


proc datasets lib=work nolist nowarn memtype = (data view);
delete W66CPRB4;
quit;

/* Options */
%let _renameVar = ;
%let Extract = %nrquote(where = %(rec_type_cd NE 3 and %(COMPANY in %(1,2,4,5,11%) OR
%(COMPANY=3 AND put%(PRODUCT,$CIA_PDS1a.%) NE %'CI%'%)%) AND PRODUCT NOT IN
%(%'QTE%',%'CVN%'%) AND TRANCNT NE 0 AND ORGTRNCNT NE 0%));

/* List of target columns to keep */


%let keep = COMPANY PRODUCT POLICY TRANCNT ORGTRNCNT rec_type_cd;

%LET Extract = %UNQUOTE(&Extract);

%MACRO extract_srcdata;

*** Extract source data ***;


DATA &_OUTPUT0.;
*** Delete - Delete - Record type ***;
SET &_INPUT0. (&Extract. keep= &keep.);
RUN;

%mend;

%extract_srcdata;

%rcSet(&syserr);
%rcSet(&sysrc);
%rcSet(&sqlrc);

SQL Join

P05
/*============================================================================*
* Step: SQL Join A55NWR2B.BI00K7NS *
* Transform: SQL Join (Version 2) *
* Description: *
* *
* Source Tables: User Written Code Target - A55NWR2B.BL00A9M5 *
* spdswork.W5J4C0T7 *
* User Written Code Target - A55NWR2B.BL00A9LT *
* spdswork.W5J583L8 *
* Target Table: SQL Target - spdswork.W5J17JAU A55NWR2B.BL00A9M6 *
*============================================================================*/

%let transformID = %quote(A55NWR2B.BI00K7NS);

%let trans_rc = 0;

proc datasets lib = spdswork nolist nowarn memtype = (data view);


delete W5J17JAU;
quit;

%let spdssqlr = ;

proc sql;
create table spdswork.W5J17JAU as
select
W5J4C0T7.COMPANY length = 8
format = 6.
informat = 6.

Protect PMOV - Functional Decomposition Analysis PAGE 33


label = 'COMPANY',
W5J4C0T7.PRODUCT length = 3
format = $3.
informat = $3.
label = 'PRODUCT',
W5J4C0T7.POLICY length = 8
format = 11.
informat = 11.
label = 'POLICY',
W5J4C0T7.ITEMNO length = 8
format = 6.
informat = 6.
label = 'ITEMNO',
W5J4C0T7.TRANCNT length = 8
format = 6.
informat = 6.
label = 'TRANCNT',
W5J4C0T7.TERMINCEP length = 8
format = 11.
informat = 11.
label = 'TERMINCEP',
W5J4C0T7.DUEDATE length = 8
format = 11.
informat = 11.
label = 'DUEDATE',
W5J4C0T7.EFFECTDTE length = 8
format = 11.
informat = 11.
label = 'EFFECTDTE',
W5J4C0T7.ACTIVTO length = 8
format = 11.
informat = 11.
label = 'ACTIVTO',
W5J4C0T7.ITMSTATUS length = 1
format = $1.
informat = $1.
label = 'ITMSTATUS',
W5J4C0T7.REASONCDE length = 2
format = $2.
informat = $2.
label = 'REASONCDE',
W5J4C0T7.ATRNTYPE as itemAtrnType length = 2
format = $2.
informat = $2.
label = 'Item - Transaction Type',
W5J4C0T7.TBASICPRM as incGrossPrem length = 5
format = COMMA12.2
informat = 13.2
label = 'Transaction Basic Premium',
W5J4C0T7.TCHARGES as incStatutCharges length = 4
format = COMMA10.2
informat = 13.2
label = 'Transaction Charge',
W5J4C0T7.TSTMPDUTY as stampduty length = 4
format = COMMA10.2
informat = 13.2
label = 'Transaction Stamp Duty',
W5J4C0T7.TCOMMISN as incCommission1 length = 4
format = COMMA10.2
informat = 13.2
label = 'Transaction Commission',
W5J4C0T7.TGST as incGst length = 4
format = COMMA10.2
informat = 13.2
label = 'Amount of GST on Transaction Premium',
W5J4C0T7.TCOMMGST as incCommGst length = 4
format = COMMA10.2
informat = 13.2
label = 'Amount of GST on Transaction
Commision',
W5J4C0T7.CLASS length = 3
format = $3.
informat = $3.
label = 'CLASS',
W5J4C0T7.SUBCLASS length = 3
format = $3.
informat = $3.
label = 'SUBCLASS',
W5J4C0T7.RISKSTATE length = 2
format = $2.

Protect PMOV - Functional Decomposition Analysis PAGE 34


informat = $2.
label = 'RISKSTATE',
W5J4C0T7.OCCUPATN length = 4
format = $4.
informat = $4.
label = 'OCCUPATN',
W5J4C0T7.SUMINS length = 8
format = 11.
informat = 11.
label = 'SUMINS',
W5J4C0T7.EXCESS length = 8
format = 11.
informat = 11.
label = 'EXCESS',
W5J4C0T7.DISTRICT length = 2
format = $2.
informat = $2.
label = 'DISTRICT',
W5J4C0T7.INDEXIND length = 1
format = $1.
informat = $1.
label = 'INDEXIND',
W5J4C0T7.FIREBRIG length = 1
format = $1.
informat = $1.
label = 'FIREBRIG',
W5J4C0T7.GSTORIDE length = 1
format = $1.
informat = $1.
label = 'GSTORIDE',
W5J4C0T7.MINPRMIND length = 1
format = $1.
informat = $1.
label = 'MINPRMIND',
W5J4C0T7.TAILORGRP length = 2
format = $2.
informat = $2.
label = 'TAILORGRP',
W5J4C0T7.TYPEOFPOL length = 1
format = $1.
informat = $1.
label = 'TYPEOFPOL',
W5J4C0T7.COINSPC length = 8
format = 7.3
informat = 7.3
label = 'COINSPC',
W5J4C0T7.LOCATNREF length = 8
format = 11.
informat = 11.
label = 'LOCATNREF',
W5J4C0T7.MANRIIND length = 1
format = $1.
informat = $1.
label = 'MANRIIND',
W5J4C0T7.TRANDATE length = 8
format = 11.
informat = 11.
label = 'TRANDATE',
W5J583L8.CLIENT length = 8
format = 11.
informat = 11.
label = 'CLIENT',
W5J583L8.STATE length = 8
format = 6.
informat = 6.
label = 'STATE',
W5J583L8.BRANCH length = 8
format = 6.
informat = 6.
label = 'BRANCH',
W5J583L8.INCEPTION length = 8
format = 11.
informat = 11.
label = 'INCEPTION',
W5J583L8.REP length = 8
format = 6.
informat = 6.
label = 'REP',
W5J583L8.AGENT length = 8
format = 11.

Protect PMOV - Functional Decomposition Analysis PAGE 35


informat = 11.
label = 'AGENT',
W5J583L8.RNWALTERM length = 8
format = 6.
informat = 6.
label = 'RNWALTERM',
W5J583L8.REVIEWIND length = 1
format = $1.
informat = $1.
label = 'REVIEWIND',
W5J583L8.NTCETO length = 1
format = $1.
informat = $1.
label = 'NTCETO',
W5J583L8.NTCEPROD length = 1
format = $1.
informat = $1.
label = 'NTCEPROD',
W5J583L8.NTCETYPE length = 1
format = $1.
informat = $1.
label = 'NTCETYPE',
W5J583L8.CLAUSEIND length = 1
format = $1.
informat = $1.
label = 'CLAUSEIND',
W5J583L8.SPCLSIND length = 1
format = $1.
informat = $1.
label = 'SPCLSIND',
W5J583L8.MSGIND length = 1
format = $1.
informat = $1.
label = 'MSGIND',
W5J583L8.BUSNESSRC length = 4
format = $4.
informat = $4.
label = 'BUSNESSRC',
W5J583L8.COYISSUED length = 8
format = 6.
informat = 6.
label = 'COYISSUED',
W5J583L8.STISSUED length = 2
format = $2.
informat = $2.
label = 'STISSUED',
W5J583L8.INSTALFRQ length = 1
format = $1.
informat = $1.
label = 'INSTALFRQ',
W5J583L8.CANCDECLN length = 1
format = $1.
informat = $1.
label = 'CANCDECLN',
W5J583L8.IMPEXCESS length = 1
format = $1.
informat = $1.
label = 'IMPEXCESS',
W5J583L8.BRCHRESP length = 8
format = 6.
informat = 6.
label = 'BRCHRESP',
W5J583L8.BUSDESC length = 1
format = $1.
informat = $1.
label = 'BUSDESC',
W5J583L8.DISCGRP length = 1
format = $1.
informat = $1.
label = 'DISCGRP',
W5J583L8.SEQPOLICY length = 8
format = 11.
informat = 11.
label = 'SEQPOLICY',
W5J583L8.PRVPOLREF length = 14
format = $14.
informat = $14.
label = 'PRVPOLREF',
W5J4C0T7.RBASICPRM length = 8
format = 13.2

Protect PMOV - Functional Decomposition Analysis PAGE 36


informat = 13.2
label = 'RBASICPRM',
W5J4C0T7.RSTMPDUTY length = 8
format = 13.2
informat = 13.2
label = 'RSTMPDUTY',
W5J4C0T7.RGST length = 8
format = 13.2
informat = 13.2
label = 'RGST',
W5J4C0T7.RCHARGES length = 8
format = 13.2
informat = 13.2
label = 'RCHARGES',
W5J4C0T7.RCOMMISN length = 8
format = 13.2
informat = 13.2
label = 'RCOMMISN',
W5J4C0T7.RCOMMGST length = 8
format = 13.2
informat = 13.2
label = 'RCOMMGST',
W5J4C0T7.SUMINSCDE length = 3
format = $3.
informat = $3.
label = 'SUMINSCDE',
W5J4C0T7.EXCESSTYP length = 1
format = $1.
informat = $1.
label = 'EXCESSTYP',
W5J4C0T7.REBATEPC length = 8
format = 6.2
informat = 6.2
label = 'REBATEPC',
W5J4C0T7.LOADINGPC length = 8
format = 7.2
informat = 7.2
label = 'LOADINGPC',
W5J4C0T7.PREMREASA length = 2
format = $2.
informat = $2.
label = 'PREMREASA',
W5J4C0T7.PREMREAST length = 2
format = $2.
informat = $2.
label = 'PREMREAST',
W5J4C0T7.IMAGEFLAG length = 1
format = $1.
informat = $1.
label = 'IMAGEFLAG',
W5J583L8.COMPLTIND length = 1
format = $1.
informat = $1.
label = 'COMPLTIND',
W5J583L8.CUSTREF length = 14
format = $14.
informat = $14.
label = 'CUSTREF',
W5J583L8.POLSTATUS length = 1
format = $1.
informat = $1.
label = 'POLSTATUS',
W5J583L8.LOCKUSER length = 8
format = $8.
informat = $8.
label = 'LOCKUSER',
W5J4C0T7.MANCOMRTE length = 8
format = 6.2
informat = 6.2
label = 'MANCOMRTE',
W5J4C0T7.DISCREAS length = 2
format = $2.
informat = $2.
label = 'DISCREAS',
W5J4C0T7.LOADREAS length = 2
format = $2.
informat = $2.
label = 'LOADREAS',
W5J4C0T7.FIELD04 length = 4
informat = comma3.2

Protect PMOV - Functional Decomposition Analysis PAGE 37


label = 'Reserved For Future Use',
W5J4C0T7.COMREAS length = 2
format = $2.
informat = $2.
label = 'COMREAS',
W5J4C0T7.CHGEXCLUD length = 2
informat = $EBCDIC002.
label = 'Code For Reason Of Exclusion Of Charges',
W5J4C0T7.GSTEXCLUD length = 2
informat = $EBCDIC002.
label = 'Gst Exclusion',
W5J4C0T7.SDEXCLUD length = 2
informat = $EBCDIC002.
label = 'Stamp Duty Exclusion Code.',
W5J4C0T7.RISKNO length = 6
informat = S370FPD004.0
label = 'Number To Identify Risk Group'
from
spdswork.W5J4C0T7 left join
spdswork.W5J583L8
on
(
W5J4C0T7.COMPANY = W5J583L8.COMPANY
and W5J4C0T7.PRODUCT = W5J583L8.PRODUCT
and W5J4C0T7.POLICY = W5J583L8.POLICY
and W5J4C0T7.EFFECTDTE >= W5J583L8.EFFECTDTE
and W5J4C0T7.EFFECTDTE <= W5J583L8.ACTIVTO
)
;
quit;
%rcSet(&sqlrc);

%macro etls_completeTarget();
%mend etls_completeTarget;
%etls_completeTarget;

P06
/*============================================================================*
* Step: SQL Join A55NWR2B.BI00K7NU *
* Transform: SQL Join (Version 2) *
* Description: *
* *
* Source Tables: User Written Code Target - A55NWR2B.BL00A9M7 *
* spdswork.W5J4DH4Z *
* Staging Niche PI -Retained Premium A55NWR2B.BX004XHB *
* Details - dbnchpis.RETPREM_PI *
* Target Table: SQL Target - spdswork.W66JACO2 A55NWR2B.BL00A9M8 *
*============================================================================*/

%let transformID = %quote(A55NWR2B.BI00K7NU);

%let trans_rc = 0;

proc datasets lib = spdswork nolist nowarn memtype = (data view);


delete W66JACO2;
quit;

%let spdssqlr = ;

proc sql;
create table spdswork.W66JACO2 as
select
W5J4DH4Z.COMPANY length = 8
format = 6.
informat = 6.
label = 'COMPANY',
W5J4DH4Z.PRODUCT length = 3
format = $3.
informat = $3.
label = 'PRODUCT',
W5J4DH4Z.POLICY length = 8
format = 11.
informat = 11.
label = 'POLICY',
W5J4DH4Z.ITEMNO length = 8
format = 6.
informat = 6.

Protect PMOV - Functional Decomposition Analysis PAGE 38


label = 'ITEMNO',
W5J4DH4Z.TRANCNT length = 8
format = 6.
informat = 6.
label = 'TRANCNT',
W5J4DH4Z.ITMSTATUS length = 1
format = $1.
informat = $1.
label = 'ITMSTATUS',
W5J4DH4Z.REASONCDE length = 2
format = $2.
informat = $2.
label = 'REASONCDE',
W5J4DH4Z.itemAtrnType length = 2
format = $2.
informat = $2.
label = 'Item - Transaction Type',
W5J4DH4Z.incGrossPrem length = 5
format = COMMA12.2
informat = 13.2
label = 'Transaction Basic Premium',
W5J4DH4Z.incStatutCharges length = 4
format = COMMA10.2
informat = 13.2
label = 'Transaction Charge',
W5J4DH4Z.stampduty length = 4
format = COMMA10.2
informat = 13.2
label = 'Transaction Stamp Duty',
W5J4DH4Z.incCommission1 length = 4
format = COMMA10.2
informat = 13.2
label = 'Transaction Commission',
W5J4DH4Z.incGst length = 4
format = COMMA10.2
informat = 13.2
label = 'Amount of GST on Transaction Premium',
W5J4DH4Z.incCommGst length = 4
format = COMMA10.2
informat = 13.2
label = 'Amount of GST on Transaction Commision',
W5J4DH4Z.CLASS length = 3
format = $3.
informat = $3.
label = 'CLASS',
W5J4DH4Z.SUBCLASS length = 3
format = $3.
informat = $3.
label = 'SUBCLASS',
W5J4DH4Z.RISKSTATE length = 2
format = $2.
informat = $2.
label = 'RISKSTATE',
W5J4DH4Z.OCCUPATN length = 4
format = $4.
informat = $4.
label = 'OCCUPATN',
W5J4DH4Z.SUMINS length = 8
format = 11.
informat = 11.
label = 'SUMINS',
W5J4DH4Z.EXCESS length = 8
format = 11.
informat = 11.
label = 'EXCESS',
W5J4DH4Z.DISTRICT length = 2
format = $2.
informat = $2.
label = 'DISTRICT',
W5J4DH4Z.INDEXIND length = 1
format = $1.
informat = $1.
label = 'INDEXIND',
W5J4DH4Z.FIREBRIG length = 1
format = $1.
informat = $1.
label = 'FIREBRIG',
W5J4DH4Z.GSTORIDE length = 1
format = $1.
informat = $1.

Protect PMOV - Functional Decomposition Analysis PAGE 39


label = 'GSTORIDE',
W5J4DH4Z.MINPRMIND length = 1
format = $1.
informat = $1.
label = 'MINPRMIND',
W5J4DH4Z.TAILORGRP length = 2
format = $2.
informat = $2.
label = 'TAILORGRP',
W5J4DH4Z.TYPEOFPOL length = 1
format = $1.
informat = $1.
label = 'TYPEOFPOL',
W5J4DH4Z.COINSPC length = 8
format = 7.3
informat = 7.3
label = 'COINSPC',
W5J4DH4Z.LOCATNREF length = 8
format = 11.
informat = 11.
label = 'LOCATNREF',
W5J4DH4Z.MANRIIND length = 1
format = $1.
informat = $1.
label = 'MANRIIND',
W5J4DH4Z.CLIENT length = 8
format = 11.
informat = 11.
label = 'CLIENT',
W5J4DH4Z.STATE length = 8
format = 6.
informat = 6.
label = 'STATE',
W5J4DH4Z.BRANCH length = 8
format = 6.
informat = 6.
label = 'BRANCH',
W5J4DH4Z.REP length = 8
format = 6.
informat = 6.
label = 'REP',
W5J4DH4Z.AGENT length = 8
format = 11.
informat = 11.
label = 'AGENT',
W5J4DH4Z.RNWALTERM length = 8
format = 6.
informat = 6.
label = 'RNWALTERM',
W5J4DH4Z.REVIEWIND length = 1
format = $1.
informat = $1.
label = 'REVIEWIND',
W5J4DH4Z.NTCETO length = 1
format = $1.
informat = $1.
label = 'NTCETO',
W5J4DH4Z.NTCEPROD length = 1
format = $1.
informat = $1.
label = 'NTCEPROD',
W5J4DH4Z.NTCETYPE length = 1
format = $1.
informat = $1.
label = 'NTCETYPE',
W5J4DH4Z.CLAUSEIND length = 1
format = $1.
informat = $1.
label = 'CLAUSEIND',
W5J4DH4Z.SPCLSIND length = 1
format = $1.
informat = $1.
label = 'SPCLSIND',
W5J4DH4Z.MSGIND length = 1
format = $1.
informat = $1.
label = 'MSGIND',
W5J4DH4Z.BUSNESSRC length = 4
format = $4.
informat = $4.

Protect PMOV - Functional Decomposition Analysis PAGE 40


label = 'BUSNESSRC',
W5J4DH4Z.COYISSUED length = 8
format = 6.
informat = 6.
label = 'COYISSUED',
W5J4DH4Z.STISSUED length = 2
format = $2.
informat = $2.
label = 'STISSUED',
W5J4DH4Z.INSTALFRQ length = 1
format = $1.
informat = $1.
label = 'INSTALFRQ',
W5J4DH4Z.CANCDECLN length = 1
format = $1.
informat = $1.
label = 'CANCDECLN',
W5J4DH4Z.IMPEXCESS length = 1
format = $1.
informat = $1.
label = 'IMPEXCESS',
W5J4DH4Z.BRCHRESP length = 8
format = 6.
informat = 6.
label = 'BRCHRESP',
W5J4DH4Z.BUSDESC length = 1
format = $1.
informat = $1.
label = 'BUSDESC',
W5J4DH4Z.DISCGRP length = 1
format = $1.
informat = $1.
label = 'DISCGRP',
W5J4DH4Z.SEQPOLICY length = 8
format = 11.
informat = 11.
label = 'SEQPOLICY',
W5J4DH4Z.modified length = 8
format = BINARY10.
label = 'Flag to identify User Modifications - Binary
00000000',
W5J4DH4Z.covRenewedDate length = 8,
W5J4DH4Z.covChgEffDate length = 8,
W5J4DH4Z.inforceIncDate length = 8,
W5J4DH4Z.inforceExpDate length = 8,
W5J4DH4Z.covChgExpDate length = 8,
W5J4DH4Z.transactionDate length = 8,
W5J4DH4Z.policyInceptDate length = 8,
W5J4DH4Z.PRVPOLREF length = 14
format = $14.
informat = $14.
label = 'PRVPOLREF',
W5J4DH4Z.RBASICPRM length = 8
format = 13.2
informat = 13.2
label = 'RBASICPRM',
W5J4DH4Z.RSTMPDUTY length = 8
format = 13.2
informat = 13.2
label = 'RSTMPDUTY',
W5J4DH4Z.RGST length = 8
format = 13.2
informat = 13.2
label = 'RGST',
W5J4DH4Z.RCHARGES length = 8
format = 13.2
informat = 13.2
label = 'RCHARGES',
W5J4DH4Z.RCOMMISN length = 8
format = 13.2
informat = 13.2
label = 'RCOMMISN',
W5J4DH4Z.RCOMMGST length = 8
format = 13.2
informat = 13.2
label = 'RCOMMGST',
W5J4DH4Z.SUMINSCDE length = 3
format = $3.
informat = $3.
label = 'SUMINSCDE',

Protect PMOV - Functional Decomposition Analysis PAGE 41


W5J4DH4Z.EXCESSTYP length = 1
format = $1.
informat = $1.
label = 'EXCESSTYP',
W5J4DH4Z.REBATEPC length = 8
format = 6.2
informat = 6.2
label = 'REBATEPC',
W5J4DH4Z.LOADINGPC length = 8
format = 7.2
informat = 7.2
label = 'LOADINGPC',
W5J4DH4Z.PREMREASA length = 2
format = $2.
informat = $2.
label = 'PREMREASA',
W5J4DH4Z.PREMREAST length = 2
format = $2.
informat = $2.
label = 'PREMREAST',
W5J4DH4Z.IMAGEFLAG length = 1
format = $1.
informat = $1.
label = 'IMAGEFLAG',
W5J4DH4Z.COMPLTIND length = 1
format = $1.
informat = $1.
label = 'COMPLTIND',
W5J4DH4Z.CUSTREF length = 14
format = $14.
informat = $14.
label = 'CUSTREF',
W5J4DH4Z.POLSTATUS length = 1
format = $1.
informat = $1.
label = 'POLSTATUS',
W5J4DH4Z.LOCKUSER length = 8
format = $8.
informat = $8.
label = 'LOCKUSER',
W5J4DH4Z.MANCOMRTE length = 8
format = 6.2
informat = 6.2
label = 'MANCOMRTE',
W5J4DH4Z.DISCREAS length = 2
format = $2.
informat = $2.
label = 'DISCREAS',
W5J4DH4Z.LOADREAS length = 2
format = $2.
informat = $2.
label = 'LOADREAS',
W5J4DH4Z.FIELD04 length = 4
informat = comma3.2
label = 'Reserved For Future Use',
W5J4DH4Z.COMREAS length = 2
format = $2.
informat = $2.
label = 'COMREAS',
W5J4DH4Z.CHGEXCLUD length = 2
informat = $EBCDIC002.
label = 'Code For Reason Of Exclusion Of Charges',
W5J4DH4Z.SDEXCLUD length = 2
informat = $EBCDIC002.
label = 'Stamp Duty Exclusion Code.',
W5J4DH4Z.GSTEXCLUD length = 2
informat = $EBCDIC002.
label = 'Gst Exclusion',
RETPREM_PI.retRiPrem length = 8
format = 12.2
label = 'Retained Premium',
RETPREM_PI.qsPrem length = 8
format = 12.2
label = 'Quota Share Premium',
RETPREM_PI.catPrem length = 8
format = 12.2
label = 'Catastrophe Premium',
RETPREM_PI.eolprem length = 8
format = 12.2
label = 'Excess Of Loss Premium',

Protect PMOV - Functional Decomposition Analysis PAGE 42


RETPREM_PI.specPrem length = 8
format = 12.2
label = 'Special Premium',
W5J4DH4Z.RISKNO length = 6
informat = S370FPD004.0
label = 'Number To Identify Risk Group'
from
spdswork.W5J4DH4Z left join
dbnchpis.RETPREM_PI
on
(
W5J4DH4Z.COMPANY = RETPREM_PI.company
and W5J4DH4Z.PRODUCT = RETPREM_PI.product
and W5J4DH4Z.POLICY = RETPREM_PI.policy
and W5J4DH4Z.ITEMNO = RETPREM_PI.itemNo
and W5J4DH4Z.TRANCNT = RETPREM_PI.trancnt
)
;
quit;

%rcSet(&sqlrc);

%macro etls_completeTarget();
%mend etls_completeTarget;
%etls_completeTarget;

P09
/*============================================================================*
* Step: SQL Join A55NWR2B.BI00K7NX *
* Transform: SQL Join (Version 2) *
* Description: *
* *
* Source Tables: User Written Code Target - A55NWR2B.BL00A9M3 *
* spdswork.W65KH115 *
* Lookup Target - spdswork.W66CQZYW A55NWR2B.BL00A9MA *
* Target Table: SQL Target - spdswork.W65KH0PT A55NWR2B.BL00A9MB *
*============================================================================*/

%let transformID = %quote(A55NWR2B.BI00K7NX);

%let trans_rc = 0;

proc datasets lib = spdswork nolist nowarn memtype = (data view);


delete W65KH0PT;
quit;

%let spdssqlr = ;

proc sql;
create table spdswork.W65KH0PT as
select
W66CQZYW.ORGTRNCNT length = 8
format = 6.
informat = 6.
label = 'ORGTRNCNT',
W66CQZYW.ITMSTATUS length = 1
format = $1.
informat = $1.
label = 'Item Status - V(void)/blank(current)',
W66CQZYW.REASONCDE length = 2
format = $2.
informat = $2.
label = 'Reason Code for Cancellation Of Item',
W66CQZYW.itemAtrnType length = 2
format = $2.
informat = $2.
label = 'Item - Transaction Type',
W66CQZYW.incGrossPrem length = 5
format = COMMA12.2
informat = 13.2
label = 'Transaction Basic Premium',
W66CQZYW.incStatutCharges length = 4
format = COMMA10.2
informat = 13.2
label = 'Transaction Charge',
W66CQZYW.stampduty length = 4
format = COMMA10.2
informat = 13.2

Protect PMOV - Functional Decomposition Analysis PAGE 43


label = 'Transaction Stamp Duty',
W66CQZYW.incCommission1 length = 4
format = COMMA10.2
informat = 13.2
label = 'Transaction Commission',
W66CQZYW.incGst length = 4
format = COMMA10.2
informat = 13.2
label = 'Amount of GST on Transaction Premium',
W66CQZYW.incCommGst length = 4
format = COMMA10.2
informat = 13.2
label = 'Amount of GST on Transaction Commision',
W66CQZYW.CLASS length = 3
format = $3.
informat = $3.
label = 'Class',
W66CQZYW.SUBCLASS length = 3
format = $3.
informat = $3.
label = 'Subclass',
W66CQZYW.RISKSTATE length = 2
format = $2.
informat = $2.
label = 'RISKSTATE',
W66CQZYW.OCCUPATN length = 4
format = $4.
informat = $4.
label = 'OCCUPATN',
W66CQZYW.SUMINS length = 8
format = 11.
informat = 11.
label = 'SUMINS',
W66CQZYW.EXCESS length = 8
format = 11.
informat = 11.
label = 'EXCESS',
W66CQZYW.DISTRICT length = 2
format = $2.
informat = $2.
label = 'DISTRICT',
W66CQZYW.INDEXIND length = 1
format = $1.
informat = $1.
label = 'INDEXIND',
W66CQZYW.FIREBRIG length = 1
format = $1.
informat = $1.
label = 'FIREBRIG',
W66CQZYW.GSTORIDE length = 1
format = $1.
informat = $1.
label = 'GSTORIDE',
W66CQZYW.MINPRMIND length = 1
format = $1.
informat = $1.
label = 'MINPRMIND',
W66CQZYW.TAILORGRP length = 2
format = $2.
informat = $2.
label = 'TAILORGRP',
W66CQZYW.TYPEOFPOL length = 1
format = $1.
informat = $1.
label = 'TYPEOFPOL',
W66CQZYW.COINSPC length = 8
format = 7.3
informat = 7.3
label = 'COINSPC',
W66CQZYW.LOCATNREF length = 8
format = 11.
informat = 11.
label = 'LOCATNREF',
W66CQZYW.MANRIIND length = 1
format = $1.
informat = $1.
label = 'MANRIIND',
W66CQZYW.CLIENT length = 8
format = 11.
informat = 11.

Protect PMOV - Functional Decomposition Analysis PAGE 44


label = 'CLIENT',
W66CQZYW.STATE length = 8
format = 6.
informat = 6.
label = 'STATE',
W66CQZYW.BRANCH length = 8
format = 6.
informat = 6.
label = 'BRANCH',
W66CQZYW.REP length = 8
format = 6.
informat = 6.
label = 'REP',
W66CQZYW.AGENT length = 8
format = 11.
informat = 11.
label = 'AGENT',
W66CQZYW.RNWALTERM length = 8
format = 6.
informat = 6.
label = 'RNWALTERM',
W66CQZYW.REVIEWIND length = 1
format = $1.
informat = $1.
label = 'REVIEWIND',
W66CQZYW.NTCETO length = 1
format = $1.
informat = $1.
label = 'NTCETO',
W66CQZYW.NTCEPROD length = 1
format = $1.
informat = $1.
label = 'NTCEPROD',
W66CQZYW.NTCETYPE length = 1
format = $1.
informat = $1.
label = 'NTCETYPE',
W66CQZYW.CLAUSEIND length = 1
format = $1.
informat = $1.
label = 'CLAUSEIND',
W66CQZYW.SPCLSIND length = 1
format = $1.
informat = $1.
label = 'SPCLSIND',
W66CQZYW.MSGIND length = 1
format = $1.
informat = $1.
label = 'MSGIND',
W66CQZYW.BUSNESSRC length = 4
format = $4.
informat = $4.
label = 'BUSNESSRC',
W66CQZYW.COYISSUED length = 8
format = 6.
informat = 6.
label = 'COYISSUED',
W66CQZYW.STISSUED length = 2
format = $2.
informat = $2.
label = 'STISSUED',
W66CQZYW.INSTALFRQ length = 1
format = $1.
informat = $1.
label = 'INSTALFRQ',
W66CQZYW.CANCDECLN length = 1
format = $1.
informat = $1.
label = 'CANCDECLN',
W66CQZYW.IMPEXCESS length = 1
format = $1.
informat = $1.
label = 'IMPEXCESS',
W66CQZYW.BRCHRESP length = 8
format = 6.
informat = 6.
label = 'BRCHRESP',
W66CQZYW.BUSDESC length = 1
format = $1.
informat = $1.

Protect PMOV - Functional Decomposition Analysis PAGE 45


label = 'BUSDESC',
W66CQZYW.DISCGRP length = 1
format = $1.
informat = $1.
label = 'DISCGRP',
W66CQZYW.SEQPOLICY length = 8
format = 11.
informat = 11.
label = 'Sequence Policy Number',
W66CQZYW.modified length = 8
format = BINARY10.
label = 'Flag to identify User Modifications in Binary
00000000',
W66CQZYW.covRenewedDate as covRenewedDate length = 5
format = DATE9.
label = 'Coverage Renewed Date',
W66CQZYW.covChgEffDate as covChgEffDate length = 5
format = DATE9.
label = 'Coverage Change Effective
Date',
W66CQZYW.inforceIncDate as inforceIncDate length = 5
format = DATE9.
label = 'In Force Inception Date',
W66CQZYW.inforceExpDate as inforceExpDate length = 5
format = DATE9.
label = 'In Force Expiry Date',
W66CQZYW.covChgExpDate as covChgExpDate length = 5
format = DATE9.
label = 'Coverage Change Expiry Date',
W66CQZYW.transactionDate as transactionDate length = 5
format = DATE9.
label = 'Transaction Date',
W66CQZYW.policyInceptDate as policyInceptDate length = 5
format = DATE9.
label = 'Policy Inception Date',
W66CQZYW.PRVPOLREF length = 14
format = $14.
informat = $14.
label = 'PRVPOLREF',
W66CQZYW.RBASICPRM length = 8
format = 13.2
informat = 13.2
label = 'RBASICPRM',
W66CQZYW.RSTMPDUTY length = 8
format = 13.2
informat = 13.2
label = 'RSTMPDUTY',
W66CQZYW.RGST length = 8
format = 13.2
informat = 13.2
label = 'RGST',
W66CQZYW.RCHARGES length = 8
format = 13.2
informat = 13.2
label = 'RCHARGES',
W66CQZYW.RCOMMISN length = 8
format = 13.2
informat = 13.2
label = 'RCOMMISN',
W66CQZYW.RCOMMGST length = 8
format = 13.2
informat = 13.2
label = 'RCOMMGST',
W66CQZYW.SUMINSCDE length = 3
format = $3.
informat = $3.
label = 'SUMINSCDE',
W66CQZYW.EXCESSTYP length = 1
format = $1.
informat = $1.
label = 'EXCESSTYP',
W66CQZYW.REBATEPC length = 8
format = 6.2
informat = 6.2
label = 'REBATEPC',
W66CQZYW.LOADINGPC length = 8
format = 7.2
informat = 7.2
label = 'LOADINGPC',
W66CQZYW.PREMREASA length = 2

Protect PMOV - Functional Decomposition Analysis PAGE 46


format = $2.
informat = $2.
label = 'PREMREASA',
W66CQZYW.PREMREAST length = 2
format = $2.
informat = $2.
label = 'PREMREAST',
W66CQZYW.IMAGEFLAG length = 1
format = $1.
informat = $1.
label = 'IMAGEFLAG',
W66CQZYW.COMPLTIND length = 1
format = $1.
informat = $1.
label = 'COMPLTIND',
W66CQZYW.CUSTREF length = 14
format = $14.
informat = $14.
label = 'CUSTREF',
W66CQZYW.POLSTATUS length = 1
format = $1.
informat = $1.
label = 'POLSTATUS',
W66CQZYW.LOCKUSER length = 8
format = $8.
informat = $8.
label = 'LOCKUSER',
COALESCE(W66CQZYW.coinsPrem ,0) as coinsPrem length = 8
format = 12.2
label = 'Coinsurance Premium',
COALESCE(W66CQZYW.retRiPrem,0) as retRiPrem length = 8,
COALESCE(W66CQZYW.qsPrem ,0) as qsPrem length = 8,
COALESCE(W66CQZYW.catPrem ,0) as catPrem length = 8,
COALESCE(W66CQZYW.eolprem ,0) as eolPrem length = 8,
COALESCE(W66CQZYW.specPrem ,0) as specPrem length = 8,
W66CQZYW.company length = 8
format = 6.
informat = 6.
label = 'Company',
W66CQZYW.product length = 3
format = $3.
informat = $3.
label = 'Product',
W66CQZYW.policy length = 8
format = 11.
informat = 11.
label = 'Policy Number',
W66CQZYW.itemNo length = 8
format = 6.
informat = 6.
label = 'Item Number',
W66CQZYW.premtranTRANDATE length = 8
format = 11.
informat = 11.
label = 'Transaction Date',
W66CQZYW.TRANTIME length = 8
format = 11.
informat = 11.
label = 'Transaction Time',
W66CQZYW.trancnt length = 8
format = 6.
informat = 6.
label = 'Transaction Counter',
W66CQZYW.premtranTbasicPrm length = 8
format = 13.2
informat = 13.2
label = 'Transaction Basic Premium',
W66CQZYW.ATRNTYPE length = 2
format = $2.
informat = $2.
label = 'Transaction Type',
W66CQZYW.MANCOMRTE length = 8
format = 6.2
informat = 6.2
label = 'MANCOMRTE',
W66CQZYW.DISCREAS length = 2
format = $2.
informat = $2.
label = 'DISCREAS',
W66CQZYW.LOADREAS length = 2

Protect PMOV - Functional Decomposition Analysis PAGE 47


format = $2.
informat = $2.
label = 'LOADREAS',
W66CQZYW.FIELD04 length = 4
informat = comma3.2
label = 'Reserved For Future Use',
W66CQZYW.COMREAS length = 2
format = $2.
informat = $2.
label = 'COMREAS',
W65KH115.MPDISC length = 1
format = $1.
informat = $1.
label = 'Multi Policy Discount',
W65KH115.PRVINSCOY length = 4
format = $4.
informat = $4.
label = 'Previous Insurer',
W66CQZYW.CHGEXCLUD length = 2
informat = $EBCDIC002.
label = 'Code For Reason Of Exclusion Of Charges',
W66CQZYW.SDEXCLUD length = 2
informat = $EBCDIC002.
label = 'Stamp Duty Exclusion Code.',
W66CQZYW.GSTEXCLUD length = 2
informat = $EBCDIC002.
label = 'Gst Exclusion',
W65KH115.CPBUSSRC length = 10
informat = $EBCDIC010.
label = 'Corporate Partners Source Of Business',
W65KH115.CAMPCODE length = 10
label = 'CAMPCODE',
W65KH115.PRVINSIND length = 1
label = 'Previous Insurance',
W65KH115.PRVINSPOL length = 14
label = 'Previous Policy Code',
W65KH115.LOYDATE length = 8
informat = IB004.
label = 'LOYDATE',
W66CQZYW.RISKNO length = 6
informat = S370FPD004.0
label = 'Number To Identify Risk Group'
from
spdswork.W66CQZYW left join
spdswork.W65KH115
on
(
W66CQZYW.company = W65KH115.COMPANY
and W66CQZYW.product = W65KH115.PRODUCT
and W66CQZYW.policy = W65KH115.POLICY
and W66CQZYW.inforceIncDate >= W65KH115.EFFECTDTE
and W66CQZYW.inforceIncDate <= W65KH115.ACTIVTO
)
;
quit;

%rcSet(&sqlrc);

%macro etls_completeTarget();
%mend etls_completeTarget;
%etls_completeTarget;

P33
/*============================================================================*
* Step: SQL Join A55NWR2B.BI00K7O3 *
* Transform: SQL Join (Version 2) *
* Description: *
* *
* Source Tables: Extract Target - work.W66NJTRK A55NWR2B.BL00A9LZ *
* Splitter Target 2 - spdswork.W66O0OTD A55NWR2B.BL00A9MI *
* Target Table: SQL Target - work.W66O0ZD9 A55NWR2B.BL00A9MK *
*============================================================================*/

%let transformID = %quote(A55NWR2B.BI00K7O3);


%let trans_rc = 0;

proc datasets lib = work nolist nowarn memtype = (data view);

Protect PMOV - Functional Decomposition Analysis PAGE 48


delete W66O0ZD9;
quit;

proc sql;
create view work.W66O0ZD9 as
select
W66O0OTD.FIREBRIG length = 1
format = $1.
informat = $1.
label = 'FIREBRIG',
W66O0OTD.COYISSUED length = 8
format = 6.
informat = 6.
label = 'COYISSUED',
W66O0OTD.itemNo length = 8
format = 6.
informat = 6.
label = 'Item No',
W66O0OTD.modified length = 8
format = BINARY10.
label = 'Flag to identify User Modifications in Binary
00000000',
W66O0OTD.GRPNAME length = 60
label = 'Group Name',
W66O0OTD.MANCOMRTE length = 8
format = 6.2
informat = 6.2
label = 'MANCOMRTE',
W66O0OTD.POLSTATUS length = 1
format = $1.
informat = $1.
label = 'POLSTATUS',
W66O0OTD.PREMREASA length = 2
format = $2.
informat = $2.
label = 'PREMREASA',
W66O0OTD.inforceIncDate length = 5
format = DATE9.
label = 'In Force Inception Date',
W66O0OTD.incCommission1 length = 4
format = 10.2
informat = 13.2
label = 'Transaction Commission',
W66O0OTD.RCOMMISN length = 8
format = 13.2
informat = 13.2
label = 'RCOMMISN',
W66O0OTD.incGrossPrem length = 5
format = 12.2
informat = 13.2
label = 'Transaction Basic Premium',
W66O0OTD.reverseTrncnt length = 8
format = 6.
informat = 6.
label = 'Transaction Count',
W66O0OTD.BRCHRESP length = 8
format = 6.
informat = 6.
label = 'BRCHRESP',
W66O0OTD.CUSTREF length = 14
format = $14.
informat = $14.
label = 'CUSTREF',
W66O0OTD.LOCKUSER length = 8
format = $8.
informat = $8.
label = 'LOCKUSER',
W66O0OTD.CITY length = 40
format = $40.
informat = $40.
label = 'City/Town/Suburb Name',
W66O0OTD.covRenewedDate length = 5
format = DATE9.
label = 'Coverage Renew Date',
W66O0OTD.incCommGst length = 4
format = 10.2
informat = 13.2
label = 'Amount of GST on Transaction Commision',
W66O0OTD.OCCUPATN length = 4
format = $4.

Protect PMOV - Functional Decomposition Analysis PAGE 49


informat = $4.
label = 'OCCUPATN',
W66O0OTD.cumEarnPremPerDay length = 5
format = 8.5
label = 'Cummulative Earned Premium Per day',
W66O0OTD.coinsPrem length = 8
format = 12.2
label = 'Coinsurance Premium',
W66O0OTD.AGENTSTATE length = 8
label = 'State Code',
W66O0OTD.subclass length = 3
format = $3.
informat = $3.
label = 'Subclass',
W66O0OTD.ORGTRNCNT length = 8
format = 6.
informat = 6.
label = 'ORGTRNCNT',
W66O0OTD.COMPLTIND length = 1
format = $1.
informat = $1.
label = 'COMPLTIND',
W66O0OTD.RGST length = 8
format = 13.2
informat = 13.2
label = 'RGST',
W66O0OTD.SPCLSIND length = 1
format = $1.
informat = $1.
label = 'SPCLSIND',
W66O0OTD.STATE length = 8
format = 6.
informat = 6.
label = 'STATE',
W66O0OTD.CAMPCODE length = 10
label = 'CAMPCODE',
W66O0OTD.BRANCH length = 8
format = 6.
informat = 6.
label = 'BRANCH',
W66O0OTD.covChgEffDate length = 5
format = DATE9.
label = 'Coverage Change Effective Date',
W66O0OTD.DISTRICT length = 2
format = $2.
informat = $2.
label = 'DISTRICT',
W66O0OTD.CANCDECLN length = 1
format = $1.
informat = $1.
label = 'CANCDECLN',
W66O0OTD.STISSUED length = 2
format = $2.
informat = $2.
label = 'STISSUED',
W66O0OTD.tranEarnPremPerDay length = 5
format = 8.5
label = 'Trans Earned Premium Per Day',
W66O0OTD.INDEXIND length = 1
format = $1.
informat = $1.
label = 'INDEXIND',
W66O0OTD.tranEarnCommPerDay length = 5
format = 8.5
label = 'Trans Earned Commission Per Day',
W66O0OTD.EXCESS length = 8
format = 11.
informat = 11.
label = 'EXCESS',
W66O0OTD.CPBUSSRC length = 10
informat = $EBCDIC010.
label = 'Corporate Partners Source Of Business',
W66O0OTD.qsPrem length = 5
format = 12.2
label = 'Quota Share Premium',
W66O0OTD.FIELD04 length = 4
informat = comma3.2
label = 'Reserved For Future Use',
W66O0OTD.NTCETYPE length = 1
format = $1.

Protect PMOV - Functional Decomposition Analysis PAGE 50


informat = $1.
label = 'NTCETYPE',
W66O0OTD.cumEarnCommPerDay length = 5
format = 8.5
label = 'Cummulative Earned Commission Per day',
W66O0OTD.GSTEXCLUD length = 2
informat = $EBCDIC002.
label = 'Gst Exclusion',
W66O0OTD.SDEXCLUD length = 2
informat = $EBCDIC002.
label = 'Stamp Duty Exclusion Code.',
W66O0OTD.COMREAS length = 2
format = $2.
informat = $2.
label = 'COMREAS',
W66O0OTD.atrnType length = 2
format = $2.
informat = $2.
label = 'Premtran - Transaction Type',
W66O0OTD.REP length = 8
format = 6.
informat = 6.
label = 'REP',
W66O0OTD.CHGEXCLUD length = 2
informat = $EBCDIC002.
label = 'Code For Reason Of Exclusion Of Charges',
W66O0OTD.NTCEPROD length = 1
format = $1.
informat = $1.
label = 'NTCEPROD',
W66O0OTD.glDate length = 5
format = DATE9.
label = 'General Ledger Date',
W66O0OTD.COINSPC length = 8
format = 7.3
informat = 7.3
label = 'COINSPC',
W66O0OTD.incGst length = 4
format = 10.2
informat = 13.2
label = 'Amount of GST on Transaction Premium',
W66O0OTD.stampDuty length = 4
format = 10.2
informat = 13.2
label = 'Transaction Stamp Duty',
W66O0OTD.tranInforce length = 3
label = 'Inforce Transaction 1(Yes)/0(No)',
W66O0OTD.BUSDESC length = 1
format = $1.
informat = $1.
label = 'BUSDESC',
W66O0OTD.cumGrossPrem length = 5
format = 12.2
label = 'Cummulative Premium Amount',
W66O0OTD.policy length = 8
format = 11.
informat = 11.
label = 'Policy Number',
W66O0OTD.cumStampDuty length = 4
format = 10.2
label = 'Cummulative Stamp Duty Amount',
W66O0OTD.covChgExpDate length = 5
format = DATE9.
label = 'Coverage Change Expiry Date',
W66O0OTD.policyInceptDate length = 5
format = DATE9.
label = 'Policy Inception Date',
W66O0OTD.cumCommission1 length = 4
format = 10.2
label = 'Cummulative Commission Amount',
W66O0OTD.PRVINSPOL length = 14
label = 'Previous Policy Code',
W66O0OTD.premtranTRANDATE length = 5
format = DATE9.
label = 'Transaction Date',
W66O0OTD.REVIEWIND length = 1
format = $1.
informat = $1.
label = 'REVIEWIND',
W66O0OTD.RISKSTATE length = 2

Protect PMOV - Functional Decomposition Analysis PAGE 51


format = $2.
informat = $2.
label = 'RISKSTATE',
W66O0OTD.AGTGROUP length = 8
label = 'Agent Group Number',
W66O0OTD.DISCREAS length = 2
format = $2.
informat = $2.
label = 'DISCREAS',
W66O0OTD.REBATEPC length = 8
format = 6.2
informat = 6.2
label = 'REBATEPC',
W66O0OTD.itemAtrnType length = 2
format = $2.
informat = $2.
label = 'Item - Transaction Type',
W66O0OTD.AGTCLUSTR length = 4
label = 'Agent Cluster',
W66O0OTD.EXCESSTYP length = 1
format = $1.
informat = $1.
label = 'EXCESSTYP',
W66O0OTD.RCOMMGST length = 8
format = 13.2
informat = 13.2
label = 'RCOMMGST',
W66O0OTD.MPDISC length = 1
format = $1.
informat = $1.
label = 'Multi Policy Discount',
W66O0OTD.RSTMPDUTY length = 8
format = 13.2
informat = 13.2
label = 'RSTMPDUTY',
W66O0OTD.BUSNESSRC length = 4
format = $4.
informat = $4.
label = 'BUSNESSRC',
W66O0OTD.SUMINS length = 8
format = 11.
informat = 11.
label = 'SUMINS',
W66O0OTD.PRVINSIND length = 1
label = 'Previous Insurance',
W66O0OTD.termIdent length = 3
label = 'Term Identification',
W66O0OTD.cumGST length = 4
format = 10.2
label = 'Cummulative GST Amount',
W66O0OTD.GSTORIDE length = 1
format = $1.
informat = $1.
label = 'GSTORIDE',
W66O0OTD.LOADREAS length = 2
format = $2.
informat = $2.
label = 'LOADREAS',
W66O0OTD.PREMREAST length = 2
format = $2.
informat = $2.
label = 'PREMREAST',
W66O0OTD.CLIENT length = 8
format = 11.
informat = 11.
label = 'CLIENT',
W66O0OTD.cumCommGst length = 4
format = 10.2
label = 'Cummulative GST on Transaction Commision',
W66O0OTD.RNWALTERM length = 8
format = 6.
informat = 6.
label = 'RNWALTERM',
W66O0OTD.NTCETO length = 1
format = $1.
informat = $1.
label = 'NTCETO',
W66O0OTD.IMAGEFLAG length = 1
format = $1.
informat = $1.

Protect PMOV - Functional Decomposition Analysis PAGE 52


label = 'IMAGEFLAG',
W66O0OTD.MINPRMIND length = 1
format = $1.
informat = $1.
label = 'MINPRMIND',
W66O0OTD.incStatutCharges length = 4
format = 10.2
informat = 13.2
label = 'Transaction Charges',
W66O0OTD.LOCATNREF length = 8
format = 11.
informat = 11.
label = 'LOCATNREF',
W66O0OTD.cumStatutCharges length = 4
format = 10.2
label = 'Cummulative Statutory Charges',
W66O0OTD.itmstatus length = 1
format = $1.
informat = $1.
label = 'Item Status - V(void)/blank(current)',
W66O0OTD.transactionDate length = 5
format = DATE9.
label = 'Transaction Date',
W66O0OTD.coverageKey length = 8
label = 'Coverage Key',
W66O0OTD.trancnt length = 8
format = 6.
informat = 6.
label = 'Transaction Count',
W66O0OTD.eolprem length = 5
format = 12.2
label = 'Excess Of Loss Premium',
W66O0OTD.PRVINSCOY length = 4
format = $4.
informat = $4.
label = 'Previous Insurer',
W66O0OTD.seqPolicy length = 8
format = 11.
informat = 11.
label = 'Sequence Policy Number',
W66O0OTD.product length = 3
format = $3.
informat = $3.
label = 'Product',
W66O0OTD.DISCGRP length = 1
format = $1.
informat = $1.
label = 'DISCGRP',
W66O0OTD.RBASICPRM length = 8
format = 13.2
informat = 13.2
label = 'RBASICPRM',
W66O0OTD.inforceExpDate length = 5
format = DATE9.
label = 'In Force Expiry Date',
W66O0OTD.MSGIND length = 1
format = $1.
informat = $1.
label = 'MSGIND',
W66O0OTD.reasoncde length = 2
format = $2.
informat = $2.
label = 'Reason Code for Cancellation Of Item',
W66O0OTD.PRVPOLREF length = 14
format = $14.
informat = $14.
label = 'PRVPOLREF',
W66O0OTD.company length = 8
format = 6.
informat = 6.
label = 'Company',
W66O0OTD.CLAUSEIND length = 1
format = $1.
informat = $1.
label = 'CLAUSEIND',
W66O0OTD.COMSCALE length = 8
label = 'Commission Scale',
W66O0OTD.POSTCODE length = 6
format = $6.
informat = $6.

Protect PMOV - Functional Decomposition Analysis PAGE 53


label = 'Postcode',
W66O0OTD.premtranTbasicPrm length = 8
format = 13.2
informat = 13.2
label = 'Transaction Basic Premium',
W66O0OTD.newRenew length = 1
label = 'New(N)/Renewal(R) Risk',
W66O0OTD.AGENT length = 8
format = 11.
informat = 11.
label = 'AGENT',
W66O0OTD.LOADINGPC length = 8
format = 7.2
informat = 7.2
label = 'LOADINGPC',
W66O0OTD.class length = 3
format = $3.
informat = $3.
label = 'Class',
W66O0OTD.IMPEXCESS length = 1
format = $1.
informat = $1.
label = 'IMPEXCESS',
W66O0OTD.TAILORGRP length = 2
format = $2.
informat = $2.
label = 'TAILORGRP',
W66O0OTD.RCHARGES length = 8
format = 13.2
informat = 13.2
label = 'RCHARGES',
W66O0OTD.retRiPrem length = 5
format = 12.2
label = 'Retained Premium',
W66O0OTD.TYPEOFPOL length = 1
format = $1.
informat = $1.
label = 'TYPEOFPOL',
W66O0OTD.catPrem length = 5
format = 12.2
label = 'Catastrophe Premium',
W66O0OTD.SUMINSCDE length = 3
format = $3.
informat = $3.
label = 'SUMINSCDE',
W66O0OTD.transactionType length = 2
label = 'User Defined - Transaction Type',
W66O0OTD.INDEXPERC length = 6
label = 'INDEX PERC',
W66O0OTD.INSTALFRQ length = 1
format = $1.
informat = $1.
label = 'INSTALFRQ',
W66O0OTD.MANRIIND length = 1
format = $1.
informat = $1.
label = 'MANRIIND',
W66O0OTD.specPrem length = 5
format = 12.2
label = 'Special Premium',
case
when W66O0OTD.company = 3 | W66NJTRK.COMPRODCT = 'Y'
then W66O0OTD.product
else " "
end as productjoin length = 3
format = $3.
informat = $3.,
case
when W66NJTRK.COMSUBCLS = 'Y'
then W66O0OTD.subclass
else " "
end as subclassjoin length = 3
format = $3.
informat = $3.,
W66NJTRK.COMPRODCT length = 1
informat = $EBCDIC001.
label = 'COMPRODCT',
W66NJTRK.COMSUBCLS length = 1
informat = $EBCDIC001.
label = 'COMSUBCLS',

Protect PMOV - Functional Decomposition Analysis PAGE 54


W66O0OTD.LOYDATE length = 8
informat = IB004.
label = 'LOYDATE',
W66O0OTD.RISKNO length = 6
informat = S370FPD004.0
label = 'Number To Identify Risk Group'
from
work.W66NJTRK right join
spdswork.W66O0OTD
on
(
W66O0OTD.company = W66NJTRK.COMPANY
and W66O0OTD.AGENTSTATE = W66NJTRK.STATE
and W66O0OTD.class = W66NJTRK.CLASS
and W66O0OTD.subclass = W66NJTRK.SUBCLASS
)
;
quit;

%rcSet(&sqlrc);

P34
/*============================================================================*
* Step: SQL Join A55NWR2B.BI00K7O4 *
* Transform: SQL Join (Version 2) *
* Description: *
* *
* Source Tables: Extract Target - work.W667ICOF A55NWR2B.BL00A9M2 *
* SQL Target - work.W66O0ZD9 A55NWR2B.BL00A9MK *
* Target Table: SQL Target - work.W66O108F A55NWR2B.BL00A9ML *
*============================================================================*/

%let transformID = %quote(A55NWR2B.BI00K7O4);

%let trans_rc = 0;

proc datasets lib = work nolist nowarn memtype = (data view);


delete W66O108F;
quit;

proc sql;
create table work.W66O108F as
select
W66O0ZD9.FIREBRIG length = 1
format = $1.
informat = $1.
label = 'FIREBRIG',
W66O0ZD9.COYISSUED length = 8
format = 6.
informat = 6.
label = 'COYISSUED',
W66O0ZD9.itemNo length = 8
format = 6.
informat = 6.
label = 'Item No',
W66O0ZD9.modified length = 8
format = BINARY10.
label = 'Flag to identify User Modifications in Binary
00000000',
W66O0ZD9.GRPNAME length = 60
label = 'Group Name',
W66O0ZD9.MANCOMRTE length = 8
format = 6.2
informat = 6.2
label = 'MANCOMRTE',
W66O0ZD9.POLSTATUS length = 1
format = $1.
informat = $1.
label = 'POLSTATUS',
W66O0ZD9.PREMREASA length = 2
format = $2.
informat = $2.
label = 'PREMREASA',
W66O0ZD9.inforceIncDate length = 5
format = DATE9.
label = 'In Force Inception Date',
W66O0ZD9.incCommission1 length = 4
format = 10.2

Protect PMOV - Functional Decomposition Analysis PAGE 55


informat = 13.2
label = 'Transaction Commission',
W66O0ZD9.RCOMMISN length = 8
format = 13.2
informat = 13.2
label = 'RCOMMISN',
W66O0ZD9.incGrossPrem length = 5
format = 12.2
informat = 13.2
label = 'Transaction Basic Premium',
W66O0ZD9.reverseTrncnt length = 8
format = 6.
informat = 6.
label = 'Transaction Count',
W66O0ZD9.BRCHRESP length = 8
format = 6.
informat = 6.
label = 'BRCHRESP',
W66O0ZD9.CUSTREF length = 14
format = $14.
informat = $14.
label = 'CUSTREF',
W66O0ZD9.LOCKUSER length = 8
format = $8.
informat = $8.
label = 'LOCKUSER',
W66O0ZD9.CITY length = 40
format = $40.
informat = $40.
label = 'City/Town/Suburb Name',
W66O0ZD9.covRenewedDate length = 5
format = DATE9.
label = 'Coverage Renew Date',
W66O0ZD9.incCommGst length = 4
format = 10.2
informat = 13.2
label = 'Amount of GST on Transaction Commision',
W66O0ZD9.OCCUPATN length = 4
format = $4.
informat = $4.
label = 'OCCUPATN',
W66O0ZD9.cumEarnPremPerDay length = 5
format = 8.5
label = 'Cummulative Earned Premium Per day',
W66O0ZD9.coinsPrem length = 8
format = 12.2
label = 'Coinsurance Premium',
W66O0ZD9.AGENTSTATE length = 8
label = 'State Code',
W66O0ZD9.subclass length = 3
format = $3.
informat = $3.
label = 'Subclass',
W66O0ZD9.ORGTRNCNT length = 8
format = 6.
informat = 6.
label = 'ORGTRNCNT',
W66O0ZD9.COMPLTIND length = 1
format = $1.
informat = $1.
label = 'COMPLTIND',
W66O0ZD9.RGST length = 8
format = 13.2
informat = 13.2
label = 'RGST',
W66O0ZD9.SPCLSIND length = 1
format = $1.
informat = $1.
label = 'SPCLSIND',
W66O0ZD9.STATE length = 8
format = 6.
informat = 6.
label = 'STATE',
W66O0ZD9.CAMPCODE length = 10
label = 'CAMPCODE',
W66O0ZD9.BRANCH length = 8
format = 6.
informat = 6.
label = 'BRANCH',
W66O0ZD9.covChgEffDate length = 5

Protect PMOV - Functional Decomposition Analysis PAGE 56


format = DATE9.
label = 'Coverage Change Effective Date',
W66O0ZD9.DISTRICT length = 2
format = $2.
informat = $2.
label = 'DISTRICT',
W66O0ZD9.CANCDECLN length = 1
format = $1.
informat = $1.
label = 'CANCDECLN',
W66O0ZD9.STISSUED length = 2
format = $2.
informat = $2.
label = 'STISSUED',
W66O0ZD9.tranEarnPremPerDay length = 5
format = 8.5
label = 'Trans Earned Premium Per Day',
W66O0ZD9.INDEXIND length = 1
format = $1.
informat = $1.
label = 'INDEXIND',
W66O0ZD9.tranEarnCommPerDay length = 5
format = 8.5
label = 'Trans Earned Commission Per Day',
W66O0ZD9.EXCESS length = 8
format = 11.
informat = 11.
label = 'EXCESS',
W66O0ZD9.CPBUSSRC length = 10
informat = $EBCDIC010.
label = 'Corporate Partners Source Of Business',
W66O0ZD9.qsPrem length = 5
format = 12.2
label = 'Quota Share Premium',
W66O0ZD9.FIELD04 length = 4
informat = comma3.2
label = 'Reserved For Future Use',
W66O0ZD9.NTCETYPE length = 1
format = $1.
informat = $1.
label = 'NTCETYPE',
W66O0ZD9.cumEarnCommPerDay length = 5
format = 8.5
label = 'Cummulative Earned Commission Per day',
W66O0ZD9.GSTEXCLUD length = 2
informat = $EBCDIC002.
label = 'Gst Exclusion',
W66O0ZD9.SDEXCLUD length = 2
informat = $EBCDIC002.
label = 'Stamp Duty Exclusion Code.',
W66O0ZD9.COMREAS length = 2
format = $2.
informat = $2.
label = 'COMREAS',
W66O0ZD9.atrnType length = 2
format = $2.
informat = $2.
label = 'Premtran - Transaction Type',
W66O0ZD9.REP length = 8
format = 6.
informat = 6.
label = 'REP',
W66O0ZD9.CHGEXCLUD length = 2
informat = $EBCDIC002.
label = 'Code For Reason Of Exclusion Of Charges',
W66O0ZD9.NTCEPROD length = 1
format = $1.
informat = $1.
label = 'NTCEPROD',
W66O0ZD9.glDate length = 5
format = DATE9.
label = 'General Ledger Date',
W66O0ZD9.COINSPC length = 8
format = 7.3
informat = 7.3
label = 'COINSPC',
W66O0ZD9.incGst length = 4
format = 10.2
informat = 13.2
label = 'Amount of GST on Transaction Premium',

Protect PMOV - Functional Decomposition Analysis PAGE 57


W66O0ZD9.stampDuty length = 4
format = 10.2
informat = 13.2
label = 'Transaction Stamp Duty',
W66O0ZD9.tranInforce length = 3
label = 'Inforce Transaction 1(Yes)/0(No)',
W66O0ZD9.BUSDESC length = 1
format = $1.
informat = $1.
label = 'BUSDESC',
W66O0ZD9.cumGrossPrem length = 5
format = 12.2
label = 'Cummulative Premium Amount',
W66O0ZD9.policy length = 8
format = 11.
informat = 11.
label = 'Policy Number',
W66O0ZD9.cumStampDuty length = 4
format = 10.2
label = 'Cummulative Stamp Duty Amount',
W66O0ZD9.covChgExpDate length = 5
format = DATE9.
label = 'Coverage Change Expiry Date',
W66O0ZD9.policyInceptDate length = 5
format = DATE9.
label = 'Policy Inception Date',
W66O0ZD9.cumCommission1 length = 4
format = 10.2
label = 'Cummulative Commission Amount',
W66O0ZD9.PRVINSPOL length = 14
label = 'Previous Policy Code',
W66O0ZD9.premtranTRANDATE length = 5
format = DATE9.
label = 'Transaction Date',
W66O0ZD9.REVIEWIND length = 1
format = $1.
informat = $1.
label = 'REVIEWIND',
W66O0ZD9.RISKSTATE length = 2
format = $2.
informat = $2.
label = 'RISKSTATE',
W66O0ZD9.AGTGROUP length = 8
label = 'Agent Group Number',
W66O0ZD9.DISCREAS length = 2
format = $2.
informat = $2.
label = 'DISCREAS',
W66O0ZD9.REBATEPC length = 8
format = 6.2
informat = 6.2
label = 'REBATEPC',
W66O0ZD9.itemAtrnType length = 2
format = $2.
informat = $2.
label = 'Item - Transaction Type',
W66O0ZD9.AGTCLUSTR length = 4
label = 'Agent Cluster',
W66O0ZD9.EXCESSTYP length = 1
format = $1.
informat = $1.
label = 'EXCESSTYP',
W66O0ZD9.RCOMMGST length = 8
format = 13.2
informat = 13.2
label = 'RCOMMGST',
W66O0ZD9.MPDISC length = 1
format = $1.
informat = $1.
label = 'Multi Policy Discount',
W66O0ZD9.RSTMPDUTY length = 8
format = 13.2
informat = 13.2
label = 'RSTMPDUTY',
W66O0ZD9.BUSNESSRC length = 4
format = $4.
informat = $4.
label = 'BUSNESSRC',
W66O0ZD9.SUMINS length = 8
format = 11.

Protect PMOV - Functional Decomposition Analysis PAGE 58


informat = 11.
label = 'SUMINS',
W66O0ZD9.PRVINSIND length = 1
label = 'Previous Insurance',
W66O0ZD9.termIdent length = 3
label = 'Term Identification',
W66O0ZD9.cumGST length = 4
format = 10.2
label = 'Cummulative GST Amount',
W66O0ZD9.GSTORIDE length = 1
format = $1.
informat = $1.
label = 'GSTORIDE',
W66O0ZD9.LOADREAS length = 2
format = $2.
informat = $2.
label = 'LOADREAS',
W66O0ZD9.PREMREAST length = 2
format = $2.
informat = $2.
label = 'PREMREAST',
W66O0ZD9.CLIENT length = 8
format = 11.
informat = 11.
label = 'CLIENT',
W66O0ZD9.cumCommGst length = 4
format = 10.2
label = 'Cummulative GST on Transaction Commision',
W66O0ZD9.RNWALTERM length = 8
format = 6.
informat = 6.
label = 'RNWALTERM',
W66O0ZD9.NTCETO length = 1
format = $1.
informat = $1.
label = 'NTCETO',
W66O0ZD9.IMAGEFLAG length = 1
format = $1.
informat = $1.
label = 'IMAGEFLAG',
W66O0ZD9.MINPRMIND length = 1
format = $1.
informat = $1.
label = 'MINPRMIND',
W66O0ZD9.incStatutCharges length = 4
format = 10.2
informat = 13.2
label = 'Transaction Charges',
W66O0ZD9.LOCATNREF length = 8
format = 11.
informat = 11.
label = 'LOCATNREF',
W66O0ZD9.cumStatutCharges length = 4
format = 10.2
label = 'Cummulative Statutory Charges',
W66O0ZD9.itmstatus length = 1
format = $1.
informat = $1.
label = 'Item Status - V(void)/blank(current)',
W66O0ZD9.transactionDate length = 5
format = DATE9.
label = 'Transaction Date',
W66O0ZD9.coverageKey length = 8
label = 'Coverage Key',
W66O0ZD9.trancnt length = 8
format = 6.
informat = 6.
label = 'Transaction Count',
W66O0ZD9.eolprem length = 5
format = 12.2
label = 'Excess Of Loss Premium',
W66O0ZD9.PRVINSCOY length = 4
format = $4.
informat = $4.
label = 'Previous Insurer',
W66O0ZD9.seqPolicy length = 8
format = 11.
informat = 11.
label = 'Sequence Policy Number',
W66O0ZD9.product length = 3

Protect PMOV - Functional Decomposition Analysis PAGE 59


format = $3.
informat = $3.
label = 'Product',
W66O0ZD9.DISCGRP length = 1
format = $1.
informat = $1.
label = 'DISCGRP',
W66O0ZD9.RBASICPRM length = 8
format = 13.2
informat = 13.2
label = 'RBASICPRM',
W66O0ZD9.inforceExpDate length = 5
format = DATE9.
label = 'In Force Expiry Date',
W66O0ZD9.MSGIND length = 1
format = $1.
informat = $1.
label = 'MSGIND',
W66O0ZD9.reasoncde length = 2
format = $2.
informat = $2.
label = 'Reason Code for Cancellation Of Item',
W66O0ZD9.PRVPOLREF length = 14
format = $14.
informat = $14.
label = 'PRVPOLREF',
W66O0ZD9.company length = 8
format = 6.
informat = 6.
label = 'Company',
W66O0ZD9.CLAUSEIND length = 1
format = $1.
informat = $1.
label = 'CLAUSEIND',
W66O0ZD9.COMSCALE length = 8
label = 'Commission Scale',
W66O0ZD9.POSTCODE length = 6
format = $6.
informat = $6.
label = 'Postcode',
W66O0ZD9.premtranTbasicPrm length = 8
format = 13.2
informat = 13.2
label = 'Transaction Basic Premium',
W66O0ZD9.newRenew length = 1
label = 'New(N)/Renewal(R) Risk',
W66O0ZD9.AGENT length = 8
format = 11.
informat = 11.
label = 'AGENT',
W66O0ZD9.LOADINGPC length = 8
format = 7.2
informat = 7.2
label = 'LOADINGPC',
W66O0ZD9.class length = 3
format = $3.
informat = $3.
label = 'Class',
W66O0ZD9.IMPEXCESS length = 1
format = $1.
informat = $1.
label = 'IMPEXCESS',
W66O0ZD9.TAILORGRP length = 2
format = $2.
informat = $2.
label = 'TAILORGRP',
W66O0ZD9.RCHARGES length = 8
format = 13.2
informat = 13.2
label = 'RCHARGES',
W66O0ZD9.retRiPrem length = 5
format = 12.2
label = 'Retained Premium',
W66O0ZD9.TYPEOFPOL length = 1
format = $1.
informat = $1.
label = 'TYPEOFPOL',
W66O0ZD9.catPrem length = 5
format = 12.2
label = 'Catastrophe Premium',

Protect PMOV - Functional Decomposition Analysis PAGE 60


W66O0ZD9.SUMINSCDE length = 3
format = $3.
informat = $3.
label = 'SUMINSCDE',
W66O0ZD9.transactionType length = 2
label = 'User Defined - Transaction Type',
W66O0ZD9.INDEXPERC length = 6
label = 'INDEX PERC',
W66O0ZD9.INSTALFRQ length = 1
format = $1.
informat = $1.
label = 'INSTALFRQ',
W66O0ZD9.MANRIIND length = 1
format = $1.
informat = $1.
label = 'MANRIIND',
W66O0ZD9.specPrem length = 5
format = 12.2
label = 'Special Premium',
COALESCE(W667ICOF.NBRATE ,0) as NBRATE length = 8
label = 'NBRATE',
COALESCE(W667ICOF.RENRATE ,0) as RENRATE length = 8
label = 'RENRATE',
COALESCE(W667ICOF.NOMRATENB ,0) as NOMRATENB length = 8
label = 'NOMRATENB',
COALESCE(W667ICOF.NOMRATEREN ,0) as NOMRATEREN length = 8
label = 'NOMRATEREN',
W66O0ZD9.LOYDATE length = 8
informat = IB004.
label = 'LOYDATE',
W66O0ZD9.RISKNO length = 6
informat = S370FPD004.0
label = 'Number To Identify Risk Group'
from
work.W667ICOF right join
work.W66O0ZD9
on
(
W667ICOF.COMPANY = W66O0ZD9.company
and W66O0ZD9.productjoin = W667ICOF.PRODUCT
and W66O0ZD9.class = W667ICOF.CLASS
and W66O0ZD9.subclassjoin = W667ICOF.SUBCLASS
and W66O0ZD9.COMSCALE = W667ICOF.SCALE
and W66O0ZD9.AGENTSTATE = W667ICOF.STATE
and W667ICOF.ACTIVFROM <= W66O0ZD9.covChgEffDate
and W667ICOF.ACTIVTO >= W66O0ZD9.covChgEffDate
)
;
quit;

%rcSet(&sqlrc);

%macro etls_completeTarget();
%mend etls_completeTarget;
%etls_completeTarget;

Lookup

P07
/*============================================================================*
* Step: Lookup A55NWR2B.BI00K7NV *
* Transform: Lookup *
* Description: *
* *
* Source Tables: Staging Niche PI - Coinsurance Premium A55NWR2B.BX004XH3 *
* Details - dbnchpis.COINS_PREM_PI *
* SQL Target - spdswork.W66JACO2 A55NWR2B.BL00A9M8 *
* Extract_Source_Data_With_TimeStamp_reqdc A55NWR2B.BL00A9M0 *
* ols - work.W66CPRB4 *
* Target Table: Lookup Target - work.W66IWKTU A55NWR2B.BL00A9M9 *
*============================================================================*/

%let transformID = %quote(A55NWR2B.BI00K7NV);


%let trans_rc = 0;

/* make the runTime macro variable to store the run time of the job */

Protect PMOV - Functional Decomposition Analysis PAGE 61


%let runTime = %sysfunc(datetime(), );

proc datasets lib = work nolist nowarn memtype = (data view);


delete W66IWKTU;
quit;

/*---- Begin DATA step to perform lookups ----*/


DATA work.W66IWKTU
(keep = COMPANY PRODUCT POLICY ITEMNO TRANCNT ITMSTATUS REASONCDE
itemAtrnType incGrossPrem incStatutCharges stampduty
incCommission1 incGst incCommGst CLASS SUBCLASS RISKSTATE
OCCUPATN SUMINS EXCESS DISTRICT INDEXIND FIREBRIG GSTORIDE
MINPRMIND TAILORGRP TYPEOFPOL COINSPC LOCATNREF MANRIIND CLIENT
STATE BRANCH REP AGENT RNWALTERM REVIEWIND NTCETO NTCEPROD
NTCETYPE CLAUSEIND SPCLSIND MSGIND BUSNESSRC COYISSUED STISSUED
INSTALFRQ CANCDECLN IMPEXCESS BRCHRESP BUSDESC DISCGRP
SEQPOLICY modified covRenewedDate covChgEffDate inforceIncDate
inforceExpDate covChgExpDate transactionDate policyInceptDate
PRVPOLREF RBASICPRM RSTMPDUTY RGST RCHARGES RCOMMISN RCOMMGST
SUMINSCDE EXCESSTYP REBATEPC LOADINGPC PREMREASA PREMREAST
IMAGEFLAG COMPLTIND CUSTREF POLSTATUS LOCKUSER MANCOMRTE
DISCREAS LOADREAS FIELD04 COMREAS CHGEXCLUD SDEXCLUD GSTEXCLUD
retRiPrem qsPrem catPrem eolprem specPrem ORGTRNCNT coinsPrem
RISKNO)
;

attrib COMPANY length=8 format=6. label="COMPANY"


PRODUCT length=$3 format=$3. label="PRODUCT"
POLICY length=8 format=11. label="POLICY"
ITEMNO length=8 format=6. label="ITEMNO"
TRANCNT length=8 format=6. label="TRANCNT"
ITMSTATUS length=$1 format=$1. label="ITMSTATUS"
REASONCDE length=$2 format=$2. label="REASONCDE"
itemAtrnType length=$2 format=$2. label="Item - Transaction Type"
incGrossPrem length=5 format=COMMA12.2 label="Transaction Basic Premium"
incStatutCharges length=4 format=COMMA10.2 label="Transaction Charge"
stampduty length=4 format=COMMA10.2 label="Transaction Stamp Duty"
incCommission1 length=4 format=COMMA10.2 label="Transaction Commission"
incGst length=4 format=COMMA10.2 label="Amount of GST on Transaction Premium"
incCommGst length=4 format=COMMA10.2 label="Amount of GST on Transaction
Commision"
CLASS length=$3 format=$3. label="CLASS"
SUBCLASS length=$3 format=$3. label="SUBCLASS"
RISKSTATE length=$2 format=$2. label="RISKSTATE"
OCCUPATN length=$4 format=$4. label="OCCUPATN"
SUMINS length=8 format=11. label="SUMINS"
EXCESS length=8 format=11. label="EXCESS"
DISTRICT length=$2 format=$2. label="DISTRICT"
INDEXIND length=$1 format=$1. label="INDEXIND"
FIREBRIG length=$1 format=$1. label="FIREBRIG"
GSTORIDE length=$1 format=$1. label="GSTORIDE"
MINPRMIND length=$1 format=$1. label="MINPRMIND"
TAILORGRP length=$2 format=$2. label="TAILORGRP"
TYPEOFPOL length=$1 format=$1. label="TYPEOFPOL"
COINSPC length=8 format=7.3 label="COINSPC"
LOCATNREF length=8 format=11. label="LOCATNREF"
MANRIIND length=$1 format=$1. label="MANRIIND"
CLIENT length=8 format=11. label="CLIENT"
STATE length=8 format=6. label="STATE"
BRANCH length=8 format=6. label="BRANCH"
REP length=8 format=6. label="REP"
AGENT length=8 format=11. label="AGENT"
RNWALTERM length=8 format=6. label="RNWALTERM"
REVIEWIND length=$1 format=$1. label="REVIEWIND"
NTCETO length=$1 format=$1. label="NTCETO"
NTCEPROD length=$1 format=$1. label="NTCEPROD"
NTCETYPE length=$1 format=$1. label="NTCETYPE"
CLAUSEIND length=$1 format=$1. label="CLAUSEIND"
SPCLSIND length=$1 format=$1. label="SPCLSIND"
MSGIND length=$1 format=$1. label="MSGIND"
BUSNESSRC length=$4 format=$4. label="BUSNESSRC"
COYISSUED length=8 format=6. label="COYISSUED"
STISSUED length=$2 format=$2. label="STISSUED"
INSTALFRQ length=$1 format=$1. label="INSTALFRQ"
CANCDECLN length=$1 format=$1. label="CANCDECLN"
IMPEXCESS length=$1 format=$1. label="IMPEXCESS"
BRCHRESP length=8 format=6. label="BRCHRESP"
BUSDESC length=$1 format=$1. label="BUSDESC"
DISCGRP length=$1 format=$1. label="DISCGRP"
SEQPOLICY length=8 format=11. label="SEQPOLICY"

Protect PMOV - Functional Decomposition Analysis PAGE 62


modified length=8 format=BINARY10. label=
"Flag to identify User Modifications - Binary 00000000"
covRenewedDate length=8
covChgEffDate length=8
inforceIncDate length=8
inforceExpDate length=8
covChgExpDate length=8
transactionDate length=8
policyInceptDate length=8
PRVPOLREF length=$14 format=$14. label="PRVPOLREF"
RBASICPRM length=8 format=13.2 label="RBASICPRM"
RSTMPDUTY length=8 format=13.2 label="RSTMPDUTY"
RGST length=8 format=13.2 label="RGST"
RCHARGES length=8 format=13.2 label="RCHARGES"
RCOMMISN length=8 format=13.2 label="RCOMMISN"
RCOMMGST length=8 format=13.2 label="RCOMMGST"
SUMINSCDE length=$3 format=$3. label="SUMINSCDE"
EXCESSTYP length=$1 format=$1. label="EXCESSTYP"
REBATEPC length=8 format=6.2 label="REBATEPC"
LOADINGPC length=8 format=7.2 label="LOADINGPC"
PREMREASA length=$2 format=$2. label="PREMREASA"
PREMREAST length=$2 format=$2. label="PREMREAST"
IMAGEFLAG length=$1 format=$1. label="IMAGEFLAG"
COMPLTIND length=$1 format=$1. label="COMPLTIND"
CUSTREF length=$14 format=$14. label="CUSTREF"
POLSTATUS length=$1 format=$1. label="POLSTATUS"
LOCKUSER length=$8 format=$8. label="LOCKUSER"
MANCOMRTE length=8 format=6.2 label="MANCOMRTE"
DISCREAS length=$2 format=$2. label="DISCREAS"
LOADREAS length=$2 format=$2. label="LOADREAS"
FIELD04 length=4 label="Reserved For Future Use"
COMREAS length=$2 format=$2. label="COMREAS"
CHGEXCLUD length=$2 label="Code For Reason Of Exclusion Of Charges"
SDEXCLUD length=$2 label="Stamp Duty Exclusion Code."
GSTEXCLUD length=$2 label="Gst Exclusion"
retRiPrem length=8 format=12.2 label="Retained Premium"
qsPrem length=8 format=12.2 label="Quota Share Premium"
catPrem length=8 format=12.2 label="Catastrophe Premium"
eolprem length=8 format=12.2 label="Excess Of Loss Premium"
specPrem length=8 format=12.2 label="Special Premium"
ORGTRNCNT length=8 format=6. label="ORGTRNCNT"
coinsPrem length=8 format=12.2 label="Coinsurance Premium"
RISKNO length=6 label="Number To Identify Risk Group"
;

retain missing0-missing1 0;

/* Build hash objects from lookup tables before reading first source row */
if (_n_ = 1) then
do;
/* Build hash h0 from lookup table work.W66CPRB4 */
nlobs = .;
dsid = open("work.W66CPRB4");
if (dsid > 0) then
do;
if ( attrc(dsid, 'MTYPE') = 'DATA' ) then
nlobs = attrn(dsid, 'NLOBS');
else
nlobs = -1;

dsid = close(dsid);
if (nlobs ^= 0) then
do;
if (nlobs > 0) then
exponent = ceil(log2(nlobs));
else
exponent = 8;
declare hash h0(dataset: "work.W66CPRB4", hashexp: exponent);
h0.defineKey( "COMPANY",
"PRODUCT",
"POLICY",
"TRANCNT");
h0.defineData( "ORGTRNCNT");
h0.defineDone();
if (nlobs = -1) then
do;
if (h0.Num_Items < 1) then
do;
put "NOTE: Lookup table is empty: work.W66CPRB4";
put "NOTE: Abort action indicated, condition= Lookup table is empty:"

Protect PMOV - Functional Decomposition Analysis PAGE 63


" work.W66CPRB4";

abort 3;
end;
end;
end;
else
do;
put "NOTE: Lookup table is empty: work.W66CPRB4";
put "NOTE: Abort action indicated, condition= Lookup table is empty:"
" work.W66CPRB4";

abort 3;
end;
end;
else
do;
put "NOTE: Lookup table does not exist or cannot be opened: work.W66CPRB4";

put "NOTE: Abort action indicated, condition= Lookup table missing:"


" work.W66CPRB4";

abort 3;
end;

/* Build hash h1 from lookup table dbnchpis.COINS_PREM_PI */


nlobs = .;
dsid = open("dbnchpis.COINS_PREM_PI");
if (dsid > 0) then
do;
if ( attrc(dsid, 'MTYPE') = 'DATA' ) then
nlobs = attrn(dsid, 'NLOBS');
else
nlobs = -1;

dsid = close(dsid);
if (nlobs ^= 0) then
do;
if (nlobs > 0) then
exponent = ceil(log2(nlobs));
else
exponent = 8;
declare hash h1(dataset: "dbnchpis.COINS_PREM_PI", hashexp: exponent);
h1.defineKey( "company",
"product",
"policy",
"itemNo",
"trancnt");
h1.defineData( "coinsPrem");
h1.defineDone();
if (nlobs = -1) then
do;
if (h1.Num_Items < 1) then
do;
put "NOTE: Lookup table is empty: dbnchpis.COINS_PREM_PI";
missing1 = 98;
end;
end;
end;
else
do;
put "NOTE: Lookup table is empty: dbnchpis.COINS_PREM_PI";
missing1 = 98;
end;
end;
else
do;
put "NOTE: Lookup table does not exist or cannot be opened:"
" dbnchpis.COINS_PREM_PI";

put "NOTE: Abort action indicated, condition= Lookup table missing:"


" dbnchpis.COINS_PREM_PI";

abort 3;
end;
call missing (COMPANY, PRODUCT, POLICY, TRANCNT, ORGTRNCNT, company,
product, policy, itemNo, trancnt, coinsPrem);

end; /* All hash objects have been defined */

Protect PMOV - Functional Decomposition Analysis PAGE 64


/* Read a row from the source table */
set spdswork.W66JACO2 end = eof;

/* Is the current key value stored in hash h0? */


rc0 = h0.find();

/* Is the current key value stored in hash h1? */


if (missing1 < 1) then
do;
rc1 = h1.find();
end;
else
rc1 = missing1;

/* Examine success of lookups */


if ( rc0=0 and rc1=0 ) then
do;
/* Write row to target */
output work.W66IWKTU;
return;
end;
else
do;
error_total + 1;

if (rc0 ^= 0) then
do;
exception_total + 1;
/* Check: Lookup value not found-Set target columns to missing */
call missing (ORGTRNCNT);
request_write_target = 1;
end;

if (rc1 ^= 0) then
do;
exception_total + 1;
if (rc1 = 98) then
do;
/* Check: Lookup table has no rows-Write exception row */
/* Check: Lookup table has no rows-Set target columns to value */
/* Check: Lookup table has no rows-Set target columns to missing */
call missing (coinsPrem);
request_write_target = 1;
end;

else
do;
/* Check: Lookup value not found-Set target columns to missing */
call missing (coinsPrem);
request_write_target = 1;
end;
end;

/* Set target columns to value/missing requested? */


if (request_write_target eq 1) then
/* Write row to target */
output work.W66IWKTU;

end; /* One or more lookups failed */

if (eof = 1) then
do;
put "Source records with errors: " error_total ;
put "Total lookup exceptions: " exception_total ;
end;

run;

%rcSet(&syserr);

P08
/*============================================================================*
* Step: Lookup A55NWR2B.BI00K7NW *
* Transform: Lookup *
* Description: *
* *

Protect PMOV - Functional Decomposition Analysis PAGE 65


* Source Tables: User Written Code Target - work.W5J1AM3C A55NWR2B.BL00A9LR *
* Lookup Target - work.W66IWKTU A55NWR2B.BL00A9M9 *
* Target Table: Lookup Target - spdswork.W66CQZYW A55NWR2B.BL00A9MA *
*============================================================================*/

%let transformID = %quote(A55NWR2B.BI00K7NW);

%let trans_rc = 0;

/* make the runTime macro variable to store the run time of the job */
%let runTime = %sysfunc(datetime(), );

proc datasets lib = spdswork nolist nowarn memtype = (data view);


delete W66CQZYW;
quit;

/*---- Begin DATA step to perform lookups ----*/


DATA spdswork.W66CQZYW
(keep = retRiPrem qsPrem catPrem eolprem specPrem ITMSTATUS REASONCDE
itemAtrnType incGrossPrem incStatutCharges stampduty
incCommission1 incGst incCommGst CLASS SUBCLASS RISKSTATE
OCCUPATN SUMINS EXCESS DISTRICT INDEXIND FIREBRIG GSTORIDE
MINPRMIND TAILORGRP TYPEOFPOL COINSPC LOCATNREF MANRIIND CLIENT
STATE BRANCH REP AGENT RNWALTERM REVIEWIND NTCETO NTCEPROD
NTCETYPE CLAUSEIND SPCLSIND MSGIND BUSNESSRC COYISSUED STISSUED
INSTALFRQ CANCDECLN IMPEXCESS BRCHRESP BUSDESC DISCGRP
SEQPOLICY modified covRenewedDate covChgEffDate inforceIncDate
inforceExpDate covChgExpDate transactionDate policyInceptDate
PRVPOLREF RBASICPRM RSTMPDUTY RGST RCHARGES RCOMMISN RCOMMGST
SUMINSCDE EXCESSTYP REBATEPC LOADINGPC PREMREASA PREMREAST
IMAGEFLAG COMPLTIND CUSTREF POLSTATUS LOCKUSER company product
policy itemNo trancnt coinsPrem MANCOMRTE DISCREAS LOADREAS
FIELD04 COMREAS CHGEXCLUD SDEXCLUD GSTEXCLUD premtranTRANDATE
TRANTIME premtranTbasicPrm ATRNTYPE ORGTRNCNT RISKNO)
;

attrib retRiPrem length=8 format=12.2 label="Retained Premium"


qsPrem length=8 format=12.2 label="Quota Share Premium"
catPrem length=8 format=12.2 label="Catastrophe Premium"
eolprem length=8 format=12.2 label="Excess Of Loss Premium"
specPrem length=8 format=12.2 label="Special Premium"
ITMSTATUS length=$1 format=$1. label="ITMSTATUS"
REASONCDE length=$2 format=$2. label="REASONCDE"
itemAtrnType length=$2 format=$2. label="Item - Transaction Type"
incGrossPrem length=5 format=COMMA12.2 label="Transaction Basic Premium"
incStatutCharges length=4 format=COMMA10.2 label="Transaction Charge"
stampduty length=4 format=COMMA10.2 label="Transaction Stamp Duty"
incCommission1 length=4 format=COMMA10.2 label="Transaction Commission"
incGst length=4 format=COMMA10.2 label="Amount of GST on Transaction Premium"
incCommGst length=4 format=COMMA10.2 label="Amount of GST on Transaction
Commision"
CLASS length=$3 format=$3. label="CLASS"
SUBCLASS length=$3 format=$3. label="SUBCLASS"
RISKSTATE length=$2 format=$2. label="RISKSTATE"
OCCUPATN length=$4 format=$4. label="OCCUPATN"
SUMINS length=8 format=11. label="SUMINS"
EXCESS length=8 format=11. label="EXCESS"
DISTRICT length=$2 format=$2. label="DISTRICT"
INDEXIND length=$1 format=$1. label="INDEXIND"
FIREBRIG length=$1 format=$1. label="FIREBRIG"
GSTORIDE length=$1 format=$1. label="GSTORIDE"
MINPRMIND length=$1 format=$1. label="MINPRMIND"
TAILORGRP length=$2 format=$2. label="TAILORGRP"
TYPEOFPOL length=$1 format=$1. label="TYPEOFPOL"
COINSPC length=8 format=7.3 label="COINSPC"
LOCATNREF length=8 format=11. label="LOCATNREF"
MANRIIND length=$1 format=$1. label="MANRIIND"
CLIENT length=8 format=11. label="CLIENT"
STATE length=8 format=6. label="STATE"
BRANCH length=8 format=6. label="BRANCH"
REP length=8 format=6. label="REP"
AGENT length=8 format=11. label="AGENT"
RNWALTERM length=8 format=6. label="RNWALTERM"
REVIEWIND length=$1 format=$1. label="REVIEWIND"
NTCETO length=$1 format=$1. label="NTCETO"
NTCEPROD length=$1 format=$1. label="NTCEPROD"
NTCETYPE length=$1 format=$1. label="NTCETYPE"
CLAUSEIND length=$1 format=$1. label="CLAUSEIND"
SPCLSIND length=$1 format=$1. label="SPCLSIND"
MSGIND length=$1 format=$1. label="MSGIND"

Protect PMOV - Functional Decomposition Analysis PAGE 66


BUSNESSRC length=$4 format=$4. label="BUSNESSRC"
COYISSUED length=8 format=6. label="COYISSUED"
STISSUED length=$2 format=$2. label="STISSUED"
INSTALFRQ length=$1 format=$1. label="INSTALFRQ"
CANCDECLN length=$1 format=$1. label="CANCDECLN"
IMPEXCESS length=$1 format=$1. label="IMPEXCESS"
BRCHRESP length=8 format=6. label="BRCHRESP"
BUSDESC length=$1 format=$1. label="BUSDESC"
DISCGRP length=$1 format=$1. label="DISCGRP"
SEQPOLICY length=8 format=11. label="SEQPOLICY"
modified length=8 format=BINARY10. label=
"Flag to identify User Modifications - Binary 00000000"
covRenewedDate length=8
covChgEffDate length=8
inforceIncDate length=8
inforceExpDate length=8
covChgExpDate length=8
transactionDate length=8
policyInceptDate length=8
PRVPOLREF length=$14 format=$14. label="PRVPOLREF"
RBASICPRM length=8 format=13.2 label="RBASICPRM"
RSTMPDUTY length=8 format=13.2 label="RSTMPDUTY"
RGST length=8 format=13.2 label="RGST"
RCHARGES length=8 format=13.2 label="RCHARGES"
RCOMMISN length=8 format=13.2 label="RCOMMISN"
RCOMMGST length=8 format=13.2 label="RCOMMGST"
SUMINSCDE length=$3 format=$3. label="SUMINSCDE"
EXCESSTYP length=$1 format=$1. label="EXCESSTYP"
REBATEPC length=8 format=6.2 label="REBATEPC"
LOADINGPC length=8 format=7.2 label="LOADINGPC"
PREMREASA length=$2 format=$2. label="PREMREASA"
PREMREAST length=$2 format=$2. label="PREMREAST"
IMAGEFLAG length=$1 format=$1. label="IMAGEFLAG"
COMPLTIND length=$1 format=$1. label="COMPLTIND"
CUSTREF length=$14 format=$14. label="CUSTREF"
POLSTATUS length=$1 format=$1. label="POLSTATUS"
LOCKUSER length=$8 format=$8. label="LOCKUSER"
company length=8 format=6. label="Company"
product length=$3 format=$3. label="Product"
policy length=8 format=11. label="Policy Number"
itemNo length=8 format=6. label="Item No"
trancnt length=8 format=6. label="Transaction Count"
coinsPrem length=8 format=12.2 label="Coinsurance Premium"
MANCOMRTE length=8 format=6.2 label="MANCOMRTE"
DISCREAS length=$2 format=$2. label="DISCREAS"
LOADREAS length=$2 format=$2. label="LOADREAS"
FIELD04 length=4 label="Reserved For Future Use"
COMREAS length=$2 format=$2. label="COMREAS"
CHGEXCLUD length=$2 label="Code For Reason Of Exclusion Of Charges"
SDEXCLUD length=$2 label="Stamp Duty Exclusion Code."
GSTEXCLUD length=$2 label="Gst Exclusion"
premtranTRANDATE length=8 format=11. label="Transaction Date"
TRANTIME length=8 format=11. label="Transaction Time"
premtranTbasicPrm length=8 format=13.2 label="Transaction Basic Premium"
ATRNTYPE length=$2 format=$2. label="Transaction Type"
ORGTRNCNT length=8 format=6. label="ORGTRNCNT"
RISKNO length=6 label="Number To Identify Risk Group"
;

retain missing0-missing0 0;

/* Build hash objects from lookup tables before reading first source row */
if (_n_ = 1) then
do;
/* Build hash h0 from lookup table work.W5J1AM3C */
nlobs = .;
dsid = open("work.W5J1AM3C");
if (dsid > 0) then
do;
if ( attrc(dsid, 'MTYPE') = 'DATA' ) then
nlobs = attrn(dsid, 'NLOBS');
else
nlobs = -1;

dsid = close(dsid);
if (nlobs ^= 0) then
do;
if (nlobs > 0) then
exponent = ceil(log2(nlobs));
else

Protect PMOV - Functional Decomposition Analysis PAGE 67


exponent = 8;
declare hash h0(dataset: "work.W5J1AM3C", hashexp: exponent);
h0.defineKey( "COMPANY",
"PRODUCT",
"POLICY",
"ITEMNO",
"TRANCNT");
h0.defineData( "premtranTRANDATE",
"TRANTIME",
"premtranTbasicPrm",
"ATRNTYPE");
h0.defineDone();
if (nlobs = -1) then
do;
if (h0.Num_Items < 1) then
do;
put "NOTE: Lookup table is empty: work.W5J1AM3C";
missing0 = 98;
end;
end;
end;
else
do;
put "NOTE: Lookup table is empty: work.W5J1AM3C";
missing0 = 98;
end;
end;
else
do;
put "NOTE: Lookup table does not exist or cannot be opened: work.W5J1AM3C";
put "NOTE: Abort action indicated, condition= Lookup table missing:"
" work.W5J1AM3C";

abort 3;
end;

call missing (COMPANY, PRODUCT, POLICY, ITEMNO, TRANCNT, premtranTRANDATE,


TRANTIME, premtranTbasicPrm, ATRNTYPE);

end; /* All hash objects have been defined */

/* Read a row from the source table */


set work.W66IWKTU end = eof;

/* Is the current key value stored in hash h0? */


if (missing0 < 1) then
do;
rc0 = h0.find();
end;
else
rc0 = missing0;

/* Examine success of lookups */


if ( rc0=0 ) then
do;
/* Write row to target */
output spdswork.W66CQZYW;
return;
end;
else
do;
error_total + 1;

if (rc0 ^= 0) then
do;
exception_total + 1;
if (rc0 = 98) then
do;
/* Check: Lookup table has no rows-Write exception row */
/* Check: Lookup table has no rows-Set target columns to value */
/* Check: Lookup table has no rows-Set target columns to missing */
call missing (premtranTRANDATE, TRANTIME, premtranTbasicPrm,
ATRNTYPE);
request_write_target = 1;
end;

else
do;

Protect PMOV - Functional Decomposition Analysis PAGE 68


/* Check: Lookup value not found-Set target columns to missing */
call missing (premtranTRANDATE, TRANTIME, premtranTbasicPrm,
ATRNTYPE);
request_write_target = 1;
end;
end;

/* Set target columns to value/missing requested? */


if (request_write_target eq 1) then
/* Write row to target */
output spdswork.W66CQZYW;

end; /* One or more lookups failed */

if (eof = 1) then
do;
put "Source records with errors: " error_total ;
put "Total lookup exceptions: " exception_total ;
end;

run;

%rcSet(&syserr);

/*---- Map the columns ----*/


proc datasets lib = work nolist nowarn memtype = (data view);
delete mapped;
quit;

%put %str(NOTE: Mapping columns ...);


proc sql;
create view work.mapped as
select retRiPrem length = 8,
qsPrem length = 8,
catPrem length = 8,
eolprem length = 8,
specPrem length = 8,
ITMSTATUS length = 1,
REASONCDE length = 2,
itemAtrnType length = 2,
incGrossPrem length = 5,
incStatutCharges length = 4,
stampduty length = 4,
incCommission1 length = 4,
incGst length = 4,
incCommGst length = 4,
CLASS length = 3,
SUBCLASS length = 3,
RISKSTATE length = 2,
OCCUPATN length = 4,
SUMINS length = 8,
EXCESS length = 8,
DISTRICT length = 2,
INDEXIND length = 1,
FIREBRIG length = 1,
GSTORIDE length = 1,
MINPRMIND length = 1,
TAILORGRP length = 2,
TYPEOFPOL length = 1,
COINSPC length = 8,
LOCATNREF length = 8,
MANRIIND length = 1,
CLIENT length = 8,
STATE length = 8,
BRANCH length = 8,
REP length = 8,
AGENT length = 8,
RNWALTERM length = 8,
REVIEWIND length = 1,
NTCETO length = 1,
NTCEPROD length = 1,
NTCETYPE length = 1,
CLAUSEIND length = 1,
SPCLSIND length = 1,
MSGIND length = 1,
BUSNESSRC length = 4,
COYISSUED length = 8,
STISSUED length = 2,
INSTALFRQ length = 1,
CANCDECLN length = 1,

Protect PMOV - Functional Decomposition Analysis PAGE 69


IMPEXCESS length = 1,
BRCHRESP length = 8,
BUSDESC length = 1,
DISCGRP length = 1,
SEQPOLICY length = 8,
modified length = 8,
covRenewedDate length = 8,
covChgEffDate length = 8,
inforceIncDate length = 8,
inforceExpDate length = 8,
covChgExpDate length = 8,
transactionDate length = 8,
policyInceptDate length = 8,
PRVPOLREF length = 14,
RBASICPRM length = 8,
RSTMPDUTY length = 8,
RGST length = 8,
RCHARGES length = 8,
RCOMMISN length = 8,
RCOMMGST length = 8,
SUMINSCDE length = 3,
EXCESSTYP length = 1,
REBATEPC length = 8,
LOADINGPC length = 8,
PREMREASA length = 2,
PREMREAST length = 2,
IMAGEFLAG length = 1,
COMPLTIND length = 1,
CUSTREF length = 14,
POLSTATUS length = 1,
LOCKUSER length = 8,
COMPANY as company length = 8,
PRODUCT as product length = 3,
POLICY as policy length = 8,
ITEMNO as itemNo length = 8,
TRANCNT as trancnt length = 8,
coinsPrem length = 8,
MANCOMRTE length = 8,
DISCREAS length = 2,
LOADREAS length = 2,
FIELD04 length = 4,
COMREAS length = 2,
CHGEXCLUD length = 2,
SDEXCLUD length = 2,
GSTEXCLUD length = 2,
premtranTRANDATE,
TRANTIME,
premtranTbasicPrm,
ATRNTYPE,
ORGTRNCNT length = 8,
RISKNO length = 6
from spdswork.W66CQZYW;
quit;

%let SYSLAST = work.mapped;

data spdswork.W66CQZYW;
set work.mapped;
run;

proc datasets lib=work nolist nowarn memtype = VIEW;


delete mapped;
quit;

P10
/*============================================================================*
* Step: Lookup A55NWR2B.BI00K7NY *
* Transform: Lookup *
* Description: *
* *
* Source Tables: SQL Target - spdswork.W65KH0PT A55NWR2B.BL00A9MB *
* Extract Target - work.W65KIXJX A55NWR2B.BL00A9MC *
* Target Table: Lookup Target - work.W66GB66B A55NWR2B.BL00A9MD *
*============================================================================*/
%let transformID = %quote(A55NWR2B.BI00K7NY);

%let trans_rc = 0;

Protect PMOV - Functional Decomposition Analysis PAGE 70


/* make the runTime macro variable to store the run time of the job */
%let runTime = %sysfunc(datetime(), );

proc datasets lib = work nolist nowarn memtype = (data view);


delete W66GB66B;
quit;

/*---- Begin DATA step to perform lookups ----*/


DATA work.W66GB66B
(keep = ORGTRNCNT ITMSTATUS REASONCDE itemAtrnType incGrossPrem
incStatutCharges stampduty incCommission1 incGst incCommGst
CLASS SUBCLASS RISKSTATE OCCUPATN SUMINS EXCESS DISTRICT
INDEXIND FIREBRIG GSTORIDE MINPRMIND TAILORGRP TYPEOFPOL
COINSPC LOCATNREF MANRIIND CLIENT STATE BRANCH REP AGENT
RNWALTERM REVIEWIND NTCETO NTCEPROD NTCETYPE CLAUSEIND SPCLSIND
MSGIND BUSNESSRC COYISSUED STISSUED INSTALFRQ CANCDECLN
IMPEXCESS BRCHRESP BUSDESC DISCGRP SEQPOLICY modified
covRenewedDate covChgEffDate inforceIncDate inforceExpDate
covChgExpDate transactionDate policyInceptDate PRVPOLREF
RBASICPRM RSTMPDUTY RGST RCHARGES RCOMMISN RCOMMGST SUMINSCDE
EXCESSTYP REBATEPC LOADINGPC PREMREASA PREMREAST IMAGEFLAG
COMPLTIND CUSTREF POLSTATUS LOCKUSER coinsPrem retRiPrem qsPrem
catPrem eolPrem specPrem COMPANY PRODUCT POLICY ITEMNO
premtranTRANDATE TRANTIME TRANCNT premtranTbasicPrm ATRNTYPE
MANCOMRTE DISCREAS LOADREAS FIELD04 COMREAS MPDISC PRVINSCOY
CHGEXCLUD SDEXCLUD GSTEXCLUD CPBUSSRC CAMPCODE PRVINSIND
PRVINSPOL POSTCODE CITY LOYDATE RISKNO)
;
attrib ORGTRNCNT length=8 format=6. label="ORGTRNCNT"
ITMSTATUS length=$1 format=$1. label="Item Status - V(void)/blank(current)"
REASONCDE length=$2 format=$2. label="Reason Code for Cancellation Of Item"
itemAtrnType length=$2 format=$2. label="Item - Transaction Type"
incGrossPrem length=5 format=COMMA12.2 label="Transaction Basic Premium"
incStatutCharges length=4 format=COMMA10.2 label="Transaction Charge"
stampduty length=4 format=COMMA10.2 label="Transaction Stamp Duty"
incCommission1 length=4 format=COMMA10.2 label="Transaction Commission"
incGst length=4 format=COMMA10.2 label="Amount of GST on Transaction Premium"
incCommGst length=4 format=COMMA10.2 label="Amount of GST on Transaction
Commision"
CLASS length=$3 format=$3. label="Class"
SUBCLASS length=$3 format=$3. label="Subclass"
RISKSTATE length=$2 format=$2. label="RISKSTATE"
OCCUPATN length=$4 format=$4. label="OCCUPATN"
SUMINS length=8 format=11. label="SUMINS"
EXCESS length=8 format=11. label="EXCESS"
DISTRICT length=$2 format=$2. label="DISTRICT"
INDEXIND length=$1 format=$1. label="INDEXIND"
FIREBRIG length=$1 format=$1. label="FIREBRIG"
GSTORIDE length=$1 format=$1. label="GSTORIDE"
MINPRMIND length=$1 format=$1. label="MINPRMIND"
TAILORGRP length=$2 format=$2. label="TAILORGRP"
TYPEOFPOL length=$1 format=$1. label="TYPEOFPOL"
COINSPC length=8 format=7.3 label="COINSPC"
LOCATNREF length=8 format=11. label="LOCATNREF"
MANRIIND length=$1 format=$1. label="MANRIIND"
CLIENT length=8 format=11. label="CLIENT"
STATE length=8 format=6. label="STATE"
BRANCH length=8 format=6. label="BRANCH"
REP length=8 format=6. label="REP"
AGENT length=8 format=11. label="AGENT"
RNWALTERM length=8 format=6. label="RNWALTERM"
REVIEWIND length=$1 format=$1. label="REVIEWIND"
NTCETO length=$1 format=$1. label="NTCETO"
NTCEPROD length=$1 format=$1. label="NTCEPROD"
NTCETYPE length=$1 format=$1. label="NTCETYPE"
CLAUSEIND length=$1 format=$1. label="CLAUSEIND"
SPCLSIND length=$1 format=$1. label="SPCLSIND"
MSGIND length=$1 format=$1. label="MSGIND"
BUSNESSRC length=$4 format=$4. label="BUSNESSRC"
COYISSUED length=8 format=6. label="COYISSUED"
STISSUED length=$2 format=$2. label="STISSUED"
INSTALFRQ length=$1 format=$1. label="INSTALFRQ"
CANCDECLN length=$1 format=$1. label="CANCDECLN"
IMPEXCESS length=$1 format=$1. label="IMPEXCESS"
BRCHRESP length=8 format=6. label="BRCHRESP"
BUSDESC length=$1 format=$1. label="BUSDESC"
DISCGRP length=$1 format=$1. label="DISCGRP"
SEQPOLICY length=8 format=11. label="Sequence Policy Number"

Protect PMOV - Functional Decomposition Analysis PAGE 71


modified length=8 format=BINARY10. label=
"Flag to identify User Modifications in Binary 00000000"
covRenewedDate length=5 format=DATE9. label="Coverage Renewed Date"
covChgEffDate length=5 format=DATE9. label="Coverage Change Effective Date"
inforceIncDate length=5 format=DATE9. label="In Force Inception Date"
inforceExpDate length=5 format=DATE9. label="In Force Expiry Date"
covChgExpDate length=5 format=DATE9. label="Coverage Change Expiry Date"
transactionDate length=5 format=DATE9. label="Transaction Date"
policyInceptDate length=5 format=DATE9. label="Policy Inception Date"
PRVPOLREF length=$14 format=$14. label="PRVPOLREF"
RBASICPRM length=8 format=13.2 label="RBASICPRM"
RSTMPDUTY length=8 format=13.2 label="RSTMPDUTY"
RGST length=8 format=13.2 label="RGST"
RCHARGES length=8 format=13.2 label="RCHARGES"
RCOMMISN length=8 format=13.2 label="RCOMMISN"
RCOMMGST length=8 format=13.2 label="RCOMMGST"
SUMINSCDE length=$3 format=$3. label="SUMINSCDE"
EXCESSTYP length=$1 format=$1. label="EXCESSTYP"
REBATEPC length=8 format=6.2 label="REBATEPC"
LOADINGPC length=8 format=7.2 label="LOADINGPC"
PREMREASA length=$2 format=$2. label="PREMREASA"
PREMREAST length=$2 format=$2. label="PREMREAST"
IMAGEFLAG length=$1 format=$1. label="IMAGEFLAG"
COMPLTIND length=$1 format=$1. label="COMPLTIND"
CUSTREF length=$14 format=$14. label="CUSTREF"
POLSTATUS length=$1 format=$1. label="POLSTATUS"
LOCKUSER length=$8 format=$8. label="LOCKUSER"
coinsPrem length=8 format=12.2 label="Coinsurance Premium"
retRiPrem length=8
qsPrem length=8
catPrem length=8
eolPrem length=8
specPrem length=8
COMPANY length=8 format=6. label="Company"
PRODUCT length=$3 format=$3. label="Product"
POLICY length=8 format=11. label="Policy Number"
ITEMNO length=8 format=6. label="Item Number"
premtranTRANDATE length=8 format=11. label="Transaction Date"
TRANTIME length=8 format=11. label="Transaction Time"
TRANCNT length=8 format=6. label="Transaction Counter"
premtranTbasicPrm length=8 format=13.2 label="Transaction Basic Premium"
ATRNTYPE length=$2 format=$2. label="Transaction Type"
MANCOMRTE length=8 format=6.2 label="MANCOMRTE"
DISCREAS length=$2 format=$2. label="DISCREAS"
LOADREAS length=$2 format=$2. label="LOADREAS"
FIELD04 length=4 label="Reserved For Future Use"
COMREAS length=$2 format=$2. label="COMREAS"
MPDISC length=$1 format=$1. label="Multi Policy Discount"
PRVINSCOY length=$4 format=$4. label="Previous Insurer"
CHGEXCLUD length=$2 label="Code For Reason Of Exclusion Of Charges"
SDEXCLUD length=$2 label="Stamp Duty Exclusion Code."
GSTEXCLUD length=$2 label="Gst Exclusion"
CPBUSSRC length=$10 label="Corporate Partners Source Of Business"
CAMPCODE length=$10 label="CAMPCODE"
PRVINSIND length=$1 label="Previous Insurance"
PRVINSPOL length=$14 label="Previous Policy Code"
POSTCODE length=$6 label="Postcode"
CITY length=$40 label="City/Town/Suburb Name"
LOYDATE length=8 label="LOYDATE"
RISKNO length=6 label="Number To Identify Risk Group"
ADDRREF length= 8
;

retain missing0-missing0 0;

/* Build hash objects from lookup tables before reading first source row */
if (_n_ = 1) then
do;
/* Build hash h0 from lookup table work.W65KIXJX */
nlobs = .;
dsid = open("work.W65KIXJX");
if (dsid > 0) then
do;
if ( attrc(dsid, 'MTYPE') = 'DATA' ) then
nlobs = attrn(dsid, 'NLOBS');
else
nlobs = -1;

dsid = close(dsid);
if (nlobs ^= 0) then

Protect PMOV - Functional Decomposition Analysis PAGE 72


do;
if (nlobs > 0) then
exponent = ceil(log2(nlobs));
else
exponent = 8;
declare hash h0(dataset: "work.W65KIXJX", hashexp: exponent);
h0.defineKey( "ADDRREF");
h0.defineData( "POSTCODE",
"CITY");
h0.defineDone();
if (nlobs = -1) then
do;
if (h0.Num_Items < 1) then
do;
put "NOTE: Lookup table is empty: work.W65KIXJX";
put "NOTE: Abort action indicated, condition= Lookup table is empty:"
" work.W65KIXJX";

abort 3;
end;
end;
end;
else
do;
put "NOTE: Lookup table is empty: work.W65KIXJX";
put "NOTE: Abort action indicated, condition= Lookup table is empty:"
" work.W65KIXJX";

abort 3;
end;
end;
else
do;
put "NOTE: Lookup table does not exist or cannot be opened: work.W65KIXJX";

put "NOTE: Abort action indicated, condition= Lookup table missing:"


" work.W65KIXJX";

abort 3;
end;

call missing (ADDRREF, POSTCODE, CITY);

end; /* All hash objects have been defined */

/* Read a row from the source table */


set spdswork.W65KH0PT end = eof;

/* Is the current key value stored in hash h0? */


ADDRREF = LOCATNREF;
rc0 = h0.find();

/* Examine success of lookups */


if ( rc0=0 ) then
do;
/* Write row to target */
output work.W66GB66B;
return;
end;
else
do;
error_total + 1;

if (rc0 ^= 0) then
do;
exception_total + 1;
/* Check: Lookup value not found-Set target columns to missing */
call missing (POSTCODE, CITY);
request_write_target = 1;
end;

/* Set target columns to value/missing requested? */


if (request_write_target eq 1) then
/* Write row to target */
output work.W66GB66B;
end; /* One or more lookups failed */

if (eof = 1) then
do;

Protect PMOV - Functional Decomposition Analysis PAGE 73


put "Source records with errors: " error_total ;
put "Total lookup exceptions: " exception_total ;
end;

run;

%rcSet(&syserr);

P13
/*============================================================================*
* Step: Lookup A55NWR2B.BI00K7O0 *
* Transform: Lookup *
* Description: *
* *
* Source Tables: Splitter Target 1 - work.W5JEMGHC A55NWR2B.BL00A9ME *
* Staging Niche PI - Reversed Transactions A55NWR2B.BX004XHA *
* - dbnchpis.REVERSETRANS_PI *
* AUTINDEX - work.W667HQLA A55NWR2B.BL00A9M1 *
* AGENT - work.W667I7NC A55NWR2B.BL00A9LX *
* Target Table: Lookup Target - spdswork.W5JEML2D A55NWR2B.BL00A9MF *
*============================================================================*/

%let transformID = %quote(A55NWR2B.BI00K7O0);

%let trans_rc = 0;

/* make the runTime macro variable to store the run time of the job */
%let runTime = %sysfunc(datetime(), );

proc datasets lib = spdswork nolist nowarn memtype = (data view);


delete W5JEML2D;
quit;

/*---- Begin DATA step to perform lookups ----*/


DATA spdswork.W5JEML2D
(keep = reverseTrncnt coinsPrem modified covChgEffDate MSGIND REASONCDE
SUMINS ITMSTATUS COINSPC GSTORIDE AGENT BRANCH ORGTRNCNT
MINPRMIND incCommission1 RNWALTERM NTCETO NTCEPROD DISTRICT
incCommGst INDEXIND OCCUPATN PRODUCT EXCESS COYISSUED BUSDESC
inforceExpDate REVIEWIND SEQPOLICY RISKSTATE itemAtrnType
stampduty covRenewedDate TYPEOFPOL incStatutCharges TRANTIME
STISSUED FIREBRIG specPrem POLICY LOCATNREF catPrem
incGrossPrem NTCETYPE STATE COMPANY transactionDate IMPEXCESS
INSTALFRQ inforceIncDate REP SPCLSIND MANRIIND SUBCLASS qsPrem
TAILORGRP policyInceptDate eolPrem incGst CANCDECLN DISCGRP
BUSNESSRC retRiPrem premtranTRANDATE premtranTbasicPrm ITEMNO
trancnt BRCHRESP covChgExpDate ATRNTYPE CLASS CLIENT CLAUSEIND
PRVPOLREF RBASICPRM RSTMPDUTY RGST RCHARGES RCOMMISN RCOMMGST
SUMINSCDE EXCESSTYP REBATEPC LOADINGPC PREMREASA PREMREAST
IMAGEFLAG COMPLTIND CUSTREF POLSTATUS LOCKUSER MANCOMRTE
DISCREAS LOADREAS FIELD04 COMREAS MPDISC PRVINSCOY POSTCODE
CITY CHGEXCLUD SDEXCLUD GSTEXCLUD CPBUSSRC CAMPCODE INDEXPERC
COMSCALE AGTGROUP GRPNAME AGTCLUSTR PRVINSIND PRVINSPOL
AGENTSTATE LOYDATE RISKNO)
;

attrib reverseTrncnt length=8 format=6. label="Transaction Count"


coinsPrem length=8 format=12.2 label="Coinsurance Premium"
modified length=8 format=BINARY10. label=
"Flag to identify User Modifications in Binary 00000000"
covChgEffDate length=5 format=DATE9. label="Coverage Change Effective Date"
MSGIND length=$1 format=$1. label="MSGIND"
REASONCDE length=$2 format=$2. label="Reason Code for Cancellation Of Item"
SUMINS length=8 format=11. label="SUMINS"
ITMSTATUS length=$1 format=$1. label="Item Status - V(void)/blank(current)"
COINSPC length=8 format=7.3 label="COINSPC"
GSTORIDE length=$1 format=$1. label="GSTORIDE"
AGENT length=6 format=11. label="AGENT"
BRANCH length=8 format=6. label="BRANCH"
ORGTRNCNT length=8 format=6. label="ORGTRNCNT"
MINPRMIND length=$1 format=$1. label="MINPRMIND"
incCommission1 length=4 format=COMMA10.2 label="Transaction Commission"
RNWALTERM length=8 format=6. label="RNWALTERM"
NTCETO length=$1 format=$1. label="NTCETO"
NTCEPROD length=$1 format=$1. label="NTCEPROD"
DISTRICT length=$2 format=$2. label="DISTRICT"
incCommGst length=4 format=COMMA10.2 label="Amount of GST on Transaction
Commision"

Protect PMOV - Functional Decomposition Analysis PAGE 74


INDEXIND length=$1 format=$1. label="INDEXIND"
OCCUPATN length=$4 format=$4. label="OCCUPATN"
PRODUCT length=$3 format=$3. label="Product"
EXCESS length=8 format=11. label="EXCESS"
COYISSUED length=8 format=6. label="COYISSUED"
BUSDESC length=$1 format=$1. label="BUSDESC"
inforceExpDate length=5 format=DATE9. label="In Force Expiry Date"
REVIEWIND length=$1 format=$1. label="REVIEWIND"
SEQPOLICY length=8 format=11. label="Sequence Policy Number"
RISKSTATE length=$2 format=$2. label="RISKSTATE"
itemAtrnType length=$2 format=$2. label="Item - Transaction Type"
stampduty length=4 format=COMMA10.2 label="Transaction Stamp Duty"
covRenewedDate length=5 format=DATE9. label="Coverage Renewed Date"
TYPEOFPOL length=$1 format=$1. label="TYPEOFPOL"
incStatutCharges length=4 format=COMMA10.2 label="Transaction Charge"
TRANTIME length=8 format=11. label="Transaction Time"
STISSUED length=$2 format=$2. label="STISSUED"
FIREBRIG length=$1 format=$1. label="FIREBRIG"
specPrem length=8
POLICY length=8 format=11. label="Policy Number"
LOCATNREF length=8 format=11. label="LOCATNREF"
catPrem length=8
incGrossPrem length=5 format=COMMA12.2 label="Transaction Basic Premium"
NTCETYPE length=$1 format=$1. label="NTCETYPE"
STATE length=8 format=6. label="STATE"
COMPANY length=4 format=6. label="Company"
transactionDate length=5 format=DATE9. label="Transaction Date"
IMPEXCESS length=$1 format=$1. label="IMPEXCESS"
INSTALFRQ length=$1 format=$1. label="INSTALFRQ"
inforceIncDate length=5 format=DATE9. label="In Force Inception Date"
REP length=8 format=6. label="REP"
SPCLSIND length=$1 format=$1. label="SPCLSIND"
MANRIIND length=$1 format=$1. label="MANRIIND"
SUBCLASS length=$3 format=$3. label="Subclass"
qsPrem length=8
TAILORGRP length=$2 format=$2. label="TAILORGRP"
policyInceptDate length=5 format=DATE9. label="Policy Inception Date"
eolPrem length=8
incGst length=4 format=COMMA10.2 label="Amount of GST on Transaction Premium"
CANCDECLN length=$1 format=$1. label="CANCDECLN"
DISCGRP length=$1 format=$1. label="DISCGRP"
BUSNESSRC length=$4 format=$4. label="BUSNESSRC"
retRiPrem length=8
premtranTRANDATE length=5 format=DATE9. label="Transaction Date"
premtranTbasicPrm length=8 format=13.2 label="Transaction Basic Premium"
ITEMNO length=8 format=6. label="Item No"
trancnt length=8 format=6. label="ORGTRNCNT"
BRCHRESP length=8 format=6. label="BRCHRESP"
covChgExpDate length=5 format=DATE9. label="Coverage Change Expiry Date"
ATRNTYPE length=$2 format=$2. label="Transaction Type"
CLASS length=$3 format=$3. label="Class"
CLIENT length=8 format=11. label="CLIENT"
CLAUSEIND length=$1 format=$1. label="CLAUSEIND"
PRVPOLREF length=$14 format=$14. label="PRVPOLREF"
RBASICPRM length=8 format=13.2 label="RBASICPRM"
RSTMPDUTY length=8 format=13.2 label="RSTMPDUTY"
RGST length=8 format=13.2 label="RGST"
RCHARGES length=8 format=13.2 label="RCHARGES"
RCOMMISN length=8 format=13.2 label="RCOMMISN"
RCOMMGST length=8 format=13.2 label="RCOMMGST"
SUMINSCDE length=$3 format=$3. label="SUMINSCDE"
EXCESSTYP length=$1 format=$1. label="EXCESSTYP"
REBATEPC length=8 format=6.2 label="REBATEPC"
LOADINGPC length=8 format=7.2 label="LOADINGPC"
PREMREASA length=$2 format=$2. label="PREMREASA"
PREMREAST length=$2 format=$2. label="PREMREAST"
IMAGEFLAG length=$1 format=$1. label="IMAGEFLAG"
COMPLTIND length=$1 format=$1. label="COMPLTIND"
CUSTREF length=$14 format=$14. label="CUSTREF"
POLSTATUS length=$1 format=$1. label="POLSTATUS"
LOCKUSER length=$8 format=$8. label="LOCKUSER"
MANCOMRTE length=8 format=6.2 label="MANCOMRTE"
DISCREAS length=$2 format=$2. label="DISCREAS"
LOADREAS length=$2 format=$2. label="LOADREAS"
FIELD04 length=4 label="Reserved For Future Use"
COMREAS length=$2 format=$2. label="COMREAS"
MPDISC length=$1 format=$1. label="Multi Policy Discount"
PRVINSCOY length=$4 format=$4. label="Previous Insurer"
POSTCODE length=$6 format=$6. label="Postcode"
CITY length=$40 format=$40. label="City/Town/Suburb Name"

Protect PMOV - Functional Decomposition Analysis PAGE 75


CHGEXCLUD length=$2 label="Code For Reason Of Exclusion Of Charges"
SDEXCLUD length=$2 label="Stamp Duty Exclusion Code."
GSTEXCLUD length=$2 label="Gst Exclusion"
CPBUSSRC length=$10 label="Corporate Partners Source Of Business"
CAMPCODE length=$10 label="CAMPCODE"
INDEXPERC length=6 label="INDEX PERC"
COMSCALE length=8 label="Commission Scale"
AGTGROUP length=8 label="Agent Group Number"
GRPNAME length=$60 label="Group Name"
AGTCLUSTR length=$4 label="Agent Cluster"
PRVINSIND length=$1 label="Previous Insurance"
PRVINSPOL length=$14 label="Previous Policy Code"
AGENTSTATE length=8 label="State Code"
LOYDATE length=8 label="LOYDATE"
RISKNO length=6 label="Number To Identify Risk Group"
;

retain missing0-missing2 0;

/* Build hash objects from lookup tables before reading first source row */
if (_n_ = 1) then
do;
/* Build hash h0 from lookup table dbnchpis.REVERSETRANS_PI */
nlobs = .;
dsid = open("dbnchpis.REVERSETRANS_PI");
if (dsid > 0) then
do;
if ( attrc(dsid, 'MTYPE') = 'DATA' ) then
nlobs = attrn(dsid, 'NLOBS');
else
nlobs = -1;

dsid = close(dsid);
if (nlobs ^= 0) then
do;
if (nlobs > 0) then
exponent = ceil(log2(nlobs));
else
exponent = 8;
declare hash h0(dataset: "dbnchpis.REVERSETRANS_PI", hashexp: exponent);
h0.defineKey( "COMPANY",
"PRODUCT",
"POLICY",
"ITEMNO",
"trancnt");
h0.defineData( "reverseTrncnt");
h0.defineDone();
if (nlobs = -1) then
do;
if (h0.Num_Items < 1) then
do;
put "NOTE: Lookup table is empty: dbnchpis.REVERSETRANS_PI";
missing0 = 98;
end;
end;
end;
else
do;
put "NOTE: Lookup table is empty: dbnchpis.REVERSETRANS_PI";
missing0 = 98;
end;
end;
else
do;
put "NOTE: Lookup table does not exist or cannot be opened:"
" dbnchpis.REVERSETRANS_PI";

put "NOTE: Abort action indicated, condition= Lookup table missing:"


" dbnchpis.REVERSETRANS_PI";

abort 3;
end;

/* Build hash h1 from lookup table work.W667HQLA */


nlobs = .;
dsid = open("work.W667HQLA");
if (dsid > 0) then
do;
if ( attrc(dsid, 'MTYPE') = 'DATA' ) then
nlobs = attrn(dsid, 'NLOBS');

Protect PMOV - Functional Decomposition Analysis PAGE 76


else
nlobs = -1;

dsid = close(dsid);
if (nlobs ^= 0) then
do;
if (nlobs > 0) then
exponent = ceil(log2(nlobs));
else
exponent = 8;
declare hash h1(dataset: "work.W667HQLA", hashexp: exponent);
h1.defineKey( "COMPANY",
"PRODUCT",
"STATE",
"CLASS",
"SUBCLASS");
h1.defineData( "INDEXPERC");
h1.defineDone();
if (nlobs = -1) then
do;
if (h1.Num_Items < 1) then
do;
put "NOTE: Lookup table is empty: work.W667HQLA";
put "NOTE: Abort action indicated, condition= Lookup table is empty:"
" work.W667HQLA";

abort 3;
end;
end;
end;
else
do;
put "NOTE: Lookup table is empty: work.W667HQLA";
put "NOTE: Abort action indicated, condition= Lookup table is empty:"
" work.W667HQLA";

abort 3;
end;
end;
else
do;
put "NOTE: Lookup table does not exist or cannot be opened: work.W667HQLA";

put "NOTE: Abort action indicated, condition= Lookup table missing:"


" work.W667HQLA";

abort 3;
end;

/* Build hash h2 from lookup table work.W667I7NC */


nlobs = .;
dsid = open("work.W667I7NC");
if (dsid > 0) then
do;
if ( attrc(dsid, 'MTYPE') = 'DATA' ) then
nlobs = attrn(dsid, 'NLOBS');
else
nlobs = -1;

dsid = close(dsid);
if (nlobs ^= 0) then
do;
if (nlobs > 0) then
exponent = ceil(log2(nlobs));
else
exponent = 8;
declare hash h2(dataset: "work.W667I7NC", hashexp: exponent);
h2.defineKey( "AGENT",
"COMPANY");
h2.defineData( "COMSCALE",
"AGTGROUP",
"GRPNAME",
"AGTCLUSTR",
"AGENTSTATE");
h2.defineDone();
if (nlobs = -1) then
do;
if (h2.Num_Items < 1) then
do;
put "NOTE: Lookup table is empty: work.W667I7NC";

Protect PMOV - Functional Decomposition Analysis PAGE 77


put "NOTE: Abort action indicated, condition= Lookup table is empty:"
" work.W667I7NC";

abort 3;
end;
end;
end;
else
do;
put "NOTE: Lookup table is empty: work.W667I7NC";
put "NOTE: Abort action indicated, condition= Lookup table is empty:"
" work.W667I7NC";

abort 3;
end;
end;
else
do;
put "NOTE: Lookup table does not exist or cannot be opened: work.W667I7NC";

put "NOTE: Abort action indicated, condition= Lookup table missing:"


" work.W667I7NC";

abort 3;
end;

call missing (COMPANY, PRODUCT, POLICY, ITEMNO, trancnt, reverseTrncnt,


STATE, CLASS, SUBCLASS, INDEXPERC, AGENT, COMSCALE, AGTGROUP,
GRPNAME, AGTCLUSTR, AGENTSTATE);
end; /* All hash objects have been defined */

/* Read a row from the source table */


set work.W5JEMGHC end = eof;

/* Is the current key value stored in hash h0? */


if (missing0 < 1) then
do;
rc0 = h0.find();
end;
else
rc0 = missing0;

/* Is the current key value stored in hash h1? */


rc1 = h1.find();

/* Is the current key value stored in hash h2? */


rc2 = h2.find();

/* Examine success of lookups */


if ( rc0=0 and rc1=0 and rc2=0 ) then
do;
/* Write row to target */
output spdswork.W5JEML2D;
return;
end;
else
do;
error_total + 1;

if (rc0 ^= 0) then
do;
exception_total + 1;
if (rc0 = 98) then
do;
/* Check: Lookup table has no rows-Write exception row */
/* Check: Lookup table has no rows-Set target columns to value */
reverseTrncnt = 0;
request_write_target = 1;
end;

else
do;
/* Check: Lookup value not found-Set target columns to value */
reverseTrncnt = 0;
request_write_target = 1;
end;
end;

Protect PMOV - Functional Decomposition Analysis PAGE 78


if (rc1 ^= 0) then
do;
exception_total + 1;
/* Check: Lookup value not found-Set target columns to missing */
call missing (INDEXPERC);
request_write_target = 1;
end;

if (rc2 ^= 0) then
do;
exception_total + 1;
/* Check: Lookup value not found-Set target columns to missing */
call missing (COMSCALE, AGTGROUP, GRPNAME, AGTCLUSTR, AGENTSTATE);
request_write_target = 1;
end;

/* Set target columns to value/missing requested? */


if (request_write_target eq 1) then
/* Write row to target */
output spdswork.W5JEML2D;

end; /* One or more lookups failed */

if (eof = 1) then
do;
put "Source records with errors: " error_total ;
put "Total lookup exceptions: " exception_total ;
end;

run;
%rcSet(&syserr);

/*---- Map the columns ----*/


proc datasets lib = work nolist nowarn memtype = (data view);
delete mapped;
quit;

%put %str(NOTE: Mapping columns ...);


proc sql;
create view work.mapped as
select reverseTrncnt,
coinsPrem length = 8,
modified length = 8,
covChgEffDate length = 5,
MSGIND length = 1,
REASONCDE length = 2,
SUMINS length = 8,
ITMSTATUS length = 1,
COINSPC length = 8,
GSTORIDE length = 1,
(AGENT) as AGENT length = 6 format = 11. informat = 11.,
BRANCH length = 8,
ORGTRNCNT length = 8,
MINPRMIND length = 1,
incCommission1 length = 4,
RNWALTERM length = 8,
NTCETO length = 1,
NTCEPROD length = 1,
DISTRICT length = 2,
incCommGst length = 4,
INDEXIND length = 1,
OCCUPATN length = 4,
PRODUCT length = 3,
EXCESS length = 8,
COYISSUED length = 8,
BUSDESC length = 1,
inforceExpDate length = 5,
REVIEWIND length = 1,
SEQPOLICY length = 8,
RISKSTATE length = 2,
itemAtrnType length = 2,
stampduty length = 4,
covRenewedDate length = 5,
TYPEOFPOL length = 1,
incStatutCharges length = 4,
TRANTIME length = 8,
STISSUED length = 2,
FIREBRIG length = 1,
specPrem length = 8,

Protect PMOV - Functional Decomposition Analysis PAGE 79


POLICY length = 8,
LOCATNREF length = 8,
catPrem length = 8,
incGrossPrem length = 5,
NTCETYPE length = 1,
STATE length = 8,
(COMPANY) as COMPANY length = 4 format = 6. informat = 6.,
transactionDate length = 5,
IMPEXCESS length = 1,
INSTALFRQ length = 1,
inforceIncDate length = 5,
REP length = 8,
SPCLSIND length = 1,
MANRIIND length = 1,
SUBCLASS length = 3,
qsPrem length = 8,
TAILORGRP length = 2,
policyInceptDate length = 5,
eolPrem length = 8,
incGst length = 4,
CANCDECLN length = 1,
DISCGRP length = 1,
BUSNESSRC length = 4,
retRiPrem length = 8,
(premtranTRANDATE) as premtranTRANDATE length = 5 format = DATE9.,
premtranTbasicPrm length = 8,
ITEMNO length = 8,
TRANCNT as trancnt length = 8,
BRCHRESP length = 8,
covChgExpDate length = 5,
ATRNTYPE length = 2,
CLASS length = 3,
CLIENT length = 8,
CLAUSEIND length = 1,
PRVPOLREF length = 14,
RBASICPRM length = 8,
RSTMPDUTY length = 8,
RGST length = 8,
RCHARGES length = 8,
RCOMMISN length = 8,
RCOMMGST length = 8,
SUMINSCDE length = 3,
EXCESSTYP length = 1,
REBATEPC length = 8,
LOADINGPC length = 8,
PREMREASA length = 2,
PREMREAST length = 2,
IMAGEFLAG length = 1,
COMPLTIND length = 1,
CUSTREF length = 14,
POLSTATUS length = 1,
LOCKUSER length = 8,
MANCOMRTE length = 8,
DISCREAS length = 2,
LOADREAS length = 2,
FIELD04 length = 4,
COMREAS length = 2,
MPDISC length = 1,
PRVINSCOY length = 4,
POSTCODE length = 6,
CITY length = 40,
CHGEXCLUD length = 2,
SDEXCLUD length = 2,
GSTEXCLUD length = 2,
CPBUSSRC length = 10,
CAMPCODE length = 10,
INDEXPERC,
COMSCALE,
AGTGROUP,
GRPNAME,
AGTCLUSTR,
PRVINSIND length = 1,
PRVINSPOL length = 14,
AGENTSTATE,
LOYDATE length = 8,
RISKNO length = 6
from spdswork.W5JEML2D;
quit;

%let SYSLAST = work.mapped;

Protect PMOV - Functional Decomposition Analysis PAGE 80


data spdswork.W5JEML2D;
set work.mapped;
run;

proc datasets lib=work nolist nowarn memtype = VIEW;


delete mapped;
quit;

P30
/*============================================================================*
* Step: Lookup A55NWR2B.BI00K7NF *
* Transform: Lookup *
* Description: *
* *
* Source Tables: Extract Target - work.W667HY6U A55NWR2B.BL00A9LW *
* AGTGRP - work.W667I6HD A55NWR2B.BL00A9LP *
* Target Table: AGENT - work.W667I7NC A55NWR2B.BL00A9LX *
*============================================================================*/

%let transformID = %quote(A55NWR2B.BI00K7NF);

%let trans_rc = 0;

/* make the runTime macro variable to store the run time of the job */
%let runTime = %sysfunc(datetime(), );

proc datasets lib = work nolist nowarn memtype = (data view);


delete W667I7NC;
quit;

/*---- Begin DATA step to perform lookups ----*/


DATA work.W667I7NC
(keep = AGENT COMSCALE COMPANY AGTGROUP AGENTSTATE GRPNAME AGTCLUSTR)
;

attrib AGENT length=8 label="Agent Number For Database Access"


COMSCALE length=8 label="Commission Scale"
COMPANY length=8 format=6. label="Company Code"
AGTGROUP length=8 label="Agent Group Number"
AGENTSTATE length=8 label="State Code"
GRPNAME length=$60 label="Group Name"
AGTCLUSTR length=$4 label="Agent Cluster"
;

retain missing0-missing0 0;

/* Build hash objects from lookup tables before reading first source row */
if (_n_ = 1) then
do;
/* Build hash h0 from lookup table work.W667I6HD */
nlobs = .;
dsid = open("work.W667I6HD");
if (dsid > 0) then
do;
if ( attrc(dsid, 'MTYPE') = 'DATA' ) then
nlobs = attrn(dsid, 'NLOBS');
else
nlobs = -1;

dsid = close(dsid);
if (nlobs ^= 0) then
do;
if (nlobs > 0) then
exponent = ceil(log2(nlobs));
else
exponent = 8;
declare hash h0(dataset: "work.W667I6HD", hashexp: exponent);
h0.defineKey( "AGTGROUP");
h0.defineData( "GRPNAME",
"AGTCLUSTR");
h0.defineDone();
if (nlobs = -1) then
do;
if (h0.Num_Items < 1) then
do;
put "NOTE: Lookup table is empty: work.W667I6HD";
put "NOTE: Abort action indicated, condition= Lookup table is empty:"

Protect PMOV - Functional Decomposition Analysis PAGE 81


" work.W667I6HD";

abort 3;
end;
end;
end;
else
do;
put "NOTE: Lookup table is empty: work.W667I6HD";
put "NOTE: Abort action indicated, condition= Lookup table is empty:"
" work.W667I6HD";

abort 3;
end;
end;
else
do;
put "NOTE: Lookup table does not exist or cannot be opened: work.W667I6HD";

put "NOTE: Abort action indicated, condition= Lookup table missing:"


" work.W667I6HD";

abort 3;
end;

call missing (AGTGROUP, GRPNAME, AGTCLUSTR);

end; /* All hash objects have been defined */

/* Read a row from the source table */


set work.W667HY6U end = eof;

/* Is the current key value stored in hash h0? */


rc0 = h0.find();

/* Examine success of lookups */


if ( rc0=0 ) then
do;
/* Write row to target */
output work.W667I7NC;
return;
end;
else
do;
error_total + 1;

if (rc0 ^= 0) then
do;
exception_total + 1;
/* Check: Lookup value not found-Set target columns to missing */
call missing (GRPNAME, AGTCLUSTR);
request_write_target = 1;
end;

/* Set target columns to value/missing requested? */


if (request_write_target eq 1) then
/* Write row to target */
output work.W667I7NC;

end; /* One or more lookups failed */

if (eof = 1) then
do;
put "Source records with errors: " error_total ;
put "Total lookup exceptions: " exception_total ;
end;

run;

%rcSet(&syserr);

/*---- Map the columns ----*/


proc datasets lib = work nolist nowarn memtype = (data view);
delete mapped;
quit;
%put %str(NOTE: Mapping columns ...);
proc sql;
create view work.mapped as
select AGENT length = 8,

Protect PMOV - Functional Decomposition Analysis PAGE 82


COMSCALE length = 8,
COMPANY length = 8 format = 6. informat = 6.,
AGTGROUP length = 8,
AGENTSTATE length = 8,
GRPNAME,
AGTCLUSTR
from work.W667I7NC;
quit;

%let SYSLAST = work.mapped;

data work.W667I7NC;
set work.mapped;
run;

proc datasets lib=work nolist nowarn memtype = VIEW;


delete mapped;
quit;

SAS Splitter

P11
/*============================================================================*
* Step: SAS Splitter A55NWR2B.BI00K7NZ *
* Transform: SAS Splitter *
* Description: *
* *
* Source Table: Lookup Target - work.W66GB66B A55NWR2B.BL00A9MD *
* Target Tables: Splitter Target 1 - work.W5JEMGHC A55NWR2B.BL00A9ME *
* Splitter Target 2 - work.W5JEMGHM A55NWR2B.BL00A9LO *
*============================================================================*/

%let SYSLAST = %nrquote(work.W66GB66B);

%let transformID = %quote(A55NWR2B.BI00K7NZ);

%let trans_rc = 0;

proc datasets lib=work nolist nowarn memtype = (data view);


delete W5JEMGHC;
delete W5JEMGHM;
quit;

data work.W5JEMGHC
work.W5JEMGHM;
set &SYSLAST;
output work.W5JEMGHC;
if ORGTRNCNT NE 0 & ATRNTYPE = 'RV' then
output work.W5JEMGHM;
run;

%rcSet(&syserr);

/*---- Map the columns ----*/


proc datasets lib = work nolist nowarn memtype = (data view);
delete etls_mapped;
quit;

%put %str(NOTE: Mapping columns ...);


proc sql;
create view work.etls_mapped as
select TRANCNT length = 8,
PRODUCT length = 3,
ITEMNO length = 8,
COMPANY length = 8,
ORGTRNCNT length = 8,
POLICY length = 8
from work.W5JEMGHM;
quit;

%let SYSLAST = work.etls_mapped;

data work.W5JEMGHM;
set work.etls_mapped;
run;

proc datasets lib = work nolist nowarn memtype = (data view);

Protect PMOV - Functional Decomposition Analysis PAGE 83


delete etls_mapped;
quit;

P14
/*============================================================================*
* Step: SAS Splitter A55NWR2B.BI00K7O1 *
* Transform: SAS Splitter *
* Description: *
* *
* Source Table: MAIN - spdswork.W5J4GJL1 A55NWR2B.BL00A9MG *
* Target Tables: Splitter Target 1 - work.W66O0OT3 A55NWR2B.BL00A9MH *
* Splitter Target 2 - spdswork.W66O0OTD A55NWR2B.BL00A9MI *
*============================================================================*/

%let SYSLAST = %nrquote(spdswork.W5J4GJL1);

%let transformID = %quote(A55NWR2B.BI00K7O1);

%let trans_rc = 0;

proc datasets lib=spdswork nolist nowarn memtype = (data view);


delete W66O0OT3;
delete W66O0OTD;
quit;

data work.W66O0OT3
spdswork.W66O0OTD;
set &SYSLAST;
if company not in (3, 5) then
output work.W66O0OT3;
if company in (3, 5) then
output spdswork.W66O0OTD;
run;

%rcSet(&syserr);

P17
/*============================================================================*
* Step: SAS Splitter A55NWR2B.BI00K7O6 *
* Transform: SAS Splitter *
* Description: *
* *
* Source Table: AppendWorkTableName - work.W66O2F0P A55NWR2B.BL00A9MM *
* Target Tables: SAS Splitter - work.W5KIDKRW A55NWR2B.BL00A9MN *
* SAS Splitter - work.W5KIDFJ3 A55NWR2B.BL00A9MO *
* SAS Splitter - work.W5KIDI12 A55NWR2B.BL00A9MP *
* SAS Splitter - work.W5JTEW9L A55NWR2B.BL00A9LY *
*============================================================================*/

%let SYSLAST = %nrquote(work.W66O2F0P);

%let transformID = %quote(A55NWR2B.BI00K7O6);

%let trans_rc = 0;

proc datasets lib=work nolist nowarn memtype = (data view);


delete W5KIDKRW;
delete W5KIDFJ3;
delete W5KIDI12;
delete W5JTEW9L;
quit;

data work.W5KIDKRW
work.W5KIDFJ3
work.W5KIDI12
work.W5JTEW9L;
set &SYSLAST;
if product NOT IN ('QTE','CVN') AND covChgEffDate >= covRenewedDate then
output work.W5KIDKRW;
if product NOT IN ('QTE','CVN') then
output work.W5KIDFJ3;
if product NOT IN ('QTE','CVN') then
output work.W5KIDI12;
if product NOT IN ('QTE','CVN') AND covChgEffDate < covRenewedDate then
output work.W5JTEW9L;
run;

Protect PMOV - Functional Decomposition Analysis PAGE 84


%rcSet(&syserr);

P22
/*============================================================================*
* Step: SAS Splitter A55NWR2B.BI00K7N5 *
* Transform: SAS Splitter *
* Description: *
* *
* Source Table: Extract Target - work.W5JR5REU A55NWR2B.BL00A9LL *
* Target Tables: Splitter Target 1 - work.W5JR5N1P A55NWR2B.BL00A9LM *
* Splitter Target 2 - work.W5JR5N1Z A55NWR2B.BL00A9LN *
*============================================================================*/

%let SYSLAST = %nrquote(work.W5JR5REU);

%let transformID = %quote(A55NWR2B.BI00K7N5);

%let trans_rc = 0;

proc datasets lib=work nolist nowarn memtype = (data view);


delete W5JR5N1P;
delete W5JR5N1Z;
quit;

data work.W5JR5N1P
work.W5JR5N1Z;
set &SYSLAST;
if RITYPE ='R' then
output work.W5JR5N1P;
if RITYPE = 'P' then
output work.W5JR5N1Z;
run;

%rcSet(&syserr);

/*---- Map the columns ----*/


proc datasets lib = work nolist nowarn memtype = (data view);
delete etls_mapped;
quit;

%put %str(NOTE: Mapping columns ...);


proc sql;
create view work.etls_mapped as
select COMPANY length = 8,
PRODUCT length = 3,
POLICY length = 8,
ITEMNO length = 8,
TRANCNT length = 8,
RITYPE length = 1,
retRiPrem as coinsPrem length = 8
from work.W5JR5N1Z;
quit;

%let SYSLAST = work.etls_mapped;

data work.W5JR5N1Z;
set work.etls_mapped;
run;

proc datasets lib = work nolist nowarn memtype = (data view);


delete etls_mapped;
quit;

Append

P16
/*============================================================================*
* Step: Append A55NWR2B.BI00K7O5 *
* Transform: Append *
* Description: *
* *
* Source Tables: SQL Target - work.W66O108F A55NWR2B.BL00A9ML *
* Extract Target - work.W66O1GOS A55NWR2B.BL00A9MJ *
* Target Table: AppendWorkTableName - work.W66O2F0P A55NWR2B.BL00A9MM *

Protect PMOV - Functional Decomposition Analysis PAGE 85


*============================================================================*/

%let transformID = %quote(A55NWR2B.BI00K7O5);

%let trans_rc = 0;

proc datasets lib = work nolist nowarn memtype = (data view);


delete W66O2F0P;
quit;

data work.W66O2F0P / view=work.W66O2F0P;


set work.W66O108F
work.W66O1GOS;
keep FIREBRIG COYISSUED itemNo modified GRPNAME MANCOMRTE POLSTATUS
PREMREASA inforceIncDate incCommission1 RCOMMISN incGrossPrem
reverseTrncnt BRCHRESP CUSTREF LOCKUSER CITY covRenewedDate incCommGst
OCCUPATN cumEarnPremPerDay coinsPrem AGENTSTATE subclass ORGTRNCNT
COMPLTIND RGST SPCLSIND STATE CAMPCODE BRANCH covChgEffDate DISTRICT
CANCDECLN STISSUED tranEarnPremPerDay INDEXIND tranEarnCommPerDay
EXCESS CPBUSSRC qsPrem FIELD04 NTCETYPE cumEarnCommPerDay GSTEXCLUD
SDEXCLUD COMREAS atrnType REP CHGEXCLUD NTCEPROD glDate COINSPC incGst
stampDuty tranInforce BUSDESC cumGrossPrem policy cumStampDuty
covChgExpDate policyInceptDate cumCommission1 PRVINSPOL
premtranTRANDATE REVIEWIND RISKSTATE AGTGROUP DISCREAS REBATEPC
itemAtrnType AGTCLUSTR EXCESSTYP RCOMMGST MPDISC RSTMPDUTY BUSNESSRC
SUMINS PRVINSIND termIdent cumGST GSTORIDE LOADREAS PREMREAST CLIENT
cumCommGst RNWALTERM NTCETO IMAGEFLAG MINPRMIND incStatutCharges
LOCATNREF cumStatutCharges itmstatus transactionDate coverageKey
trancnt eolprem PRVINSCOY seqPolicy product DISCGRP RBASICPRM
inforceExpDate MSGIND reasoncde PRVPOLREF company CLAUSEIND COMSCALE
POSTCODE premtranTbasicPrm newRenew AGENT LOADINGPC class IMPEXCESS
TAILORGRP RCHARGES retRiPrem TYPEOFPOL catPrem SUMINSCDE
transactionType INDEXPERC INSTALFRQ MANRIIND specPrem NBRATE RENRATE
NOMRATENB NOMRATEREN LOYDATE RISKNO;
run;

%rcSet(&syserr);

Table Loader

P18
/*============================================================================*
* Step: Table Loader A55NWR2B.BI00K7O8 *
* Transform: Table Loader (Version 2) *
* Description: *
* *
* Source Table: SAS Splitter - work.W5KIDKRW A55NWR2B.BL00A9MN *
* Target Table: Protect Niche PI - Daily Policy Movement A55NWR2B.BX004XI5 *
* - dbnchpip.PMOV_PI *
*============================================================================*/

%let SYSLAST = %nrquote(work.W5KIDKRW);

%let transformID = %quote(A55NWR2B.BI00K7O8);

%let trans_rc = 0;

%global etls_tableExist;
%global etls_numIndex;
%global etls_lastTable;
%let etls_tableExist = -1;
%let etls_numIndex = -1;
%let etls_lastTable = &SYSLAST;

/*---- Define load data macro ----*/


%macro etls_loader;

%let SYSOPT = ;

/* Get number of records in table */


%let etls_recordsBefore = 0;
%macro etls_recordCheck;
%let etls_recCheckExist = %eval(%sysfunc(exist(dbnchpip.PMOV_PI, DATA)) or
%sysfunc(exist(dbnchpip.PMOV_PI, VIEW)));

%if (&etls_recCheckExist) %then


%do;

Protect PMOV - Functional Decomposition Analysis PAGE 86


proc contents data = dbnchpip.PMOV_PI out = work.etls_contents(keep = nobs)
noprint;
run;

data _null_;
set work.etls_contents (obs = 1);
call symput("etls_recordsBefore", left(put(nobs,32.)));
run;

proc datasets lib = work nolist nowarn memtype = (data view);


delete etls_contents;
quit;

%end;
%mend etls_recordCheck;
%etls_recordCheck;

%let etls_table = %nrquote(Protect Niche PI - Daily Policy Movement);


%let etls_lib = %nrquote(Protect Niche PI - Daily Base Layer PreLive Library);

/*---- Map the columns ----*/


proc datasets lib = work nolist nowarn memtype = (data view);
delete mapped;
quit;

%put %str(NOTE: Mapping columns ...);


proc sql;
create view work.mapped as
select coverageKey length = 8,
(company) as company length = 3 format = 6. informat = 6.,
product length = 3,
class length = 3,
subclass length = 3,
policy length = 8,
seqPolicy length = 8,
(itemNo) as itemNo length = 3 format = 6. informat = 6.,
termIdent length = 3,
(trancnt) as trancnt length = 4 format = 6. informat = 6.,
(ORGTRNCNT) as orgtrncnt length = 4,
(reverseTrncnt) as reversedTrncnt length = 4,
covRenewedDate length = 5,
covChgEffDate length = 5,
covChgExpDate length = 5,
policyInceptDate length = 5,
transactionDate length = 5,
premtranTRANDATE as premtranTrandate length = 5,
glDate length = 5,
inforceIncDate length = 5,
inforceExpDate length = 5,
tranInforce length = 3,
itmstatus length = 1,
reasoncde length = 2,
transactionType length = 2,
newRenew length = 1,
itemAtrnType length = 2,
atrnType length = 2,
incGrossPrem length = 5,
cumGrossPrem length = 5,
incStatutCharges length = 4,
cumStatutCharges length = 4,
stampDuty length = 4,
cumStampDuty length = 4,
incCommission1 length = 4,
cumCommission1 length = 4,
incGst length = 4,
cumGST length = 4,
incCommGst length = 4,
cumCommGst length = 4,
tranEarnPremPerDay length = 5,
tranEarnCommPerDay length = 5,
cumEarnPremPerDay length = 5,
cumEarnCommPerDay length = 5,
(coinsPrem) as coinsPrem length = 5 format = 12.2,
retRiPrem length = 5,
qsPrem length = 5,
catPrem length = 5,
eolprem length = 5,
specPrem length = 5,
modified length = 8,
RISKSTATE length = 2,

Protect PMOV - Functional Decomposition Analysis PAGE 87


(LOCATNREF) as addrref length = 8 format = 11. informat = 11.,
(STATE) as STATE length = 4 format = 6. informat = 6.,
(BRANCH) as BRANCH length = 4 format = 6. informat = 6.,
(BRCHRESP) as BRCHRESP length = 4 format = 6. informat = 6.,
(COYISSUED) as COYISSUED length = 4 format = 6. informat = 6.,
STISSUED length = 2,
REP length = 8,
(DATETIME()) as row_insert_dt length = 8 format = DATETIME20.,
PRVPOLREF length = 14,
RBASICPRM length = 8,
RSTMPDUTY length = 8,
RGST length = 8,
RCHARGES length = 8,
RCOMMISN length = 8,
RCOMMGST length = 8,
SUMINSCDE length = 3,
EXCESSTYP length = 1,
REBATEPC length = 8,
LOADINGPC length = 8,
PREMREASA length = 2,
PREMREAST length = 2,
IMAGEFLAG length = 1,
COMPLTIND length = 1,
CUSTREF length = 14,
POLSTATUS length = 1,
LOCKUSER length = 8,
BUSNESSRC length = 4,
(MANCOMRTE) as MANCOMRTE length = 6 format = 10.2,
DISCREAS length = 2,
LOADREAS length = 2,
FIELD04 as premmodpct length = 4 informat = COMMA3.2,
COMREAS length = 2,
MPDISC length = 1,
PRVINSCOY length = 4,
CHGEXCLUD length = 2,
SDEXCLUD length = 2,
GSTEXCLUD length = 2,
CPBUSSRC length = 10,
CAMPCODE length = 10,
NBRATE length = 8,
RENRATE length = 8,
NOMRATENB length = 8,
NOMRATEREN length = 8,
POSTCODE length = 6,
CITY length = 40,
GRPNAME length = 60,
AGTCLUSTR length = 4,
COMSCALE length = 8,
PRVINSIND length = 1,
PRVINSPOL length = 14,
RISKNO length = 6
from &etls_lastTable;
quit;

%let SYSLAST = work.mapped;

%let etls_lastTable = &SYSLAST;


%let SYSOPT = ;

/* Determine if the target table exists */


%let etls_tableExist = %eval(%sysfunc(exist(dbnchpip.PMOV_PI, DATA)) or
%sysfunc(exist(dbnchpip.PMOV_PI, VIEW)));

/*---- Drop a table ----*/


%put %str(NOTE: Dropping table ...);
proc datasets lib = dbnchpip nolist nodetails;
delete PMOV_PI;
quit;

%rcSet(&syserr);

%let etls_tableExist = 0;

/*---- Create a new table ----*/


data dbnchpip.PMOV_PI
(label = 'Protect Niche PI - Daily Policy Movement');
attrib coverageKey length = 8
label = 'Coverage Key';
attrib company length = 3 format = 6. informat = 6.
label = 'Company';

Protect PMOV - Functional Decomposition Analysis PAGE 88


attrib product length = $3 format = $3. informat = $3.
label = 'Product';
attrib class length = $3 format = $3. informat = $3.
label = 'Class';
attrib subclass length = $3 format = $3. informat = $3.
label = 'Subclass';
attrib policy length = 8 format = 11. informat = 11.
label = 'Policy Number';
attrib seqPolicy length = 8 format = 11. informat = 11.
label = 'Sequence Policy Number';
attrib itemNo length = 3 format = 6. informat = 6.
label = 'Item No';
attrib termIdent length = $3
label = 'Term Identification';
attrib trancnt length = 4 format = 6. informat = 6.
label = 'Transaction Count';
attrib orgtrncnt length = 4
label = 'Original Trans Count being Reversed';
attrib reversedTrncnt length = 4
label = 'This trans has been reversed by this Trans Count';
attrib covRenewedDate length = 5 format = DATE9.
label = 'Coverage Renew Date';
attrib covChgEffDate length = 5 format = DATE9.
label = 'Coverage Change Effective Date';
attrib covChgExpDate length = 5 format = DATE9.
label = 'Coverage Change Expiry Date';
attrib policyInceptDate length = 5 format = DATE9.
label = 'Policy Inception Date';
attrib transactionDate length = 5 format = DATE9.
label = 'Transaction Date';
attrib premtranTrandate length = 5 format = DATE9.
label = 'Transaction Date - PremTran';
attrib glDate length = 5 format = DATE9.
label = 'General Ledger Date';
attrib inforceIncDate length = 5 format = DATE9.
label = 'In Force Inception Date';
attrib inforceExpDate length = 5 format = DATE9.
label = 'In Force Expiry Date';
attrib tranInforce length = 3
label = 'Inforce Transaction 1(Yes)/0(No)';
attrib itmstatus length = $1 format = $1. informat = $1.
label = 'Item Status - V(void)/blank(current)';
attrib reasoncde length = $2 format = $2. informat = $2.
label = 'Reason Code for Cancellation Of Item';
attrib transactionType length = $2
label = 'User Defined - Transaction Type';
attrib newRenew length = $1
label = 'New(N)/Renewal(R) Risk';
attrib itemAtrnType length = $2 format = $2. informat = $2.
label = 'Item - Transaction Type';
attrib atrnType length = $2 format = $2. informat = $2.
label = 'Premtran - Transaction Type';
attrib incGrossPrem length = 5 format = 12.2 informat = 13.2
label = 'Transaction Basic Premium';
attrib cumGrossPrem length = 5 format = 12.2
label = 'Cummulative Premium Amount';
attrib incStatutCharges length = 4 format = 10.2 informat = 13.2
label = 'Transaction Charges';
attrib cumStatutCharges length = 4 format = 10.2
label = 'Cummulative Statutory Charges';
attrib stampDuty length = 4 format = 10.2 informat = 13.2
label = 'Transaction Stamp Duty';
attrib cumStampDuty length = 4 format = 10.2
label = 'Cummulative Stamp Duty Amount';
attrib incCommission1 length = 4 format = 10.2 informat = 13.2
label = 'Transaction Commission';
attrib cumCommission1 length = 4 format = 10.2
label = 'Cummulative Commission Amount';
attrib incGst length = 4 format = 10.2 informat = 13.2
label = 'Amount of GST on Transaction Premium';
attrib cumGST length = 4 format = 10.2
label = 'Cummulative GST Amount';
attrib incCommGst length = 4 format = 10.2 informat = 13.2
label = 'Amount of GST on Transaction Commision';
attrib cumCommGst length = 4 format = 10.2
label = 'Cummulative GST on Transaction Commision';
attrib tranEarnPremPerDay length = 5 format = 8.5
label = 'Trans Earned Premium Per Day';
attrib tranEarnCommPerDay length = 5 format = 8.5
label = 'Trans Earned Commission Per Day';

Protect PMOV - Functional Decomposition Analysis PAGE 89


attrib cumEarnPremPerDay length = 5 format = 8.5
label = 'Cummulative Earned Premium Per day';
attrib cumEarnCommPerDay length = 5 format = 8.5
label = 'Cummulative Earned Commission Per day';
attrib coinsPrem length = 5 format = 12.2
label = 'Coinsurance Premium';
attrib retRiPrem length = 5 format = 12.2
label = 'Retained Premium';
attrib qsPrem length = 5 format = 12.2
label = 'Quota Share Premium';
attrib catPrem length = 5 format = 12.2
label = 'Catastrophe Premium';
attrib eolprem length = 5 format = 12.2
label = 'Excess Of Loss Premium';
attrib specPrem length = 5 format = 12.2
label = 'Special Premium';
attrib modified length = 8 format = BINARY10.
label = 'Flag to identify User Modifications in Binary 00000000';
attrib RISKSTATE length = $2 format = $2. informat = $2.
label = 'State Of Risk';
attrib addrref length = 8 format = 11. informat = 11.
label = 'Location reference to link to ADDRESS table';
attrib STATE length = 4 format = 6. informat = 6.
label = 'State Code';
attrib BRANCH length = 4 format = 6. informat = 6.
label = 'Branch Number';
attrib BRCHRESP length = 4 format = 6. informat = 6.
label = 'Branch Responsible';
attrib COYISSUED length = 4 format = 6. informat = 6.
label = 'Company Of Issue';
attrib STISSUED length = $2 format = $2. informat = $2.
label = 'State Of Issue';
attrib REP length = 8 format = 6. informat = 6.
label = 'REP';
attrib row_insert_dt length = 8 format = DATETIME20.
label = 'Date rows are inserted';
attrib PRVPOLREF length = $14
label = 'Previous Policy Reference Number';
attrib RBASICPRM length = 8 format = 13.2 informat = 13.2
label = 'RBASICPRM';
attrib RSTMPDUTY length = 8 format = 13.2 informat = 13.2
label = 'RSTMPDUTY';
attrib RGST length = 8 format = 13.2 informat = 13.2
label = 'RGST';
attrib RCHARGES length = 8 format = 13.2 informat = 13.2
label = 'RCHARGES';
attrib RCOMMISN length = 8 format = 13.2 informat = 13.2
label = 'RCOMMISN';
attrib RCOMMGST length = 8 format = 13.2 informat = 13.2
label = 'RCOMMGST';
attrib SUMINSCDE length = $3 format = $3. informat = $3.
label = 'SUMINSCDE';
attrib EXCESSTYP length = $1 format = $1. informat = $1.
label = 'EXCESSTYP';
attrib REBATEPC length = 8 format = 6.2 informat = 6.2
label = 'REBATEPC';
attrib LOADINGPC length = 8 format = 7.2 informat = 7.2
label = 'LOADINGPC';
attrib PREMREASA length = $2 format = $2. informat = $2.
label = 'PREMREASA';
attrib PREMREAST length = $2 format = $2. informat = $2.
label = 'PREMREAST';
attrib IMAGEFLAG length = $1 format = $1. informat = $1.
label = 'IMAGEFLAG';
attrib COMPLTIND length = $1 format = $1. informat = $1.
label = 'COMPLTIND';
attrib CUSTREF length = $14 format = $14. informat = $14.
label = 'CUSTREF';
attrib POLSTATUS length = $1 format = $1. informat = $1.
label = 'POLSTATUS';
attrib LOCKUSER length = $8 format = $8. informat = $8.
label = 'LOCKUSER';
attrib BUSNESSRC length = $4 format = $4. informat = $4.
label = 'BUSNESSRC';
attrib MANCOMRTE length = 6 format = 10.2
label = 'Manual Commission Rate';
attrib DISCREAS length = $2
label = 'Discount Reason';
attrib LOADREAS length = $2
label = 'Loading Reason';

Protect PMOV - Functional Decomposition Analysis PAGE 90


attrib premmodpct length = 4 informat = COMMA3.2
label = 'Capping Percentage';
attrib COMREAS length = $2
label = 'Reason Of Override Of Commission';
attrib MPDISC length = $1 format = $1. informat = $1.
label = 'Multi Policy Discount';
attrib PRVINSCOY length = $4 format = $4. informat = $4.
label = 'Previous Insurer';
attrib CHGEXCLUD length = $2 informat = $EBCDIC002.
label = 'Code For Reason Of Exclusion Of Charges';
attrib SDEXCLUD length = $2 informat = $EBCDIC002.
label = 'Stamp Duty Exclusion Code.';
attrib GSTEXCLUD length = $2 informat = $EBCDIC002.
label = 'Gst Exclusion';
attrib CPBUSSRC length = $10 informat = $EBCDIC010.
label = 'Corporate Partners Source Of Business';
attrib CAMPCODE length = $10
label = 'CAMPCODE';
attrib NBRATE length = 8
label = 'NBRATE';
attrib RENRATE length = 8
label = 'RENRATE';
attrib NOMRATENB length = 8
label = 'NOMRATENB';
attrib NOMRATEREN length = 8
label = 'NOMRATEREN';
attrib POSTCODE length = $6 format = $6. informat = $6.
label = 'Postcode';
attrib CITY length = $40 format = $40. informat = $40.
label = 'City/Town/Suburb Name';
attrib GRPNAME length = $60
label = 'Group Name';
attrib AGTCLUSTR length = $4
label = 'Agent Cluster';
attrib COMSCALE length = 8
label = 'Commission Scale';
attrib PRVINSIND length = $1
label = 'Previous Insurance';
attrib PRVINSPOL length = $14
label = 'Previous Policy Code';
attrib RISKNO length = 6
label = 'Number To Identify Risk Group';
stop;
run;

%rcSet(&syserr);

/*---- Append new data ----*/


%put %str(NOTE: Appending data ...);

proc append base = dbnchpip.PMOV_PI


data = &etls_lastTable (&SYSOPT) force;
run;

%rcSet(&syserr);

/*---- Create the indexes for a table ----*/


%put %str(NOTE: Creating indexes ...);
proc datasets lib = dbnchpip nolist;
modify PMOV_PI;
index create coverageKey
/ unique;
index create policy;
quit;

%rcSet(&syserr);

proc datasets lib = work nolist nowarn memtype = (data view);


delete mapped;
quit;

/* Get number of records in table */


%let etls_recordsAfter = 0;
%macro etls_recordCheck;
%let etls_recCheckExist = %eval(%sysfunc(exist(dbnchpip.PMOV_PI, DATA)) or
%sysfunc(exist(dbnchpip.PMOV_PI, VIEW)));
%if (&etls_recCheckExist) %then
%do;

Protect PMOV - Functional Decomposition Analysis PAGE 91


proc contents data = dbnchpip.PMOV_PI out = work.etls_contents(keep = nobs)
noprint;
run;

data _null_;
set work.etls_contents (obs = 1);
call symput("etls_recordsAfter", left(put(nobs,32.)));
run;

proc datasets lib = work nolist nowarn memtype = (data view);


delete etls_contents;
quit;

%end;
%mend etls_recordCheck;
%etls_recordCheck;

%mend etls_loader;
%etls_loader;

P36
/*============================================================================*
* Step: Table Loader A55NWR2B.BI00K7O7 *
* Transform: Table Loader (Version 2) *
* Description: *
* *
* Source Table: SAS Splitter - work.W5KIDI12 A55NWR2B.BL00A9MP *
* Target Table: Staging Niche PI - Generic Daily A55NWR2B.BX004XH2 *
* Coverage Details - *
* dbnchpis.COVDTLS_PI_STG *
*============================================================================*/

%let SYSLAST = %nrquote(work.W5KIDI12);

%let transformID = %quote(A55NWR2B.BI00K7O7);

%let trans_rc = 0;

%global etls_tableExist;
%global etls_numIndex;
%global etls_lastTable;
%let etls_tableExist = -1;
%let etls_numIndex = -1;
%let etls_lastTable = &SYSLAST;

/*---- Define load data macro ----*/


%macro etls_loader;

%let SYSOPT = ;

/* Get number of records in table */


%let etls_recordsBefore = 0;
%macro etls_recordCheck;
%let etls_recCheckExist = %eval(%sysfunc(exist(dbnchpis.COVDTLS_PI_STG, DATA)) or
%sysfunc(exist(dbnchpis.COVDTLS_PI_STG, VIEW)));

%if (&etls_recCheckExist) %then


%do;
proc contents data = dbnchpis.COVDTLS_PI_STG out = work.etls_contents(keep =
nobs) noprint;
run;

data _null_;
set work.etls_contents (obs = 1);
call symput("etls_recordsBefore", left(put(nobs,32.)));
run;

proc datasets lib = work nolist nowarn memtype = (data view);


delete etls_contents;
quit;

%end;
%mend etls_recordCheck;
%etls_recordCheck;
%let etls_table = %nrquote(Staging Niche PI - Generic Daily Coverage Details);
%let etls_lib = %nrquote(Protect Niche PI - Daily Staging Library);

Protect PMOV - Functional Decomposition Analysis PAGE 92


/*---- Map the columns ----*/
proc datasets lib = work nolist nowarn memtype = (data view);
delete mapped;
quit;

%put %str(NOTE: Mapping columns ...);


proc sql;
create view work.mapped as
select coverageKey length = 8,
(company) as company length = 3 format = 6. informat = 6.,
product length = 3,
class length = 3,
subclass length = 3,
policy length = 8,
seqPolicy length = 8,
(itemNo) as itemNo length = 3 format = 6. informat = 6.,
termIdent length = 3,
(trancnt) as trancnt length = 4 format = 6. informat = 6.,
(ORGTRNCNT) as orgTrncnt length = 4,
(reverseTrncnt) as reversedTrncnt length = 4,
covRenewedDate length = 5,
covChgEffDate length = 5,
covChgExpDate length = 5,
policyInceptDate length = 5,
modified length = 8,
RISKSTATE length = 2,
OCCUPATN length = 4,
SUMINS length = 8,
EXCESS length = 8,
DISTRICT length = 2,
INDEXIND length = 1,
FIREBRIG length = 1,
GSTORIDE length = 1,
MINPRMIND length = 1,
TAILORGRP length = 2,
TYPEOFPOL length = 1,
COINSPC length = 8,
LOCATNREF length = 8,
MANRIIND length = 1,
CLIENT length = 8,
STATE length = 8,
(BRANCH) as BRANCH length = 4 format = 6. informat = 6.,
REP length = 8,
AGENT length = 8,
RNWALTERM length = 8,
REVIEWIND length = 1,
NTCETO length = 1,
NTCEPROD length = 1,
NTCETYPE length = 1,
CLAUSEIND length = 1,
SPCLSIND length = 1,
MSGIND length = 1,
BUSNESSRC length = 4,
COYISSUED length = 8,
STISSUED length = 2,
INSTALFRQ length = 1,
CANCDECLN length = 1,
IMPEXCESS length = 1,
(BRCHRESP) as BRCHRESP length = 4 format = 6. informat = 6.,
BUSDESC length = 1,
DISCGRP length = 1,
transactionDate length = 5,
POSTCODE length = 6,
CITY length = 40,
COMSCALE length = 8,
INDEXPERC length = 8,
AGTCLUSTR length = 4 informat = $EBCDIC004.,
GRPNAME length = 60 informat = $EBCDIC060.,
CAMPCODE length = 10,
LOYDATE length = 8
from &etls_lastTable;
quit;

%let SYSLAST = work.mapped;

%let etls_lastTable = &SYSLAST;


%let SYSOPT = ;

/* Determine if the target table exists */


%let etls_tableExist = %eval(%sysfunc(exist(dbnchpis.COVDTLS_PI_STG, DATA)) or

Protect PMOV - Functional Decomposition Analysis PAGE 93


%sysfunc(exist(dbnchpis.COVDTLS_PI_STG, VIEW)));

/*---- Drop a table ----*/


%put %str(NOTE: Dropping table ...);
proc datasets lib = dbnchpis nolist nodetails;
delete COVDTLS_PI_STG;
quit;

%rcSet(&syserr);

%let etls_tableExist = 0;

/*---- Create a new table ----*/


data dbnchpis.COVDTLS_PI_STG
(label = 'Staging Niche PI - Generic Daily Coverage Details');
attrib coverageKey length = 8
label = 'Coverage Key';
attrib company length = 3 format = 6. informat = 6.
label = 'Company';
attrib product length = $3 format = $3. informat = $3.
label = 'Product';
attrib class length = $3 format = $3. informat = $3.
label = 'Class';
attrib subclass length = $3 format = $3. informat = $3.
label = 'Subclass';
attrib policy length = 8 format = 11. informat = 11.
label = 'Policy Number';
attrib seqPolicy length = 8 format = 11. informat = 11.
label = 'Sequence Policy Number';
attrib itemNo length = 3 format = 6. informat = 6.;
attrib termIdent length = $3
label = 'Term Identification';
attrib trancnt length = 4 format = 6. informat = 6.
label = 'Transaction Count';
attrib orgTrncnt length = 4
label = 'Original Trans Count Being Reversed';
attrib reversedTrncnt length = 4
label = 'This trans being reversed by this Tranc Count';
attrib covRenewedDate length = 5 format = DATE9.
label = 'Coverage Renew Date';
attrib covChgEffDate length = 5 format = DATE9.
label = 'Coverage Change Effective Date';
attrib covChgExpDate length = 5 format = DATE9.
label = 'Coverage Change Expiry Date';
attrib policyInceptDate length = 5 format = DATE9.
label = 'Policy Inception Date';
attrib modified length = 8 format = BINARY10.
label = 'Flag to identify User Modifications in Binary 00000000';
attrib RISKSTATE length = $2 format = $2. informat = $2.
label = 'RISKSTATE';
attrib OCCUPATN length = $4 format = $4. informat = $4.
label = 'OCCUPATN';
attrib SUMINS length = 8 format = 11. informat = 11.
label = 'SUMINS';
attrib EXCESS length = 8 format = 11. informat = 11.
label = 'EXCESS';
attrib DISTRICT length = $2 format = $2. informat = $2.
label = 'DISTRICT';
attrib INDEXIND length = $1 format = $1. informat = $1.
label = 'INDEXIND';
attrib FIREBRIG length = $1 format = $1. informat = $1.
label = 'FIREBRIG';
attrib GSTORIDE length = $1 format = $1. informat = $1.
label = 'GSTORIDE';
attrib MINPRMIND length = $1 format = $1. informat = $1.
label = 'MINPRMIND';
attrib TAILORGRP length = $2 format = $2. informat = $2.
label = 'TAILORGRP';
attrib TYPEOFPOL length = $1 format = $1. informat = $1.
label = 'TYPEOFPOL';
attrib COINSPC length = 8 format = 7.3 informat = 7.3
label = 'COINSPC';
attrib LOCATNREF length = 8 format = 11. informat = 11.
label = 'LOCATNREF';
attrib MANRIIND length = $1 format = $1. informat = $1.
label = 'MANRIIND';
attrib CLIENT length = 8 format = 11. informat = 11.
label = 'CLIENT';
attrib STATE length = 8 format = 6. informat = 6.
label = 'STATE';

Protect PMOV - Functional Decomposition Analysis PAGE 94


attrib BRANCH length = 4 format = 6. informat = 6.
label = 'BRANCH';
attrib REP length = 8 format = 6. informat = 6.
label = 'REP';
attrib AGENT length = 8 format = 11. informat = 11.
label = 'AGENT';
attrib RNWALTERM length = 8 format = 6. informat = 6.
label = 'RNWALTERM';
attrib REVIEWIND length = $1 format = $1. informat = $1.
label = 'REVIEWIND';
attrib NTCETO length = $1 format = $1. informat = $1.
label = 'NTCETO';
attrib NTCEPROD length = $1 format = $1. informat = $1.
label = 'NTCEPROD';
attrib NTCETYPE length = $1 format = $1. informat = $1.
label = 'NTCETYPE';
attrib CLAUSEIND length = $1 format = $1. informat = $1.
label = 'CLAUSEIND';
attrib SPCLSIND length = $1 format = $1. informat = $1.
label = 'SPCLSIND';
attrib MSGIND length = $1 format = $1. informat = $1.
label = 'MSGIND';
attrib BUSNESSRC length = $4 format = $4. informat = $4.
label = 'BUSNESSRC';
attrib COYISSUED length = 8 format = 6. informat = 6.
label = 'COYISSUED';
attrib STISSUED length = $2 format = $2. informat = $2.
label = 'STISSUED';
attrib INSTALFRQ length = $1 format = $1. informat = $1.
label = 'INSTALFRQ';
attrib CANCDECLN length = $1 format = $1. informat = $1.
label = 'CANCDECLN';
attrib IMPEXCESS length = $1 format = $1. informat = $1.
label = 'IMPEXCESS';
attrib BRCHRESP length = 4 format = 6. informat = 6.
label = 'Branch Responsible';
attrib BUSDESC length = $1 format = $1. informat = $1.
label = 'BUSDESC';
attrib DISCGRP length = $1 format = $1. informat = $1.
label = 'DISCGRP';
attrib transactionDate length = 5 format = DATE9.
label = 'Transaction Date';
attrib POSTCODE length = $6 format = $6. informat = $6.
label = 'Postcode';
attrib CITY length = $40 format = $40. informat = $40.
label = 'City/Town/Suburb Name';
attrib COMSCALE length = 8
label = 'Commission Scale';
attrib INDEXPERC length = 8
label = 'INDEX PERC';
attrib AGTCLUSTR length = $4 informat = $EBCDIC004.
label = 'Agent Cluster';
attrib GRPNAME length = $60 informat = $EBCDIC060.
label = 'Group Name';
attrib CAMPCODE length = $10
label = 'CAMPCODE';
attrib LOYDATE length = 8
label = 'LOYDATE';
stop;
run;

%rcSet(&syserr);

/*---- Append new data ----*/


%put %str(NOTE: Appending data ...);

proc append base = dbnchpis.COVDTLS_PI_STG


data = &etls_lastTable (&SYSOPT) force;
run;

%rcSet(&syserr);

/*---- Create the indexes for a table ----*/


%put %str(NOTE: Creating indexes ...);
proc datasets lib = dbnchpis nolist;
modify COVDTLS_PI_STG;
index create coverageKey;
quit;

%rcSet(&syserr);

Protect PMOV - Functional Decomposition Analysis PAGE 95


proc datasets lib = work nolist nowarn memtype = (data view);
delete mapped;
quit;

/* Get number of records in table */


%let etls_recordsAfter = 0;
%macro etls_recordCheck;
%let etls_recCheckExist = %eval(%sysfunc(exist(dbnchpis.COVDTLS_PI_STG, DATA)) or
%sysfunc(exist(dbnchpis.COVDTLS_PI_STG, VIEW)));

%if (&etls_recCheckExist) %then


%do;
proc contents data = dbnchpis.COVDTLS_PI_STG out = work.etls_contents(keep =
nobs) noprint;
run;

data _null_;
set work.etls_contents (obs = 1);
call symput("etls_recordsAfter", left(put(nobs,32.)));
run;

proc datasets lib = work nolist nowarn memtype = (data view);


delete etls_contents;
quit;

%end;
%mend etls_recordCheck;
%etls_recordCheck;
%mend etls_loader;
%etls_loader;

P37
/*============================================================================*
* Step: NOT USED A55NWR2B.BI00K7O9 *
* Transform: Table Loader (Version 2) *
* Description: *
* *
* Source Table: SAS Splitter - work.W5KIDFJ3 A55NWR2B.BL00A9MO *
* Target Table: Protect Niche PI - Daily Master Key - A55NWR2B.BX004XI4 *
* dbnchpip.MASTERKEY_PI *
* *
* User Written: NOT USED A55NWR2B.AF00OCOP *
*============================================================================*/

/* Access the data for Protect Niche PI - Daily Base Layer PreLive Library */
LIBNAME dbnchpip SASSPDS GROUP='production' user="&uid" passwd = "&pw"
schema="D_B_PNCHPI_PRELIVE" HOST='sasap2' Serv='5090' ;
%rcSet(&syslibrc);

%let SYSLAST = %nrquote(work.W5KIDFJ3);

%let transformID = %quote(A55NWR2B.BI00K7O9);

%let trans_rc = 0;

%let _OUTPUT = %nrquote(dbnchpip.MASTERKEY_PI);

/*---- Start of User Written Code ----*/

/*---- End of User Written Code ----*/

%rcSet(&syserr);
%rcSet(&sqlrc);

User Defined Summary Statistics

P20
/*============================================================================*
* Step: User Define Summary Statistics A55NWR2B.BI00K7NK *
* Transform: User Define Summary Statistics *
* Description: User Define Summary Statistics *
* *

Protect PMOV - Functional Decomposition Analysis PAGE 96


* Source Table: PNCH_PREMTRAN - dbpncstg.PNCH_PREMTRAN A55NWR2B.BX001CW2 *
* Target Table: test1 - spdswork.W5J1AN5G A55NWR2B.BL00A9LQ *
*============================================================================*/

%let SYSLAST = %nrquote(dbpncstg.PNCH_PREMTRAN);

%let transformID = %quote(A55NWR2B.BI00K7NK);

%let trans_rc = 0;

/* Source table(s)/view(s) */
%let _INPUT0 = dbpncstg.PNCH_PREMTRAN;

/* Target table/view(s) */
%let _OUTPUT = spdswork.W5J1AN5G;
%let _OUTPUT0 = spdswork.W5J1AN5G;

/* Delete target table(s) */


proc datasets lib=spdswork nolist nowarn memtype = (data view);
delete W5J1AN5G;
quit;

/* Options */
%let options = ;
%let noprint = ;
%let outputOptions = ;
%let procOptions = %nrquote(NWAY MISSING);
%let statistics = %nrquote(SUM);
%let ClassColumns = COMPANY PRODUCT POLICY ITEMNO TRANCNT TRANDATE;
%let idColumns = TRANTIME ATRNTYPE;
%let whereEqual = %nrquote(where = %(rec_type_cd NE 3 and %(COMPANY in %(1,2,4,5,11%) OR
%(COMPANY=3 AND
put%(COMPRESS%(product%)||COMPRESS%(class%)||COMPRESS%(subclass%),$CIA_PDS1a.%) NE
%'CI%'%)%) AND PRODUCT NOT IN %(%'QTE%',%'CVN%'%)%));
%let VarColumns = TBASICPRM;

/* List of target columns to keep */


%let keep = COMPANY PRODUCT POLICY ITEMNO TRANDATE TRANTIME TRANCNT tbasicprm
ATRNTYPE;

%LET whereEqual = %UNQUOTE(&whereEqual);


%macro SummaryTable;

options mprint;

%if (%quote(&options) ne) %then


%do;
options &options;
%end;

%if (%upcase(&noprint) eq YES) %then


%let procOptions=NOPRINT &procOptions;

proc summary data=&SYSLAST(&whereEqual) &procOptions;


%if (%quote(&classColumns) ne) %then
%do;
class &classColumns;
%end;
%if (%quote(&idColumns) ne) %then
%do;
id &idColumns;
%end;
%if (%quote(&varColumns) ne) %then
%do;
var &varColumns;
%end;
output out=&_OUTPUT(&outputOptions)

%if (%quote(&statistics) ne) %then


%do;

%let stat=;
%let count=0;
%do %until (%quote(&stat) eq);
%let count=%eval(&count + 1);
%let stat=%scan(%quote(&statistics), &count, %quote( ));
%if (%quote(&stat) ne) %then
%do;
&stat=

Protect PMOV - Functional Decomposition Analysis PAGE 97


%end; /* stat is not blank */

%end; /* %do until no more stats */

%end; /* list of statistics is not blank */


;

run;
%RCSET(&syserr);
%mend SummaryTable;

%SummaryTable;

%rcSet(&syserr);
%rcSet(&sysrc);
%rcSet(&sqlrc);

User Written Code

P26
/*============================================================================*
* Step: User Written Code A55NWR2B.BI00K7NN *
* Transform: User Written Code *
* Description: *
* *
* Source Table: PNCH_AGENT - dbpncstg.PNCH_AGENT A55NWR2B.BX001CTT *
* Target Table: User Written Code Target - work.W667HWHQ A55NWR2B.BL00A9LV *
* *
* User Written: agent lookup A55NWR2B.AF00OCKA *
* agent lookup *
*============================================================================*/

%let SYSLAST = %nrquote(dbpncstg.PNCH_AGENT);

%let transformID = %quote(A55NWR2B.BI00K7NN);

%let trans_rc = 0;

%let _OUTPUT = %nrquote(work.W667HWHQ);

/*---- Start of User Written Code ----*/

*** Only take the last record for each maintenance ***;
DATA &_OUTPUT.;
SET &SYSLAST.;
BY md5_key row_effective_dt rec_type_cd;
IF last.md5_key AND rec_type_cd NE 3;
RUN;

/*---- End of User Written Code ----*/

%rcSet(&syserr);
%rcSet(&sqlrc);

Protect PMOV - Functional Decomposition Analysis PAGE 98

You might also like