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

Sorting in OUTFIL


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

New User


Joined: 15 May 2006
Posts: 92

PostPosted: Tue Jul 31, 2012 2:30 pm
Reply with quote

Hi there,

I have the following sort card.

Code:
SORT FIELDS= (1,6,BI,A)                                                           
OUTFIL FNAMES=D2DOUT,INCLUDE=(117,1,CH,EQ,C'X', -       
AND,118,2,CH,EQ,C'XY',AND,149,6,ZD,EQ,200000), -         
OUTREC=(1:1,116)                                         
OUTFIL FNAMES=DEVOUT,INCLUDE=(117,1,CH,EQ,C'Y'), -       
OUTREC=(1:1,116)


For D2DOUT, I am getting records such as:

200105123456702A............................
200105123456702B............................
200105123456702C............................

200105345678901X...........................
200105345678901Y...........................
200105345678901Z...........................

200105987654321X...........................
200105987654321Y...........................
200105987654321Z...........................


The file in question is FB with LRECL=116. First six bytes belong to a code and the next 9 bytes are for an account number.

As per my new requirement I need the records in red at the bottom of the file. Basically I want all the records with code = 200105 and account no = 123456702 at the bottom of my file. Other records must be sorted the way it was done before. Now can I achieve this by just modifying the existing sortcard or do I have to introduce one extra sort step? I tried searching for such an example where sorting is done only at the OUTFIL level but couldn't find anything.

Regards,
Mohit
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jul 31, 2012 2:35 pm
Reply with quote

Use INREC with IFTHEN=(WHEN=(logexp) to identify the keys you want to outsort. Add (front or back of record, depending on variable/fixed) a byte set to a value higher than space. Sort on that byte as the major key. Remove that byte with BUILD in your OUTFILs.
Back to top
View user's profile Send private message
knickraj
Warnings : 1

New User


Joined: 11 Jun 2007
Posts: 50
Location: Euro

PostPosted: Tue Jul 31, 2012 10:15 pm
Reply with quote

may be try this logic

Code:
inrec overlay 200105 to 999999
for the record with
Code:
code = 200105 and account no = 123456702

do the normal sort (1,6,BI,A)
then do
Code:
outrec overlay change 999999 to again 200105
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Jul 31, 2012 10:29 pm
Reply with quote

Use the following control cards

Code:

//SYSIN    DD *                                                     
  INCLUDE COND=(117,1,CH,EQ,C'Y',OR,                               
               (117,3,CH,EQ,C'XXY',AND,149,6,ZD,EQ,200000))         
                                                                   
  INREC IFOUTLEN=118,IFTHEN=(WHEN=INIT,OVERLAY=(118:X)),           
  IFTHEN=(WHEN=(1,15,CH,EQ,C'200105123456702'),OVERLAY=(118:C'1')) 
                                                                   
  SORT FIELDS=(1,6,BI,A,118,1,CH,A),EQUALS                         
                                                                   
  OUTFIL FNAMES=D2DOUT,INCLUDE=(117,1,CH,EQ,C'X'),BUILD=(1,116)     
  OUTFIL FNAMES=DEVOUT,INCLUDE=(117,1,CH,EQ,C'Y'),BUILD=(1,116)     
//*


Knickraj,

OP needs to evaluate the full 15 bytes not just the key. So if there is another account number with the same key then it will also be pushed to the bottom.
Back to top
View user's profile Send private message
knickraj
Warnings : 1

New User


Joined: 11 Jun 2007
Posts: 50
Location: Euro

PostPosted: Tue Jul 31, 2012 10:38 pm
Reply with quote

kolusu,

i have also mention 15 bytes only.

Code:
Code:
inrec overlay 200105 to 999999
for the record with
Code:
code = 200105 and account no = 123456702 
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Jul 31, 2012 10:41 pm
Reply with quote

Oops sorry overlooked the second portion.
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 Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
This topic is locked: you cannot edit posts or make replies. Automation need help in sorting the data DFSORT/ICETOOL 38
No new posts OUTFIL with SAVE option DFSORT/ICETOOL 7
No new posts Sorting a record spanned over multipl... DFSORT/ICETOOL 13
No new posts Creating additional seqnum/Literal wh... DFSORT/ICETOOL 4
Search our Forums:

Back to Top