Extract start date and end date from a file field

2505 pts.
Tags:
AS/400
AS/400 Reports
I have a requirement like this. I need to generate a report which has 2 fields start date and maturity date. I have FileA which has a date field and has some values say 12/31/2012, 01/05/2013, 10/01/2013,25/01/2013 and so on. I need to generate a report which has a field start date and maturity date. Only for first record in the report, the start date is from FileB. The maturity date for first record in report is from FileA(12/31/2012). The second record'start date is (12/31/2012) and maturity date is the second date from fileA(01/05/2013). Third record's start date is 01/05/2013 and maturity date is 3rd date from FileA(10/01/2013) and so on. How can I achieve this?

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    I'm sorry, but your description isn't clear. First, we will need file/field descriptions for the two files, and then a description of the relationship between the two files. Other details might also be needed, but more questions can be asked after we understand the files. -- Tom
    125,585 pointsBadges:
    report
  • Splat
    Let's see if I've got this right: your initial start date is from your FileB, with the maturity date coming from the first record in your FileA; your next start date is the previous maturity date, with the new maturity date coming from the next record in your FileA, repeat until the end of FileA is reached.It sounds like you need to access your FileB first, then proceed through your FileA.
    7,235 pointsBadges:
    report
  • philpl1jb
    If I understand .. which never seems to happen ... this would be a procedural program .. rpg or cobol.  It would read the necessary files and write the first record.  For each subsequent record put the current date into a workfield for Maturity date and get the next record from fileA.  Prepare your output and write one record for each record from file A. Phil 
    49,960 pointsBadges:
    report
  • TomLiotta
    ...a date field and has some values say 12/31/2012, 01/05/2013, 10/01/2013,25/01/2013   If those really are values in the file, then the field is apparently not a "date" field. It's just a plain character field.   The fact that only the "first record" has a start date in FileB needs some explanation. Is FileB used in order to find the starting point in FileA? Does FileA need to be read through until finding the proper starting record? Or are all records in FileA and FileB always used?   It seems that every date in FileA is both a starting date and a maturity date. Record N is a starting date, and record N+1 is a corresponding maturity date. Or maybe not. The requirement isn't clear yet.   One particularly unclear element is the ordering of the data. How is it guaranteed that start and maturity dates are properly paired? If views are used, for example, an ORDER BY needs to be shown so we know what's going on.   Regardless, more info is needed. The design of the database seems to be enough of a problem by itself that the proper processing needs the extra info.   Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following