Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
creating new field using sort.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: creating new field using sort.
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts JOINKEYS Paired and Unpaired Sort on ... MFwhiz DFSORT/ICETOOL 7 Tue Nov 07, 2017 2:46 am
This topic is locked: you cannot edit posts or make replies. Incrementing current time field by 30... arunsoods DFSORT/ICETOOL 11 Thu Oct 26, 2017 3:22 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Partial color change of a field in CI... waseem0424 CICS 5 Fri Sep 29, 2017 7:56 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us