IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

DFSort Question


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
krrp

New User


Joined: 23 Oct 2015
Posts: 12
Location: canada

PostPosted: Mon Mar 07, 2016 7:11 pm
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2448
Location: Hampshire, UK

PostPosted: Mon Mar 07, 2016 7:50 pm
Reply with quote

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
View user's profile Send private message
krrp

New User


Joined: 23 Oct 2015
Posts: 12
Location: canada

PostPosted: Mon Mar 07, 2016 8:01 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7311
Location: Inside the Matrix

PostPosted: Mon Mar 07, 2016 9:10 pm
Reply with quote

Yes, of course you can do it. Design finished.
Back to top
View user's profile Send private message
krrp

New User


Joined: 23 Oct 2015
Posts: 12
Location: canada

PostPosted: Mon Mar 07, 2016 9:35 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1565
Location: Andromeda Galaxy

PostPosted: Mon Mar 07, 2016 9:47 pm
Reply with quote

Try the steps below

1.Use When group
2.Then Push
3.Overlay
4.Reformat
Back to top
View user's profile Send private message
krrp

New User


Joined: 23 Oct 2015
Posts: 12
Location: canada

PostPosted: Mon Mar 07, 2016 9:52 pm
Reply with quote

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
View user's profile Send private message
krrp

New User


Joined: 23 Oct 2015
Posts: 12
Location: canada

PostPosted: Mon Mar 07, 2016 11:37 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7311
Location: Inside the Matrix

PostPosted: Tue Mar 08, 2016 5:20 am
Reply with quote

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
View user's profile Send private message
krrp

New User


Joined: 23 Oct 2015
Posts: 12
Location: canada

PostPosted: Tue Mar 08, 2016 7:53 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Join lines with dfsort DFSORT/ICETOOL 5
No new posts Covert k to 1000 / m to 1000000 using... DFSORT/ICETOOL 5
No new posts Question for Cobol Report Writer COBOL Programming 3
No new posts Infoprint AOPPRINT question All Other Mainframe Topics 0
No new posts DFSORT Output file order query DFSORT/ICETOOL 2
Search our Forums:

Back to Top