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

Is this possible via sort (in one pass)?


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
chillmo

New User


Joined: 31 Aug 2017
Posts: 39
Location: USA

PostPosted: Sat Oct 26, 2024 2:53 am
Reply with quote

I have a file with multiple record types in position 26 (PD, length=2), e.g., 0, 10, 11, 15, 20, 25, etc., however, if position 25 is "Y" for record type 0, I need to change the date in position 30 of record type 10, to current date (CCYY-MM-DD).

I'm able to accomplish this in two passes but wanted to know if it can be done in one pass?

any assistance or guidance would be greatly appreciated!
icon_smile.gif
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1329
Location: Bamberg, Germany

PostPosted: Sat Oct 26, 2024 10:18 am
Reply with quote

You have not provided sample data, nor shared info whether the records are sorted by type and such. Depended on that, I would chose a strategy.
Back to top
View user's profile Send private message
chillmo

New User


Joined: 31 Aug 2017
Posts: 39
Location: USA

PostPosted: Sat Oct 26, 2024 7:34 pm
Reply with quote

Yes, the final output record will be sorted by record type and account, ascending order, and I included sample data below:

Code:

 ----+----1----+----2----+----3----+----4----+--
 999A00000000000000000000Y  2024-10-252024-10-25
 FFFCFFFFFFFFFFFFFFFFFFFFE00FFFF6FF6FFFFFF6FF6FF
 99910000000000000000000080F20240100252024010025
------------------------------------------------
 999D00000000000000000001D  2024-10-252024-10-25
 FFFCFFFFFFFFFFFFFFFFFFFFC00FFFF6FF6FFFFFF6FF6FF
 99940000000000000000000141F20240100252024010025
------------------------------------------------
 999D00000000000000000001D  2024-10-252024-10-25
 FFFCFFFFFFFFFFFFFFFFFFFFC00FFFF6FF6FFFFFF6FF6FF
 99940000000000000000000142F20240100252024010025
------------------------------------------------
 999D00000000000000000001D  2024-10-252024-10-25
 FFFCFFFFFFFFFFFFFFFFFFFFC00FFFF6FF6FFFFFF6FF6FF
 99940000000000000000000142F20240100252024010025
------------------------------------------------
 999D00000000000000000001D  2024-10-252024-10-25
 FFFCFFFFFFFFFFFFFFFFFFFFC00FFFF6FF6FFFFFF6FF6FF
 99940000000000000000000142F20240100252024010025
------------------------------------------------
 999D00000000000000000002D  2024-10-252024-10-25
 FFFCFFFFFFFFFFFFFFFFFFFFC00FFFF6FF6FFFFFF6FF6FF
 99940000000000000000000241F20240100252024010025


Correction: Date field that needs to change starts in position 38.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1329
Location: Bamberg, Germany

PostPosted: Tue Oct 29, 2024 8:16 am
Reply with quote

Try this snippet:
Code:
OPTION COPY                                                   
INREC IFTHEN=(WHEN=GROUP,BEGIN=(26,2,PD,EQ,+0),PUSH=(81:25,1)),
  IFTHEN=(WHEN=(81,1,CH,EQ,C'Y',AND,26,2,PD,EQ,+10),           
    OVERLAY=(38:DATE=(4MD-)))                                 
OUTFIL FNAMES=(SORTOUT),                                       
  REMOVECC,                                                   
  BUILD=(1,47)                                                 
END
Back to top
View user's profile Send private message
chillmo

New User


Joined: 31 Aug 2017
Posts: 39
Location: USA

PostPosted: Tue Oct 29, 2024 4:56 pm
Reply with quote

Joerg.Fineisen, as usual, it worked like a charm.

The business changed their requirement from current date to first of the month, so I modified the code below:

Code:
OPTION COPY                                                   
INREC IFTHEN=(WHEN=GROUP,BEGIN=(26,2,PD,EQ,+0),PUSH=(81:25,1)),
  IFTHEN=(WHEN=(81,1,CH,EQ,C'Y',AND,26,2,PD,EQ,+10),           
    OVERLAY=(46:C'01'))                                 
OUTFIL FNAMES=(SORTOUT),                                       
  REMOVECC,                                                   
  BUILD=(1,47)                                                 
END


Thanks again! icon_biggrin.gif icon_biggrin.gif icon_biggrin.gif
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts JCL sort to compare dates in two file... DFSORT/ICETOOL 2
No new posts GDG generation name to GDG Base name ... DFSORT/ICETOOL 3
No new posts SORT on detail record, then repeat he... DFSORT/ICETOOL 3
No new posts FB to .CSV conversion using sort DFSORT/ICETOOL 7
No new posts SORT CARD meaning please DFSORT/ICETOOL 3
Search our Forums:

Back to Top