MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to apply PDS Member Stats in a Batch Job?

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
RoyKMathur
Beginner


Joined: 05 Jan 2012
Posts: 47
Topics: 11

PostPosted: Mon Dec 02, 2013 10:27 am    Post subject: How to apply PDS Member Stats in a Batch Job? Reply with quote

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:
Code:
// SET ENV='TEST',SUB='DB2T'
//*SET ENV='USER',SUB='DB2U'
//JS01OF04 EXEC PGM=IKJEFT01,                       
//       PARM='CHGWORD PROD &ENV DB2P &SUB


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.

Thanks,
Roy
Back to top
View user's profile Send private message
RoyKMathur
Beginner


Joined: 05 Jan 2012
Posts: 47
Topics: 11

PostPosted: Mon Dec 02, 2013 10:29 am    Post subject: Reply with quote

I had a bug in my code...the LISTALC is working.
Back to top
View user's profile Send private message
RoyKMathur
Beginner


Joined: 05 Jan 2012
Posts: 47
Topics: 11

PostPosted: Mon Dec 02, 2013 1:57 pm    Post subject: Reply with quote

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...

Please let me know how to get it working.

Code:
//DSS37ZRM JOB (29302PP,G4K3,,600),'ROY MATHUR',                       
//             NOTIFY=&SYSUID,                                         
//             TIME=10,                                               
//             MSGCLASS=G                                             
//*                                                                   
/*JBS BIND BSYS                                                       
//*                                                                   
//*-------------------------------------------------------------------*
//*                       Create Startup CLIST                        *
//*-------------------------------------------------------------------*
//GENER0   EXEC PGM=IEBGENER                                           
//SYSUT1   DD *                                                       
                                                                       
 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 */         
                                                                       
//SYSUT2   DD DISP=(,PASS),DSN=&&CLIST0(TEMPNAME),                     
//            SPACE=(TRK,(1,1,2),RLSE),UNIT=VIO,                       
//            DCB=(LRECL=255,BLKSIZE=0,DSORG=PO,RECFM=VB)             
//PROFILE  DD DISP=(,PASS),SPACE=(TRK,(10,10,5)),UNIT=VIO,             
//            DCB=(LRECL=80,BLKSIZE=0,DSORG=PO,RECFM=FB)               
//SYSPRINT DD DUMMY                                                   
//SYSIN    DD DUMMY                                                   
//*-------------------------------------------------------------------*
//*              Initialize profile data set (optional)               *
//*-------------------------------------------------------------------*
//* COPY     EXEC PGM=IEBCOPY                                         
//* SYSPRINT DD  DUMMY                                                 
//* SYSIN    DD  DUMMY                                                 
//* SYSUT1   DD  DISP=SHR,DSN=XX370AA.ISPF.ISPPROF.BSYS                 
//* SYSUT2   DD  DISP=(OLD,PASS),DSN=*.GENER0.PROFILE                 
//*-------------------------------------------------------------------*
//*                            Invoke ISPF                            *
//*-------------------------------------------------------------------*
//BATCHPDF EXEC PGM=IKJEFT01,DYNAMNBR=128,                             
//       PARM='CHGWORD2 N XX370AA.SYSIN T37.RUNSTATS.SYSIN XX370AA.CLIST
//             T37.CLIST'                                             
//STEPLIB  DD DISP=SHR,DSN=GEIDP.DB2.LOGON.DSNEXIT                     
//         DD DISP=SHR,DSN=GEIDP.DB2.LOGON.DSNLOAD                     
//SYSPROC  DD DSN=&&CLIST0,DISP=(OLD,DELETE)                           
//         DD DISP=SHR,DSN=GEITP.IOF.CLIST                             
//         DD DISP=SHR,DSN=XX370AA.CLIST                               
//         DD DISP=SHR,DSN=XX370AA.CLIST.OTHER                         
//         DD DISP=SHR,DSN=XX37.CLIST                                   
//         DD DISP=SHR,DSN=XX24.CLIST                                   
//         DD DISP=SHR,DSN=ZOS.ISP.GEIPCLIB.VB255                         
//         DD DISP=SHR,DSN=GEI1.SBLSCLI0.VB255         
//         DD DISP=SHR,DSN=ZOS.CLIST                   
//         DD DISP=SHR,DSN=GEITP.FILEAID.CLIST         
//         DD DISP=SHR,DSN=GEIDP.DB2.LOGON.DSNCLIST     
//         DD DISP=SHR,DSN=GEIOP.LOGREC.VIEWER.VB255   
//         DD DISP=SHR,DSN=GEITT.XCOM.CINB0SCL         
//         DD DISP=SHR,DSN=GEISP.SCC.R51.ISPFLIB       
//         DD DISP=SHR,DSN=GEITP.JCLCHECK.CAICLS0       
//SYSEXEC  DD DISP=SHR,DSN=XX370AA.CLIST                 
//         DD DISP=SHR,DSN=XX370AA.CLIST.OTHER           
//         DD DISP=SHR,DSN=XX370AA.CLIST.SYSEXEC         
//         DD DISP=SHR,DSN=GEIOP.ISPF.ZOSR13.EXEC       
//         DD DISP=SHR,DSN=ZOS.EXEC                     
//         DD DISP=SHR,DSN=ZOS.ISP.GEIPEXEC.VB255           
//         DD DISP=SHR,DSN=GEI1.SBPXEXEC.VB255         
//         DD DISP=SHR,DSN=GLD.SGLDEXEC.VB255           
//         DD DISP=SHR,DSN=GEISP.BCM.V4R1M3.REXXLIB.VB 
//         DD DISP=SHR,DSN=OPSMVS.R120.CCLXEXEC.VB255   
//         DD DISP=SHR,DSN=OPSMVS.R120.CCLXOPEX.VB255   
//ISPLLIB  DD DISP=SHR,DSN=GEI1.DGTLLIB                 
//         DD DISP=SHR,DSN=GEI1.DFQLLIB                 
//         DD DISP=SHR,DSN=GIM.SGIMLMD0                 
//         DD DISP=SHR,DSN=ZOS.STORMGMT.LOAD           
//         DD DISP=SHR,DSN=GEIDP.DB2.LOGON.DSNEXIT     
//         DD DISP=SHR,DSN=GEIDP.DB2.LOGON.DSNLOAD     
//         DD DISP=SHR,DSN=GEIOP.XPAF.V60.XPFLOAD       
//ISPPLIB  DD DISP=SHR,DSN=XX370AA.ISPPLIB.OTHER         
//         DD DISP=SHR,DSN=GEIOP.ISPF.ZOSR13.PANELS     
//         DD DISP=SHR,DSN=ZOS.ISP.GEIPPENU                 
//         DD DISP=SHR,DSN=ISF.SISFPLIB                 
//         DD DISP=SHR,DSN=GEI1.SBLSPNL0               
//         DD DISP=SHR,DSN=GEI1.SBPXPENU               
//         DD DISP=SHR,DSN=T35.ISPF.SYSTEMS.PANELS     
//         DD DISP=SHR,DSN=ZOS.TECHASST.PANELS         
//         DD DISP=SHR,DSN=GEITP.JCLCHECK.CAIPNL0       
//         DD DISP=SHR,DSN=GEIDP.DB2.LOGON.SDSNSPFP     
//         DD DISP=SHR,DSN=GEIDP.DB2.LOGON.SDSNPFPE     
//         DD DISP=SHR,DSN=GEIOP.THRUPUT.TMV6220.DTMPENU
//         DD DISP=SHR,DSN=GEITT.XCOM.CINB0SPL         
//         DD DISP=SHR,DSN=XX370AA.ISPPLIB               
//ISPSLIB  DD DISP=SHR,DSN=XX370AA.ISPSLIB               
//         DD DISP=SHR,DSN=ZOS.ISP.GEIPSENU                 
//         DD DISP=SHR,DSN=ZOS.ISP.GEIPSLIB                 
//         DD DISP=SHR,DSN=ZOS.TECHASST.PROCS           
//         DD DISP=SHR,DSN=GEITP.JCLCHECK.CAISKL0       
//         DD DISP=SHR,DSN=GEIDP.DB2.LOGON.SDSNSPFS     
//         DD DISP=SHR,DSN=IMSVSTST.SDFSSLIB           
//ISPMLIB  DD DISP=SHR,DSN=XX370AA.ISPMLIB               
//         DD DISP=SHR,DSN=XX370AA.ISPMLIB.OTHER         
//         DD DISP=SHR,DSN=ZOS.ISP.GEIPMENU                 
//         DD DISP=SHR,DSN=ISF.SISFMLIB                 
//         DD DISP=SHR,DSN=GEI1.SBLSMSG0               
//         DD DISP=SHR,DSN=GEI1.SBPXMENU               
//         DD DISP=SHR,DSN=ZOS.TECHASST.MESSAGES       
//         DD DISP=SHR,DSN=GEITP.JCLCHECK.CAIMSG0       
//         DD DISP=SHR,DSN=GEIDP.DB2.LOGON.SDSNSPFM     
//         DD DISP=SHR,DSN=GEIOP.THRUPUT.TMV6220.DTMMENU
//         DD DISP=SHR,DSN=GEITT.XCOM.CINB0SML         
//ISPPROF  DD DISP=(OLD,PASS),DSN=*.GENER0.PROFILE     
//ISPTABL  DD DISP=(OLD,PASS),DSN=*.GENER0.PROFILE,VOL=REF=*.ISPPROF
//ISPTLIB  DD DISP=(OLD,PASS),DSN=*.GENER0.PROFILE,VOL=REF=*.ISPPROF
//         DD DISP=SHR,DSN=XX370AA.ISPTABL                           
//         DD DISP=SHR,DSN=ZOS.ISP.GEIPTENU                             
//         DD DISP=SHR,DSN=ISF.SISFTLIB                             
//         DD DISP=SHR,DSN=GEI1.SBPXTENU                           
//         DD DISP=SHR,DSN=GEI1.SBLSTBL0                           
//         DD DISP=SHR,DSN=ZOS.ABENDAID.TABLES                     
//         DD DISP=SHR,DSN=GEITP.QUICKREF.TABLES                   
//         DD DISP=SHR,DSN=ZOS.TECHASST.TABLES                     
//         DD DISP=SHR,DSN=GEIDP.DB2.LOGON.SDSNSPFT                 
//         DD DISP=SHR,DSN=GEIOP.THRUPUT.TMV6220.DTMTENU           
//         DD DISP=SHR,DSN=GEITT.XCOM.CINB0STL                     
//ISPCTL0  DD DISP=(,DELETE),SPACE=(TRK,(10,10)),UNIT=VIO,         
//            DCB=(LRECL=80,BLKSIZE=0,DSORG=PS,RECFM=FB)           
//ISPCTL1  DD DISP=(,DELETE),SPACE=(TRK,(10,10)),UNIT=VIO,         
//            DCB=(LRECL=80,BLKSIZE=0,DSORG=PS,RECFM=FB)           
//ISPWRK1  DD DISP=(,DELETE),SPACE=(TRK,(10,10)),UNIT=VIO,         
//            DCB=(LRECL=80,BLKSIZE=0,DSORG=PS,RECFM=FB)           
//ISPLST1  DD DISP=(,DELETE),SPACE=(TRK,(10,10)),                   
//            DCB=(LRECL=133,BLKSIZE=0,DSORG=PS,RECFM=VB)           
//ISPLOG   DD SYSOUT=*,                                             
//            DCB=(LRECL=120,BLKSIZE=2400,DSORG=PS,RECFM=FB)       
//ISPLIST  DD SYSOUT=*,DCB=(LRECL=121,BLKSIZE=1210,RECFM=FBA)       
//* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//SYSTSPRT DD SYSOUT=*                                             
//SYSTSIN  DD *                                                     
 PROFILE PREFIX(XX370AA)                                             
 ISPSTART CMD(%TEMPNAME) NEWAPPL(ISR)                               
/*                                                                 
//IN01     DD DSN=XX370AA.JCL(ETRPTU1),DISP=SHR                     
//IN02     DD DSN=XX370AA.JCL(ETRPTU2),DISP=SHR                     
//OUT01    DD DSN=XX37.RUNSTATS.JCL(ETRPTU1),DISP=SHR               
//OUT02    DD DSN=XX37.RUNSTATS.JCL(ETRPTU2),DISP=SHR               


Here's the job output:
Code:
Input parms:                                                                 
   p_display = "N"                                                           
   p_arg     = "XX370AA.SYSIN T37.RUNSTATS.SYSIN XX370AA.CLIST T37.CLIST"       
                                                                             
Processing file IN01                                                         
   Changes made IN01: XX370AA.SYSIN=21, XX370AA.CLIST=7                         
s_pds_mem="T37.RUNSTATS.JCL(ETRPTU1)"                                         
   448 *-*    "LMINIT DATAID(OUTDD999) DATASET('"s_pds"') ENQ(SHRW)"         
       +++ RC(-3) +++                                                         
==> Error 5: LmInit OUT01 for T37.RUNSTATS.JCL(ETRPTU1), RC=-3               
READY                                                                         
 PROFILE PREFIX(XX370AA)                                                       
READY                                                                         
 ISPSTART CMD(%TEMPNAME) NEWAPPL(ISR)                                         
13:38:34.33                                                                   
Input parms:                                                                 
   p_display = ""                                                             
   p_arg     = ""                                                             
                                                                             
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                                                   
                                                                       
    "LMINIT DATAID(OUTDD999) DATASET('"s_pds"') ENQ(SHRW)"             
                                                                       
    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                                                               
                                                                     
    /*---------------------------------------------------------------
     | get the statistics                                             
     |--------------------------------------------------------------*/
    s_Date4      = date('s')                                         
    s_Date_YYYY  = substr(s_Date4, 1, 4)                             
    s_Date_MM    = substr(s_Date4, 5, 2)                             
    s_Date_DD    = substr(s_Date4, 7, 2)                             
    s_Date       = s_Date_YYYY||'/'s_Date_MM'/'s_Date_DD             
                                                                     
    s_Time       = time()                                             
    s_User       = sysvar('sysuid')                                   
                                                                     
    if i_in - 1 <= 65535 then i_in = i_in - 1                         
                         else i_in = 65535                           
                                                                     
    "LMMSTATS DATAID("OUTDD999")"              ,                     
             "MEMBER("    || p_mem     || ")"  ,                     
             "MODDATE4("  || s_Date    || ")"  ,                     
             "MODTIME("   || s_Time    || ")"  ,                     
             "CURSIZE("   || i_in      || ")"  ,                     
             "USER("      || s_User    || ")"                         
                                                                     
    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                                                             
                                                                   
    return                                                         


Thanks,
Roy
Back to top
View user's profile Send private message
RoyKMathur
Beginner


Joined: 05 Jan 2012
Posts: 47
Topics: 11

PostPosted: Tue Dec 03, 2013 8:38 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Tue Dec 03, 2013 11:07 am    Post subject: Reply with quote

RoyKMathur,

You went searching all over when the solution is right here infront of you

http://www.mvsforums.com/helpboards/viewtopic.php?t=5276

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

http://www.mvsforums.com/helpboards/viewtopic.php?t=584&highlight=cobol


Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Tue Dec 03, 2013 12:52 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group