Posted: Mon Dec 02, 2013 10:27 am Post subject: How to apply PDS Member Stats in a Batch Job?
I currently have a REXX program named CHGWORD that executes in a z/OS Batch job that reads file //IN01 DD, searches the file and replaces all occurances of the string(s) passed into the REXX program via a Job Step Parm, and then writes the results to //OUT01 DD. Note: You can key in as many strings to change as will fit in a PARM statement (100 bytes).
The reason it passes the change strings via JCL Parm instead of an input file is so that JCL Symbolic Parameters can be set at the top of the job and passed using the // SET statement into the REXX program via the Job Step Parm statement. This comes in handy when submitting a job against multiple environments, where each environment has it's own high level qualifier or dataset names, such as TEST, USER, or PROD. Example:
I'd like to modify it so that it can apply ISPF Statistics, to see the Changed Date/Time and Userid.
I attempted to use LISTALC to trap the //IN01 DD name to extract the PDS(member) name, but it returned nothing.
I already have the logic to apply stats using LMMSTATS (along with a few other ISPF services).
I searched the Forum, but after 40 minutes still hadn't found anything.
How can I capture the PDS(member) name for the input file? Or, perhaps I should ask if there's a better way to go about this or maybe even whether someone else already has a utility that'll do this.
Now I'm getting a rc = -3 when I try to run my job. I looked at Doug Nadel's BATCHPDF and ran that to create the JCL; however I have a few questions. What is the first job step doing? How can I determine exactly which datasets are necessary. I was expecting a short little utility job step that I can add to jobs whenever necessary...this thing is starting to look like a monster.
If I'm understanding BATCHPDF, it says to start my program in the first step, but then I won't be able to pass the JCL Symbolic Parameters to it.
Currently my job initiates the REXX program CHGWORD from the Job Step card, not the SYSTSIN card. I need to be able to pass JCL Symbolic parms into my REXX program, which can't be done in the SYSTSIN card.
I attempted to integrate what I need to what BATCHPDF generated and have apparently butchered the job.
Also I searched the ISPF Reference manual but can't see how to continue a PARM(...) card...
ISPEXEC VGET (ZTIMEL) /* ISPF services can run here */
WRITE &ZTIMEL
/* Add any setup here */
/* And start your program here. Use ISPEXEC SELECT. */
/* */
/* To invoke the editor, code a line like: */
/* ISPEXEC EDIT DATASET('FRED.CNTL(BUBBA)') MACRO(BINKY) */
/* and remember that the macro must do an END or CANCEL. */
ISPEXEC SELECT CMD(CHGWORD2)
/* You can set the step return code if you want. */
SET ZISPFRC = 0
ISPEXEC VPUT (ZISPFRC) SHARED /* set step return code */
Processing file IN01
Changes made IN01:
s_pds_mem="T37.RUNSTATS.JCL(ETRPTU1)"
------------------------------------------------------------------------------
Error: NoValue signalled at line 499 of CHGWORD2
"LMMSTATS DATAID("OUTDD999")" ,
XX370AA.DSS37ZRM.JOB45019.D0000103.? was preallocated (no free was done).
READY
END
Here's my REXX code:
Code:
4000_Set_File_Stats:
i_dd = i_file + 0
/*---------------------------------------------------------------
| skip non-pds(mem)
|--------------------------------------------------------------*/
if pos('(', a_dd_out_dsname.i_dd) = 0 then return
/*---------------------------------------------------------------
| break down pds(mem)
|--------------------------------------------------------------*/
s_pds_mem = a_dd_out_dsname.i_dd
parse var s_pds_mem s_pds '(' s_mem ')'
say '4000 1: s_pds='s_pds', s_mem='s_mem
s_outdd = a_dd_out_ddname.i_dd
/*---------------------------------------------------------------
| init the dd
|--------------------------------------------------------------*/
address ispexec
s_rc = rc
say '4000 2: LMINIT rc='s_rc
if s_rc <> 0 then do
say '==> Error 5: LmInit 's_outdd' for 's_pds_mem', RC='s_rc
exit 16
end
/*---------------------------------------------------------------
| open the dd
|--------------------------------------------------------------*/
"LMOPEN DATAID("OUTDD999") OPTION(INPUT)"
s_rc = rc
say '4000 3: LMOPEN rc='s_rc
if s_rc <> 0 then do
say '==> Error 6: LmOpen 's_outdd' for 's_pds_mem', RC='s_rc
"LMFREE DATAID("OUTDD999")"
exit 16
end
/*---------------------------------------------------------------
| open the dd
|--------------------------------------------------------------*/
"LMMFIND DATAID("OUTDD999") MEMBER("s_mem") STATS(YES)"
s_rc = rc
say '4000 4: LMMFIND rc='s_rc
if s_rc <> 0 then do
say '==> Error 7: LmmFind 's_outdd' for 's_pds_mem', RC='s_rc
"LMCLOSE DATAID("OUTDD999")"
"LMFREE DATAID("OUTDD999")"
exit 16
end
s_rc = rc
say '4000 5: LMMSTATS rc='s_rc
if s_rc <> 0 then do
say '==> Error 8: LmmStats 's_outdd' for 's_pds_mem', RC=' ,
s_rc
say ' moddate4 ={'s_Date'}'
say ' modtime ={'s_Time'}'
say ' cursize ={'i_in'}'
say ' user ={'s_User'}'
"LMCLOSE DATAID("OUTDD999")"
"LMFREE DATAID("OUTDD999")"
exit 16
end
/*---------------------------------------------------------------
| close the dd
|--------------------------------------------------------------*/
"LMCLOSE DATAID("OUTDD999")"
s_rc = rc
if s_rc <> 0 then do
say '==> Error 9: LmClose 'soutdd' for 's_pds_mem', RC='s_rc
"LMFREE DATAID("OUTDD999")"
exit 16
end
/*---------------------------------------------------------------
| free the dd
|--------------------------------------------------------------*/
"LMFREE DATAID("OUTDD999")"
s_rc = rc
if s_rc <> 0 then do
say '==> error 10: LmFree 's_outdd' for 's_pds_mem', RC='s_rc
exit 16
end
I found a post that helped me see exactly which datasets I needed to code to get ISPF to work.
Due to this website's URL "security" software? I can't paste in the URL that contains the post; it keeps changing it to Mcmillan_the_moron. It is on the xxxxxx website. Hmm..Let me try and put a space between the i and b and see if that works. It does. Apparently MVSFORUMS hates xxxxxx Which is odd, since I'd expect both forums to enjoy helping others and each other.
Now I just need to figure out how to pass JCL parms that are longer than 80 bytes to it.
Doug nadel posts on this forum as Semigeezer and would have clarified all your questions.
Once you realized that there is a filter(is there for a reason) for that URL you should have stopped that. IMHO Anyone selling other peoples knowledge as if it is their own and making money are not worthy of discussion.
May be you should read this topic before you form an opinion about hatred. It is 4 pages long, so read every post and then come back and comment on it
Joined: 31 May 2004 Posts: 391 Topics: 4 Location: Richfield, MN, USA
Posted: Tue Dec 03, 2013 12:52 pm Post subject:
Out of curiousity, I just got done reading that 4-page thread. Guess I hadn't joined until after 2003, so I missed it the 1st time around. I agree that you are a very patient person, kolusu! _________________ ....Terry
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum