My team has a fairly wide range of jobcards that have very specific tasks, but within the jobcard, there are editing instructions with xxxx and yyyy variables, generally where xxxx needs to be changed to your sysuid and yyyy to the uid you're trying to create/alter/delete. My task is to get these jobs to be closer to automated. I'm going to use the built-in &sysuid to pull the admin's uid, but what I can't figure out is how to modify the jobcard without VISUALLY opening it. It has to be behind the scenes. I've been playing with &SUBSTR, and i've gotten it to work, but if there are spaces, it craps with the EOF error.
My ultimate question is, How do I modifiy connection/permit/ALU/AU statements and change the needed uid and execute it?
This is what I've been working with:
CLIST: (TESTPRM)
PROC 0
allocate file(testprm) da('aaaa.jcl.lib(testprm)') shr reu
OPENFILE testprm UPDATE /* Open file for updating */
GETFILE testprm /* Read first record */
DO WHILE &SUBSTR(1:4,&testprm)?=xxxx
GETFILE testprm /* Read another record */
END
SET testprm = yyyy /* Set new value */
PUTFILE testprm /* Write new value to data set */
CLOSFILE testprm /* Close the file */
END
allocate file(testprm) da('aaaa.jcl.lib(testprm)') shr reu
OPENFILE testprm UPDATE /* Open file for updating */
GETFILE testprm /* Read first record */
DO WHILE &SUBSTR(1:4,&testprm)?=xxxx
GETFILE testprm /* Read another record */
END
SET testprm = yyyy /* Set new value */
PUTFILE testprm /* Write new value to data set */
CLOSFILE testprm /* Close the file */
END
JCL: ('aaaa.jcl.lib(testprm)')
CO xxxx GROUP($9AOUNEW) OWNER($9AOUNEW)
PE 'xxxx.**' ID(blah) ACCESS(ALTER) GEN
PE 'KATM.**' ID(xxxx) ACCESS(ALTER) GEN
PE 'QCG1X1.**' ID(xxxx) ACCESS(ALTER) GEN
SETROPTS GENERIC (DATASET ) REFRESH
PE 'xxxx.**' ID(blah) ACCESS(ALTER) GEN
PE 'KATM.**' ID(xxxx) ACCESS(ALTER) GEN
PE 'QCG1X1.**' ID(xxxx) ACCESS(ALTER) GEN
SETROPTS GENERIC (DATASET ) REFRESH
The odd thing is that I can get it to work if there are no spaces...I have no idea how to begin to fix this though. Any ideas? Any help would be greatly appreciated!
Once I can get these variables to be changed/saved, I can get them saved to a temp pds instead, and execute from there so I don't modify the original, then I can change the PROC 0 to PROC 1 UID so noone has to go into the pds at all!