SAS Documentation
SASĀ® Solution for Stress Testing
Reference manual - version 08.2021
Loading...
Searching...
No Matches
install_update_data_loaders.sas
1/* Solution id and installSampleModels */
2%let solution_id = %sysget(solution_id);
3%let installSampleModels = YES;*%sysfunc(coalescec(%sysget(installSampleModels), YES));
4
5/* Federated Area Id (as specified in SMC) */
6%let irm_fa_id = %sysget(irm_fa_id);
7%let rmc_fa_id = %sysget(rmc_fa_id);
8
9/* Make sure the rmc_fa_id parameter has been set */
10%if %sysevalf(%superq(rmc_fa_id) =, boolean) %then %do;
11 %let rmc_fa_id = rmc.*;
12%end;
13
14/* If solution id is missing, set it to the prefix of irm_fa_id*/
15%if %sysevalf(%superq(solution_id) =, boolean) %then %do;
16 %let solution_id = %substr(&irm_fa_id.,1,%index(&irm_fa_id.,%str(.))-1);
17%end;
18
19/* Get the path to the FA from metadata */
20%let irm_fa_path = %sysfunc(metadata_appprop(IRM Mid-Tier Server, com.sas.solutions.risk.irm.fa.&irm_fa_id.));
21
22/* Extract the irm folder name and the source path */
23%let fa_name = %scan(%bquote(&irm_fa_path.), -1, /\);
24%let source_path = %sysfunc(prxchange(s/[\\\/]&fa_name.$//i, -1, %bquote(&irm_fa_path.)));
25
26/* ***************************************************************************/
27/* Update sasautos and setup LUA paths */
28/* ***************************************************************************/
29
30/* Add macros to the auto search path */
31options insert = (sasautos = ("&source_path./&fa_name./source/sas/ucmacros"));
32
33/* Set SASAUTOS for RMC */
34%put NOTE: Input parameter RMC_FA_PATH has not been set.;
35%put NOTE: Fetching RMC federated area location from metadata searching for IRM Mid-Tier Server property: com.sas.solutions.risk.irm.fa.&rmc_fa_id.;
36%irm_set_fa_sasautos(fa_id = &rmc_fa_id.
37 , fa_path =
38 , mode = insert
39 , insert_after = &source_path./&fa_name.
40 , limit = 1
41 , outvar_prefix = irm_setup_rmc_fa
42 );
43
44/* Throw a warning if we haven't found any RMC federated area */
45%if(&irm_setup_rmc_fa_count. = 0) %then %do;
46 %put WARNING: Could not find any federated area with id: com.sas.solutions.risk.irm.fa.&rmc_fa_id.;
47%end;
48
49/* Set LUAPATH for the current FA */
50%irm_set_fa_luapath(fa_path = &source_path./&fa_name./source/lua
51 , mode = insert
52 );
53
54/* Add RMC to the LUAPATH */
55%irm_set_fa_luapath(fa_id = &rmc_fa_id.
56 , mode = insert
57 , insert_after = &source_path./&fa_name.
58 , limit = 1
59 );
60
61/* ***************************************************************************/
62/* Get the rmc version name from the rmc fa id */
63/* ***************************************************************************/
64
65%let rmc_version_nm = &rmc_fa_id.;
66
67%if "&rmc_version_nm." eq "rmc.*" %then %do;
68
69 /* Get the list of IRM federated areas matching the specified value */
70 %irm_get_swc_property(swc_name = IRM Mid-Tier Server
71 , property = com.sas.solutions.risk.irm.fa.(?!readonly.)&rmc_fa_id.
72 , debug = true
73 , outvar = swc_property_value
74 , out_ds = irm_federated_areas
75 , pattern_match_flg = Y
76 );
77
78 /* Sort in descending order */
79 proc sort data = irm_federated_areas;
80 by descending property_name;
81 run;
82
83 /* Get the top-most rmc federated area */
84 data _null_;
85 set irm_federated_areas (obs=1);
86 call symputx("rmc_version_nm", substr(property_name, index(property_name,".rmc.")+1), "L");
87 run;
88
89%end;
90
91%put NOTE: Using RMC version &rmc_version_nm. for Cycle data loader.;
92
93/* *********************************************************** */
94/* Initialize the macro variables and macros needed */
95/* *********************************************************** */
96
97/* Set the file path and file name macro variables */
98%let data_load_root = &source_path./rgf/data_loader_files;
99%let dynamic_field_location = &data_load_root./dynamic_fields;
100%let scripts_location = &source_path./rgf/sas/scripts;
101%let params_location = &scripts_location./script_params;
102%let workflow_location = &source_path./rgf/workflow_templates;
103%let data_loader_file = &solution_id._data_loader.xlsx;
104
105/* Create the dynamic_fields folder if it does not exist */
106options dlcreatedir;
107libname dl_dyn "&dynamic_field_location.";
108
109%macro readFileContent(resolve_fields =, file_location =);
110
111 length
112 _filepath_ $1024.
113 _record_ $32000.
114 _file_content_ $32000.
115 ;
116
117 drop
118 _filepath_
119 _record_
120 _file_content_
121 rx_path
122 fid
123 rc_fread
124 rc i
125 ;
126
127 array _resolve_fields_ {*} &resolve_fields.;
128
129 /* Compile Regex to identify file paths */
130 retain rx_path;
131 if _N_ = 1 then do;
132 rx_path = prxparse("/^((\\\\?|\/)?([^\\\/]*[\\\/])*)([^\\\/\.]+\.[^\\\/\.]+)$/i");
133 end;
134
135 /* Loop through the fields that might contain file paths */
136 do i = 1 to dim(_resolve_fields_);
137 if(prxmatch(rx_path, _resolve_fields_[i])) then do;
138 /* Initialize the variable that holds the content of the file */
139 call missing(_file_content_);
140 /* Set the filename */
141 _filepath_ = catx("/", %unquote(&file_location.), _resolve_fields_[i]);
142 rc = filename("fref", _filepath_);
143 if rc = 0 then do;
144 /* Open the file */
145 fid = fopen("fref");
146 if fid > 0 then do;
147 rc_fread = 0;
148 /* Loop through all records */
149 do while(rc_fread = 0);
150 /* Read a record to the file data buffer */
151 rc_fread = fread(fid);
152 if(rc_fread = 0) then do;
153 /* Copy the content of the file data buffer to the _record_ variable */
154 rc = fget(fid, _record_, 32000);
155 /* Append record to the _file_content_ */
156 _file_content_ = catt(_file_content_, "0a"x, _record_);
157 end; /* if(rc_fread = 0) */
158 end; /* Loop through all records */
159 /* Update the value of the code field */
160 _resolve_fields_[i] = _file_content_;
161 /* Close file */
162 rc = fclose(fid);
163 end; /* if fid > 0 */
164 else do;
165 put "WARNING: Could not open file " _filepath_;
166 end;
167 /* Deassign fref */
168 rc = filename("fref");
169 end; /* if rc = 0 */
170 else do;
171 put "WARNING: Could not assign a filename to " _filepath_;
172 end;
173
174 end;
175 end;
176
177%mend;
178
179/* *************************************** */
180/* Content Loader */
181/* *************************************** */
182data Content;
183 attrib
184 objectId length = $100. label = "businessObject.businessObjectId"
185 contentType length = $400. label = "content.contentType"
186 groupNo length = 8. label = "content.groupNo"
187 attachmentTypeCd length = $100. label = "content.attachmentTypeCd"
188 fileNm length = $256. label = "content.fileName"
189 newFileNm length = $256. label = "content.newName"
190 description length = $400. label = "content.description"
191 fileLocation length = $10000. label = "content.location"
192 objectSSC length = $10. label = "businessObject.sourceSystemCd"
193 contentSSC length = $10. label = "content.sourceSystemCd"
194 objectTypeNm length = $100. label = "businessObject.businessObjectTypeNm"
195 ;
196 infile "&data_load_root./Content.csv" dlm = "," dsd firstobs = 2;
197
198 /* Compile Regex to identify comments */
199 retain rx;
200 drop rx;
201 if _N_ = 1 then
202 rx = prxparse("/^\s*(#.*)?$/");
203
204 /* Read entire record */
205 input @;
206
207 /* Skip comments */
208 if not prxmatch(rx, _infile_);
209
210 input
211 objectId $
212 contentType $
213 groupNo
214 attachmentTypeCd $
215 fileNm $
216 newFileNm $
217 description $
218 fileLocation $
219 objectSSC $
220 contentSSC $
221 objectTypeNm $
222 ;
223
224 /* Resolve the file location in case it contains a macro variable */
225 fileLocation = resolve(fileLocation);
226
227run;
228
229/* *********************************************************** */
230/* Read Cycle Data Loader */
231/* *********************************************************** */
232
233data Cycle;
234 attrib
235 sourceSystemCd length = $10. label = "customObject214.sourceSystemCd"
236 custObj214Id length = $100. label = "customObject214.custObj214Id"
237 custObjNm length = $150. label = "customObject214.custObjNm"
238 versionNm length = $100. label = "customObject214.versionNm"
239 rmcVersionNm length = $100. label = "customObject214.rmcVersionNm"
240 entityId length = $256. label = "customObject214.entityId"
241 baseDt length = $100. label = "customObject214.baseDt"
242 cycleStartDt length = $100. label = "customObject214.cycleStartDt"
243 statusCd length = $100. label = "customObject214.statusCd"
244 userId length = $100. label = "customUser1.user.userId"
245 initialRunFlg length = $10. label = "customObject214.initialRunFlg"
246 iterationFlg length = $10. label = "customObject214.iterationFlg"
247 solutionCreatedIn length = $10. label = "customObject214.solutionCreatedIn"
248 auxOpDim1Id length = $10. label = "auxOpDim1.auxOpDim1Id"
249 auxOpDim1SSC length = $10. label = "auxOpDim1.sourceSystemCd"
250 auxOrgDim1Id length = $10. label = "auxOrgDim1.auxOrgDim1Id"
251 auxOrgDim1SSC length = $10. label = "auxOrgDim1.sourceSystemCd"
252 ;
253 infile "&data_load_root./Cycle.csv" dlm = "," dsd firstobs = 2;
254
255 /* Compile Regex to identify comments */
256 retain rx;
257 drop rx;
258 if _N_ = 1 then
259 rx = prxparse("/^\s*(#.*)?$/");
260
261 /* Read entire record */
262 input @;
263
264 /* Skip comments */
265 if not prxmatch(rx, _infile_);
266
267 input
268 sourceSystemCd $
269 custObj214Id $
270 custObjNm $
271 versionNm $
272 rmcVersionNm $
273 entityId $
274 baseDt $
275 cycleStartDt $
276 statusCd $
277 userId $
278 initialRunFlg $
279 iterationFlg $
280 solutionCreatedIn $
281 auxOpDim1Id $
282 auxOpDim1SSC $
283 auxOrgDim1Id $
284 auxOrgDim1SSC $
285 ;
286 rmcVersionNm = resolve(rmcVersionNm);
287run;
288
289/* *********************************************************** */
290/* Control Framework Loader */
291/* *********************************************************** */
292
293data controlFramework;
294 attrib
295 sourceSystemCd length = $10. label = "customObject240.sourceSystemCd"
296 custObj240Id length = $100. label = "customObject240.custObj240Id"
297 custObjNm length = $150. label = "customObject240.custObjNm"
298 custObjDesc length = $1024. label = "customObject240.custObjDesc"
299 ctrlRules_business length = $32000. label = "customObject240.cntrlRules_business"
300 cntrlRules_exception length = $32000. label = "customObject240.cntrlRules_exception"
301 cntrlRules_logAnalysis length = $32000. label = "customObject240.cntrlRules_logAnalysis"
302 cntrlRules_metricTrend length = $32000. label = "customObject240.cntrlRules_metricTrend"
303 cntrlRules_specific length = $32000. label = "customObject240.cntrlRules_specific"
304 cntrlRules_technical length = $32000. label = "customObject240.cntrlRules_technical"
305 controlRuleTypes length = $1024. label = "customObject240.controlRuleTypes"
306 versionNm length = $100. label = "customObject240.versionNm"
307 solutionCreatedIn length = $10. label = "customObject240.solutionCreatedIn"
308 auxOpDim1Id length = $10. label = "auxOpDim1.auxOpDim1Id"
309 auxOpDim1SSC length = $10. label = "auxOpDim1.sourceSystemCd"
310 auxOrgDim1Id length = $10. label = "auxOrgDim1.auxOrgDim1Id"
311 auxOrgDim1SSC length = $10. label = "auxOrgDim1.sourceSystemCd"
312 ;
313 infile "&data_load_root./ControlFramework.csv" dlm = "," dsd firstobs = 2;
314
315 /* Compile Regex to identify comments */
316 retain
317 rx_comment
318 rx_cr
319 ;
320
321 length
322 _optional_flg_ $1.
323 ;
324 drop
325 _optional_flg_
326 rx_comment
327 rx_cr
328 ;
329
330 if _N_ = 1 then do;
331 /* Regex to identify comments (#) and blank lines */
332 rx_comment = prxparse("/^\s*(#.*)?$/");
333 /* Regex to convert \n to carriage return "0a"x */
334 rx_cr = prxparse(cats("s/\\n/", "0a"x, "/"));
335 end;
336
337 /* Read entire record */
338 input @;
339
340 /* Skip comments */
341 if not prxmatch(rx_comment, _infile_);
342
343 input
344 _optional_flg_ $
345 sourceSystemCd $
346 custObj240Id $
347 custObjNm $
348 custObjDesc $
349 ctrlRules_business $
350 cntrlRules_exception $
351 cntrlRules_logAnalysis $
352 cntrlRules_metricTrend $
353 cntrlRules_specific $
354 cntrlRules_technical $
355 controlRuleTypes $
356 versionNm $
357 solutionCreatedIn $
358 auxOpDim1Id $
359 auxOpDim1SSC $
360 auxOrgDim1Id $
361 auxOrgDim1SSC $
362 ;
363
364 /* Convert \n into Excel Carriage Return ('0a'x) */
365 custObjDesc = prxchange(rx_cr, -1, custObjDesc);
366
367 %readFileContent(resolve_fields = ctrlRules_business cntrlRules_exception cntrlRules_logAnalysis cntrlRules_metricTrend cntrlRules_specific cntrlRules_technical
368 , file_location = "&dynamic_field_location."
369 );
370
371 %if(&installSampleModels. = NO) %then %do;
372 /* Load only the required models */
373 if(_optional_flg_ = "N");
374 %end;
375
376run;
377
378/* *********************************************************** */
379/* Read LinkInstances Data Loader */
380/* *********************************************************** */
381
382data LinkInstances;
383 attrib
384 linkInstanceSSC length = $10. label = "linkInstance.sourceSystemCd"
385 linkInstanceId length = $150. label = "linkInstance.linkInstanceId"
386 linkTypeSSC length = $10. label = "linkType.sourceSystemCd"
387 linkTypeId length = $150. label = "linkType.linkTypeId"
388 bo1SSC length = $10. label = "businessObject1.sourceSystemCd"
389 bo1Id length = $150. label = "businessObject1.businessObjectId"
390 bo2SSC length = $10. label = "businessObject2.sourceSystemCd"
391 bo2Id length = $150. label = "businessObject2.businessObjectId"
392 creator length = $100. label = "linkInstance.creator"
393 ;
394 infile "&data_load_root./LinkInstances.csv" dlm = "," dsd firstobs = 2;
395
396 /* Compile Regex to identify comments */
397 retain rx;
398 drop rx;
399 if _N_ = 1 then
400 rx = prxparse("/^\s*(#.*)?$/");
401
402 /* Read entire record */
403 input @;
404
405 /* Skip comments */
406 if not prxmatch(rx, _infile_);
407
408 input
409 linkInstanceSSC $
410 linkInstanceId $
411 linkTypeSSC $
412 linkTypeId $
413 bo1SSC $
414 bo1Id $
415 bo2SSC $
416 bo2Id $
417 creator $
418 ;
419run;
420
421/* *********************************************************** */
422/* Read Workflows Data Loader */
423/* *********************************************************** */
424
425data Workflows;
426 attrib
427 boTypeName length = $150. label = "businessObject.typeNm"
428 boSSC length = $10. label = "businessObject.sourceSystemCd"
429 boId length = $150. label = "businessObject.id"
430 templateName length = $150. label = "workflow.templateNm"
431 perspectiveId length = $10. label = "workflow.perspectiveId"
432 wfDelete length = $32. label = "workflow.delete"
433 wfClearRegistry length = $32. label = "workflow.clearregistry"
434 ;
435 infile "&data_load_root./Workflows.csv" dlm = "," dsd firstobs = 2;
436
437 /* Compile Regex to identify comments */
438 retain rx;
439 drop rx;
440 if _N_ = 1 then
441 rx = prxparse("/^\s*(#.*)?$/");
442
443 /* Read entire record */
444 input @;
445
446 /* Skip comments */
447 if not prxmatch(rx, _infile_);
448
449 input
450 boTypeName $
451 boSSC $
452 boId $
453 templateName $
454 perspectiveId $
455 wfDelete $
456 wfClearRegistry $
457 ;
458run;
459
460/* ************************************************* */
461/* Read Model data loader */
462/* ************************************************* */
463
464data model;
465 attrib
466 sourceSystemCd length = $10. label = "customObject1.sourceSystemCd"
467 custObj1Id length = $100. label = "customObject1.custObj1Id"
468 custObjNm length = $150. label = "customObject1.custObjNm"
469 custObjDesc length = $1024. label = "customObject1.custObjDesc"
470 independentRunFlg length = $10. label = "customObject1.independentRunFlg"
471 rolesForIndependentRun length = $1024. label = "customObject1.rolesForIndependentRun"
472 businessCatCd length = $150. label = "customObject1.businessCatCd"
473 typeCd length = $150. label = "customObject1.typeCd"
474 subTypeCd length = $32. label = "customObject1.subTypeCd"
475 versionId length = $32000. label = "customObject1.versionId"
476 engineCd length = $150. label = "customObject1.engineCd"
477 runTypeCd length = $150. label = "customObject1.runTypeCd"
478 statusCd length = $150. label = "customObject1.statusCd"
479 mipRunTypeCd length = $150. label = "customObject1.mipRunTypeCd"
480 parameters length = $32000. label = "customObject1.parameters"
481 codeEditor length = $32000. label = "customObject1.codeEditor"
482 mipModelingSystemName length = $150. label = "customObject1.mipModelingSystemName"
483 mipModelingSystemVersion length = $150. label = "customObject1.mipModelingSystemVersion"
484 mipModelingSystemWorkgroup length = $150. label = "customObject1.mipModelingSystemWorkgroup"
485 preCodeFlg length = $10. label = "customObject1.preCodeFlg"
486 postCodeFlg length = $10. label = "customObject1.postCodeFlg"
487 preCodeEditor length = $32000. label = "customObject1.preCodeEditor"
488 postCodeEditor length = $32000. label = "customObject1.postCodeEditor"
489 preMipFlg length = $10. label = "customObject1.preMipFlg"
490 postMipFlg length = $10. label = "customObject1.postMipFlg"
491 mipPreCodeEditor length = $32000. label = "customObject1.mipPreCodeEditor"
492 mipPostCodeEditor length = $32000. label = "customObject1.mipPostCodeEditor"
493 mipWeightedOutputVars length = $32000. label = "customObject1.mipWeightedOutputVars"
494 scenWeightFlg length = $10. label = "customObject1.scenWeightFlg"
495 bepConfigSetCd length = $32. label = "customObject1.bepConfigsetCd"
496 scenarioFlg length = $10. label = "customObject1.scenarioFlg"
497 solutionCreatedIn length = $10. label = "customObject1.solutionCreatedIn"
498 auxOpDim1Id_1 length = $10. label = "auxOpDim1[1].auxOpDim1Id"
499 auxOpDim1SSC_1 length = $10. label = "auxOpDim1[1].sourceSystemCd"
500 auxOpDim1Id_2 length = $10. label = "auxOpDim1[2].auxOpDim1Id"
501 auxOpDim1SSC_2 length = $10. label = "auxOpDim1[2].sourceSystemCd"
502 auxOpDim1Id_3 length = $10. label = "auxOpDim1[3].auxOpDim1Id"
503 auxOpDim1SSC_3 length = $10. label = "auxOpDim1[3].sourceSystemCd"
504 auxOrgDim1Id_1 length = $10. label = "auxOrgDim1[1].auxOrgDim1Id"
505 auxOrgDim1SSC_1 length = $10. label = "auxOrgDim1[1].sourceSystemCd"
506 auxOrgDim1Id_2 length = $10. label = "auxOrgDim1[2].auxOrgDim1Id"
507 auxOrgDim1SSC_2 length = $10. label = "auxOrgDim1[2].sourceSystemCd"
508 auxOrgDim1Id_3 length = $10. label = "auxOrgDim1[3].auxOrgDim1Id"
509 auxOrgDim1SSC_3 length = $10. label = "auxOrgDim1[3].sourceSystemCd"
510 refreshUsingFuncVals length = $5. label = "customObject1.refreshUsingFuncVals"
511 ;
512 infile "&data_load_root./Model.csv" dlm = "," dsd firstobs = 2;
513
514 /* Compile Regex to identify comments */
515 retain
516 rx_comment
517 rx_cr
518 ;
519
520 length
521 _optional_flg_ $1.
522 ;
523 drop
524 _optional_flg_
525 rx_comment
526 rx_cr
527 ;
528
529 if _N_ = 1 then do;
530 /* Regex to identify comments (#) and blank lines */
531 rx_comment = prxparse("/^\s*(#.*)?$/");
532 /* Regex to convert \n to carriage return "0a"x */
533 rx_cr = prxparse(cats("s/\\n/", "0a"x, "/"));
534 end;
535
536 /* Read entire record */
537 input @;
538
539 /* Skip comments */
540 if not prxmatch(rx_comment, _infile_);
541
542 input
543 _optional_flg_ $
544 sourceSystemCd $
545 custObj1Id $
546 custObjNm $
547 custObjDesc $
548 independentRunFlg $
549 rolesForIndependentRun $
550 businessCatCd $
551 typeCd $
552 subTypeCd $
553 versionId $
554 engineCd $
555 runTypeCd $
556 statusCd $
557 mipRunTypeCd $
558 parameters $
559 codeEditor $
560 mipModelingSystemName $
561 mipModelingSystemVersion $
562 mipModelingSystemWorkgroup $
563 preCodeFlg $
564 postCodeFlg $
565 preCodeEditor $
566 postCodeEditor $
567 preMipFlg $
568 postMipFlg $
569 mipPreCodeEditor $
570 mipPostCodeEditor $
571 mipWeightedOutputVars $
572 scenWeightFlg $
573 bepConfigsetCd $
574 scenarioFlg $
575 solutionCreatedIn $
576 auxOpDim1Id_1 $
577 auxOpDim1SSC_1 $
578 auxOrgDim1Id_1 $
579 auxOrgDim1SSC_1 $
580 auxOrgDim1Id_2 $
581 auxOrgDim1SSC_2 $
582 auxOrgDim1Id_3 $
583 auxOrgDim1SSC_3 $
584 refreshUsingFuncVals $
585 ;
586
587 /* If multiple Solutions Shared With are provided, there needs to be an equivalent number of Solution Created In nodes */
588 if not missing(auxOrgDim1Id_2) and not missing(auxOrgDim1SSC_2) then do;
589 auxOpDim1Id_2 = auxOpDim1Id_1;
590 auxOpDim1SSC_2 = auxOpDim1SSC_1;
591 end;
592 if not missing(auxOrgDim1Id_3) and not missing(auxOrgDim1SSC_3) then do;
593 auxOpDim1Id_3 = auxOpDim1Id_1;
594 auxOpDim1SSC_3 = auxOpDim1SSC_1;
595 end;
596
597 /* Convert \n into Excel Carriage Return ('0a'x) */
598 custObjDesc = prxchange(rx_cr, -1, custObjDesc);
599
600 %readFileContent(resolve_fields = parameters codeEditor preCodeEditor postCodeEditor mipPreCodeEditor mipPostCodeEditor
601 , file_location = %bquote(ifc(vname(_resolve_fields_[i]) = "parameters", "&params_location.", "&scripts_location."))
602 );
603
604 %if(&installSampleModels. = NO) %then %do;
605 /* Load only the required models */
606 if(_optional_flg_ = "N");
607 %end;
608
609run;
610
611/* *********************************************************** */
612/* Read Workflow Template Data Loader */
613/* *********************************************************** */
614
615data workflowTemplate;
616 attrib
617 sourceSystemCd length = $10. label = "customObject225.sourceSystemCd"
618 custObj225Id length = $100. label = "customObject225.custObj225Id"
619 custObjNm length = $150. label = "customObject225.custObjNm"
620 fileNm length = $512. label = "customObject225.fileNm"
621 wf_template_name length = $512. label = "customObject225.wfTemplateNm"
622 wf_activity_model_mapping length = $32000. label = "customObject225.wfActivityModelMapping"
623 wf_flow_diagram length = $32000. label = "customObject225.wfDiagram"
624 reviewActivities length = $32000. label = "customObject225.reviewActivities"
625 wf_tag length = $100. label = "customObject225.wfTag"
626 taskDetails length = $32000. label = "customObject225.taskDetails"
627 solutionCreatedIn length = $10. label = "customObject225.solutionCreatedIn"
628 auxOpDim1Id length = $10. label = "auxOpDim1.auxOpDim1Id"
629 auxOpDim1SSC length = $10. label = "auxOpDim1.sourceSystemCd"
630 auxOrgDim1Id length = $10. label = "auxOrgDim1.auxOrgDim1Id"
631 auxOrgDim1SSC length = $10. label = "auxOrgDim1.sourceSystemCd"
632 ;
633 infile "&data_load_root./WorkflowTemplate.csv" dlm = "," dsd firstobs = 2;
634
635 /* Compile Regex to identify comments */
636 retain
637 rx_comment
638 rx_cr
639 ;
640
641 drop
642 rx_comment
643 ;
644
645 if _N_ = 1 then do;
646 /* Regex to identify comments (#) and blank lines */
647 rx_comment = prxparse("/^\s*(#.*)?$/");
648 end;
649
650 /* Read entire record */
651 input @;
652
653 /* Skip comments */
654 if not prxmatch(rx_comment, _infile_);
655
656 input
657 sourceSystemCd $
658 custObj225Id $
659 custObjNm $
660 fileNm $
661 wf_template_name $
662 wf_activity_model_mapping $
663 wf_flow_diagram $
664 reviewActivities $
665 wf_tag $
666 taskDetails $
667 solutionCreatedIn $
668 auxOpDim1Id $
669 auxOpDim1SSC $
670 auxOrgDim1Id $
671 auxOrgDim1SSC $
672 ;
673
674 wf_template_name = cats("wf_template_name","_",fileNm);
675 wf_activity_model_mapping = cats("wf_activity_model_mapping","_",fileNm);
676 wf_flow_diagram = cats("wf_flow_diagram","_",fileNm);
677 reviewActivities = cats("reviewActivities","_",fileNm);
678 wf_tag = cats("wf_tag","_",fileNm);
679 taskDetails = cats("taskDetails","_",fileNm);
680run;
681
682/* Parse the workflow template json files */
683%let resolve_json_fields = wf_activity_model_mapping wf_flow_diagram reviewActivities taskDetails;
684%let resolve_txt_fields = wf_template_name wf_tag;
685
686proc sql noprint;
687 select distinct fileNm
688 into :file_list separated by " "
689 from work.workflowTemplate;
690quit;
691
692proc lua restart;
693 submit;
694 local JSON = require 'risk.common.json'
695 local stringutils = require 'sas.risk.utils.stringutils'
696 --[[Loop through each workflow template file]]--
697 local file_list = stringutils.split(sas.symget("file_list"), " ")
698 for i,file_name in ipairs(file_list) do
699
700 --[[Read the contents of the input json file from workflow_location/file_name]]--
701 local file_location = sas.symget("workflow_location")
702 sas.print("Reading file "..file_location.."/"..file_name)
703 file = io.open(file_location.."/"..file_name, "r")
704 local fileJson = JSON:decode(file:read("*all"))
705 io.close(file)
706
707 local out_file_location = sas.symget("dynamic_field_location")
708 local resolve_json_fields = stringutils.split(sas.symget("resolve_json_fields"), " ")
709 local resolve_txt_fields = stringutils.split(sas.symget("resolve_txt_fields"), " ")
710
711 --[[For each JSON field that needs to be resolved, create a corresponding json file]]--
712 for j,field in ipairs(resolve_json_fields) do
713 sas.print("Creating file "..out_file_location.."/"..field.."_"..file_name)
714 out_file = io.open(out_file_location.."/"..field.."_"..file_name, "w")
715 io.output(out_file)
716 io.write(JSON:encode(fileJson[field]))
717 io.close(out_file)
718 end
719 --[[For each text field that needs to be resolved, create a corresponding json file]]--
720 for k,field in ipairs(resolve_txt_fields) do
721 sas.print("Creating file "..out_file_location.."/"..field.."_"..file_name)
722 out_file = io.open(out_file_location.."/"..field.."_"..file_name, "w")
723 io.output(out_file)
724 io.write(fileJson[field])
725 io.close(out_file)
726 end
727
728 end
729 endsubmit;
730run;
731
732/* Update the workflow template data loader */
733data workflowTemplate;
734 set workflowTemplate;
735
736 /* Read the json/text fields from the json files */
737 %readFileContent(resolve_fields =&resolve_json_fields. &resolve_txt_fields.
738 , file_location = "&dynamic_field_location.");
739run;
740
741/* ************************************************* */
742/* Read Data Map Loader */
743/* ************************************************* */
744
745data dataMap;
746 attrib
747 sourceSystemCd length = $10. label = "customObject220.sourceSystemCd"
748 custObj220Id length = $100. label = "customObject220.custObj220Id"
749 custObjNm length = $150. label = "customObject220.custObjNm"
750 custObjDesc length = $1024. label = "customObject220.custObjDesc"
751 mappingInfo length = $32000. label = "customObject220.mappingInfo"
752 mapType length = $150. label = "customObject220.mapType"
753 solutionCreatedIn length = $10. label = "customObject220.solutionCreatedIn"
754 auxOpDim1Id_1 length = $10. label = "auxOpDim1[1].auxOpDim1Id"
755 auxOpDim1SSC_1 length = $10. label = "auxOpDim1[1].sourceSystemCd"
756 auxOpDim1Id_2 length = $10. label = "auxOpDim1[2].auxOpDim1Id"
757 auxOpDim1SSC_2 length = $10. label = "auxOpDim1[2].sourceSystemCd"
758 auxOrgDim1Id_1 length = $10. label = "auxOrgDim1[1].auxOrgDim1Id"
759 auxOrgDim1SSC_1 length = $10. label = "auxOrgDim1[1].sourceSystemCd"
760 auxOrgDim1Id_2 length = $10. label = "auxOrgDim1[2].auxOrgDim1Id"
761 auxOrgDim1SSC_2 length = $10. label = "auxOrgDim1[2].sourceSystemCd"
762 ;
763 infile "&data_load_root./DataMap.csv" dlm = "," dsd firstobs = 2;
764
765 /* Compile Regex to identify comments */
766 retain
767 rx_comment
768 rx_cr
769 ;
770
771 drop
772 rx_comment
773 rx_cr
774 ;
775
776 if _N_ = 1 then do;
777 /* Regex to identify comments (#) and blank lines */
778 rx_comment = prxparse("/^\s*(#.*)?$/");
779 /* Regex to convert \n to carriage return "0a"x */
780 rx_cr = prxparse(cats("s/\\n/", "0a"x, "/"));
781 end;
782
783 /* Read entire record */
784 input @;
785
786 /* Skip comments */
787 if not prxmatch(rx_comment, _infile_);
788
789 input
790 sourceSystemCd $
791 custObj220Id $
792 custObjNm $
793 custObjDesc $
794 mappingInfo $
795 mapType $
796 solutionCreatedIn $
797 auxOpDim1Id_1 $
798 auxOpDim1SSC_1 $
799 auxOrgDim1Id_1 $
800 auxOrgDim1SSC_1 $
801 auxOrgDim1Id_2 $
802 auxOrgDim1SSC_2 $
803 ;
804
805 /* If multiple Solutions Shared With are provided, there needs to be an equivalent number of Solution Created In nodes */
806 if not missing(auxOrgDim1Id_2) and not missing(auxOrgDim1SSC_2) then do;
807 auxOpDim1Id_2 = auxOpDim1Id_1;
808 auxOpDim1SSC_2 = auxOpDim1SSC_1;
809 end;
810
811 /* Convert \n into Excel Carriage Return ('0a'x) */
812 custObjDesc = prxchange(rx_cr, -1, custObjDesc);
813
814 %readFileContent(resolve_fields = mappingInfo
815 , file_location = "&dynamic_field_location."
816 );
817
818run;
819
820/* ************************************ */
821/* Solution Created In */
822/* ************************************ */
823data SolutionCreatedInDimension;
824 attrib
825 nodeId length = $100. label = "auxOpDim1.auxOpDim1Id"
826 nodeNm length = $150. label = "auxOpDim1.auxOpDim1Nm"
827 nodeDesc length = $150. label = "auxOpDim1.auxOpDim1Desc"
828 nodeSSC length = $10. label = "auxOpDim1.sourceSystemCd"
829 ;
830 infile "&data_load_root./SolutionCreatedInDimension.csv" dlm = "," dsd firstobs = 2;
831
832 /* Compile Regex to identify comments */
833 retain rx;
834 drop rx;
835 if _N_ = 1 then
836 rx = prxparse("/^\s*(#.*)?$/");
837
838 /* Read entire record */
839 input @;
840
841 /* Skip comments */
842 if not prxmatch(rx, _infile_);
843
844 input
845 nodeId $
846 nodeNm $
847 nodeDesc $
848 nodeSSC $
849 ;
850run;
851
852/* ************************************* */
853/* Solution Shared With */
854/* ************************************* */
855data SolutionsSharedWithDimension;
856 attrib
857 nodeId length = $100. label = "auxOrgDim1.auxOrgDim1Id"
858 nodeNm length = $150. label = "auxOrgDim1.auxOrgDim1Nm"
859 nodeDesc length = $150. label = "auxOrgDim1.auxOrgDim1Desc"
860 nodeSSC length = $10. label = "auxOrgDim1.sourceSystemCd"
861 ;
862 infile "&data_load_root./SolutionsSharedWithDimension.csv" dlm = "," dsd firstobs = 2;
863
864 /* Compile Regex to identify comments */
865 retain rx;
866 drop rx;
867 if _N_ = 1 then
868 rx = prxparse("/^\s*(#.*)?$/");
869
870 /* Read entire record */
871 input @;
872
873 /* Skip comments */
874 if not prxmatch(rx, _infile_);
875
876 input
877 nodeId $
878 nodeNm $
879 nodeDesc $
880 nodeSSC $
881 ;
882run;
883
884/* ********************************** */
885/* Named List Options */
886/* ********************************** */
887data NamedListOptions;
888 attrib
889 listNm length = $100. label = "namedList.listNm"
890 optionCd length = $32. label = "namedList.optionCd"
891 ;
892 infile "&data_load_root./NamedListOptions.csv" dlm = "," dsd firstobs = 2;
893
894 /* Compile Regex to identify comments */
895 retain rx;
896 drop rx;
897 if _N_ = 1 then
898 rx = prxparse("/^\s*(#.*)?$/");
899
900 /* Read entire record */
901 input @;
902
903 /* Skip comments */
904 if not prxmatch(rx, _infile_);
905
906 input
907 listNm $
908 optionCd $
909 ;
910run;
911
912/* *************************************** */
913/* Named List Translations */
914/* *************************************** */
915data NamedListTranslations;
916 attrib
917 listNm length = $100. label = "namedList.listNm"
918 optionCd length = $100. label = "namedList.optionCd"
919 languageCd length = $10. label = "businessObjectLocalization.languageCd"
920 descTxt length = $250. label = "businessObjectLocalization.descTxt"
921 helpTxt length = $250. label = "businessObjectLocalization.helpTxt"
922 nameTxt length = $250. label = "businessObjectLocalization.nameTxt"
923 ;
924 infile "&data_load_root./NamedListTranslations.csv" dlm = "," dsd firstobs = 2;
925
926 /* Compile Regex to identify comments */
927 retain rx;
928 drop rx;
929 if _N_ = 1 then
930 rx = prxparse("/^\s*(#.*)?$/");
931
932 /* Read entire record */
933 input @;
934
935 /* Skip comments */
936 if not prxmatch(rx, _infile_);
937
938 input
939 listNm $
940 optionCd $
941 languageCd $
942 descTxt $
943 helpTxt $
944 nameTxt $
945 ;
946run;
947
948/* *********************************************************** */
949/* Link Type Loaders */
950/* *********************************************************** */
951
952data LinkTypes;
953 attrib
954 sourceSystemCd length = $10. label = "linkType.sourceSystemCd"
955 linkTypeId length = $100. label = "linkType.linkTypeId"
956 businessObjectTypeNm1 length = $100. label = "linkType.businessObjectTypeNm1"
957 businessObjectTypeNm2 length = $100. label = "linkType.businessObjectTypeNm2"
958 defaultLanguageCd length = $10. label = "linkType.defaultLanguageCd"
959 otherLanguageCds length = $10000. label = "linkType.otherLanguageCds"
960 name1 length = $100. label = "linkType.name1"
961 description1 length = $250. label = "linkType.description1"
962 help1 length = $100. label = "linkType.help1"
963 name2 length = $100. label = "linkType.name2"
964 description2 length = $250. label = "linkType.description2"
965 help2 length = $100. label = "linkType.help2"
966 ;
967 infile "&data_load_root./LinkTypes.csv" dlm = "," dsd firstobs = 2;
968
969 /* Compile Regex to identify comments */
970 retain rx;
971 drop rx;
972 if _N_ = 1 then
973 rx = prxparse("/^\s*(#.*)?$/");
974
975 /* Read entire record */
976 input @;
977
978 /* Skip comments */
979 if not prxmatch(rx, _infile_);
980
981 input
982 sourceSystemCd $
983 linkTypeId $
984 businessObjectTypeNm1 $
985 businessObjectTypeNm2 $
986 defaultLanguageCd $
987 otherLanguageCds $
988 name1 $
989 description1 $
990 help1 $
991 name2 $
992 description2 $
993 help2 $
994 ;
995run;
996
997/* *********************************************************** */
998/* Link Type Translation Loaders */
999/* *********************************************************** */
1000
1001data LinkTypeTranslations;
1002 attrib
1003 linkTypeId length = $100. label = "linkType.linkTypeId"
1004 sourceSystemCd length = $10. label = "linkType.sourceSystemCd"
1005 languageCd length = $10. label = "businessObjectLocalization.languageCd"
1006 name1Txt length = $250. label = "businessObjectLocalization.name1Txt"
1007 desc1Txt length = $250. label = "businessObjectLocalization.desc1Txt"
1008 help1Txt length = $250. label = "businessObjectLocalization.help1Txt"
1009 name2Txt length = $250. label = "businessObjectLocalization.name2Txt"
1010 desc2Txt length = $250. label = "businessObjectLocalization.desc2Txt"
1011 help2Txt length = $250. label = "businessObjectLocalization.help2Txt"
1012 ;
1013
1014 infile "&data_load_root./LinkTypeTranslations.csv" dlm = "," dsd firstobs = 2 encoding='utf-8';
1015
1016 /* Read entire record */
1017 input @;
1018
1019 /* Compile Regex to identify comments */
1020 retain rx;
1021 drop rx;
1022 if _N_ = 1 then
1023 rx = prxparse("/^\s*(#.*)?$/");
1024
1025 /* Skip comments */
1026 if not prxmatch(rx, _infile_);
1027
1028 input
1029 linkTypeId $
1030 sourceSystemCd $
1031 languageCd $
1032 name1Txt $
1033 desc1Txt $
1034 help1Txt $
1035 name2Txt $
1036 desc2Txt $
1037 help2Txt $
1038 ;
1039
1040run;
1041
1042/* *************************************** */
1043/* Create Excel Data Loader */
1044/* *************************************** */
1045
1046proc export data = work.Content
1047 dbms = xlsx
1048 outfile = "&data_load_root./&data_loader_file."
1049 replace
1050 label;
1051 sheet = "Content";
1052run;
1053
1054proc export data = work.Cycle
1055 dbms = xlsx
1056 outfile = "&data_load_root./&data_loader_file."
1057 replace
1058 label;
1059 sheet = "Cycle";
1060run;
1061
1062proc export data = work.controlFramework
1063 dbms = xlsx
1064 outfile = "&data_load_root./&data_loader_file."
1065 replace
1066 label;
1067 sheet = "ControlFramework";
1068run;
1069
1070proc export data = work.LinkInstances
1071 dbms = xlsx
1072 outfile = "&data_load_root./&data_loader_file."
1073 replace
1074 label;
1075 sheet = "LinkInstances";
1076run;
1077
1078proc export data = work.Workflows
1079 dbms = xlsx
1080 outfile = "&data_load_root./&data_loader_file."
1081 replace
1082 label;
1083 sheet = "Workflows";
1084run;
1085
1086proc export data = work.Model
1087 dbms = xlsx
1088 outfile = "&data_load_root./&data_loader_file."
1089 replace
1090 label;
1091 sheet = "Model";
1092run;
1093
1094proc export data = work.workflowTemplate
1095 dbms = xlsx
1096 outfile = "&data_load_root./&data_loader_file."
1097 replace
1098 label;
1099 sheet = "WorkflowTemplate";
1100run;
1101
1102proc export data = work.dataMap
1103 dbms = xlsx
1104 outfile = "&data_load_root./&data_loader_file."
1105 replace
1106 label;
1107 sheet = "DataMap";
1108run;
1109
1110proc export data = work.SolutionCreatedInDimension
1111 dbms = xlsx
1112 outfile = "&data_load_root./&data_loader_file."
1113 replace
1114 label;
1115 sheet = "SolutionCreatedInDimension";
1116run;
1117
1118proc export data = work.SolutionsSharedWithDimension
1119 dbms = xlsx
1120 outfile = "&data_load_root./&data_loader_file."
1121 replace
1122 label;
1123 sheet = "SolutionsSharedWithDimension";
1124run;
1125
1126proc export data = work.NamedListOptions
1127 dbms = xlsx
1128 outfile = "&data_load_root./&data_loader_file."
1129 replace
1130 label;
1131 sheet = "NamedListOptions";
1132run;
1133
1134proc export data = work.NamedListTranslations
1135 dbms = xlsx
1136 outfile = "&data_load_root./&data_loader_file."
1137 replace
1138 label;
1139 sheet = "NamedListTranslations";
1140run;
1141
1142proc export data = work.LinkTypes
1143 dbms = xlsx
1144 outfile = "&data_load_root./&data_loader_file."
1145 replace
1146 label;
1147 sheet = "LinkTypes";
1148run;
1149
1150proc export data = work.LinkTypeTranslations
1151 dbms = xlsx
1152 outfile = "&data_load_root./&data_loader_file."
1153 replace
1154 label;
1155 sheet = "LinkTypeTranslations";
1156run;
1157
1158/* Create data_load_sequence.txt */
1159data _null_;
1160 file "&data_load_root./data_load_sequence.txt";
1161 put "&data_loader_file.";
1162run;