joining info into one record



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

joining info into one record

Postby ottoelflaco » Tue Oct 22, 2013 6:31 pm

Hi experts!!

Could you tell me how can I do the next?:

In (key in position 1,3):
111AA
111  BBBB
222CC
222  AAAA 


Out
111AABBBB
222CCAAAA 


I can do this exercise with numbers using SUM FIELDS...but with chars?, I m trying to do. Is there other way to do it?

My english is very poor. I hope that you understand my requirements


Regards!! :!:
ottoelflaco
 
Posts: 36
Joined: Fri Sep 21, 2012 2:33 pm
Has thanked: 1 time
Been thanked: 0 time

Re: joining info into one record

 

Re: joining info into one record

Postby BillyBoyo » Tue Oct 22, 2013 6:49 pm

Are the records always in pairs? If so, look at IFTHEN=(WHEN=GROUP and some examples of transferring data from one record to another.

If not, please show a representative sample input and expected output.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: joining info into one record

Postby ottoelflaco » Wed Oct 23, 2013 3:54 pm

Hi,

Thank you Billy, it works. I did this:
//SORT12   EXEC PGM=SORT,REGION=2M,COND=(0,NE)         
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD *                                         
111AA                                                   
111  BBBB                                               
222CC                                                   
222  AAAA                                               
333DD                                                   
333  AAAA                                               
//SORTOUT  DD DSN=DES.IS.LR.BDK.JCJCL10.SORT12,         
//            DISP=(,CATLG,CATLG),                     
//            SPACE=(TRK,(100,225),RLSE),               
//            DCB=(RECFM=FB,LRECL=20,BLKSIZE=0,DSORG=PS)
//SYSIN    DD *                                         
  SORT FIELDS=COPY                                     
  INREC IFOUTLEN=20,                                   
  IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,3),PUSH=(10:4,2)),     
  IFTHEN=(WHEN=INIT,                                   
  OVERLAY=(4:10,2))                                     


I get this out:
111AA    AA
111AABBBBAA
222CC    CC
222CCAAAACC
333DD    DD
333DDAAAADD


Now I only need filter the space in position 6.

Only one question more, how can I filter in the same step??, If I add INCLUDE COND=(6,1,CH,NE,C' ') to the code, of this way:
SORT FIELDS=COPY                                 
INREC IFOUTLEN=20,                               
IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,3),PUSH=(10:4,2)),
IFTHEN=(WHEN=INIT,                               
OVERLAY=(4:10,2))                               
INCLUDE COND=(6,1,CH,NE,C' ')                   


The out is the next
111  BBBB
222  AAAA
333  AAAA



, anybody can help me with this doubt...
ottoelflaco
 
Posts: 36
Joined: Fri Sep 21, 2012 2:33 pm
Has thanked: 1 time
Been thanked: 0 time

Re: joining info into one record

Postby ottoelflaco » Thu Oct 24, 2013 4:03 pm

Now :D

SORT FIELDS=COPY                                       
INREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,3),PUSH=(10:4,2)),
      IFTHEN=(WHEN=INIT,OVERLAY=(4:10,2))             
OUTFIL INCLUDE=(6,1,CH,NE,C' ')                       
ottoelflaco
 
Posts: 36
Joined: Fri Sep 21, 2012 2:33 pm
Has thanked: 1 time
Been thanked: 0 time

Re: joining info into one record

Postby ottoelflaco » Fri Oct 25, 2013 8:44 pm

I won´t open a new topic for this,...because is related. If moderador consider that is better a new topic, I ll open it.. sorry if not OK

A new requeriment, this is interesting for me!

-key: position(1,3)
-Values are in pair in position(4,8), and the values are in pair: 'AA', 'BB', 'CC', 'DD'.....
Can I get the last value ordered descending of pair AA,BB,CC?

Is hard for me explain it. I ll try with example:
111AA  AAAA
111  BBBB 
111CC     
222  CC  BB
222CCAABBBB
222DDAA  DD
222AA  AAAA
333  AA  CC
333
444EEGGFF
444AARREE
444  XX 
555AACCDDRR


My desired output would be:
111CCBBBBAA
222DDCCBBDD
333  AA  CC
444EEXXFF 
555AACCDDRR


I wish my explanataion is OK..

Sorry for my poor english :(

Regards!!
ottoelflaco
 
Posts: 36
Joined: Fri Sep 21, 2012 2:33 pm
Has thanked: 1 time
Been thanked: 0 time

Re: joining info into one record

Postby NicC » Sat Oct 26, 2013 5:36 pm

What are your rules for getting the output from the input? I just tried one in my head for the records beginning 111 ut it did not work for records beginning 222.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: joining info into one record

Postby ottoelflaco » Sun Oct 27, 2013 5:48 pm

NicC I m trying to get the last value of position (4,2) (6,2) (8,2) (10,2) for each key.

For example for key '111':
- the last value in position (4,2) ordering desc -->CC.
- the last value in position (6,2) ordering desc -->BB.
...
...

For example, key '222':
- the last value in position (4,2) ordering desc --> DD.
- the last value in position (6,2) ordering desc --> CC.
...
...

I can do this exercise in four steps, doing IFTHEN=GROUP for each value in position (4,2) (6,2)... But I am asking for my knowledge if is posible do it with other solution.

Sorry my english :(..

Thxx
Regards!!
ottoelflaco
 
Posts: 36
Joined: Fri Sep 21, 2012 2:33 pm
Has thanked: 1 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post