Skip to content

Commit 43ac52d

Browse files
Round two changes
Added the supporting rexx used by the utilities and updated the README
1 parent a62cdcb commit 43ac52d

File tree

5 files changed

+666
-1
lines changed

5 files changed

+666
-1
lines changed
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
/* REXX */
2+
3+
TRACE Off
4+
WhatDDName = 'DB2MASK$'
5+
/* If DB2MASK$ is allocated? If yes, then turn on Trace */
6+
isItThere = ,
7+
BPXWDYN("INFO FI(EDCHKDD) INRTDSN(DSNVAR) INRDSNT(myDSNT)")
8+
If isItThere = 0 then Trace r
9+
10+
MY_RC = 0
11+
12+
/* DB2 Masking routine for processors */
13+
14+
Mask. = ''
15+
/* Capture Mask names ane values */
16+
/* Read Endevor's Masking rules in the MASKING data */
17+
"EXECIO * DISKR MASKING (STEM mask. FINIS "
18+
19+
Do m# = 1 to mask.0
20+
msk = Strip(mask.m#)
21+
posEqual = Pos('=',msk)
22+
if posEqual = 0 then iterate ;
23+
msk = overlay(' ',msk,posEqual)
24+
text = Substr(msk,1,(posEqual-1))
25+
if Words(text)/= 1 then iterate
26+
MaskWord = Word(msk,1)
27+
posValue = Wordindex(msk,2)
28+
MaskValue = Strip(Substr(msk,posValue))
29+
Say 'Found Mask for' MaskWord '=' MaskValue
30+
MaskValue = Strip(MaskValue,"B",'"')
31+
MaskValue = Strip(MaskValue,"B","'")
32+
Mask.MaskWord = MaskValue
33+
End ; /* Do m# = 1 to mask.0 */
34+
35+
X = OUTTRAP(LINE.);
36+
37+
/* Apply mask values to Bind statement */
38+
/* Read the BINDSTMT */
39+
"EXECIO * DISKR BINDSTMT (Stem bind. Finis "
40+
41+
/* Scan each line of the Bind Statement */
42+
Do b# = 1 to bind.0
43+
BindStatement = Strip(substr(bind.b#,1,72))
44+
/* BindStatement = substr(BindStatement,1,72) */
45+
If Words(BindStatement) = 0 then Iterate ;
46+
If b# > 1 & b# < bind.0 &,
47+
Substr(BindStatement,Length(BindStatement),1) /= '-' then,
48+
BindStatement = BindStatement '-'
49+
50+
/* Scan each Word of the Bind Statement */
51+
Do wrd# = 1 to Words(BindStatement)
52+
pos_db2_1 = pos("BIND",BindStatement)
53+
pos_db2_2 = pos("PLAN",BindStatement)
54+
myword = Word(BindStatement,wrd#) ;
55+
myword = Translate(myword,' ','(')
56+
myword = Word(myword,1)
57+
Mask = Mask.myword
58+
If Mask = '' then iterate
59+
tmp = Translate(myword,' ','()-+');
60+
stmt = Word(tmp,1)
61+
Say 'Before:' BindStatement
62+
63+
/* Find Starting and Ending positions of the clause */
64+
/* to be masked */
65+
plc = Wordindex(BindStatement,wrd#)
66+
startpos = Pos('(',BindStatement,plc)
67+
endpos = Pos(')',BindStatement,plc)
68+
clauseLen = endpos - startpos + 1
69+
if plc = 0 then iterate ;
70+
MaskValue = Substr(BindStatement,startpos,clauseLen)
71+
MaskValue = Strip(MaskValue,'L','(')
72+
MaskValue = Strip(MaskValue,'T',')')
73+
MaskValue = Strip(MaskValue)
74+
If Pos('.',MaskValue) > 0 then,
75+
Do
76+
wherePeriod = Pos('.',MaskValue)
77+
Mask = Copies('-',wherePeriod) || Mask
78+
End
79+
OriginalLen = Length(MaskValue)
80+
ValueStarts = Pos(MaskValue,BindStatement) ;
81+
82+
/* Apply Mask to clause within the DB2 bind */
83+
Call ApplySingleMaskOverride ;
84+
say 'Mask:' Mask
85+
MaskValue = Strip(MaskValue)
86+
where = Wordindex(BindStatement,wrd#)
87+
newvalue = stmt'('MaskValue')'
88+
newvalue = Left(newvalue,Length(myword))
89+
If ValueStarts > 1 then,
90+
head = Substr(BindStatement,1,ValueStarts-1)
91+
Else head = ''
92+
BindStatement = head || MaskValue || ,
93+
Strip(Substr(BindStatement,ValueStarts+OriginalLen)) ;
94+
Say 'After: ' BindStatement
95+
Say Copies('-',70)
96+
End /* Do wrd# = 1 Words(BindStatement) */
97+
98+
bind.b# = BindStatement
99+
100+
End /* Do b# = 1 to bind.0 */
101+
102+
/* Replace the member with the Masked data */
103+
"EXECIO * DISKW BINDS (Stem bind. Finis "
104+
105+
EXIT (MY_RC) ;
106+
107+
ApplySingleMaskOverride:
108+
109+
/* This routine applies values in 'Mask' */
110+
/* to the value in 'MaskValue' */
111+
SupportedWildCards = '?*-^'
112+
113+
If Mask = ' ' then Mask ='*' ;
114+
Do char# = 1 to Length(Mask)
115+
maskchar = Substr(Mask,char#,1) ;
116+
If maskchar = "?" then iterate ;
117+
If maskchar = "*" then Leave ;
118+
If maskchar = "-" then,
119+
Do /* use one character from the value */
120+
tail = Substr(MaskValue,char# + 1)
121+
head = Substr(MaskValue,1,char#)
122+
MaskValue = Strip( head || tail) ;
123+
Iterate ;
124+
End;
125+
If maskchar = "^" then,
126+
Do /* eat one character from each .... */
127+
/* eat a MaskValue char */
128+
if char# > Length(MaskValue) then,
129+
tail = ''
130+
else,
131+
tail = Substr(MaskValue,char# + 1)
132+
if char# > 1 then,
133+
head = Substr(MaskValue,1,char# - 1)
134+
else,
135+
head = ''
136+
MaskValue = Strip( head || tail) ;
137+
/* eat a Mask char too */
138+
If char# > 1 then,
139+
Mask = Substr(Mask,1,(char#-1)) || Substr(Mask,(char#+1))
140+
Else,
141+
Mask = Substr(Mask,2)
142+
/* Mask char is changed for char# position */
143+
char# = char# - 1
144+
Iterate ;
145+
End;
146+
Maskchar = Substr(Mask,char#,1) ;
147+
MaskValue = Overlay(Maskchar,MaskValue,char#)
148+
If char# = Length(Mask) then,
149+
MaskValue = Substr(MaskValue,1,char#)
150+
End /* Do char# = 1 to Length(Mask) */
151+
152+
Return
153+
154+

endevor/Field-Developed-Programs/Table-Tool-Examples/README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Examples in this folder include:
1818
- EXAMPL#3 Add members of a PDS into Endevor
1919
- EXAMPL#4 Execute PDM to update elements out of sync.
2020
- EXAMPL#5 Report the total Track consumption of a list of datasets
21-
- EMPL#7XA Example processor that uses Table Tool to process JCLCheck data
21+
- EMPL#7XA Example processor that uses Table Tool to process JCLCheck data
2222
- EXAMPL#8 Report processor usage including UnUsed processors.
2323
- EXAMPLEG Report of counts for each processor group reference
2424
- EXAMPL1A Report Elements in DEV signed out to one userid
@@ -29,6 +29,18 @@ Examples in this folder include:
2929
- EXAMPL2P To Report Packages created over nnn days ago (using CSV data)
3030
- LISTDSNS From a Dataset mask, lists dataset names and attributes
3131
- PKGEMNTR To run the Package Monitor report
32+
- Commonly requested utilities and the rexx which support them:
33+
* CSV and TableTool emails element list to a distribution - need a report of what's in QA? need it emailed as an attachment?
34+
* CSV and TableTool shows processor group usage - too many processor groups? want to know which ones are used / not used?
35+
* CSV and TableTool finds and deletes unused processor groups - too many processor groups? want to find & delete the unused?
36+
* CSV and TableTool showing element counts for each inventory area - easy to read report of elements and key data fields.
37+
* TableTool builds a DB2 bindcard based on inventory area - dynamically build the bindcards based on system, stage, overrides, etc.
38+
* TableTool builds a DB2 bindcard based on YAML control tablen - dynamically build the bindcards based on a YAML control table.
39+
* CSV and TableTool examples in IEBUPDTE format - All of the above examples in singe member used as input to an IEBUPDTE job.
40+
* DB2MASK$ rexx to build DB2 bindcards - masking utility used by the DB2 bindcard utility
41+
* REX1LINE rexx to put processor group CSV data on one line - utility used by the processor group utiliites
42+
* REXMERGE rexx to merge CSV list element with CSV list processor group - utility used by the processor group utiliites
43+
* YAML2REX rexx to reformat YAML syntax to REXX - conversion utility used by the DB2 YAML bindcard utility
3244

3345
The **Table-Tool-CSV-Sorting** folder contains items that allow you to SORT CSV data prior to a Table Tool Execution
3446

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*****************************************************************\
2+
* Rexx routine to put move, gen, delete processor data onto one *
3+
* line. *
4+
\*****************************************************************/
5+
6+
'execio * diskr FILEIN (stem line.'
7+
do # = 1 to line.0
8+
writerec = 'N'
9+
skiprec = 'N'
10+
11+
if POS(' G ',line.#) > 0 then save1 = SUBSTR(line.#,1,48)
12+
if POS(' D ',line.#) > 0 then save2 = SUBSTR(line.#,39,10)
13+
if POS(' M ',line.#) > 0 then do
14+
save3 = SUBSTR(line.#,39,10)
15+
line.# = save1 save2 save3
16+
if POS('G *NOPROC* D *NOPROC* M *NOPROC*',line.#) > 0 then,
17+
skiprec = 'Y'
18+
if POS('G GPPROCSS D DPPROCSS M GPPROCSS',line.#) > 0 then,
19+
skiprec = 'Y'
20+
if skiprec = 'N' then writerec = 'Y'
21+
end
22+
23+
if writerec = 'Y' then queue line.#
24+
end
25+
26+
'EXECIO * DISKW FILEOUT ( FINIS'
27+
exit
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*****************************************************************\
2+
* Rexx routine to merge Endevor processor group data with *
3+
* element counts. *
4+
\*****************************************************************/
5+
6+
'execio * diskr FILEIN1 (stem file1.'
7+
'execio * diskr FILEIN2 (stem file2.'
8+
h1 = 'Env # System Type P.Group Generate Delete Mo'
9+
h2 = 've E.Count'
10+
header = h1 || h2
11+
queue header
12+
h1 = '-------- - -------- -------- -------- ---------- ---------- --'
13+
h2 = '-------- -------'
14+
header = h1 || h2
15+
queue header
16+
17+
do # = 1 to file1.0
18+
f1key = SUBSTR(file1.#,1,38)
19+
20+
do $ = 1 to file2.0
21+
f2key = SUBSTR(file2.$,1,38)
22+
ecount = SUBSTR(file2.$,39,7)
23+
if f1key = f2key then file1.# = SUBSTR(file1.#,1,71) ecount
24+
end
25+
26+
queue file1.#
27+
end
28+
29+
'EXECIO * DISKW FILEOUT ( FINIS'
30+
exit

0 commit comments

Comments
 (0)