Format LISTDS output using DFSORT



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

Format LISTDS output using DFSORT

Postby mfrookie » Tue Apr 26, 2011 10:21 am

I am using LISTDS to list all the members of some of the PDSs. My input looks like as shown and I want it to be formatted as shown in output below. I tried a lot but couldn't it as expected. I can do it in multiple passes but was wondering if there a better way to do it in minimum passes.

Input -

READY
  LISTDS 'USERID.COBSRC' MEMBERS
USERID.COBSRC
--RECFM-LRECL-BLKSIZE-DSORG
  FB    80    32720   PO

--VOLUMES--
  LILTAN
--MEMBERS--
  ABI00001
  ABI00002
  ABI00003
  ABI00004
READY
  LISTDS 'USERID.CPYLIB' MEMBERS
USERID.CPYLIB
--RECFM-LRECL-BLKSIZE-DSORG
  FB    80    27920   PO

--VOLUMES--
  LILTAL
--MEMBERS--
  ABC00001
  DGC00001
  POC00001
READY
  LISTDS 'USERID.JCLLIB' MEMBERS
USERID.JCLLIB
--RECFM-LRECL-BLKSIZE-DSORG
  FB    80    27920   PO

--VOLUMES--
  LIXLAD
--MEMBERS--
  SDJCL001
  SDJCL002
READY
  LISTDS 'USERID.PROCLIB' MEMBERS
USERID.PROCLIB
--RECFM-LRECL-BLKSIZE-DSORG
  FB    80    27920   PO

--VOLUMES--
  LILTAL
--MEMBERS--
  SDPRC001
  SDPRC002
READY
END


Expected Output -

ABI00001 USERID.COBSRC
ABI00002 USERID.COBSRC
ABI00003 USERID.COBSRC
ABI00004 USERID.COBSRC
ABC00001 USERID.CPYLIB
DGC00001 USERID.CPYLIB
POC00001 USERID.CPYLIB
SDJCL001 USERID.JCLLIB
SDJCL002 USERID.JCLLIB
SDPRC001 USERID.PROCLIB
SDPRC002 USERID.PROCLIB


In short, besides the member name, I want the PDS name to be appear to which the member belongs. this output will further be used in building multiple FTP scripts.

Thanks
mfrookie
 
Posts: 40
Joined: Mon Apr 25, 2011 8:46 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Format LISTDS output using DFSORT

Postby skolusu » Tue Apr 26, 2011 9:42 pm

mfrookie,

Use the following DFSORT JCL which will give you the results in one pass. I am also showing you the LISTDS step. This will create the output of 80 bytes with member name of 8 bytes and PDS name of 36 bytes and the rest padded with spaces.

//STEP0050 EXEC PGM=IKJEFT01                             
//SYSTSPRT DD DSN=&&L,                                   
//            DISP=(NEW,CATLG,DELETE),                   
//            SPACE=(CYL,(15,5),RLSE),                   
//            DCB=(LRECL=80,RECFM=FB,BLKSIZE=27920)       
//SYSTSIN  DD *
  LISTDS 'USERID.COBSRC' MEMBERS
  LISTDS 'USERID.CPYLIB' MEMBERS
  LISTDS 'USERID.JCLLIB' MEMBERS
  LISTDS 'USERID.PROCLIB' MEMBERS                         
//*
//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD DSN=&&L,DISP=SHR                                 
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                               
  SORT FIELDS=COPY                                             
  OMIT COND=(1,3,CH,EQ,C'END')                                 
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(3,6,CH,EQ,C'LISTDS'),       
  PUSH=(81:SEQ=1),RECORDS=2),                                 
  IFTHEN=(WHEN=GROUP,BEGIN=(81,1,ZD,EQ,2),PUSH=(82:1,36)),     
  IFTHEN=(WHEN=GROUP,BEGIN=(01,11,CH,EQ,C'--MEMBERS--'),       
  END=(1,5,CH,EQ,C'READY'),PUSH=(118:1,1))                     
                                                               
  OUTFIL BUILD=(3,8,X,82,36,80:X),                             
  OMIT=(118,01,CH,EQ,C' ',OR,                                 
        001,05,CH,EQ,C'READY',OR,                             
        001,11,CH,EQ,C'--MEMBERS--')                           
//*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Format LISTDS output using DFSORT

Postby mfrookie » Wed Apr 27, 2011 11:16 am

Hi Kolusu,

Thanks a lot for the solution. Its working perfectly.

It seems my understanding of WHEN=GROUP clause wasn't correct. I was under the impression that at a time only one WHEN=GROUP (the first one that satisfies the condition, similar to that of EVALUATE clause in COBOL) is applied and then all following GROUP clauses are ignored. And I always thought why don't we have HIT=NEXT option available on WHEN=GROUP clause whereas its already available on WHEN=(condition) clause. :)

But now I am clear on how it works, should have carefully read the fine manual.

Thanks lot once again.
mfrookie
 
Posts: 40
Joined: Mon Apr 25, 2011 8:46 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post