You are on page 1of 2

How to get the timestamp in JCL?

You really don't have to use the CHAR function. you can use the following

Code:

WHERE AUDIT_UPDT_TS BETWEEN


TIMESTAMP(CURRENT DATE -1 DAY,TIME('00:00:00'))
AND TIMESTAMP(CURRENT DATE,TIME('00:00:00')) - 1 MICROSECOND
;

this would produce the 2 time stamps as follows

Code:

2009/07/14/00.00.00.000000
2009/07/14/23.59.59.999999

or you can even use this format

Code:

WHERE AUDIT_UPDT_TS >= (SELECT TIMESTAMP(CURRENT DATE -1 DAY,


TIME('00:00:00'))
FROM SYSIBM.SYSDUMMY1)

TIME('00:00:00')) - 1 MICROSECOND
FROM SYSIBM.SYSDUMMY1)
;

If you still need sort to generate the timestamps then use the following job
Code:

//STEP0100 EXEC PGM=SORT


//SYSOUT DD SYSOUT=*
//SORTIN DD *
DUMMY RECORD
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC BUILD=(2:DATE1(/)-1,x'00.00.00.000000',
' AND ',DATE1(/)-1,C'-23.59.59.999999')
/*

slash is used as a separator , you can substitute the appropriate separator


according to your needs

The output will be


Code:

2009/07/14-00.00.00.000000 AND 2009/07/14-23.59.59.999999


--------------------------

//S1 EXEC PGM=SORT


//SYSOUT DD SYSOUT=*
//SORTIN DD *
DUMMY
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REMOVECC,NODETAIL,
HEADER1=(C'SENDDATE=',DATE=(4MD-),/,C'TIMESTAMP=',TIME=(24.))
/*

Output will be like...


Code:

SENDDATE=2011-09-23
TIMESTAMP=10.44.07

----------

I need a JCL which create a member with the actual Date or /and the actual Time.
I don't have icetool. Is it possible to use iebgener ?
The date should be in format yymmdd time hh:mm

//STEP1 EXEC PGM=SORT


//SORTIN DD *

/*
//SORTOUT DD DISP=SHR,DSN=THE.PDS(MEMBER1)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
INREC FIELDS=(DATE,TIME)
OPTION COPY
OUTREC FIELDS=(3,6,,10,5:x)
/*

---------

You might also like