To obtain date in Gregorian format

IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

To obtain date in Gregorian format

Postby kimir » Mon Mar 12, 2012 10:40 am


I have a requirement wherein the output file should have the date format in Gregorian in the detail record without any separator(Eg 01122012 MMDDYYYY). I went thru the forum posts and found that &DATENS=(MD4) will provide the output in Julian format.
1) Is there any function to convert the date to Gregorian.
2)At a set position of the input file, another date is present in packed format(Julian date). I have used the below to unpack it. However the output stll comes in Julian format.Is there a way to unpack it and convert it to Gregorian MMDDYYYY format at the same time.

The output format is:
0012282011 where 00 represents header record

Note: 12282011 - MMDDYYYY format.

Posts: 6
Joined: Sun Oct 23, 2011 7:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: To obtain date in Gregorian format


Re: To obtain date in Gregorian format

Postby BillyBoyo » Mon Mar 12, 2012 1:11 pm

Check the manual/forum for TOGREG.
Global moderator
Posts: 3738
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 255 times

Re: To obtain date in Gregorian format

Postby Frank Yaeger » Tue Mar 13, 2012 12:01 am



You didn't read the manual very carefully. &DATENS=(MD4) does give the date in Gregorian form, not Julian, e.g. it would give today's date as:


That is gregorian (mmddyyyy)


Assuming you have a P'dddyyyy' date (Julian) in positions 90-93 of your input records, you can use the following DFSORT control statements to convert it to a 'mmddyyyy' date (Gregorian):

  OPTION COPY                               
  OUTFIL BUILD=(20:90,04,Y4X,TOGREG=(Y4W))   
Frank Yaeger - DFSORT Development Team (IBM) -
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at
User avatar
Frank Yaeger
Global moderator
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times



  • Related topics
    Last post