Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Apr 12, 2005 4:19 pm Post subject:
What are the rules for selecting the records you want in the output data set? From the example you show above, I can think of a few possibilities such as (1) keep each B1 record and the record that precedes it (2) keep each record where the first field ends with '1' or '2'. Please tell us the actual rules YOU want to use. Also, what is the RECFM and LRECL of the input file? _________________ 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
Frank, the format of my input file is VB, the length is 9954. My input file is of the format shown below:
Code:
Mem No Seg no form no
111111111 10
111111111
111111111
111111111
111111111
111111111
111111111 60 B1
222222222 10
222222222
222222222
222222222
222222222 60 B1
333333333 10
333333333
333333333
333333333
333333333 60 B1
444444444 10
444444444
444444444
444444444
444444444 60 B1
555555555 10
555555555
555555555
555555555 60
My output should have
Code:
Mem No Seg No form no
11111111 10
11111111 60 B1
22222222 10
22222222 60 B1
33333333 10
33333333 60 B1
44444444 10
44444444 60 B1
My input file is sorted by Member number and its position on the input file is 35. The position of the Segment no the input file is 122 and the position of the form no on the input file is 912. My requirement is I need to print the all the members that have form number B1 in Segment 60 along with Segment 10. Segment 10 and 60 are mandatory segments.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Apr 13, 2005 11:07 am Post subject:
sri,
So if I understand what you want correctly, the trick here is to keep the 10/60 pairs where the 60 has B1 and delete the 10/60 pairs where the 60 does not have B1. Since the records are already in order by the member name, we can use a MERGE instead of a SORT for better performance.
With z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95214 (Dec, 2004), you can use DFSORT's new IFTHEN and OVERLAY parameters to do what you want. The trick is to use SUM to add the segment numbers for the 10/60 pairs without B1 to get 70, but not to sum the 10/60 pairs with B1. We can then remove the records with 70, leaving only the 10/60 pairs with B1. Here's the DFSORT job:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN01 DD DSN=... input file (sorted by member name)
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION VLSCMP,EQUALS,ZDPRINT
* Get the '10' and '60' records.
INCLUDE COND=(122,2,CH,EQ,C'10',OR,122,2,CH,EQ,C'60')
* Reformat the '10' records to:
* |RDW|1|...member...10... ...|
* Reformat the '60' records without 'B1' to:
* |RDW|1|...member...60... ...|
* Reformat the '60' records with 'B1' to:
* |RDW|2|...member...60...B1...|
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,5:C'1',6:5)),
IFTHEN=(WHEN=(123,2,CH,EQ,C'60',AND,913,2,CH,EQ,C'B1'),
OVERLAY=(5:C'2'))
* Merge on the member name and the '1' or '2' in cc 5.
MERGE FIELDS=(36,9,CH,A,5,1,CH,A)
* Sum: '10' records and '60' records with 'B1' are dups
* because they both have '1' for the key in cc 5. So the
* seg numbers are summed to get '70'.
* '10' records and '60' records without 'B1' are nondups
* because they have '1' and '2' for the key in cc 5, resp.
* So they are not summed.
SUM FIELDS=(123,2,ZD)
* Delete the records with '70' (no 'B1').
OUTFIL OMIT=(123,2,CH,EQ,C'70'),
* Remove the '1' or '2' in cc 5.
OUTREC=(1,4,5:6)
/*
Note that when we add the '1' or '2' in cc 5, it moves all the other data over one column, so we have to use column+1 when referring to these fields (e.g. 123 instead of 122 for the segment field). The OUTFIL OUTREC removes the '1' or '2' in cc 5, restoring the fields back to their original columns. _________________ 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: Wed Apr 13, 2005 4:39 pm Post subject:
Ask your System Programmer to install the Dec, 2004 PTF ASAP (it's free). _________________ 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