Using WHEN GROUP - Example Output



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

Using WHEN GROUP - Example Output

Postby rockstar2020 » Mon Jan 12, 2015 10:54 am

Hello All,
I'm trying to produce an output that I require using SORT (WHEN BEGIN and END) attaching values at the end of record but failing to achieve it.
Below is the sample input.
001AAALISA    MATHS
002BBBLISA   
001AAATINA    PHYSI
002BBBTINA       
001AAAMATT    CHEM
002BBBMATT       
003BBBMATT       
001AAADINO    MATHS
002BBBDINO     
001AAARAGG    BIOLO
002BBBRAGG       
003BBBRAGG     


Expected O/P- I want below output
001AAALISA    MATHS  MATHS
002BBBLISA           MATHS
001AAATINA    PHYSI  PHYSI
002BBBTINA           PHYSI
001AAAMATT    CHEM   CHEM
002BBBMATT           CHEM
003BBBMATT           CHEM
001AAADINO    MATHS  MATHS
002BBBDINO           MATHS
001AAARAGG    BIOLO  BIOLO
002BBBRAGG           BIOLO
003BBBRAGG           BIOLO


But am getting below output from my SORT card

001AAALISA    MATHS  MATHS
002BBBLISA           MATHS
001AAATINA    PHYSI  PHYSI
002BBBTINA           PHYSI
001AAAMATT    CHEM   CHEM
002BBBMATT           CHEM
003BBBMATT           
001AAADINO    MATHS  MATHS
002BBBDINO           MATHS
001AAARAGG    BIOLO  BIOLO
002BBBRAGG           BIOLO
003BBBRAGG           


Note '003BBBMATT' doesnt have CHEM and also '003BBBRAGG' doesnt have BIOLO at the end of record.
My code- I use BBB which is default in END so when we have 2 or more occurrences of BBB for same group, the o/p fails. I'm not sure what i can use in END, as I dont find anything else defaulted. LISA, MATT like names varies for each group eventhough they are same for that group. Please suggest me an idea. Thank you!!
    SORT FIELDS=COPY                                         
         OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(4,3,CH,EQ,C'AAA'),
         END=(4,3,CH,EQ,C'BBB'),PUSH=(20:SEQ=3,23,4))     
rockstar2020
 
Posts: 32
Joined: Wed Jan 08, 2014 3:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Using WHEN GROUP - Example Output

 

Re: Using WHEN GROUP - Example Output

Postby BillyBoyo » Mon Jan 12, 2015 12:57 pm

END= if is optional. If you don't have handy criteria for END=, leave it out.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Using WHEN GROUP - Example Output

Postby rockstar2020 » Mon Jan 12, 2015 9:07 pm

Thanks a lot Billy. i removed END and that worked for me.
rockstar2020
 
Posts: 32
Joined: Wed Jan 08, 2014 3:51 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post