Skip to content

Commit c0d140a

Browse files
authored
Merge pull request #129 from DaveHardingIndy/dave's-examples
Dave's Exampls
2 parents 25635d7 + 95eafb9 commit c0d140a

11 files changed

+1914
-0
lines changed

endevor/Field-Developed-Programs/PackageBuilder.moveout

Lines changed: 1262 additions & 0 deletions
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
/* REXX */
2+
3+
TRACE Off
4+
5+
/* Performs masking on DB2 DDL statements */
6+
/* Variable names in mask may use an underscore to */
7+
/* replace values preceeded by multiple words. */
8+
/* Masking characters: */
9+
/* */
10+
/* ? Copies a corresponding single character from source */
11+
/* field to target field */
12+
/* */
13+
/* * Copies 0 or more corresponding source characters */
14+
/* to target field */
15+
/* */
16+
/* - Removes the single character */
17+
/* */
18+
19+
WhatDDName = 'DB2MASK2'
20+
/* If DB2MASK# is allocated? If yes, then turn on Trace */
21+
isItThere = ,
22+
BPXWDYN("INFO FI(EDCHKDD) INRTDSN(DSNVAR) INRDSNT(myDSNT)")
23+
If isItThere = 0 then Trace r
24+
MY_RC = 0
25+
26+
/* DB2 Masking routine for named output */
27+
/* and possible output appending */
28+
Arg MYOUTDD
29+
30+
Mask. = ''
31+
/* Cature Mask names ane values */
32+
/* Read Endevor's Masking rules in the MASKING data */
33+
"EXECIO * DISKR MASKING (STEM mask. FINIS "
34+
35+
ListMaskWords = ''
36+
Do m# = 1 to mask.0
37+
msk = Strip(mask.m#)
38+
posEqual = Pos('=',msk)
39+
if posEqual = 0 then iterate ;
40+
msk = overlay(' ',msk,posEqual)
41+
text = Substr(msk,1,(posEqual-1))
42+
if Words(text)/= 1 then iterate
43+
MaskWord = Word(msk,1)
44+
Upper MaskWord
45+
ListMaskWords = ListMaskWords MaskWord
46+
posValue = Wordindex(msk,2)
47+
MaskValue = Strip(Substr(msk,posValue))
48+
Say 'Found Mask for' MaskWord '=' MaskValue
49+
MaskValue = Strip(MaskValue,"B",'"')
50+
MaskValue = Strip(MaskValue,"B","'")
51+
Mask.MaskWord = MaskValue
52+
End ; /* Do m# = 1 to mask.0 */
53+
54+
Say Copies('-',70)
55+
56+
/* Apply mask values to Bind statement */
57+
/* Read the DB2#STMT */
58+
"EXECIO * DISKR DB2#STMT (Stem db2. Finis "
59+
/* Scan each line of the Bind Statement */
60+
Do b# = 1 to db2.0
61+
DB2Statement = db2.b#
62+
If Words(DB2Statement) = 0 then Iterate ;
63+
64+
/* Scan each Word of the Bind Statement */
65+
Do m# = 1 to Words(ListMaskWords)
66+
MaskWord = Word(ListMaskWords,m#)
67+
SrchWord = Translate(MaskWord,' ','_') || ' '
68+
WhereMaskString = Pos(SrchWord,DB2Statement)
69+
If WhereMaskString < 1 then Iterate
70+
OrigMask = Mask.MaskWord
71+
Mask = OrigMask
72+
If Mask = '' then iterate
73+
Call DoSubstitution
74+
Leave
75+
End; /* Do m# = 1 to Words(ListMaskWords) */
76+
77+
End /* Do b# = 1 to db2.0 */
78+
79+
/* Write masked output to MYOUTDD */
80+
/* (Do not close output to allow appending of data */
81+
"EXECIO * DISKW" MYOUTDD "(Stem db2. "
82+
83+
EXIT (MY_RC) ;
84+
85+
DoSubstitution :
86+
87+
Say 'Before:' DB2Statement
88+
Sa= DB2Statement
89+
Sa= WhereMaskString
90+
Sa= MaskWord
91+
92+
/* Find Starting and Ending positions of the clause */
93+
/* to be masked */
94+
maskEnd = WhereMaskString + length(MaskWord) - 1
95+
ValueStarts = ,
96+
maskEnd + WordIndex(Substr(DB2Statement, maskEnd+1),1)
97+
BeforeChange = Word(Substr(DB2Statement, ValueStarts),1)
98+
valueEnd = ValueStarts + Length(BeforeChange) - 1
99+
100+
/* Apply Mask to clause within the DB2 bind */
101+
/* This routine applies values in 'Mask' */
102+
/* to the value in 'BeforeChange' */
103+
SupportedWildCards = '?*-'
104+
AfterChange = BeforeChange
105+
106+
If Mask = ' ' then Mask ='*' ;
107+
Howlong = Length(Mask) + Length(AfterChange)
108+
Do char# = 1 to Howlong
109+
Maskchar = Substr(Mask,char#,1) ;
110+
If maskchar = " " then Leave ;
111+
If maskchar = "?" then iterate ;
112+
If maskchar = "*" then,
113+
Do
114+
tail = Substr(Mask,char# + 1)
115+
Mask = AfterChange || tail;
116+
char# = Max(char#,length(AfterChange) )
117+
Iterate ;
118+
End;
119+
If maskchar = "-" then,
120+
Do
121+
tail = Substr(AfterChange,char# + 1)
122+
if char# > 1 then,
123+
head = Substr(AfterChange,1,char# - 1)
124+
else,
125+
head = ''
126+
AfterChange = head || tail;
127+
Iterate ;
128+
End;
129+
Maskchar = Substr(Mask,char#,1) ;
130+
AfterChange = Overlay(Maskchar,AfterChange,char#)
131+
If char# = Length(Mask) then,
132+
AfterChange = Substr(AfterChange,1,char#)
133+
End /* Do char# = 1 to Length(Mask) */
134+
135+
say 'Mask:' OrigMask
136+
If ValueStarts > 1 then,
137+
head = Substr(DB2Statement,1,ValueStarts -1)
138+
Else head = ''
139+
DB2Statement = head || AfterChange || ,
140+
Strip(Substr(DB2Statement,valueEnd + 1 ));
141+
Say 'After: ' DB2Statement
142+
Say Copies('-',70)
143+
144+
db2.b# = DB2Statement
145+
146+
Return
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* REXX */
2+
/* Find Native Stored Procedure qualifier & name */
3+
Arg WhatDD
4+
5+
"EXECIO * DISKR" WhatDD "( Stem Table. finis"
6+
do # = 1 to Table.0
7+
A = Table.#
8+
B = pos('CREATE PROCEDURE ',A)
9+
if B > 0 then do
10+
C = pos('.',A)
11+
C = C + 1
12+
Value = substr(A,C,32)
13+
Value = 'SPName ="' || Value || '"'
14+
Say 'DB2SNAME:' Value
15+
queue Value
16+
exit
17+
end
18+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* REXX */
2+
/*********************************************************************/
3+
/* THIS UTILITY READS A SUPFI BATCH REPORT TO DETERMINE IF A */
4+
/* STORED PROCEDURE EXISTS. */
5+
/* RC=0 MEANS THE STORED PROCEDURE IS NEW. RC=1 MEANS IT EXISTS */
6+
/*********************************************************************/
7+
'EXECIO * DISKR FILEIN (STEM TABLE.'
8+
DO # = 1 TO TABLE.0
9+
IF POS('| 0 |',TABLE.#) > 0 THEN EXIT(0)
10+
IF POS('| 1 |',TABLE.#) > 0 THEN EXIT(1)
11+
END
12+
SAY 'DB2SPCHK REXX ERROR: DID NOT FIND REPORT LINE'
13+
EXIT(12)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
CREATE PROCEDURE ????????.YIPPIE_KAY_YAY
2+
(
3+
OUT X CHAR(1) CCSID EBCDIC FOR SBCS DATA
4+
)
5+
VERSION V1
6+
LANGUAGE SQL
7+
DETERMINISTIC
8+
MODIFIES SQL DATA
9+
CALLED ON NULL INPUT
10+
DYNAMIC RESULT SETS 0
11+
DISABLE DEBUG MODE
12+
PARAMETER CCSID EBCDIC
13+
QUALIFIER YourQualifier
14+
PACKAGE OWNER YourOwner
15+
ASUTIME LIMIT 1000
16+
COMMIT ON RETURN NO
17+
INHERIT SPECIAL REGISTERS
18+
WLM ENVIRONMENT FOR DEBUG MODE YourDb2WLM
19+
CURRENT DATA NO
20+
DEGREE 1
21+
DYNAMICRULES RUN
22+
APPLICATION ENCODING SCHEME EBCDIC
23+
WITHOUT EXPLAIN
24+
WITHOUT IMMEDIATE WRITE
25+
WITHOUT KEEP DYNAMIC
26+
ISOLATION LEVEL CS
27+
OPTHINT ''
28+
RELEASE AT COMMIT
29+
REOPT NONE
30+
VALIDATE RUN
31+
ROUNDING DEC_ROUND_HALF_EVEN
32+
DATE FORMAT ISO
33+
DECIMAL( 15 )
34+
FOR UPDATE CLAUSE REQUIRED
35+
TIME FORMAT ISO
36+
BUSINESS_TIME SENSITIVE YES
37+
SYSTEM_TIME SENSITIVE YES
38+
ARCHIVE SENSITIVE YES
39+
APPLCOMPAT V12R1
40+
CONCENTRATE STATEMENTS OFF
41+
RETURN X;
42+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
See your site's CSIQCLS(ENBPIU00) member for the latest TableTool
2+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
ESYMBOLS TITLE 'SITE-WIDE SYMBOLICS TABLE'
2+
***********************************************************************
3+
* COPYRIGHT (C) 2022 BROADCOM. ALL RIGHTS RESERVED. *
4+
* NAME: ESYMBOLS *
5+
* DESCRIPTION: Site-Wide Symbolics Definition Table *
6+
* FUNCTION: Define symbolics for use in element type definitions *
7+
* and processors. *
8+
***********************************************************************
9+
* DEPLOY FOR TEST (D4T) MAPPING *
10+
***********************************************************************
11+
* ATST (DEV)
12+
$ESYMBOL SYMNAME=#ATSTD4T, X
13+
SYMDATA='Y'
14+
$ESYMBOL SYMNAME=#ATSTLDB, X
15+
SYMDATA='Your.Team.DEV.ATST.LOADLIB'
16+
$ESYMBOL SYMNAME=#ATSTLDC, X
17+
SYMDATA='Your.Team.DEV.ATST.CICSLOAD'
18+
$ESYMBOL SYMNAME=#ATSTLST, X
19+
SYMDATA='Your.Team.DEV.ATST.LISTLIB'
20+
$ESYMBOL SYMNAME=#ATSTDBR, X
21+
SYMDATA='Your.Team.DEV.ATST.DBRM'
22+
* BTST (DEV)
23+
$ESYMBOL SYMNAME=#BTSTD4T, X
24+
SYMDATA='Y'
25+
$ESYMBOL SYMNAME=#BTSTLDB, X
26+
SYMDATA='Your.Team.DEV.BTST.LOADLIB'
27+
$ESYMBOL SYMNAME=#BTSTLDC, X
28+
SYMDATA='Your.Team.DEV.BTST.CICSLOAD'
29+
$ESYMBOL SYMNAME=#BTSTLST, X
30+
SYMDATA='Your.Team.DEV.BTST.LISTLIB'
31+
$ESYMBOL SYMNAME=#BTSTDBR, X
32+
SYMDATA='Your.Team.DEV.BTST.DBRM'
33+
* CTST (DEV)
34+
$ESYMBOL SYMNAME=#CTSTD4T, X
35+
SYMDATA='Y'
36+
$ESYMBOL SYMNAME=#CTSTLDB, X
37+
SYMDATA='Your.Team.DEV.CTST.LOADLIB'
38+
$ESYMBOL SYMNAME=#CTSTLDC, X
39+
SYMDATA='Your.Team.DEV.CTST.CICSLOAD'
40+
$ESYMBOL SYMNAME=#CTSTLST, X
41+
SYMDATA='Your.Team.DEV.CTST.LISTLIB'
42+
$ESYMBOL SYMNAME=#CTSTDBR, X
43+
SYMDATA='Your.Team.DEV.CTST.DBRM'
44+
*
45+
*
46+
*
47+
*Symbol Definition Examples: *
48+
*
49+
* Example DSN High Level Qualifier:
50+
$ESYMBOL SYMNAME=#HLQ,SYMDATA='Your.Application.HLQ'
51+
*
52+
*
53+
***********************************************************************
54+
* LAST INVOCATION - END THE TABLE GENERATION
55+
*---------------------------------------------------------------------*
56+
$ESYMBOL CALL=END
57+
END

0 commit comments

Comments
 (0)