|
View previous topic :: View next topic
|
| Author |
Message |
krrp
New User
Joined: 23 Oct 2015 Posts: 12 Location: canada
|
|
|
|
Hi
Based on Header record validation, I need to change a specific field in the detail record.
Let me know your thoughts
Thanks,
Krrp
In Type0 Col 15 is DDA then Change Col 19 to A for all Type1 records.
INPUT::
00000000001003DDA
10000000002TESTXYZA
10000000003TESTABCA
10000000004TESTRBCB
10000000005TESTCBCA
10000000006TESTDEVB
90000000007TRAILER
The ouptut should look like
00000000001003DDA
10000000002TESTXYZA
10000000003TESTABCA
10000000004TESTRBCA
10000000005TESTCBCA
10000000006TESTDEVA
90000000007TRAILER |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
1) We know you have a DFSort question because you posted in that part of the forum. Create a meaningful title for your topics.
2) use the code tags to present your code and data. This maintains any spacing and uses a fixed width font so that stuff lines up correctly
3) As your sample data, which is supposed to be representative of the data in your dataset, only has 1 type 0 record and it has DDA (presumably in the position you say, why not simply change your data if the record type is 1 - no need to go checking your typ 0? |
|
| Back to top |
|
 |
krrp
New User
Joined: 23 Oct 2015 Posts: 12 Location: canada
|
|
|
|
| Nic Clouston wrote: |
1) We know you have a DFSort question because you posted in that part of the forum. Create a meaningful title for your topics.
2) use the code tags to present your code and data. This maintains any spacing and uses a fixed width font so that stuff lines up correctly
3) As your sample data, which is supposed to be representative of the data in your dataset, only has 1 type 0 record and it has DDA (presumably in the position you say, why not simply change your data if the record type is 1 - no need to go checking your typ 0? |
Thanks Nic for your reply...
I just wanted to see if we could do it...I don't have any data. I'm in the design phase and see if we could change without changing the proc.
To your bullet point 3, it could be DDA/SAV etc...I just want to change if it is only DDA based on the file we process.
Thanks,
KRRP |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| Yes, of course you can do it. Design finished. |
|
| Back to top |
|
 |
krrp
New User
Joined: 23 Oct 2015 Posts: 12 Location: canada
|
|
|
|
| Bill Woodger wrote: |
| Yes, of course you can do it. Design finished. |
Hi Bill
Can you please share with me with the sort statements for my above example?
Based on header record (DDA/SAV/ACH etc), I need to update the detail record field.
header record column 1 is 0
detail record column 1 is 1
trailer record column 1 is 9
Only when header record has DDA update the detail record. Else no changes.
Thanks, |
|
| Back to top |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Try the steps below
1.Use When group
2.Then Push
3.Overlay
4.Reformat |
|
| Back to top |
|
 |
krrp
New User
Joined: 23 Oct 2015 Posts: 12 Location: canada
|
|
|
|
| Pandora-Box wrote: |
Try the steps below
1.Use When group
2.Then Push
3.Overlay
4.Reformat |
Thanks...Let me go through the manual and try it. |
|
| Back to top |
|
 |
krrp
New User
Joined: 23 Oct 2015 Posts: 12 Location: canada
|
|
|
|
| krrp wrote: |
| Pandora-Box wrote: |
Try the steps below
1.Use When group
2.Then Push
3.Overlay
4.Reformat |
Thanks...Let me go through the manual and try it. |
Okay...it worked...here is what I did:
| Code: |
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,1,CH,EQ,C'0',AND,15,3,CH,EQ,C'DDA'),
PUSH=(251:15,3))
OUTREC IFTHEN=(WHEN=(1,1,CH,EQ,C'1',AND,19,1,CH,EQ,C'B',
AND,251,3,CH,EQ,C'DDA'),
OVERLAY=(19:C'A')) |
Thanks much for all your help!!
Thanks
Krrp
Code'd |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| Code: |
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,1,CH,EQ,C'0',AND,15,3,CH,EQ,C'DDA'),
PUSH=(251:15,3)),
IFTHEN=(WHEN=(1,1,CH,EQ,C'1',AND,19,1,CH,EQ,C'B',
AND,251,3,CH,EQ,C'DDA'),
OVERLAY=(19:C'A')) |
Although your sample data is limited, test your code well. You have no "END" to limit the WHEN=GROUP, so the PUSH will potentially affect every record following, even if it is another "header" and the records belonging to that header. |
|
| Back to top |
|
 |
krrp
New User
Joined: 23 Oct 2015 Posts: 12 Location: canada
|
|
|
|
| Bill Woodger wrote: |
| Code: |
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,1,CH,EQ,C'0',AND,15,3,CH,EQ,C'DDA'),
PUSH=(251:15,3)),
IFTHEN=(WHEN=(1,1,CH,EQ,C'1',AND,19,1,CH,EQ,C'B',
AND,251,3,CH,EQ,C'DDA'),
OVERLAY=(19:C'A')) |
Although your sample data is limited, test your code well. You have no "END" to limit the WHEN=GROUP, so the PUSH will potentially affect every record following, even if it is another "header" and the records belonging to that header. |
Thanks Bill for you input. I'll update my package so I don't forget.
Thanks,
Krrp |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|