kaushik8205
New User
Joined: 10 Nov 2006 Posts: 49 Location: Canada
|
|
|
|
Hi,
I need to do operation on a character field of 7 bytes.
But it can hav any number of digits.
No number will be repeated except few, whose duplicate will be prefixed with 0.
eg:- 123456 --> 6byte
0123456--> 7byte
wat i want is that if such a situation arises 0123456 should be selected.
Input File:-
147852
123456
0123456
963258
0654456
654456
Output File should have:-
147852
0123456
963258
0654456
can it be done using any of the SORT techniques? |
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
What is the RECFM and LRECL of the input file?
Are we only worried about duplicates for 6-byte values vs 7-byte values, or are there other variations such as 5-byte values vs 6-byte values. Please give a complete picture of the variations along with examples.
Do the output records have to be in the original order of the input records or can they be sorted by the numeric values? |
|
kaushik8205
New User
Joined: 10 Nov 2006 Posts: 49 Location: Canada
|
|
|
|
REcord format is FB and LRECL = 300. The duplicates we need to handle i case of 7 and 6 bytes only.
In normal case there won't be any duplicates. But if the same Policy is coming from 2 different systems, then on esystem sends it by prefixing 0.
So when we query from database we all the policies get selected. Now while giving this Unload file as to our program, we don't want any duplicates. And in case there eg:- 0123456 and 123456 we want 0123456.
Hope this clarifies my requirement. |
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT/ICETOOL job that will do what you asked for. You didn't answer my question about whether the output records could be in sorted order, so I assumed you wanted them in their original order as shown in your example. You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use INREC with SELECT. If you don't have the April, 2006 PTF, you won't get the correct output, so ask your System Programmer to install the PTF (it's free). Alternatively, you could use COPY with INREC and SELECT without INREC instead of SELECT with INREC.
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (FB/300)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=... output file (FB/300)
//TOOLIN DD *
SELECT FROM(IN) TO(T1) ON(309,7,CH) FIRST USING(CTL1)
SORT FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=INIT,
OVERLAY=(301:SEQNUM,8,ZD,309:1,7,UFF,M11,LENGTH=7,316:C'A')),
IFTHEN=(WHEN=(7,1,CH,EQ,C' '),OVERLAY=(316:C'B'))
SORT FIELDS=(309,7,CH,A,316,1,CH,A)
/*
//CTL2CNTL DD *
SORT FIELDS=(301,8,ZD,A)
OUTREC BUILD=(1,300)
/*
|
|
|