IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

creating new field using sort.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Rambhupal.chaudari

New User


Joined: 30 Mar 2007
Posts: 25
Location: Hyderabad

PostPosted: Thu Mar 25, 2010 4:20 pm
Reply with quote

Hi ALL,

Please help me in achieving below query.

I/p file format :-
EMP.no EMPname Salary
1 Ram 1000
2 Sam 200
1 Ram 900
3 Tom 200
4 Jam 100
2 Sam 1200


If you find any duplicates (Key fields are Emp No and Emp Name), the Indicator should be set to 'Y', otherwise, 'N'. The output should be in ascending order of Key.

O/P file format :-
EMP.no EMPname Salary Indicator
1 Ram 1900 Y
2 Sam 1400 Y
3 Tom 200 N
4 Jam 100 N

I want to get the above output file from given input, Using sort utility, with any number of steps.

I got the output with out the new field 'indicator'.

Please let me know any suggestions.

Thanks,
Ram.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Mar 25, 2010 4:41 pm
Reply with quote

Quote:
I got the output with out the new field 'indicator'.


Post the sortcard you are using for this.
Back to top
View user's profile Send private message
Rambhupal.chaudari

New User


Joined: 30 Mar 2007
Posts: 25
Location: Hyderabad

PostPosted: Thu Mar 25, 2010 4:46 pm
Reply with quote

Hi Sambhaji,

Here is my sysin , just to sum sal field.

Code:

//SYSIN    DD  *
  SORT FIELDS=(1,1,zd,A,3,3,ch,a)
  SUM  FIELDS=(7,4,ZD) 
/*


o/p will be
1 Ram 1900
2 Sam 1400
3 Tom 0200
4 Jam 0100
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Mar 25, 2010 9:46 pm
Reply with quote

Rambhupal.chaudari,

Use the following DFSORT JCL

Code:

//STEP0100 EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//SORTIN   DD *                                   
----+----1----+----2----+----3----+----4----+----5
1 RAM 1000                                       
2 SAM  200                                       
1 RAM  900                                       
3 TOM  200                                       
4 JAM  100                                       
2 SAM 1200                                       
//SORTOUT  DD SYSOUT=*                           
//SYSIN    DD *                                   
  INREC OVERLAY=(81:C'01')                       
  SORT FIELDS=(1,1,CH,A,3,3,CH,A)                 
  SUM FIELDS=(7,4,ZD,81,2,ZD)                     
  OUTREC IFOUTLEN=80,                             
  IFTHEN=(WHEN=INIT,OVERLAY=(12:C'N')),           
  IFTHEN=(WHEN=(81,2,ZD,GT,1),OVERLAY=(12:C'Y')) 
//*


The output of this job is

Code:

1 RAM 1900 Y   
2 SAM 1400 Y   
3 TOM  200 N   
4 JAM  100 N   
Back to top
View user's profile Send private message
Rambhupal.chaudari

New User


Joined: 30 Mar 2007
Posts: 25
Location: Hyderabad

PostPosted: Fri Mar 26, 2010 11:51 am
Reply with quote

Thank you very much Skolusu,

Its really nice logic. Amazing .. icon_smile.gif

thnks again,
Ram..
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top