Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Tue Mar 29, 2005 9:50 am Post subject:
peterblaak,
Try this
Code:
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
11111111 A A
11111111 B A
22222222 A B
33333333 A A
33333333 A A
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,8,CH) USING(CTL1) FIRST
//CTL1CNTL DD *
SORT FIELDS=(01,8,CH,A,
10,1,CH,D)
/*
Posted: Wed Mar 30, 2005 2:31 am Post subject: almost
Hi
it works with the sample i gave you but I forgot to say there's more than 2 fields with A's or B's, so the correct input is:
Code:
KEYFIELD DATAFIELDS
11111111 A A A A
11111111 B A A A
11111111 A B A A
22222222 A B A A
33333333 A A A A
33333333 A A A A
33333333 A A B A
44444444 A A A B
required output:
11111111 B B A A
22222222 A B A A
33333333 A A B A
44444444 A A A B
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Wed Mar 30, 2005 9:03 am Post subject:
peterblaak,
Post detailed information on what you're trying to accomplish. Do not make people guess what you mean. This will give you a much better chance of getting a good answer to your question.
You just posted a sample input and desired output without any describing the criteria to pick the records.
Based on your sample input and output, I am assuming that your datafields can only have an "a" or "b". I am assuming that your input is of FB recfm and has an lrecl of 80.
try this job.
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
11111111 A A A A
11111111 B A A A
11111111 A B A A
22222222 A B A A
33333333 A A A A
33333333 A A A A
33333333 A A B A
44444444 A A A B
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC FIELDS=(01,9,
10,1,CHANGE=(1,C'A',C'0',
C'B',C'1'),NOMATCH=(C'0'),
11,1,
12,1,CHANGE=(1,C'A',C'0',
C'B',C'1'),NOMATCH=(C'0'),
13,1,
14,1,CHANGE=(1,C'A',C'0',
C'B',C'1'),NOMATCH=(C'0'),
15,1,
16,1,CHANGE=(1,C'A',C'0',
C'B',C'1'),NOMATCH=(C'0'),
17,64)
SORT FIELDS=(1,8,CH,A)
SUM FIELDS=(10,1,12,1,14,1,16,1),FORMAT=ZD
OUTREC FIELDS=(01,9,
10,1,CHANGE=(1,C'0',C'A'),NOMATCH=(C'B'),
11,1,
12,1,CHANGE=(1,C'0',C'A'),NOMATCH=(C'B'),
13,1,
14,1,CHANGE=(1,C'0',C'A'),NOMATCH=(C'B'),
15,1,
16,1,CHANGE=(1,C'0',C'A'),NOMATCH=(C'B'),
17,64)
/*
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Mar 30, 2005 11:47 am Post subject:
peterblaak,
If you have z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004), you can use DFSORT's new IFTHEN and OVERLAY parameters to do what you want as shown below. Since you show your records as already in order, I used MERGE and SORTIN01 (a merge is faster than a sort). If your records are not actually in order, use SORT and SORTIN instead. Note: I added a couple of data points with a B in the same column in both records to make it more interesting.
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN01 DD *
11111111 A A A A
11111111 B A A A
11111111 A B A A
11111111 B B A A
22222222 A B A A
33333333 A A A A
33333333 A A A A
33333333 A A B A
33333333 A A B A
44444444 A A A B
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
* Init. 81-84 to '0000'. Replace '0' with '1' for each 'B'.
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'0000')),
IFTHEN=(WHEN=(10,1,CH,EQ,C'B'),OVERLAY=(81:C'1'),HIT=NEXT),
IFTHEN=(WHEN=(12,1,CH,EQ,C'B'),OVERLAY=(82:C'1'),HIT=NEXT),
IFTHEN=(WHEN=(14,1,CH,EQ,C'B'),OVERLAY=(83:C'1'),HIT=NEXT),
IFTHEN=(WHEN=(16,1,CH,EQ,C'B'),OVERLAY=(84:C'1'))
MERGE FIELDS=(1,8,CH,A)
OPTION ZDPRINT
* Sum 81-84. Sum for each column will be '0' if only 'A's, or
* >0 if any 'B's.
SUM FIELDS=(81,4,ZD)
* Init. 10-16 to 'B B B B'. Replace 'B' with 'A' for each '0'.
* Remove 81-84.
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(10:C'B B B B')),
IFTHEN=(WHEN=(81,1,CH,EQ,C'0'),OVERLAY=(10:C'A'),HIT=NEXT),
IFTHEN=(WHEN=(82,1,CH,EQ,C'0'),OVERLAY=(12:C'A'),HIT=NEXT),
IFTHEN=(WHEN=(83,1,CH,EQ,C'0'),OVERLAY=(14:C'A'),HIT=NEXT),
IFTHEN=(WHEN=(84,1,CH,EQ,C'0'),OVERLAY=(16:C'A')),
IFOUTLEN=80
/*
_________________ 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
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Thu Mar 31, 2005 12:04 pm Post subject:
Quote:
You can look at the first line in your sysout to find the version of the sort product you are using.
Kolusu,
I'm not sure if that's true for Syncsort in terms of their equivalent of PTFs (?), but it's not true for DFSORT.
For DFSORT, the ICE000I message (not the first line) tells you the release: 'Z/OS DFSORT V1R5' or 'REL 14.0'. But it doesn't tell you which PTFs are installed. Actually, PTFs only "hit" certain modules, so the current level of DFSORT will have a mix of PTFs for various modules. _________________ 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