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


Related Posts

blog comments powered by Disqus

There's 18 Comments So Far

  •   Prerna
    May 11th, 2012 at 7:16 am

    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


  •   Karthik
    May 11th, 2012 at 9:14 am

    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.

  •   Prerna
    May 11th, 2012 at 11:51 am

    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)

  •   Karthik
    May 11th, 2012 at 1:10 pm

    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?

  •   Sunil Patwal
    May 24th, 2012 at 9:50 am

    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.

  •   Karthik
    May 24th, 2012 at 12:14 pm

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

  •   Sunil Patwal
    May 25th, 2012 at 3:58 am

    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.

  •   Karthik
    May 26th, 2012 at 1:35 pm

    yes Sunil, can you check this pdf, page 122? ftp://service.boulder.ibm.com/software/migration/pubs/fsyug002.pdf

  •   Supamanny
    June 7th, 2012 at 8:10 am

    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.

  •   HONEY
    August 23rd, 2012 at 6:38 am

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

  •   Rituraj Singh Rawat
    November 20th, 2012 at 11:09 am

    Karthik, change the spelling of SYSTIME in the article’s first line. 😛

  •   Karthik
    November 21st, 2012 at 2:07 pm

    thanks Rituraj ! corrected..

  •   vishwadeep
    February 21st, 2013 at 6:11 am

    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/13.my requirement is to have it displayed as 02/20/13..any suggestions..

  •   John
    April 25th, 2013 at 5:59 pm

    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.

  •   Will
    November 13th, 2013 at 7:15 pm

    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?

  •   pankaj agarwal
    December 17th, 2013 at 4:51 pm


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

  •   Abinash
    July 23rd, 2014 at 5:00 pm

    How can i add 21 days to date – 07/23/2014
    using easytrieve

  •   Yzark Leon
    September 20th, 2014 at 1:49 am

    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?

Share your thoughts, leave a comment!