View previous topic :: View next topic
|
Author |
Message |
xenomorph
New User
Joined: 27 Jul 2007 Posts: 9 Location: Europe
|
|
|
|
Hi all !
Can you help me with this ? I've to change all char from position 6 from 'D' -> 'C' and 'U' -> 'C' when the record starts with 'BBBB'.
So I tried :
Code: |
//SORTIN DD *
AAAA
BBBBPU
CCCC U
BBBBZD
/*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1:1,5, 6:6,1,CHANGE(1,C'U',C'C',C'D',C'C'),NOMATCH=(6,1))
INCLUDE COND=(1,4,CH,EQ,C'BBBB')
/*
|
I was expecting:
AAAA
BBBBPC
CCCC U
BBBBZC
No luck, in this case, it drops all records except 'BBBB'
Thanks for your help !
BTW where can I find the spec for the SORT command ? |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
xenomorph,
Check the following -
Code: |
//SORTIN DD *
AAAA
BBBBPU
CCCC U
BBBBZD
BBBBZA
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=(1,4,CH,EQ,C'BBBB',AND,(6,1,CH,EQ,C'D',
OR,6,1,CH,EQ,C'U')),
OVERLAY=(6:C'C'))
/* |
Output:
Code: |
AAAA
BBBBPC
CCCC U
BBBBZC
BBBBZA |
|
|
Back to top |
|
|
xenomorph
New User
Joined: 27 Jul 2007 Posts: 9 Location: Europe
|
|
|
|
Thank you murmohk1, it works great.
I wouldn’t want to abuse but is there a document explaining all the functionality of the SORT command ? Couldn't find anything on IBM web site. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
Back to top |
|
|
xenomorph
New User
Joined: 27 Jul 2007 Posts: 9 Location: Europe
|
|
|
|
Thanks ! |
|
Back to top |
|
|
|