How to comment particular procs from a PS file.



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

How to comment particular procs from a PS file.

Postby Surabhi » Fri Nov 18, 2016 6:43 pm

Hi All,

i have a requirement to comment out only some particular proc's from myPS file.
Example:-
****** ***************************** Top of Data ******************************
000001 //JOBNAME JOB  12345ABC, , COMMENT JOB
000002 //            CLASS=A,MSGCLASS=K,REGION=8000K,COND=(0,NE)     
000003 //*                                                           
000004 //JOBLIB       DD  DSN=USID.PGM.OBJLIB,                     
000005 //            DISP=SHR                                         
000006 //             DD  DSN=USID.PGM1.LOADLIB,                       
000007 //            DISP=SHR                                         
000008 //             DD  DSN=SYS2.COBLIB,                           
000009 //            DISP=SHR                                         
000010 // step 02 PROC123                 <===
00CM11 //            DISP=SHR                                         
000012 //             DD  DSN=SYS2.SUBRLIB,                           
000013 //            DISP=SHR                                         
000014 //             DD  DSN=SYS3.ABNDIDMS.LOAD,                     
000015 //            DISP=SHR   
000016 //             DD  DSN=USID.PGM2.LOAD,                   
000017 //            DISP=SHR                                         
000018 //             DD  DSN=USID.PGM3.LOAD,       
000019 //            DISP=SHR                           
000020 //             DD  DSN=USID.PGM4.LOAD,             
000021 //            DISP=SHR                           
000022 //STEP1   PrcoXYZ                           <===                
000023 //            COND=(0,NE)                         
000024 //*                                               
000025 //STP01A      DD  DSN=USID.SYS.FILE1,     
000026 //            DISP=(NEW,CATLG,DELETE),           
000027 //            UNIT=SYSDA,SPACE=(TRK,(5,2),RLSE)
00CM28 //            DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)   
000029 //*                                               
000030 //STP02A      DD  DSN=USID.SYS.FILE2,     
000031 //            DISP=(NEW,CATLG,DELETE)
000032 //            UNIT=SYSDA,SPACE=(TRK,(5,2),RLSE)
000033 //            DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)   
000034 //*                                               
000035 //STP03A    ProcABCD                         <===
000000//              DD  DSN=USID.SYS.FILE3,     
000036 //            DISP=(NEW,CATLG,DELETE),           
000037 //            UNIT=SYSDA,SPACE=(TRK,(5,2),RLSE)
000038 //            DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)   
000039 //*                                               
000040 //STP04A      DD  DSN=USID.SYS.FILE4,     
000041 //            DISP=(NEW,CATLG,DELETE),           
000042 //            UNIT=SYSDA,SPACE=(TRK,(5,2),RLSE)
000043 //            DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)   
000044 //*                                               
****** **************************** Bottom of Data ****************************
 

So as per the above example the steps using Procs ABCD, XYZ, 123 should get comment out from my ps file.
Can we use any kind of cond or any sort which will verify the PROC name and comment out all the steps for that PROC.

Thanks.
Surabhi
 
Posts: 49
Joined: Thu Sep 10, 2015 7:51 pm
Has thanked: 4 times
Been thanked: 0 time

Re: How to comment particular procs from a PS file.

Postby Robert Sample » Fri Nov 18, 2016 7:30 pm

Can we use any kind of cond or any sort which will verify the PROC name and comment out all the steps for that PROC.
No. First, it is not clear what you mean by "verify the PROC name" -- either there is a PROC name or there is not; what kind of verification do you think you want? Second, the only way to do what you want is to write a program in the language of your choice to do what you want. I would recommend NOT replacing your source -- create another data set with the changed JCL.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: How to comment particular procs from a PS file.

Postby Surabhi » Fri Nov 18, 2016 7:40 pm

I need to verify if the Proc is present, if its there then comment out the whole step.I want to know if its possible through JCL.
Surabhi
 
Posts: 49
Joined: Thu Sep 10, 2015 7:51 pm
Has thanked: 4 times
Been thanked: 0 time

Re: How to comment particular procs from a PS file.

Postby Aki88 » Fri Nov 18, 2016 7:52 pm

Hello,

Before jumping into the thick of things, is the code-snippet shared from a working JCL; there are multiple errors if the JCL is looked at as-is, and other than the name- PROCmmm, I donot see a PROC (unless I missed something; it is Friday evening).

If you want to identify PROCABCD/PROCXYZ and so on, and add an asterisk (*) in column 3 of the JCL for such rows using DFSORT, look at IFTHEN/WHEN constructs. Check for the values you are looking for using IFTHEN/WHEN, and BUILD your record by inserting an asterisk in column 3; when this output is routed to SORTOUT, it'll have a commented line in all such places which satisfied your condition.

The challenge here is to cater to code that appears as below, i.e. how do you handle a code that extends beyond 1 line; there are numerous examples in the forum that perform this - core logic being driven by IFTHEN/WHEN, but I'll leave it to you to explore. In the below example, if the line containing EXEC statement is commented, next 4 lines should also be commented:


//*                                  
//TESTPROC EXEC TESTPROC,            
//            SEG1='1',              
//            PARMMEM='TESTPARM',    
//            DSNAMES='RANDOM.TEST'  
//            MEMLIB='USER.MEMLIB'    
//*                                  
 


Edit: To your last post, not possible through JCL; yes possible, if you write a bit of code using some program. Hope this answers the question in your last post. It'd be great if you can now share the solution you'll build after learning that it is possible to achieve the task.
Last edited by Aki88 on Fri Nov 18, 2016 7:55 pm, edited 1 time in total.
Aki88
 
Posts: 381
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 36 times

Re: How to comment particular procs from a PS file.

Postby Robert Sample » Fri Nov 18, 2016 7:55 pm

I need to verify if the Proc is present, if its there then comment out the whole step.I want to know if its possible through JCL.
"the Proc (sic) is present" -- WHERE? Instream in the JCL? in a system PROCLIB? in a JCLLIB PROCLIB? There are multiple places a PROC can exist, and the system PROCLIB concatenation, for example, can consist of a number of PROCLIB data sets -- unless you are a system programmer with access beyond a normal application programmer, it is entirely possible that you may not even be able to find out what the system PROCLIB concatenation is. So right off the bat I suspect that you will find that what you want to do (based upon what you've said so far) is either very difficult or impossible to accomplish. You are asking to do some pretty hard things -- such as scan your job stream to identify the PROC executions, identify each executed program / PROC, and then find the PROC (somewhere) and use that determination to update the job stream. Since you cannot change the JCL of an executing job stream, that means you have to be working on JCL in a data set.
I want to know if its possible through JCL.
This is an easy question to answer -- NO. All JCL does is establish the environment for programs to execute; JCL may invoke SORT or an application program or another system utility to do things, but by itself JCL does very little (when executed, JCL can allocate or delete data sets but by itself it cannot even sort a data set -- that takes the system utility SORT). And before you ask, I don't think there is any way to do what you want (whatever that turns out to be) with a system utility -- you need to write a program.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: How to comment particular procs from a PS file.

Postby NicC » Sat Nov 19, 2016 5:49 pm

It is not at all clear as to what you want to do! Also your JCL is totally bad e.g. what is PROC123 doing in the middle of your JOBLIB statement?

If you just want to verify that the JCL is valid then run your job with a TYPRUN=SCAN or, even better, add a first step, before the first proc, to execute a non-existent program. That will abend with an S806 if your JCL is valid.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: How to comment particular procs from a PS file.

Postby Surabhi » Sat Nov 19, 2016 7:59 pm

Hi all,

Thank you so much for the inputs.
I know the jcl is not correct, it was just a sample.
Below one is the ps file i am working on,
//******************************************************************
//STEP05   EXEC PROCXYZ,
//              MEMA=ABCD123,                                      
//              MEMBER=XYZ123,                                    
//*STEP10   EXEC PROCABC,                                            
//*             DSN='TEST.FILE',
//STEP40   EXEC PROC123          
//             DSN1=INPUT.FILE1,                
//             DSN2=OUTPUT.FILE.BKP(+1),            
//             LRECL=800,                                          
//             DCB=                                                
//*********************************************************    


And below is the JCL i am trying to get the PROC XYZ step commented.
It should search for the proc name and then also search for the next STEP in the jcl and stop before that.
//STEP01 EXEC PGM=SORT                                    
//SYSPRINT DD SYSOUT=*                                    
//SYSOUT DD SYSOUT=*                                      
//SORTIN   DD  DSN=MYINPUT.FILE,DISP=SHR                  
//SORTOUT  DD  DSN=MYOUTPUT.FILE,                          
//             DISP=(NEW,CATLG,DELETE),                    
//             RECFM=FB,                                  
//             UNIT=SYSDA                                  
//SYSIN DD *                                              
  OPTION COPY                                              
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(17,7,CH,EQ,C'PROCXYZ'),
             ENDBEFR=(4,4,CH,EQ,C'STEP'),                  
        OVERLAY=(3:C'*'))                                  
/*    


But the JCL is abending with two reasons:-
ICE006A 0 OPERAND DEFINER ERROR  
ICE107A F DUPLICATE, CONFLICTING, OR MISSING INREC OR OUTREC STATEMENT OPERANDS


Could you please help me in getting the above logic correct.
Surabhi
 
Posts: 49
Joined: Thu Sep 10, 2015 7:51 pm
Has thanked: 4 times
Been thanked: 0 time

Re: How to comment particular procs from a PS file.

Postby NicC » Sat Nov 19, 2016 8:22 pm

Please use the code tags when presenting stuff from your screen.
Also, please present your actual code without errors so that we can concentrate on your actual problem and not what we think your problem is. You can, of course, change data set names to preserve security.
Also, if this is a sort problem then you should have osted in the DFsort section of the form

Now, you should have presented the SYSOUT from the sort so that we can see which operand is in error. Have you checked the sort manual for correct syntax?

Note: the JCL did NOT abend - JCL does not abend, programs do. The sort program probably did not abend but terminated with a condition code greater than zero.

Finally, why not just do it by manually? You could have done it by now.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: How to comment particular procs from a PS file.

Postby Aki88 » Mon Nov 21, 2016 12:00 pm

Hello,

Note: The below code is one of the many approaches to the solution. This is just a sample code, something that you can use to build the final solution. As for the errors in your code, they were syntactical; a quick look at the DFSORT manual on the format of IFTHEN statement would have cleared the same. Also, please note that the JCL that is being overlayed - has errors, I've left them untouched.

Input:


********************************* Top of Data **********************************
//STEP05   EXEC PROCXYZ,                                                        
//              MEMA=ABCD123,                                                  
//              MEMBER=XYZ123,                                                  
//STEP10   EXEC PROCABC,                                                        
//             DSN='TEST.FILE',                                                
//STEP40   EXEC PROC123                                                        
//             DSN1=INPUT.FILE1,                                                
//             DSN2=OUTPUT.FILE.BKP(+1),                                        
//             LRECL=800,                                                      
//             DCB=                                                            
******************************** Bottom of Data ********************************
 


Code:


//STEP01   EXEC PGM=SORT                                                
//SYSPRINT DD SYSOUT=*                                                  
//SYSOUT   DD SYSOUT=*                                                  
//SORTIN   DD DISP=SHR,DSN=MY.INPUT.DS                                  
//SORTOUT  DD SYSOUT=*                                                  
//SYSIN    DD *                                                        
*                                                                      
* PAD THE PROC NAME TO THE END OF THE RECORD, TO UNIQUELY GROUP THE DATA
* OCCURRING UNDER A PROC.                                              
*                                                                      
* WORD OF CAUTION: THE BELOW LOGIC WILL FAIL IN A SCENARIO WHEREIN THE  
* ---------------  CODE AFTER THE EXEC STATEMENT IS A VALID JCL, UNDER  
*                  SUCH A SCENARIO, ADDITIONAL CODE WILL BE REQUIRED IN
* 'INREC IFTHEN' TO IDENTIFY ONLY AND ONLY THE CODE PERTAINING TO THE  
* PROC; BUT FOR NOW, IT IS LEFT FOR ANOTHER DAY.                        
*                                                                      
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(17,4,CH,EQ,C'PROC'),                  
                           PUSH=(81:17,7))                              
*                                                                      
* NOW THAT THE INPUT RECORD IS PADDED TO UNIQUELY IDENTIFY THE DATA, WE
* CAN EASILY TEST THE PORTION WE NEED TO OVERLAY. BELOW CODE            
*                                                                      
  OUTFIL REMOVECC,                                                      
         IFTHEN=(WHEN=(81,7,CH,EQ,C'PROCXYZ'),                          
                       BUILD=(1,2,C'*',3,77)),                          
         IFTHEN=(WHEN=NONE,                                            
                       BUILD=(1,80))                                    
*                                                                      
* AT THIS POINT, THE RECORDS HAVE BEEN FORMATTED AND OVERLAYED IN A    
* DESIRED MANNER; SAME ARE READY TO BE COPIED TO OUTPUT.                
*                                                                      
  OPTION COPY                                                          
/*                                                                      
 


Output:


********************************* TOP OF DATA **********************************
//*STEP05   EXEC PROCXYZ,                                                      
//*              MEMA=ABCD123,                                                  
//*              MEMBER=XYZ123,                                                
//STEP10   EXEC PROCABC,                                                        
//             DSN='TEST.FILE',                                                
//STEP40   EXEC PROC123                                                        
//             DSN1=INPUT.FILE1,                                                
//             DSN2=OUTPUT.FILE.BKP(+1),                                        
//             LRECL=800,                                                      
//             DCB=                                                            
******************************** BOTTOM OF DATA ********************************
 

These users thanked the author Aki88 for the post:
Surabhi (Wed Nov 23, 2016 1:36 pm)
Aki88
 
Posts: 381
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 36 times

Re: How to comment particular procs from a PS file.

Postby Surabhi » Wed Nov 23, 2016 1:36 pm

Thank you Aki88 this worked out for me.
Surabhi
 
Posts: 49
Joined: Thu Sep 10, 2015 7:51 pm
Has thanked: 4 times
Been thanked: 0 time


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post