MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Change the order of records.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Sun Jan 25, 2009 8:47 am    Post subject: Change the order of records. Reply with quote

Hi,

My input dataset (RECFM=FB, LRECL=80) is as given below.

Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
0000016138800000NA132009          000002303070000100000230307000013ZX62   000100
0000016138800000NB11+C1U +LE5 +MN5 +NE1 +UE0 +U2J +VQ2 +VX7 +1FL +75U +83B     
0000016138800000NA162009          000001896240000100000189624000018SL28   000100
0000016138800000NB11+C1U +C60 +LAX +MX0 +NE1 +PCM +VQ2 +VX7 +1SB +14C +20U     
0000016138800000NA162009          000001896240000100000189624000018SL28   000100
0000016138800000NB11+C1U +C60 +LAX +MX0 +NE1 +PCM +VQ2 +VX7 +1SB +14C +70U     
0000016138800000NA132009          000002303070000100000230307000019ZG61   000100
0000016138800000NB11+C1U +LE5 +MN5 +NE1 +UE0 +U2J +VQ2 +VX7 +1FL +75U +83B     
0000016138800000NA162009          000001896240000100000189624000018SL28   000100
0000016138800000NB11+C1U +C60 +LAX +MX0 +NE1 +PCM +VQ2 +VX7 +1SB +14C +71U     


I need the output to be as shown below: The record with '8SL28' and its immediate next record to be the top records and remaining records should go to bottom. Sorting is not a problem.

Code:

0000016138800000NA162009          000001896240000100000189624000018SL28   000100
0000016138800000NB11+C1U +C60 +LAX +MX0 +NE1 +PCM +VQ2 +VX7 +1SB +14C +20U     
0000016138800000NA162009          000001896240000100000189624000018SL28   000100
0000016138800000NB11+C1U +C60 +LAX +MX0 +NE1 +PCM +VQ2 +VX7 +1SB +14C +70U     
0000016138800000NA162009          000001896240000100000189624000018SL28   000100
0000016138800000NB11+C1U +C60 +LAX +MX0 +NE1 +PCM +VQ2 +VX7 +1SB +14C +71U     
0000016138800000NA132009          000002303070000100000230307000013ZX62   000100
0000016138800000NB11+C1U +LE5 +MN5 +NE1 +UE0 +U2J +VQ2 +VX7 +1FL +75U +83B     
0000016138800000NA132009          000002303070000100000230307000019ZG61   000100
0000016138800000NB11+C1U +LE5 +MN5 +NE1 +UE0 +U2J +VQ2 +VX7 +1FL +75U +83B     


Thanks.
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Sun Jan 25, 2009 10:34 am    Post subject: Reply with quote

We can apply this technique here also....

Quote:

Copy 1st lines to a separate file
Copy 2nd lines to a separate file
Do Join keys based on matching field to club both 1st and 2nd line into a single record
Copy only required records (67,5,ch,eq,c'8SL28').
Sort records according to requirement.
Split the single record into two halves using (1,80,/,81,80)


Ahh.....now, I understand why it is very useful to have WHEN=GROUP. Crying or Very sad

Thanks.
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Jan 26, 2009 12:40 pm    Post subject: Reply with quote

ranga_subham,

With When=Group, it is Just 1 one pass of the data.

Code:

//SYSIN    DD *                                       
 OPTION EQUALS                                         
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(67,5,CH,EQ,C'8SL28'),
 RECORDS=2,PUSH=(81:67,5))                             
 SORT FIELDS=(81,5,CH,D)                               
 OUTREC BUILD=(1,80)                                   
//*                                                   

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group