Page 2 of 2

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

PostPosted: Thu Jan 08, 2009 8:47 pm
by blexann
a follow up to this: I want the BRANCH highlighted below to have the original value from the input record. The ORG is changed as a result of the INREC but I want the BRANCH to remaing the same.

input fiield output fields
a --> ORG and BRANCH
I want b to have the new value and c to have the original value in a

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,L(X'00036F',X'00041F',X'00042F',
X'00046F',X'00047F',X'00049F',X'00052F',X'04399F')),
OVERLAY=(1271:X'85726F'))
SORT FIELDS=(1,5,PD,A,10,5,PD,A) * NUMBER
OUTREC FIELDS=(C'1', *
2,4,PD,M11,LENGTH=7, * NUMBER
34C' ', * PAD TO 41 BLANKS
C'000', * PAD TO LENGTH 12
10,5,PD,M11,LENGTH=9, * INV
C'A0810', * CUSTOMER
C' ', * CORP CODE
1271,3,PD,M11,LENGTH=5, * BRANCH
1262,3,PD,M11,LENGTH=4, * PRODUCT
1271,3,PD,M11,LENGTH=5, * ORG
1265,4,PD,M11,LENGTH=7, * ACCOUNT
C'0', * CURRENCY INDICATOR
C'1 ', * CURRENCY CODE
1269,2,PD,M11,LENGTH=3) * SUB ACCT

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

PostPosted: Fri Jan 09, 2009 12:36 am
by dick scherrer
Hello,

Please re-post this using the "Code" tag rather than trying to use multi-color.

Please post a few input and output records showing how you want the process to work. These do not need to be complete records, just the fields to show what you want to accomplish.

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

PostPosted: Fri Jan 09, 2009 2:52 am
by blexann
Input ORG is changed to 1234 on the output for product=0036,0041,0052 and 0047 and set Branch on the output equal to original ORG from Input

input packed data

product org
0036 8500
0041 8500
1023 9567
0052 8500
0047 8500

output

product org branch
0036 1234 8500
0041 1234 8500
1023 9567 9567
0052 1234 8500
0047 1234 8500



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,L(X'00036F',X'00041F',X'00042F',     
       X'00046F',X'00047F',X'00049F',X'00052F',X'04399F')),             
       OVERLAY=(1271:X'85726F'))                                       
 SORT FIELDS=(1,5,PD,A,10,5,PD,A)                 * NUMBER       
 OUTREC FIELDS=(C'1',                             * 
                2,4,PD,M11,LENGTH=7,              * NUMBER             
                34C' ',                           * PAD TO 41 BLANKS   
                C'000',                        * PAD TO LENGTH 12
                10,5,PD,M11,LENGTH=9,            * INV               
                C'A0810',                        * CUSTOMER 
                C'     ',                        * CORP CODE       
                1271,3,PD,M11,LENGTH=5, * BRANCH
                1262,3,PD,M11,LENGTH=4, * PRODUCT                 
                1271,3,PD,M11,LENGTH=5, * ORG
                1265,4,PD,M11,LENGTH=7, * ACCOUNT             
                 C'0',                   * CURRENCY INDICATOR
                 C'1   ',                * CURRENCY CODE     
                 1269,2,PD,M11,LENGTH=3) * SUB ACCT


Re-Coded for alignment

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

PostPosted: Fri Jan 09, 2009 3:23 am
by dick scherrer
Hello,

OVERLAY=(1271:X'85726F'))
Should this be in the output?

You need to look at the "output definition in the code. There appear to be inconsistencies.

What happens when you run this? If errors are presented by the sort, you need to post the entire message (including the id). If the output is not what you want, you need to show what happened.

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

PostPosted: Fri Jan 09, 2009 11:10 am
by blexann
this is running in production - no errors

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

PostPosted: Fri Jan 09, 2009 11:15 am
by dick scherrer
Thank you for letting us know it is working :)

d

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

PostPosted: Sat Jan 10, 2009 1:11 am
by blexann
my original posted code works in production - how do I modify it to do what I want as I've posted above in the example.

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

PostPosted: Sat Jan 10, 2009 1:49 am
by dick scherrer
Hello,

how do I modify it to do what I want as I've posted above in the example.
Suggest you read my prior post, resolve or explain the inconsistencies in the sort control info, and make changes to the code to deal with the new/modified requirement. When there are problems, we can help.

The purpose of the forum is not to write code, but to help you work on your code. If you do not correctly present the requirement, it is sometimes not even possible for us to help. . .

As far as this:
this is running in production - no errors
i am confused. the outrec fields appear to overlap which might cause all sorts of adventures. . . possibly, there is something i misunderstand.

                1271,3,PD,M11,LENGTH=5, * BRANCH
                1262,3,PD,M11,LENGTH=4, * PRODUCT                 
                1271,3,PD,M11,LENGTH=5, * ORG
                1265,4,PD,M11,LENGTH=7, * ACCOUNT             
                 C'0',                   * CURRENCY INDICATOR
                 C'1   ',                * CURRENCY CODE     
                 1269,2,PD,M11,LENGTH=3) * SUB ACCT