Page 1 of 2

use SYNCSORT - need to do a type of searh and replace

PostPosted: Tue Dec 02, 2008 3:17 am
by blexann
I would like to change value in column B based on the values in column B. Is this possible with sybcsort ?

123 456 789
abc def jhi

if column 1-3 has 'abc' then change column 789 to 'xyz'

Re: use SYNCSORT - need to do a type of searh and replace

PostPosted: Tue Dec 02, 2008 3:25 am
by Alissa Margulies
Try this:
//SYSIN DD *
   OUTREC IFTHEN=(WHEN=(1,3,CH,EQ,C'abc'),
   OVERLAY=(7:C'xyz'))
/*

Re: use SYNCSORT - need to do a type of searh and replace

PostPosted: Tue Dec 02, 2008 8:20 am
by blexann
I dont believe ifthen is supported by syncsort. is there a way to do this using the change command ?

Re: use SYNCSORT - need to do a type of searh and replace

PostPosted: Tue Dec 02, 2008 8:24 am
by dick scherrer
Hello,

Please notice that Alissa is a tech rep from Syncsort. . . .

I dont believe ifthen is supported by syncsort.
If my memory is working, ifthen has been in Syncsort for some time (since release 1.2.x) - which is no longer even the current product release. Release 1.3 became available many months ago.

Did you try the suggested code? What happened? If you've not tried this, do so and post any diagnostic info presented including the message ids.

Re: use SYNCSORT - need to do a type of searh and replace

PostPosted: Tue Dec 02, 2008 7:56 pm
by blexann
..oh sorry about that. below is my current sort - I was trying to incorporate the suggested solution to the below sort. I need to chagne UNIT to '09702' only if ACCOUNT is one of '0036' OR '0041' OR '0042'


INCLUDE COND=((10,5,BI,EQ,X'000001000F'),OR,                           
                         (10,5,BI,EQ,X'000001001F'),OR,                           
                        (10,5,BI,EQ,X'000001003F'),OR,                           
                        (10,5,BI,EQ,X'000001021F'))                             
INREC FIELDS=(1,1270,1271,3,                     * IF = 95189         
              CHANGE=(3,X'95189F',X'97740F'),    * MAKE IT 97740         
              NOMATCH=(1271,3))                      * ELSE LEAVE IT         
SORT FIELDS=(1,5,PD,A,10,5,PD,A)                     
OUTREC FIELDS=(C'1',                             
               2,4,PD,M11,LENGTH=7,                           
               34C' ',                             
               C'000',                       
               10,5,PD,M11,LENGTH=9,               
               C'A0810',                         
               C'     ',                               
               1271,3,PD,M11,LENGTH=5,   
               1262,3,PD,M11,LENGTH=4,       [u][b]ACCOUNT[/b][/u]                 
               1271,3,PD,M11,LENGTH=5,       [u][b]UNIT[/b][/u]                 
               1265,4,PD,M11,LENGTH=7,                 
               C'0',                         
               C'1   ',                     
               1269,2,PD,M11,LENGTH=3)

"Code"ed for readability

Re: use SYNCSORT - need to do a type of searh and replace

PostPosted: Tue Dec 02, 2008 9:12 pm
by Alissa Margulies
blexann,

Which release of SyncSort are you running? Did you try to code the IFTHEN statement? If you tried, but you got an error, what was the error message?

Re: use SYNCSORT - need to do a type of searh and replace

PostPosted: Tue Dec 02, 2008 11:47 pm
by blexann
SYNCSORT FOR Z/OS 1.3.0.1R

I tried the below and it seems to do what I want. Please let me know if I am doing it correctly.

INCLUDE COND=((10,5,BI,EQ,X'000001000F'),OR,
(10,5,BI,EQ,X'000001001F'),OR,
(10,5,BI,EQ,X'000001003F'),OR,
(10,5,BI,EQ,X'000001021F'))
INREC IFTHEN=(WHEN=(1262,3,BI,EQ,X'00036F'),OVERLAY=(1271:X'85726F')),
IFTHEN=(WHEN=(1262,3,BI,EQ,X'00041F'),OVERLAY=(1271:X'85726F')),
IFTHEN=(WHEN=(1262,3,BI,EQ,X'00042F'),OVERLAY=(1271:X'85726F')),
IFTHEN=(WHEN=(1262,3,BI,EQ,X'00046F'),OVERLAY=(1271:X'85726F')),
IFTHEN=(WHEN=(1262,3,BI,EQ,X'00047F'),OVERLAY=(1271:X'85726F')),
IFTHEN=(WHEN=(1262,3,BI,EQ,X'00049F'),OVERLAY=(1271:X'85726F')),
IFTHEN=(WHEN=(1262,3,BI,EQ,X'00052F'),OVERLAY=(1271:X'85726F')),
IFTHEN=(WHEN=(1262,3,BI,EQ,X'04399F'),OVERLAY=(1271:X'85726F'))
SORT FIELDS=(1,5,PD,A,10,5,PD,A)
OUTREC FIELDS=(C'1',
2,4,PD,M11,LENGTH=7,
34C' ',
C'000',
10,5,PD,M11,LENGTH=9,
C'A0810',
C' ',
1271,3,PD,M11,LENGTH=5,
1262,3,PD,M11,LENGTH=4, * ACCOUNT
1271,3,PD,M11,LENGTH=5, * UNIT
1265,4,PD,M11,LENGTH=7,
C'0',
C'1 ',
1269,2,PD,M11,LENGTH=3)

Re: use SYNCSORT - need to do a type of searh and replace

PostPosted: Wed Dec 03, 2008 12:13 am
by Alissa Margulies
blexann,

You can simplify the INCLUDE statement as follows:

INCLUDE COND=((10,5,BI,EQ,L(X'000001000F',X'000001001F',
        X'000001003F',X'000001021F'))

You can also simplify the INREC statement as follows:

INREC IFTHEN=(WHEN=(1262,3,BI,EQ,L(X'00036F',X'00041F',X'00042F',
      X'00046F',X'00047F',X'00049F',X'00052F',X'04399F')),
      OVERLAY=(1271:X'85726F'))

Re: use SYNCSORT - need to do a type of searh and replace

PostPosted: Wed Dec 03, 2008 3:50 am
by blexann
...waht does the L mean at the end of this statement ? INREC IFTHEN=(WHEN=(1262,3,BI,EQ,L


..thanks for your help

Re: use SYNCSORT - need to do a type of searh and replace

PostPosted: Wed Dec 03, 2008 3:55 am
by dick scherrer
Hello,

The L indicates a List of Literal values follow.