Page 1 of 1

File Manger batch job to add a line of JCL in PDS members

PostPosted: Fri Apr 07, 2017 10:20 pm
by tripmush
Hi all! Looking for some help with a batch File Manager job to delete a line from JCL in a PDS. I am not very familiar with File Manager, but have some old jobs that I inherited and have been attempting to modify – for example, I have a job that will delete a line for PDS members:
//STEP01  EXEC PGM=FMNMAIN                                  
//SYSUDUMP DD SYSOUT=*                                      
//SYSPRINT DD SYSOUT=*                                      
//SYSLIST  DD SYSOUT=*                                      
//SYSTOTAL DD SYSOUT=*                                      
//DDIN     DD DISP=SHR,DSN=CICSESA.CICS.TEST          
//DDOUT    DD DISP=SHR,DSN=CICSESA.CICS.TEST.AFTER    
//SYSIN    DD *                                            
$$FILEM DSC ,                                              
$$FILEM MEMBER=*,REPLACE=YES,PROC=*                        
*FASTREXX                                                  
IF FLD_CO(,,,'CCRCLR=') THEN                                
   RETURN 'DROP'                                            
/*                                                          
//*                                                        
 

So what I am looking for is a batch File Manager job that will ADD a line of JCL after it find another specific line, in all members in a PDS. For example, if it finds 'ENV=TEST,', then I would like it to insert a line like '// OMEG=YES,'. If someone can provide an example, that would be great!

Re: File Manger batch job to add a line of JCL in PDS member

PostPosted: Fri Apr 21, 2017 2:43 am
by tripmush
WE figured it out - the SYSIN would be something like this:
$$FILEM DSC ,                                              
$$FILEM MEMBER=*,REPLACE=YES,PROC=*                        
 IF FLD(11,5) = 'CSMNT'                                    
   THEN DO;                                                
     WRITE()      /* WRITE ORIGINAL RECORD */              
     OUTREC='//        CCRCLR=WHITE        CAFC RGN COLOR',
            '                                    '          
     WRITE()      /* WRITE NEW RECORD */                    
     RETURN DROP                                            
   END;

Re: File Manger batch job to add a line of JCL in PDS member

PostPosted: Fri Apr 21, 2017 3:46 pm
by NicC
Good to know you got it resolved and thanks for sharing.

When posting code please use the code tags. I have coded your posts for you. If you do not know how to use the code tags then use the POSTREPLY button instead of the Quick Reply button.

Re: File Manger batch job to add a line of JCL in PDS member

PostPosted: Fri Apr 21, 2017 6:12 pm
by tripmush
Thanks NicC!