Page 1 of 1

Using SORT to change member separators into JCL nulls

PostPosted: Thu Mar 09, 2017 2:49 pm
by Steve Coalbran
Hi, I want to flatten a PDS, which I can do with IEBPTPCH.
The intermediate output file looks like this...
SDSF OUTPUT DISPLAY N472730R JOB99747  DSID   111
 COMMAND INPUT ===>                              
----+----1----+----2----+----3----+----4----+----5
********************************* TOP OF DATA ****
VMEMBER NAME  PGACPY10                            
V//PGACPY10 JOB (GA,P),'WST',CLASS=C,MSGCLASS=E  
V/*JOBPARM  L=999,R=OPC                          
V/*ROUTE    PRINT LOCAL
...
so I then have to remove the first character (always a 'V').
If I find the 'VMEMBER NAME' header I want to replace the whole record with only '//'.
I am successfully doing this at the moment with this...
//IEBPTPCH EXEC PGM=IEBPTPCH                                    
//SYSPRINT DD SYSOUT=*                                          
//SYSUT1   DD DISP=SHR,DSN=&DLJ         Input Library
//SYSUT2   DD DSN=&&SQ1,                                        
//            DISP=(,PASS,DELETE),                              
//            SPACE=(CYL,(5,5),RLSE),                          
//            RECFM=FB,LRECL=81                                
//SYSIN    DD  *                                                
  PUNCH TYPORG=PO
//*                                              
//FCBNULLS EXEC PGM=SORT                                        
//SYSOUT   DD SYSOUT=*                                          
//SYSPRINT DD SYSOUT=*                                          
//SYSUDUMP DD SYSOUT=*                                          
//REPORT1  DD SYSOUT=*                                          
//SORTIN   DD DISP=SHR,DSN=&&SQ1                                
//SORTOUT  DD DSN=&&SQ2,                                        
//            DISP=(,PASS,DELETE),SPACE=(CYL,(5,5)),            
//            RECFM=FB,LRECL=80                                
//SORTWK01 DD SPACE=(CYL,(20,5),RLSE)                          
//SORTWK02 DD SPACE=(CYL,(20,5),RLSE)                          
//SORTWK03 DD SPACE=(CYL,(20,5),RLSE)                          
//SYSIN    DD *                                                
  SORT FIELDS=COPY                                              
  INREC IFTHEN=(WHEN=(1,14,CH,EQ,C'VMEMBER NAME  '),            
          OVERLAY=(2:C'//                                    '))
  OUTREC FIELDS=(1:2,80)                                        
//*
However I want to ensure that the ONLY thing on the line when this is a 'header' is '//'.
Can I add a length parameter (72 or 80) to the OVERLAY?
I scoured the fora and Gooogled for 'SORT OUTREC OVERLAY SYNTAX' but could not find a good (understandable) ol'fashioned Syntax Diagram.
Also OVERLAY may not be the optimum way to achieve this?

Re: Using SORT to change member separators into JCL nulls

PostPosted: Thu Mar 09, 2017 3:46 pm
by BillyBoyo
INREC IFTHEN=(WHEN=(1,14,CH,EQ,C'VMEMBER NAME  '),            
          OVERLAY=(2:C'//',78X))

That would get you // starting in column two, followed by 78 blanks.

You could also use BUILD instead of OVERLAY here, because you are wanting to overlay the lot:

          BUILD=(1,1,C'//',81:X)


That would build a new current record from the first byte of the old current record, the constant //, and at position 81 would put one blank. Any intervening fields implicitly created by the use of a column-number in BUILD are blank-padded automatically.

Please use BUILD stead of FIELDS when... building... new records.

Re: Using SORT to change member separators into JCL nulls

PostPosted: Thu Mar 09, 2017 5:03 pm
by Steve Coalbran
The BUILD failed...
ICE000I 1 - CONTROL STATEMENTS FOR 5650-ZOS, Z/OS DFSORT V2R2  - 12:15 ON THU MA
            SORT FIELDS=COPY                                                    
            INREC IFTHEN=(WHEN=(1,14,CH,EQ,C'VMEMBER NAME  '),                  
                    BUILD=(1,1,C'//',81:X)                                      
                                          Å                                    
ICE007A 0 SYNTAX ERROR                                                          
            OUTREC FIELDS=(1:2,80)

This however worked...
         OVERLAY=(2:C'//',79X))

Re: Using SORT to change member separators into JCL nulls

PostPosted: Thu Mar 09, 2017 9:43 pm
by BillyBoyo
It's missing a closing bracket from the IFTHEN. The BUILD is correct. The pain of showing the BUILD separately :-)