Page 1 of 1

To obtain date in Gregorian format

PostPosted: Mon Mar 12, 2012 10:40 am
by kimir
Hi,

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.
OUTREC=(20:90,04,PD,EDIT=(TTTTTTT))

The output format is:
0012282011 where 00 represents header record
01ABCDEFGHIJKLMNOP12282011

Note: 12282011 - MMDDYYYY format.

Regards,
Kimir.

Re: To obtain date in Gregorian format

PostPosted: Mon Mar 12, 2012 1:11 pm
by BillyBoyo
Check the manual/forum for TOGREG.

Re: To obtain date in Gregorian format

PostPosted: Tue Mar 13, 2012 12:01 am
by Frank Yaeger
Kimir,

1)

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:

03122012

That is gregorian (mmddyyyy)

2)

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))