z/OS DFSORT Application Programming Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Current date as character string

z/OS DFSORT Application Programming Guide
SC23-6878-00

DATE1, &DATE1, DATE1(c), &DATE1(c), DATE2, &DATE2, DATE2(c), &DATE2(c), DATE3, &DATE3, DATE3(c), &DATE3(c), DATE4, &DATE4, DATE5 or &DATE5 can be used to generate a character string for the current date of the run.

Table 1 shows the form of the character string constant generated for each current date operand along with an example of the actual character string generated when the date of the run is June 21, 2005 at 04:42:45 PM, using (/) for (c) where relevant. yyyy represents the year, mm (for date) represents the month (01-12), dd represents the day (01-31), ddd represents the day of the year (001-366), hh represents the hour (00-23), mm (for time) represents the minutes (00-59), ss represents the seconds (00-59), nnnnnn represents the microseconds (000000-999999) and c can be any character except a blank.

Table 1. Character Strings for Current Date
Character Strings for Current DateFormat of Operand
Format of Constant Example of Constant
DATE1 C'yyyymmdd' C'20050621'
DATE1(c) C'yyyycmmcdd' C'2005/06/21'
DATE2 C'yyyymm' C'200506'
DATE2(c) C'yyyycmm' C'2005/06'
DATE3 C'yyyyddd' C'2005172'
DATE3(c) C'yyyycddd' C'2005/172'
DATE4 C'yyyy-mm-dd-hh.mm.ss' C'2005-06-21-16.52.45'
DATE4 C'yyyy-mm-dd-hh.mm.ss' C'2005-06-21-16.52.45'
DATE5 C'yyyy-mm-dd-hh.mm.ss.nnnnnn' C'2005-06-21-16.52.45.582013'
Note: You can precede each of the operands in the table with an & with identical results.
Tip: When a field is shorter than the character string it's compared to, DFSORT truncates the string on the right. You can take advantage of this to compare a field to only part of the DATE4 timestamp when appropriate. For example:
  INCLUDE COND=(1,13,CH,GT,DATE4)
would compare the field in positions 1-13 to the truncated DATE4 constant C'yyyy-mm-dd-hh'.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014