Posted: Tue Nov 15, 2005 7:24 am Post subject: DFSort - Extract from DCollect
Hello,
I am using dfsort to extract certain record types matching certain volsers from dcollect data. So far so good. I have found, that VSAM dataset type "D" records also have matching type "A" record (containing the cluster name). This is always the record after the type "D" record. Unfortunately the type "A" record does not contain a volser to base my selection upon. Selecting all type "A" records results in the record output sequence being changed. Is there a way to get dfsort to select type "A" records only following matching type "D" records. Or at least to extract all type "A" records without changing the record sequence.
Here my statements
RECORD TYPE=V
SORT FIELDS=COPY
OUTFIL FNAMES=DREC,INCLUDE=(9,1,CH,EQ,C'D',AND,121,3,CH,EQ,C'SYW',OR,
9,1,CH,EQ,C'A')
OUTFIL FNAMES=VREC,INCLUDE=(9,1,CH,EQ,C'V',AND,29,3,CH,EQ,C'SYW')
Also how can I sort the selected data using different criteria?
here an extract of the data showing the structure. The volume name can not be seen as it is too far to the right. It is however only contained in the type "D" records.
Regards
Jon
[code:1:5b2a37bef7]
***************************** Top of Data *****************************
V 309W
.... here something about the output. It could look like this:
D ABCVPS.RMER1083.LRS.DRS.RULES.INDEX
A ABCVPS.RMER1083.LRS.DRS.RULES.INDEX ABCVPS.
D ABCMVSY.SM6ZOS14.MVS1TRG.CSI.DATA
A ABCMVSY.SM6ZOS14.MVS1TRG.CSI.DATA ABCMVSY
In this case just the two type d records match the required volser and the corresponding type a records are also placed in the output file
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Nov 15, 2005 12:06 pm Post subject:
I'm really not sure what you're trying to do. You need to show an example of your input records (you can just show the relevent fields) and what you want for the output records. I suspect you can use DFSORT's IFTHEN clauses to group the records, but I can't tell you exactly how unless I understand exactly what your input looks like and what you want the output to look like.
For a couple of examples of doing group operations with DFSORT, see the "Include or omit groups of records" and "Sort groups of records" Smart DFSORT Tricks at:
here a simplified version showing the record types V, D and A. The number of records can be very large. Not all type D records have a corresponding type A record. If one is there, it will always follow directly after the type D record.
Input File:
V SYS001
D TEST.DSN1.DATA SYS001
A TEST.DSN1.DATA TEST.DSN1.CLUSTER
D TEST.DSN4 SYS001
D TEST.DSN5 SYS001
V SYS002
D TEST.DSN2.DATA SYS002
A TEST.DSN2.DATA TEST.DSN2.CLUSTER
V SYS003
D TEST.DSN3.DATA SYS003
A TEST.DSN3.DATA TEST.DSN3.CLUSTER
After extract using sort (in this example selecting SYS001 and SYS003 from record type V & D) the output data should look something like this:
File1:
V SYS001
V SYS003
File2:
D TEST.DSN1.DATA SYS001 TEST.DSN1.CLUSTER
D TEST.DSN4 SYS001
D TEST.DSN5 SYS001
D TEST.DSN3.DATA SYS003 TEST.DSN3.CLUSTER
The required field from the type A record has been appended to the matching type D record. A split accross two files is not needed - just the way I have tried to solve the problem.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Nov 15, 2005 2:11 pm Post subject:
Jon,
The DFSORT/ICETOOL job below gives the results you want for the data you showed in your previous post. It's pretty specific to that data layout, so if you have a different data layout, it would have to be reworked for that.
You'll need z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004) in order to use DFSORT's IFTHEN, OVERLAY, KEEPBASE and VLENMAX functions. Only DFSORT has these functions, so if you don't have DFSORT, you won't be able to use them. If you do have DFSORT, but you don't have the Dec, 2004 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (VB)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T3 DD DSN=&&T3,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT1 DD DSN... output file -> V records (VB)
//OUT2 DD DSN=... output file -> D records (VB)
//TOOLIN DD *
* Set up D and A records as a group.
COPY FROM(IN) TO(T1) USING(CTL1)
* Splice D and A records together.
SPLICE FROM(T1) TO(T2) ON(5,8,ZD) WITH(21,6) WITH(51,19) -
KEEPNODUPS
* Set up V and D records for each volser as a group.
COPY FROM(T2) TO(T3) USING(CTL2)
* Splice volser into each group and do INCLUDE on wanted volsers
* and record types.
SPLICE FROM(T3) TO(OUT1) ON(5,8,ZD) WITHALL WITH(27,41) -
KEEPBASE VLENMAX USING(CTL3)
/*
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=INIT,
BUILD=(1,4,5:SEQNUM,8,ZD,13:8X,21:6X,27:5)),
IFTHEN=(WHEN=(27,1,SS,EQ,C'V,D'),
OVERLAY=(5:SEQNUM,8,ZD),HIT=NEXT),
IFTHEN=(WHEN=(27,1,CH,EQ,C'V'),
OVERLAY=(21:29,6)),
IFTHEN=(WHEN=(27,1,CH,EQ,C'A'),
OVERLAY=(13:SEQNUM,8,ZD,
5:5,8,ZD,SUB,13,8,ZD,M11,LENGTH=8,
51:44,19,29:22X)),
IFTHEN=(WHEN=NONE,
OVERLAY=(13:SEQNUM,8,ZD,
5:5,8,ZD,SUB,13,8,ZD,M11,LENGTH=8))
/*
//CTL2CNTL DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(5:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(27,1,CH,EQ,C'V'),
OVERLAY=(5:SEQNUM,8,ZD)),
IFTHEN=(WHEN=NONE,
OVERLAY=(13:SEQNUM,8,ZD,
5:5,8,ZD,SUB,13,8,ZD,M11,LENGTH=8))
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT1,INCLUDE=(21,6,SS,EQ,C'SYS001,SYS003',AND,
27,1,CH,EQ,C'V'),
BUILD=(1,4,5:27)
OUTFIL FNAMES=OUT2,INCLUDE=(21,6,SS,EQ,C'SYS001,SYS003',AND,
27,1,CH,EQ,C'D'),
BUILD=(1,4,5:27)
/*
OUT1 has:
Code:
V SYS001
V SYS003
OUT2 has:
Code:
D TEST.DSN1.DATA SYS001 TEST.DSN1.CLUSTER
D TEST.DSN4 SYS001
D TEST.DSN5 SYS001
D TEST.DSN3.DATA SYS003 TEST.DSN3.CLUSTER
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum