SYSDATE and SYSTIME in Easytrieve

SYSDATE and SYSTIME are keywords in Easytrieve that will return Current System date and System time respectively.


Output will be


18 thoughts on “SYSDATE and SYSTIME in Easytrieve”

  1. I have a requirement in which i only have to process those records in the file, in which difference between System date and the date mentioned in each record < 3

    My logic is getting complex since the file has records from 1990s also. Is there a function in Easytrieve which can make it easier or you can suggest a better way?

    I only have to use Easytrieve


  2. Hi Prerna,

    There is no in-built function to calculate date difference.

    But, I can suggest you one simple logic – since you are saying only 3 days difference allowed.
    First get the current date from SYSDATE and write logic to calculate two previous day’s date.
    From the input file, take each date and see if it matches with with any of the three dates. If yes, process. otherwise, skip.

    also, SYSDATE gives only two digits of the Year.
    use SYSDATE-LONG, which will give 4 digits of the year.

  3. I am sorry to have confused you( by not being clear with the question)
    We actually need to calculate difference between the Years of the two date i.e System Date and the Year mentioned along the record

    eg Difference in the 12/15/99 and Current System Date( I need to know differnce between Years i.e 2012 and 1999)

  4. ok, SYSDATE-LONG will give you the date like ’07/02/2012′, you can take last four digits and move it to a numeric variable. then, you can subtract the year you have in the file.
    is that all your requirement?

  5. How can we subtract 1 month from a date in eazytrieve. Or How can we subtract 30 days from a date, taking into consideration number of month days and leap year?.
    Please suggest.

  6. Hi Sunil,
    there is no direct way to do that. You will need to manually handle all the scenarios to arrive at the date.

  7. Thanks Karthik for your response. While doing research on this topic I found that using DATECALC macro we can handle such scenario. But I am still researching how to use this Macro.

  8. You can use CEECBLDY (IBM standard function) to translate the gregorian dates you want to compare into absolute dates where 1601 01 01 is 00001, and then just subtract the two resultant absolute dates from each other to work out the number of days between the two dates. You define the date fomats you send and receive.

  9. How to extract records from an inputfile in which the difference between two dates should be lie between one year?

  10. i have a requirement like i have to print system date in the report title,i understand that the system date comes automatically in the report title but as i am using easytrieve plus my leading zero is being suppressed ie. 02/20/13 is being displayed as 2/20/ requirement is to have it displayed as 02/20/13..any suggestions..

  11. There is no really easy way to do this, but you would have to place NODATE in your report line and actually parse out SYSDATE-LONG into a WS field and then depending on the month, add a 0 (zero) to the 1st position of the month.

  12. Old article, I know, but thanks for putting this together. I’m running a job now, displaying systime with every 5000th record, and the display always has the same time. In other words, it appears that SYSTIME is not updating dynamically. Is that normal? Is there a way to get it to update dynamically?

  13. Hi

    how to display currentdate and time in report generation.please help me out as soon as possible,urgently required.

  14. I have a long running job and i want to display the time every on every 1000 records read to determine at which point in time every 1000 recs are processed.

    I tried displaying the systime every 1k recs but the displayed all the same with the time the job starts even when my job runs for more than 5mins.

    Is there a way to display it so i can know the elapsed time it spent while the job is running?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.