gileshpg
New User
Joined: 22 May 2008 Posts: 27 Location: Bangaluru
|
|
|
|
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. |
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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))
/*
|
|
|