Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Sort out the unique fields

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Deepa Natarajan

New User


Joined: 06 Jan 2008
Posts: 11
Location: India

PostPosted: Mon Nov 16, 2009 4:28 pm    Post subject: Sort out the unique fields
Reply with quote

Hi..
My input file is of Lrecl 11 and its in the below format:
My key field is 1-9 bytes.

111111111__
111111111__
111111111CR
111111112HR
111111112CR
111111112BR
111111113__
111111113__
111111113__

My output file should be lik the below:

111111111CR
111111112HR
111111112CAR
111111112BAR
111111113__

if Pos10-11 is having values (for the same key) i should write that to the output file (See: 111111112). If Pos10-11 is having all blanks then output only one key with a blank (see:111111113) if pos10-11 is having spaces as well as values, then output the key only with the values (See:111111111)

Can someone help me in this?
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon Nov 16, 2009 11:59 pm    Post subject:
Reply with quote

Where did the CAR and BAR output records come from? They aren't in the input file (the input file does have CR and BR records).

What is the RECFM and LRECL of the input file?

Quote:
if pos10-11 is having spaces as well as values, then output the key only with the values (See:111111111)


Can you have input records like this:

111111114__
111111114__
111111114CR
111111114CR
111111114HR

If so, what would you expect as output for these input records?

If there are blank records, are they always before the non-blank records, or can the blank records be anywhere? For example, would this be possible:

111111115__
111111115HR
111111115__
Back to top
View user's profile Send private message
Deepa Natarajan

New User


Joined: 06 Jan 2008
Posts: 11
Location: India

PostPosted: Tue Nov 17, 2009 9:11 am    Post subject: Reply to: Sort out the unique fields
Reply with quote

Sorry for d typo!
there is no CAR and BAR records. tat shud be CR and BR only.

if my input file is like below:
111111114__
111111114__
111111114CR
111111114CR
111111114HR

My output shud be:

111111114CR
111111114CR
111111114HR

if there r blank values and a value, remove the blank values.

Yes, the blank records can occur anywhere.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Nov 18, 2009 2:26 am    Post subject:
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for based on the examples you gave and your explanations:

Code:

 //S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG   DD  SYSOUT=*
//IN DD DSN=...  input file (FB/11)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/11)
//TOOLIN   DD    *
SORT FROM(IN) USING(CTL1)
SORT FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(12:SEQNUM,8,ZD)
  SORT FIELDS=(1,9,CH,A,10,2,CH,D)
  OUTREC OVERLAY=(20:SEQNUM,8,ZD,RESTART=(1,9))
  OUTFIL FNAMES=T1,OMIT=(10,2,CH,EQ,C' ',AND,20,8,ZD,GT,1)
/*
//CTL2CNTL DD *
  SORT FIELDS=(12,8,ZD,A)
  OUTREC BUILD=(1,11)
/*


I used these input records for SORTIN:

Code:

111111111         
111111111         
111111111CR       
111111112HR       
111111112CR       
111111112BR       
111111113         
111111113         
111111113         
111111114         
111111114         
111111114CR       
111111114CR       
111111114HR       
111111115         
111111115HR       
111111115         


and got these output records for SORTOUT:

Code:

111111111CR   
111111112HR   
111111112CR   
111111112BR   
111111113     
111111114CR   
111111114CR   
111111114HR   
111111115HR   
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Nov 18, 2009 3:53 am    Post subject:
Reply with quote

Deepa Natarajan,

Here is another way of doing it
Code:

//STEP0100 EXEC PGM=SORT     
//SYSOUT   DD SYSOUT=*       
//SORTIN   DD DSN=Your 11 byte FB input file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *                                               
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,11,C'0')),                 
  IFTHEN=(WHEN=(10,2,CH,EQ,C' '),OVERLAY=(12:C'1'))           
  SORT FIELDS=(1,9,CH,A,12,1,CH,A),EQUALS                     
  OUTREC OVERLAY=(13:SEQNUM,8,ZD,RESTART=(1,9))               
  OUTFIL OMIT=(12,1,ZD,EQ,1,AND,13,8,ZD,GT,1),BUILD=(1,11)   
//*
Back to top
View user's profile Send private message
Deepa Natarajan

New User


Joined: 06 Jan 2008
Posts: 11
Location: India

PostPosted: Wed Nov 18, 2009 9:16 am    Post subject: Reply to: Sort out the unique fields
Reply with quote

Thanks for your help, franker n kolusu!
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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Sum Fields ballaswaroop DFSORT/ICETOOL 4 Tue May 02, 2017 11:07 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us