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
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


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