I want to validate JCL parameters by REXX.
Like it should check for "CLASS", "MSGLEVEL", "MSGCLASS", jobname, "NOTIFY" etc.. and give the values in a report format...
card = left(left(card,71),80)
p_ = pos("PARM.",card)
if p_ <> 0 then ,
card = overlay("PARM^",card,p_,5)
if stmt_name = "" then do
if substr(card,3,1) = " " then do
stmt_name = "NONAME"
card = strip(substr(card,3))
end
else do
stmt_name = strip(word(substr(card,3),1))
card = strip(substr(card,3))
card = strip(delword(card,1,1))
end
stmt_oper = word(card,1)
card = strip(delword(card,1,1)) || " "
end
else do
card = strip(substr(card,3)) || " "
end
_b = 1
_a = pos(apostr,card)
do while ( _a > 0 )
_b = _a
_a = pos(apostr,card,_b+1)
end
wp = wordpos("VOLUME",keyw_tabl)
if wp > 0 then do
keyw_tabl = delword(keyw_tabl,wp,1)
keyw_coun = keyw_coun - 1
drop VOLUME
end
wp = wordpos("DD.VOLUME",keyw_tabl)
if wp > 0 then do
keyw_tabl = delword(keyw_tabl,wp,1)
keyw_coun = keyw_coun - 1
drop DD.VOLUME
end
end
if __convvol = 1 & ,
symbol("DD.VOL") = "VAR" Then do
zvlser = $extract("SER=",$strip(dd.vol,"(",")"))
if zvlser = "" then do
drop VOL
wp = wordpos("VOL",keyw_tabl)
if wp > 0 then do
keyw_tabl = delword(keyw_tabl,wp,1)
keyw_coun = keyw_coun - 1
end
drop DD.VOL
wp = wordpos("DD.VOL",keyw_tabl)
if wp > 0 then do
keyw_tabl = delword(keyw_tabl,wp,1)
keyw_coun = keyw_coun - 1
end
end
else ,
dd.vol = "SER=" || zvlser
trace "O"
end
if __convspc = 1 & ,
symbol("DD.SPACE") = "VAR" Then do
if datatype(zunits) = "NUM" then do
rectrk = $trkbal(zunits)
prispc = ( prispc % rectrk ) + 1
if secspc <> "" & ,
secspc <> 0 then do
secspc = ( secspc % rectrk ) + 1
end
zunits = "TRK"
end
if zunits = "TRK" then do
prispc = ( prispc % dt.?trkscyl.devtype ) + 1
if secspc <> "" & ,
secspc <> 0 then do
secspc = ( secspc % dt.?trkscyl.devtype ) + 1
end
zunits = "CYL"
end
prispc = $round(prispc,8)
if secspc <> "" & ,
secspc <> 0 then do
sectmp = prispc % 5 + 1
if sectmp > secspc then ,
secspc = sectmp
secspc = $round(secspc,8)
zalloc = $replace(2,zalloc,secspc)
if secspc > prispc then ,
prispc = secspc
end
zalloc = $replace(1,zalloc,prispc)
if dirblk <> "" & ,
dirblk <> 0 then do
dirblk = $round(dirblk,dt.?dirblks.devtype) - 1
zalloc = $replace(3,zalloc,dirblk)
end
zalloc = "(" || zalloc || ")"
zspace = $replace(1,zspace,zunits)
zspace = $replace(2,zspace,zalloc)
dd.space = "(" || zspace || ")"
end
if __convdcb = 1 & ,
symbol("DD.DCB") = "VAR" Then do
zdcb = $strip(dd.dcb,"(",")")
zrecfm = $extract("RECFM=",zdcb)
zlrecl = $extract("LRECL=",zdcb)
zblksz = $extract("BLKSIZE=",zdcb)
zdsorg = $extract("DSORG=",zdcb)
/*
say "****** dsname >>" || dd.dsn || "<<"
say "****** zdcb >>" || zdcb || "<<"
say "****** zrecfm >>" || zrecfm || "<<"
say "****** zlrecl >>" || zlrecl || "<<"
say "****** zblksz >>" || zblksz || "<<"
say "****** zdsorg >>" || zdsorg || "<<"
*/
select
when zrecfm = "U" | ,
zrecfm = "VB" | ,
zrecfm = "VBA" then do
if zblksz = 1024 then do
end
else do
zblksz = dt.?blksize.devtype
zdcb = $replace("BLKSIZE=",zdcb,zblksz)
end
end
when zrecfm = "FB" then do
if zblksz = 80 | ,
zblksz = 800 then do
end
else do
zblksz = zlrecl * ( dt.?blksize.devtype % zlrecl )
zdcb = $replace("BLKSIZE=",zdcb,zblksz)
end
end
otherwise nop
end
dd.dcb = "(" || zdcb || ")"
end
insert_ = 0
wstr = string
llen = 0
do while ( pos(left(wstr,1),head) > 0 )
llen = llen + 1
wstr = substr(wstr,2)
end
wstr = reverse(wstr)
rlen = 0
do while ( pos(left(wstr,1),tail) > 0 )
rlen = rlen + 1
wstr = substr(wstr,2)
end
if llen = rlen then do
result = reverse(wstr)
return result
end
if llen < rlen then ,
leng = llen
else ,
leng = rlen
wstr = string
do leng while ( pos(left(wstr,1),head) > 0 )
wstr = substr(wstr,2)
end
wstr = reverse(wstr)
do leng while ( pos(left(wstr,1),tail) > 0 )
wstr = substr(wstr,2)
end
result = reverse(wstr)
return result
I have only a very basic knowledge of REXX...
Not able to get through the logic provided by enrico-sorichetti.
But i feel REXX could be better to solve the purpose...
More explanation to my requirement -
I need to check the following -
1. JCL parameters.
2. Display the files used in the JCL which are updated or created (can be in any Easytrieve as well in update mode).
Basic need is to check if any of the production parameters are not used and that if any of the production files are not attempted for addition or updation.
...
I need to check the following -
1. JCL parameters.
2. Display the files used in the JCL which are updated or created (can be in any Easytrieve as well in update mode).
the code might not easy to understand because its a parser based on the structure of jcl language, with no reference to the jcl keywords being used
- I.E whenever a pattern is found of the type some_string=something
some_string is assumed to be a jcl keyword,
so apart the formal apperance balanced parentheses, apostrophes
anything is considered valid ( I did not want to be troubled by new keyword being added )
the only place where the keywords are referenced is at the rebuild stage
when I call the build function with the keyword names to rebuild in a particular sequence
otherwise all the variables are build dynamically the values are set
using INTERPRET and retrieved using VALUE
anyway writing something along the lines of my script is the only way to go
remember anyway that from jcl only You might not be able to infer the mode of a dataset
- You can use in output a DISP=SHR or DISP=OLD
but You can filter and classify on the disposition
I really thing that You cannot get away with less than I showed You
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
Hello,
Quote:
I have only a very basic knowledge of REXX...
Not able to get through the logic provided by enrico-sorichetti.
But i feel REXX could be better to solve the purpose...
As has been mentioned, this is not a basic task - it is an advanced task. If you cannot follow the code Enrico posted, this probably means that you need to learn much more before attempting this. Yes, REXX is a good tool for this type of requirement, but only when the developer is fluent with the tool.
For checking the file updation, "DISP=SHR or DISP=OLD" will not help since it do not signify whether the file is updated or just used as input in the job.
Is there any other way which could better solve the requirement and could be moulded as per requirement more easily.
Display the files used in the JCL which are updated or created (can be in any Easytrieve as well in update mode).
for this type of reporting the best thing would be to process smf data..
I suggest You talk to the storage support group to verify that :
smf collection is activated for dataset open/close/activity
( record types 14/15/42s - if I remember correctly )
as far as smf processing is concerned,
unless Your support has something already written
I would suggest to ask them to look on the net for a freeware utility
called DAF - Dataset Audit Facility
http://www.geocities.com/michaeljosephcleary/Freeware.html