modify date conditionally
Moderators: Frank Yaeger, Moderator Group
modify date conditionally
My file has a header record containing a date and data records. My task is to modify the date in the data records to current-date but only if the date is the same as in the header record. As that is a little confusing I will give an example
00 is the header record
01 are the data records
today is 20121024
input
00 20121018XYZ
01 20121018XYZ
01 20121016XYZ
output
00 20121018XYZ
01 20121024XYZ
01 20121016XYZ
header record remains unchanged
record 1: 20121018 is changed to 20121024 (current date) because it has the same date as header record
record 2: remains unchanged because the date is not equal header record
any solution for my problem
00 is the header record
01 are the data records
today is 20121024
input
00 20121018XYZ
01 20121018XYZ
01 20121016XYZ
output
00 20121018XYZ
01 20121024XYZ
01 20121016XYZ
header record remains unchanged
record 1: 20121018 is changed to 20121024 (current date) because it has the same date as header record
record 2: remains unchanged because the date is not equal header record
any solution for my problem
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
This pseudo code should be handy:
In above pseudo- code "DATE" is a 'conceptual data items' and has the implicit PICTURE 9(6) and the sequence of data elements (from left to right) would be: 2 digits for the year, 2 digits for the month, 2 digits for the day.
As you have a four-digit year, you can consider to use intrinsic function CURRENT-DATE. However, how do you make use of the working-storage definitions in using DATE and CURRENT-DATE, I leave it you for experiment.
Code: Select all
If header-date=detail-date
ACCEPT ws-date FROM DATE
move ws-date to detail-date
END-IF
As you have a four-digit year, you can consider to use intrinsic function CURRENT-DATE. However, how do you make use of the working-storage definitions in using DATE and CURRENT-DATE, I leave it you for experiment.
Regards,
Anuj
Anuj
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
Please post the ICE201I message from any Sort step so we can see what level of the product you have.
It should be simple with a IFTHEN=(WHEN=GROUP on the header record, and PUSH the date from the header. Then you have functions for the current date (consult the manual) if you want all the confusion of "before midnight or after midnight" and problems with re-running/testing.
It should be simple with a IFTHEN=(WHEN=GROUP on the header record, and PUSH the date from the header. Then you have functions for the current date (consult the manual) if you want all the confusion of "before midnight or after midnight" and problems with re-running/testing.
ICE201I H RECORD TYPE IS V - DATA STARTS IN POSITION 5William Collins wrote:Please post the ICE201I message from any Sort step so we can see what level of the product you have.
It should be simple with a IFTHEN=(WHEN=GROUP on the header record, and PUSH the date from the header. Then you have functions for the current date (consult the manual) if you want all the confusion of "before midnight or after midnight" and problems with re-running/testing.
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page