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

Swap two fileds in a file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
gileshpg

New User


Joined: 22 May 2008
Posts: 27
Location: Bangaluru

PostPosted: Tue Apr 12, 2011 4:46 pm
Reply with quote

Hi,

I need to swap two fields in a file.
My file is of 80 bytes.

I need to swap position 1-3 with position 4-6, only when the input file record which have position 51-53 as ‘100’.

Input:
Code:

----+----1----+----2----+----3----+----4----+----5----+----6
123456789012345678901234567890123456789012345678901234567890
***************************** Top of Data ******************
AAABBB                                            100 
CCCDDD                                            100 
222555                                            200 

Output expected:
Code:

----+----1----+----2----+----3----+----4----+----5----+----6
123456789012345678901234567890123456789012345678901234567890
***************************** Top of Data ******************
BBBAAA                                            100 
DDDCCC                                            100 
222555                                            200 


Thanks in Advance

Gilesh.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Apr 12, 2011 5:31 pm
Reply with quote

Below should give you required output...
Code:

//STEP0100 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD *                                             
AAABBB                                            100       
CCCDDD                                            100       
222555                                            200       
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *                                             
 OPTION COPY                                         
 INREC IFTHEN=(WHEN=(51,3,CH,EQ,C'100'),BUILD=(4,3,1,3,7,74))
/*                                                           
Back to top
View user's profile Send private message
gileshpg

New User


Joined: 22 May 2008
Posts: 27
Location: Bangaluru

PostPosted: Tue Apr 12, 2011 5:57 pm
Reply with quote

The above logic is working...Thanks a lot!!! icon_smile.gif
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 4
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top