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
 
Sorting in OUTFIL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Sorting in OUTFIL
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Tue Jul 31, 2012 2:35 pm    Post subject: Reply to: Sorting in OUTFIL
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    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 POSSIBLE TO HAVE SAME OUTFIL FNAME? pshongal DFSORT/ICETOOL 9 Wed Nov 29, 2017 3:42 pm
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts Sorting on text - but in non-alphabet... Roy Ware SYNCSORT 5 Wed Aug 23, 2017 9:15 pm
No new posts Sorting of hex values Saurabh_mi DFSORT/ICETOOL 11 Thu May 25, 2017 3:49 pm
No new posts Sorting group data rajella DFSORT/ICETOOL 4 Sun Jan 22, 2017 11:32 pm

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