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 

Switch position of the record in the file

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


Joined: 05 Apr 2006
Posts: 56
Topics: 20

PostPosted: Tue Mar 20, 2007 5:24 pm    Post subject: Switch position of the record in the file Reply with quote

I have a file with the VB. Is it possible by using any Utility to move the last record to the first record position?
For Example:
Input file:
111111
222222
3333333333
.................

00000000000

Output file:

00000000000
1111111
2222222
3333333333
................
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Mar 20, 2007 5:51 pm    Post subject: Reply with quote

With the example you show, you could just sort the records on the key and the 0 record would be first followed by the 1, 2 and 3 records. Are the keys really in that order by key? Or are they not necessarily in order? Is there anything unique about the last record (for example, it has 0 in postion 1) other than it being the last record?
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ldushkin
Beginner


Joined: 05 Apr 2006
Posts: 56
Topics: 20

PostPosted: Tue Mar 20, 2007 6:49 pm    Post subject: Reply with quote

I probably didn't show the correct example. There is no key in the record, i just need to make the last record in the file to be the first record. Only the last record should be effected. the sort is not required.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Mar 20, 2007 9:05 pm    Post subject: Reply with quote

ldushkin,

Try this DFSORT/ICETOOL jcl

Code:

//STEP0100 EXEC PGM=ICETOOL                                 
//TOOLMSG  DD  SYSOUT=*                                     
//DFSMSG   DD  SYSOUT=*                                     
//IN       DD  DSN=your input vb file,
//             DISP=SHR
//OUT      DD  DSN=your output vb file,
//             DISP=(MOD,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(CYL,(X,Y),RLSE)
//CARD     DD  SYSOUT=*                                     
//TOOLIN   DD  *                                             
  SORT FROM(IN) TO(OUT) USING(CTL1)                         
  COPY FROM(IN) TO(OUT) USING(CTL2)                         
//CTL1CNTL DD  *                                             
  SORT FIELDS=(5,8,ZD,D)                                     
  OUTREC FIELDS=(1,4,SEQNUM,8,ZD,START=0,5)                   
  OUTFIL FNAMES=OUT,ENDREC=1,OUTREC=(1,4,13)                 
  OUTFIL FNAMES=CTL2CNTL,ENDREC=1,VTOF,                     
  OUTREC=(C'  OPTION COPY,STOPAFT=',5,8,80:X)
/*               
//CTL2CNTL DD  DSN=&T1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)   
/*


Hope this helps...

cheers

Kolusu
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Jul 29, 2008 3:16 pm    Post subject: Reply with quote

Here's another way to do this using the new SUBSET operator of DFSORT's ICETOOL available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008):

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file
//OUT DD DISP=MOD,DSN=...   MOD output file
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT) INPUT KEEP LAST
SUBSET FROM(IN) TO(OUT) INPUT REMOVE LAST
/*


For complete details on the new SUBSET function and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
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