Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Swap two fileds in a file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Swap two fileds in a file
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us