<div dir="ltr"><div><div><div><div><div>I was recently given this task.  it's a very IBM mainframe specific task so I'm not sure how to find equivalent terms in another environment.  I will just use the mainframe terminology and hopefully y'all can figure out what I mean.<br>
<br></div>Given a list of DBRM members create a JCL which has a series of bind statements for each DBRM.<br><br></div>This is the tack I took.  I have 3 input files<br>a_ contains the fixed part of the JCL<br>b_ contains the template for the bind statement.<br>
c_ contains the list of DBRMs<br><br><br>This is the script I came up with...Would you critique it and let me know how I could have done it better?<br>#create a series of bind statements<br>fo = open('i:/text/jclout.txt', 'w')<br>
fi = open('i:/text/bindjclfirstpart.txt','rU')<br>fibindjclvar = open('i:/text/bindjclvariable.txt','rU')<br>filistofdbrms= open('i:/text/bindjcldbrmlist.txt','rU')<br><br>varlines =[] <br>
varlines = fibindjclvar.readlines()<br>for line in fi: #write out all the lines in the first part of JCL<br>    fo.write(line)<br>fo.write('\n')<br>varline = ''<br>for dbrm in filistofdbrms: <br>    fo.write('\n')<br>
    for index in range(0,9):<br>        if varlines[index].find('member') > 0: <br>            varline = varlines[index] + '('+ dbrm + ')' + ' -'<br>        else:<br>            varline = varlines[index]<br>
        fo.write(varline)<br>            <br>fo.close()<br>fi.close()<br>fibindjclvar.close()<br>filistofdbrms.close()<br><br></div>The "variable" part of the bind statement is where I have to include the DBRM name.  I look for the word 'member' in the template.<br>
</div>Template looks like this (content of bindjclvariable.txt)<br>BIND PACKAGE(PROD) -<br>     MEMBER<br>     OWNER(PRODOWNR) -<br>     QUALIFIER(PRODTBLS) -<br>     ISOLATION(CS) -<br>     EXPLAIN(YES) -<br>     ACTION(REPLACE) -<br>
     CURRENTDATA(YES) -<br>     VALIDATE(BIND)<br><br></div>Thanks!<br></div>