Thursday, May 16, 2013

Reformatting SearchFor(ISRSUPC) output Report


You know how useful the search for (ISRSUPC) utility is. Now if You want to use the output report of the utility in a layout format with detail records ready to be used as a input to a program or downloaded to spreadsheet for analysis purpose, then You can use the following Job which uses DFSORT to do the same for You.

//JS010 EXEC PGM=ISRSUPC,PARM=(SRCHCMP,IDPFX,XREF,NOSUMS)            
//NEWDD    DD DSN=HLQ1.HLQ2.DATA.PDS,                              
//            DISP=SHR                                            
//OUTDD    DD DSN=&&TEMPFILE,DISP=(,PASS),SPACE=(CYL,(5,5),RLSE)        
//SYSIN    DD *                                                  
SRCHFOR  'SEARCH STRING 1'
SRCHFOR  'SEARCH STRING 2'
SRCHFOR  'SEARCH STRING 3'
.
.
SRCHFOR  'SEARCH STRING N'                                                
/*                                                                
//JS020 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                            
//SORTIN   DD DSN=&&TEMPFILE,DISP=SHR                                    
//SORTOUT  DD SYSOUT=*,RECFM=FB                                  
//SYSIN    DD * 
  OMIT COND=(01,1,ZD,EQ,1,OR,03,15,CH,EQ,C'MEMBER   LINE-#') 
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(2,14,CH,EQ,C'----- STRING="'), 
           PUSH=(134:15,20))                                              
  SORT FIELDS=(134,20,CH,A)                                             
  OUTFIL BUILD=(134,20,2,132), 
  OMIT=(2,14,CH,EQ,C'----- STRING="',OR,1,133,CH,EQ,C' ')
/*

The significant thing to be noted here is the sort control statements esp. the use of IFTHEN/WHEN=GROUP statement where in we consider all the records following a header line to be a part of the group and using the PUSH keyword in the INREC, we add a particular field value of the header record to all the records in the group.



No comments:

Post a Comment

Popular

Featured

Three Months of Chadhei