Switch position of the record in the file
Select messages from
# through # FAQ
[/[Print]\]

MVSFORUMS.com -> Utilities

#1: Switch position of the record in the file Author: ldushkin PostPosted: Tue Mar 20, 2007 5:24 pm
    —
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
................

#2:  Author: Frank YaegerLocation: San Jose PostPosted: Tue Mar 20, 2007 5:51 pm
    —
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?

#3:  Author: ldushkin PostPosted: Tue Mar 20, 2007 6:49 pm
    —
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.

#4:  Author: kolusuLocation: San Jose PostPosted: Tue Mar 20, 2007 9:05 pm
    —
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

#5:  Author: Frank YaegerLocation: San Jose PostPosted: Tue Jul 29, 2008 3:16 pm
    —
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/



MVSFORUMS.com -> Utilities


output generated using printer-friendly topic mod. All times are GMT - 5 Hours

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group