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

When an employee with two difference write first record


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

New User


Joined: 05 Dec 2006
Posts: 89
Location: chennai

PostPosted: Wed May 07, 2008 6:24 pm
Reply with quote

Hi all,
consider a below input record (REF = 80 FB) contains employee and indicator
Input

Code:

Employee  Indicator
1                y
1                N
2                Y
3                Y
3                N


Output

Code:

Employee  Indicator
1                y
3                y


Req : same Employee with different indicator.When an employee with two different we need to write first record into output.
In our case employee 1 and 3 contains record with two different indicator so we need to write first occurance of record into output. Employee 2 doesn contains two type of indicator.so no need to write into output.

please help me out to sort this
Back to top
View user's profile Send private message
HappySrinu

Active User


Joined: 22 Jan 2008
Posts: 194
Location: India

PostPosted: Wed May 07, 2008 6:57 pm
Reply with quote

first gather only the values who are repeating in to file.
then duplicate using first column. guess it works.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed May 07, 2008 7:18 pm
Reply with quote

could there be 3 records for an employee?

is the input file sorted? if so, what are the keys?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed May 07, 2008 8:08 pm
Reply with quote

also, I would like to commend you for such a useful title/subject. I am sure that others searching will find a wealth of info.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed May 07, 2008 10:26 pm
Reply with quote

The following DFSORT JCL will give you the desired results. I assumed that your employee is 10 bytes length key and the indicator starts at pos 15. I also assumed that the indicator must be Y or N.

Code:

//STEP0100 EXEC PGM=ICEMAN                                 
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                           
1             Y                                           
1             N                                           
2             Y                                           
3             Y                                           
3             N                                           
4             N 
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *                                           
  OPTION EQUALS                                           
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'00')),             
        IFTHEN=(WHEN=(15,1,CH,EQ,C'Y'),OVERLAY=(81:C'1')),
        IFTHEN=(WHEN=(15,1,CH,EQ,C'N'),OVERLAY=(82:C'1')) 
                                                           
  SORT FIELDS=(01,10,CH,A)                                 
  SUM FIELDS=(81,1,ZD,82,1,ZD)
  OUTFIL OMIT=((81,1,ZD,EQ,0,AND,82,1,ZD,GT,0),OR,
          (81,1,ZD,GT,0,AND,82,1,ZD,EQ,0)), 
      BUILD=(01,80)   
/*


Hope this helps...

Cheers

Kolusu
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top