Spliting one record in to two records of output file



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

Spliting one record in to two records of output file

Postby gotobaskar » Wed Jul 11, 2012 10:53 pm

I have a record in the input file in the below format
BASIC SALARY = BS
VARIABLE ALLOWNANCE = VA

ID - 3 BYTE, NAME - 10, DESIGNATION - 15, BS - 6, VA - 6

ID NAME DESIGNA BS VA

ABA;KUMAR;DEVELOPER;10000;15000
ABC;MURAL;SUPERVISOR;9000;14000
AB0;DILIP;ENGINEER;6000;12000
AB1;ANAND;ASSISTANT;7000;13000
111;SUDHA;CONSULTANT;12000;20000

OUTPUT FILE SHOULD BE (Have to achieve it through SORT/ICETOOL)

AB0;DILIP;ENGINEER;CONSULTANT
ABA;KUMAR;DEVELOPER;CONSULTANT;10000
ABA;KUMAR;DEVELOPER;CONSULTANT;15000
ABC;MURAL;SUPERVISOR;CONSULTANT;9000
ABC;MURAL;SUPERVISOR;CONSULTANT;14000
AB1;ANAND;ASSISTANT;CONSULTANT;7000
AB1;ANAND;ASSISTANT;CONSULTANT;13000

Scenario / Rules to generat Output : One record in the input file has to be splitted to many and also one field value of the output record has to be picked from other input records..

Brief description of the output file below,

AB0;DILIP;ENGINEER;CONSULTANT ---> First output record
In the above First record, forth field value picked from the last record( key field has 111)
ABA;KUMAR;DEVELOPER;CONSULTANT;10000 --> Second output record
ABA;KUMAR;DEVELOPER;CONSULTANT;15000 --> Third output record

The above second and third records splited from the first record from the input file.
First record of the output file has CONSULTANT from the last record key field has 111 and Basic salary fom input file
Secomd record of the output file has CONSULTANT from the last record key field has 111 and Variable allowance fom input file

Kindly, help me out to get the result.

thanks,
Baski
gotobaskar
 
Posts: 3
Joined: Tue Jul 10, 2012 11:02 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Spliting one record in to two records of output file

Postby Akatsukami » Wed Jul 11, 2012 11:03 pm

Please justify your "having" to perform this with DFSORT/ICETOOL.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Spliting one record in to two records of output file

Postby gotobaskar » Wed Jul 11, 2012 11:25 pm

Sorry Akatsukami, I didn't get u...I have to do this thru sort instead of writing a program....Please advic me, is this possible in SORT
gotobaskar
 
Posts: 3
Joined: Tue Jul 10, 2012 11:02 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Spliting one record in to two records of output file

Postby Akatsukami » Wed Jul 11, 2012 11:29 pm

Please explain why this must be done with DFSORT rather than by a program that you have written. Is this homework or a programming class assignment?
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Spliting one record in to two records of output file

Postby gotobaskar » Wed Jul 11, 2012 11:33 pm

No, It's a requirement...not a homework or assignment
gotobaskar
 
Posts: 3
Joined: Tue Jul 10, 2012 11:02 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Spliting one record in to two records of output file

Postby dick scherrer » Thu Jul 12, 2012 12:00 am

Hello,

The "requirement" is to support the business function - Not the tool used to reach the desired output.

If someone is so insistent that you must use your sort product, they need to provide the information you need to implement. . .

In order to implement using any tool or language, i believe the requirement needs to be more clearly presented. . . at least for me to understand.
First record of the output file has CONSULTANT from the last record key field has 111 and Basic salary fom input file
Why? Same question regarding the second record . . .

You should not implement a solution that you will have no idea how to maintain. . .
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: Spliting one record in to two records of output file

Postby skolusu » Thu Jul 12, 2012 2:28 am

gotobaskar,

It is not clear as to how the match is done. You need to do a better job of explaining your requirements.


1. How did the 3rd record frominput end up as 1st record in the output? What is the SORT criteria?

2.How do you identify the Key field 111? is it always the last record in the file? and does it always have 111 in the first 3 byes?

3. Why is AB0;DILIP;ENGINEER;CONSULTANT a special record in the output when every other record has either BASIC SALARY or VARIABLE ALLOWNANCE in the 5th field?

4. What is the LRECL and RECFM of the input and output files?
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


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post