Fetch record in output



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

Fetch record in output

Postby ajuatsgp » Sun Jul 15, 2012 5:06 pm

Hi,
I have records as shown below:
000509603019444 0 000509603019444 000150000810005 1 L
000509603020807 0 000509603019444 000150000810005 1

000509603017979 0 000509603019460 000150000810005 1 L
000509603018361 0 000509603019460 000150000810005 1
000509603019460 0 000509603019460 000150000810005 1 L


000509603019473 0 000509603019473 000150000810005 1 L
000509603050264 0 000509603019473 000150000810005 1


000509603017244 0 000509603019487 000150000810005 1 L
000509603018105 0 000509603019487 000150000810005 1
000509603019487 0 000509603019487 000150000810005 1 L
000509603021889 0 000509603019487 000150000810005 1 L

000506874008000 0 000406474008000 000150000800000 1 L


My driving field starts at position 19 and of length 15.
My output need to have the records when position 65 is SPACES. Only problem is the last record as shown here.My input file can have few records like this,where there will be only 1 record with postion 65 not SPACES and in such scenario I need to get those records.When there are multiple records for my driving field I can easily sort out unwanted records by checking = or not =SPACES,but if there is only one record exist for the driving field then I need to fetch that in my output irrespective of position 65 =SPACES or not=SPACES.

I guess my question is clear.I am not confusing.

Thanks,
AK
ajuatsgp
 
Posts: 82
Joined: Thu May 20, 2010 6:50 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Fetch record in output

Postby dick scherrer » Mon Jul 16, 2012 2:24 am

Hello,

I guess my question is clear.
Not yet . . .

If you post the "output" you want from the sample input it will help.

Is this the way the input will always appear? If there are other possibilities, these need to be posted as well.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Fetch record in output

Postby ajuatsgp » Mon Jul 16, 2012 4:31 am

Hi,
My output should look like as below:
       000509603020807 0 000509603019444 000150000810005 1

       000509603018361 0 000509603019460 000150000810005 1
   
      000509603050264 0 000509603019473 000150000810005 1

      000509603018105 0 000509603019487 000150000810005 1
      000506874008000 0 000406474008000 000150000800000 1 L

Please note that as this is just a sample data,hence the digits between field 36-51 are same for most of the records,they can be different. As already mentioned my driver field starts at position 19 and of length 15.
Thanks,
AK
ajuatsgp
 
Posts: 82
Joined: Thu May 20, 2010 6:50 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Fetch record in output

Postby skolusu » Mon Jul 16, 2012 9:24 pm

ajuatsgp,

Use the following DFSORT/ICETOOL JCL which will give you the desired results
//STEP0100 EXEC PGM=ICETOOL                                       
//TOOLMSG  DD SYSOUT=*                                           
//DFSMSG   DD SYSOUT=*                                           
//IN       DD *                                                   
----+----1----+----2----+----3----+----4----+----5----+----6----+-
000509603019444 0 000509603019444 000150000810005 1             L
000509603020807 0 000509603019444 000150000810005 1               
000509603017979 0 000509603019460 000150000810005 1             L
000509603018361 0 000509603019460 000150000810005 1               
000509603019460 0 000509603019460 000150000810005 1             L
000509603019473 0 000509603019473 000150000810005 1             L
000509603050264 0 000509603019473 000150000810005 1               
000509603017244 0 000509603019487 000150000810005 1             L
000509603018105 0 000509603019487 000150000810005 1               
000509603019487 0 000509603019487 000150000810005 1             L
000509603021889 0 000509603019487 000150000810005 1             L
000506874008000 0 000406474008000 000150000800000 1             L
//OUT      DD SYSOUT=*                                           
//TOOLIN   DD *                                                   
  SELECT FROM(IN) TO(OUT) ON(19,15,CH) FIRST USING(CTL1)         
//*                                                               
//CTL1CNTL DD *                                                   
  SORT FIELDS=(19,15,CH,A,                                       
               65,01,CH,A)                                       
//*


The output from this job is
000506874008000 0 000406474008000 000150000800000 1             L 
000509603020807 0 000509603019444 000150000810005 1               
000509603018361 0 000509603019460 000150000810005 1               
000509603050264 0 000509603019473 000150000810005 1               
000509603018105 0 000509603019487 000150000810005 1               
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: Fetch record in output

Postby ajuatsgp » Mon Jul 16, 2012 9:28 pm

Thanks skolusu...I will try this tomorrow
ajuatsgp
 
Posts: 82
Joined: Thu May 20, 2010 6:50 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Fetch record in output

Postby ajuatsgp » Wed Jul 25, 2012 9:17 pm

Hi,
If my input is as below:
000509603019444 0 000509603019444 000150000810005 1             L
000509603020807 0 000509603019444 000150000810005 1               
000509603017979 0 000509603019460 000150000810005 1             L
000509603018361 0 000509603019460 000150000810005 1               
000509603019460 0 000509603019460 000150000810005 1             L
000509603019473 0 000509603019473 000150000810005 1             L
000509603050264 0 000509603019473 000150000810005 1               
000509603017244 0 000509603019487 000150000810005 1             L
000509603018105 0 000509603019487 000150000810005 1               
000509603019487 0 000509603019487 000150000810005 1             L
000509603021889 0 000509603019487 000150000810005 1             L
000506874008000 0 000406474008000 000150000800000 1             L
000509603018555 0 000509603018555 000150000810005 1             L
000509603020807 0 000509603018555 000150000810005 1             
000609502030807 0 000509603018555 000150000810005 1             
000509603027155 0 000509603019589 000150000810005 1             L
000509601037216 0 000509603019589 000150000810005 1               
000509601038497 0 000509603019589 000150000810005 1             L
000509603529108 0 000509603019589 000150000810005 1             L
000609503418209 0 000509603019589 000150000810005 1               
000509605620507 0 000509603219455 000150000810005 1             
000609513050607 0 000509603219455 000150000810005 1             
 
and my required output is
000506874008000 0 000406474008000 000150000800000 1             L
000509603020807 0 000509603018555 000150000810005 1             
000609502030807 0 000509603018555 000150000810005 1               
000509603020807 0 000509603019444 000150000810005 1               
000509605620507 0 000509603219455 000150000810005 1             
000609513050607 0 000509603219455 000150000810005 1           
000509603018361 0 000509603019460 000150000810005 1               
000509603050264 0 000509603019473 000150000810005 1               
000509603018105 0 000509603019487 000150000810005 1                         
000509601037216 0 000509603019589 000150000810005 1
000609503418209 0 000509603019589 000150000810005 1
I have gone through all the other Operands available with the SELECT Operator of ICETOOL, but could not find any using which I can get this output. My sample output is looks to be sorted on 19,15,CH,A but it is not mandatory.
Could you please help?

Thanks,
AK
ajuatsgp
 
Posts: 82
Joined: Thu May 20, 2010 6:50 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Fetch record in output

Postby skolusu » Wed Jul 25, 2012 11:58 pm

ajuatsgp,

So if you have dups on the key with spaces on both records you need both records?

For key 000509603018555 you have 3 records . 1 has an indicator L and the other 2 records have spaces. In your output you show 2 records with spaces. If you do need the dups then you can use the following DFSORT JCL which will give you the desired results. I assumed your input is FB and LRECL=80
//STEP0100 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD *                                                   
000509603019444 0 000509603019444 000150000810005 1             L
000509603020807 0 000509603019444 000150000810005 1               
000509603017979 0 000509603019460 000150000810005 1             L
000509603018361 0 000509603019460 000150000810005 1               
000509603019460 0 000509603019460 000150000810005 1             L
000509603019473 0 000509603019473 000150000810005 1             L
000509603050264 0 000509603019473 000150000810005 1               
000509603017244 0 000509603019487 000150000810005 1             L
000509603018105 0 000509603019487 000150000810005 1               
000509603019487 0 000509603019487 000150000810005 1             L
000509603021889 0 000509603019487 000150000810005 1             L
000506874008000 0 000406474008000 000150000800000 1             L
000509603018555 0 000509603018555 000150000810005 1             L
000509603020807 0 000509603018555 000150000810005 1               
000609502030807 0 000509603018555 000150000810005 1               
000509603027155 0 000509603019589 000150000810005 1             L
000509601037216 0 000509603019589 000150000810005 1               
000509601038497 0 000509603019589 000150000810005 1             L
000509603529108 0 000509603019589 000150000810005 1             L
000609503418209 0 000509603019589 000150000810005 1               
000509605620507 0 000509603219455 000150000810005 1               
000609513050607 0 000509603219455 000150000810005 1               
//SORTOUT  DD DSN=&&O1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)       
//SYSIN    DD *                                                   
  SORT FIELDS=(19,15,CH,A,                                       
               65,01,CH,A),EQUALS                                 
                                                                 
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(81:65,1)),                   
  IFTHEN=(WHEN=GROUP,KEYBEGIN=(19,15),PUSH=(82:81,1))             
                                                                 
  OUTFIL OMIT=(81,2,CH,EQ,C'L '),BUILD=(1,80)                     
//*
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: Fetch record in output

Postby ajuatsgp » Thu Jul 26, 2012 12:47 am

Hi skolusu,
I will try this tomorrow when I will have MF access.
My input is FB and LRECL=65.I will modify your solution accordingly.
Just one question, will the sort output contain below record as well?
000506874008000 0 000406474008000 000150000800000 1             L

When there is record where there is no SPACE @ 65position and only record with L as mentioned in the input.

I understand while trying your solution I can know it,just wanted to confirm if this case is considered or not?

Thanks,
AK
ajuatsgp
 
Posts: 82
Joined: Thu May 20, 2010 6:50 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Fetch record in output

Postby skolusu » Thu Jul 26, 2012 1:51 am

ajuatsgp wrote:Hi skolusu,
I will try this tomorrow when I will have MF access.
My input is FB and LRECL=65.I will modify your solution accordingly.
Just one question, will the sort output contain below record as well?
000506874008000 0 000406474008000 000150000800000 1             L

When there is record where there is no SPACE @ 65position and only record with L as mentioned in the input.

I understand while trying your solution I can know it,just wanted to confirm if this case is considered or not?

Thanks,
AK


Yes It is picked up for output. I am only eliminating if the 1st record is a space and the any of the following record has L in 65 position.
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: Fetch record in output

Postby ajuatsgp » Thu Jul 26, 2012 10:05 pm

Hi,
I was doing Merge in one step and in the next step I was trying to fetch the required output as mentioned below. So last time when we had a solution using ICETOOL,I made 1 single step and I did both the merge and sort in one step using ICETOOL. So my code was looking something like:
//TOOLIN   DD *                                                   
  MERGE  FROM(IN1) TO (OUT1) USING(MERG)
  SELECT FROM(IN) TO(OUT) ON(19,15,CH) FIRST USING(CTL1)         
//*                   
//MERGCNTL DD *
OPTION EQUALS
MERGE FIELDS=My reqd Fields
/*                                           
//CTL1CNTL DD *                                                   
  SORT FIELDS=(19,15,CH,A,                                       
               65,01,CH,A)                                       
//*

but now with the current sort card again I have to split to two steps as I checked all the Operands available with SELECT operator(ex:ALLDUPS,NODUPS,HIGHER(x) etc) I can't use any of them neither can I ignore them.
Is it possible to use the current sort card in CTL1
SORT FIELDS=(19,15,CH,A,                                       
               65,01,CH,A),EQUALS                                 
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(81:65,1)),                   
  IFTHEN=(WHEN=GROUP,KEYBEGIN=(19,15),PUSH=(82:81,1))                                                                           
  OUTFIL OMIT=(81,2,CH,EQ,C'L '),BUILD=(1,80) 
and do both my merge and sort in one step using ICETOOL.

Thanks,
AK
ajuatsgp
 
Posts: 82
Joined: Thu May 20, 2010 6:50 pm
Has thanked: 0 time
Been thanked: 0 time

Next

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post