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

Swap Fields thru SYNCSORT


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 174
Location: Bangalore

PostPosted: Tue Feb 26, 2008 10:26 am
Reply with quote

Hi,

Input FILE

1234 ABC 2421.00
4242 AKA 525.00
3852 SAS 2325.00

OutPut file should be
2421.00 ABC 1234
525.00 AKA 4242
2325.00 SAS 3852

Thanks
Back to top
View user's profile Send private message
Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Tue Feb 26, 2008 10:47 am
Reply with quote

Is your fields in fixed column or varying
Back to top
View user's profile Send private message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 174
Location: Bangalore

PostPosted: Tue Feb 26, 2008 11:04 am
Reply with quote

Devzee wrote:
Is your fields in fixed column or varying


Fields in FB 80
Back to top
View user's profile Send private message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 199
Location: india

PostPosted: Tue Feb 26, 2008 12:10 pm
Reply with quote

hello shrivatsa,

you can use the following code.

I have assumed that your first filed(1234) length is 4 , second filed(ABC) length is 3 and third filed(2421.00) length is 7. If they are different then the code can be changed accordingly.

Code:
//VZM1CKKN JOB (3GAHF3,R),                                 
//         'RAJAT TEST',CLASS=X,MSGCLASS=Y,NOTIFY=&SYSUID 
//S1    EXEC  PGM=ICETOOL                                 
//TOOLMSG DD SYSOUT=*                                     
//DFSMSG  DD SYSOUT=*                                     
//IN  DD *                                                 
1234 ABC 2421.00                                           
4242 AKA 525.00                                           
3852 SAS 2325.00                                           
3333 MDK 456.00                                           
4444 SDF 3244.00                                           
4444 PLD 2335.00                                           
/*                                                         
//OUT DD SYSOUT=*                                         
//TOOLIN DD *                                             
   COPY FROM(IN) TO(OUT) USING(CTL1)                       
/*                                                         
//CTL1CNTL DD *                               
  OUTREC FIELDS=(1:10,7,X,9:6,3,X,13:1,4,64:X)
/*                                             
 
Back to top
View user's profile Send private message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 199
Location: india

PostPosted: Tue Feb 26, 2008 12:13 pm
Reply with quote

You can also use

//S1 EXEC PGM=SYNCTOOL

instead of :

//S1 EXEC PGM=ICETOOL
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Tue Feb 26, 2008 10:16 pm
Reply with quote

You can also try this:
Code:

//STEP1  EXEC  PGM=SORT
//SORTIN   DD *
1234 ABC 2421.00
4242 AKA  525.00
3852 SAS 2325.00
//SORTOUT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//SYSIN      DD *
    SORT FIELDS=COPY
    OUTREC FIELDS=(1:10,7,9:6,3,13:1,4,80:X)
/*

Which produces the following output:
Code:

2421.00 ABC 1234
 525.00 AKA 4242
2325.00 SAS 3852

As rajatbagga stated, you may need to adjust the columns if this is not exactly how your data is positioned.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts split and swap in ISPF TSO/ISPF 6
No new posts Count Records with a crietaria in a f... DFSORT/ICETOOL 5
No new posts Concatenate 2 fields (usage national)... COBOL Programming 2
No new posts DFSORT/SYNCSORT/ICETOOL JCL & VSAM 8
Search our Forums:

Back to Top