Using SORT to change member separators into JCL nulls



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Using SORT to change member separators into JCL nulls

Postby Steve Coalbran » Thu Mar 09, 2017 2:49 pm

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?
Steve
User avatar
Steve Coalbran
 
Posts: 138
Joined: Wed Apr 06, 2011 11:49 am
Location: Stockholm, Sweden
Has thanked: 13 times
Been thanked: 1 time

Re: Using SORT to change member separators into JCL nulls

Postby BillyBoyo » Thu Mar 09, 2017 3:46 pm

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.

These users thanked the author BillyBoyo for the post:
Steve Coalbran (Thu Mar 09, 2017 4:44 pm)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Using SORT to change member separators into JCL nulls

Postby Steve Coalbran » Thu Mar 09, 2017 5:03 pm

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))
Steve
User avatar
Steve Coalbran
 
Posts: 138
Joined: Wed Apr 06, 2011 11:49 am
Location: Stockholm, Sweden
Has thanked: 13 times
Been thanked: 1 time

Re: Using SORT to change member separators into JCL nulls

Postby BillyBoyo » Thu Mar 09, 2017 9:43 pm

It's missing a closing bracket from the IFTHEN. The BUILD is correct. The pain of showing the BUILD separately :-)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post