View previous topic :: View next topic
Author
Message
chillmo New User Joined: 31 Aug 2017Posts: 39 Location: USA
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!
Back to top
Joerg.Findeisen Senior Member Joined: 15 Aug 2015Posts: 1329 Location: Bamberg, Germany
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
chillmo New User Joined: 31 Aug 2017Posts: 39 Location: USA
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
Joerg.Findeisen Senior Member Joined: 15 Aug 2015Posts: 1329 Location: Bamberg, Germany
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
chillmo New User Joined: 31 Aug 2017Posts: 39 Location: USA
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!
Back to top
Please enable JavaScript!