Page 1 of 1

convert julian date of the format "2017.335" to normal date

PostPosted: Mon Jul 30, 2018 10:44 am
by N J Baruah
Hi All,

I am trying to convert some julian dates which are in the format like "2017.335" , "2018.106" etc into normal dates of the format YY/MM/DD .
I have tried the below code:

//STEP1  EXEC PGM=SORT,PARM='CENTWIN=80'
//SYSOUT DD SYSOUT=*
//SORTIN DD *
2017335
2018106
//SORTOUT DD DSN=XXXXXX.dataset,DISP=SHR
//SYSIN DD *
 SORT FIELDS=COPY
 INREC BUILD=(3,5,Y2T,DT=(4MD/))
/*
 



Output: 2017/12/01
Output: 2018/04/16
 


But I want the output in the format YY/MM/DD and also when the Julian date is like " 2017.335 " , " 2018.106 " .
Can anyone please help me how I can achieve it ....

Re: convert julian date of the format "2017.335" to normal d

PostPosted: Mon Jul 30, 2018 11:37 am
by expat
As a quick guess, without having read a manual, did you try 2MD/ instead of 4MD/

Re: convert julian date of the format "2017.335" to normal d

PostPosted: Mon Jul 30, 2018 11:53 am
by N J Baruah
Hi Expat,

Yeah I tried with 2MD as well...It is giving me syntax error.

Re: convert julian date of the format "2017.335" to normal d

PostPosted: Mon Jul 30, 2018 12:32 pm
by N J Baruah
Hi Expat,

I am able to achieve in the format YY/MM/DD by doing the below:

//STEP1  EXEC PGM=SORT,PARM='CENTWIN=80'
//SYSOUT DD SYSOUT=*
//SORTIN DD *
2017335
2018106
//SORTOUT DD DSN=XXXXXX.dataset,DISP=SHR  <---- LRECL=8
//SYSIN DD *
 SORT FIELDS=COPY
 INREC BUILD=(3,5,Y2T,DT=(4MD/))
 OUTREC OVERLAY=(1:3,8,9:X)
/*
 



Output:  17/12/01
Output:  18/04/16
 


But how I can achieve the same result when the Julian dates are in the format "2017.335" i.e as below:


//SORTIN DD *
2017.335
2018.106
 

Re: convert julian date of the format "2017.335" to normal d

PostPosted: Mon Jul 30, 2018 1:38 pm
by NicC
On INREC take the YY and the DDD and place them on the record as YYDDD then convert

Re: convert julian date of the format "2017.335" to normal d

PostPosted: Mon Jul 30, 2018 3:12 pm
by N J Baruah
yep, Thanks NicC .... its done in the same way as u advised.