To convert Julian date in packed format to Gregorian



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

To convert Julian date in packed format to Gregorian

Postby kimir » Wed Mar 14, 2012 8:53 pm

Hi,

I had earlier posted the query in the DFSORT section, however the requirement is now being handled in SYNCSORT. Hence I am posting this in the appropriate section of the forum.The requirement is:
I have date in the packed (COMP-3) julian format eg 2011031 (P'ccyyddd'). Is there a way to read it from the file, unpack it and also do the conversion in a single sort step.
A) As of now,I am unpacking it by the sort statement
20:94,04,PD,EDIT=(TTTTTTT) ==> 94 is the starting position of the packed julian date in the input file
B) and then using another sort step to convert this unpacked julian date to Gregorian date.
CENTWIN=1949
OUTREC FIELDS=(22,5,Y2T,DTNS=(MD4))
Is there a way to combine step (B) in (A) itself.

If I directly use Y4T or other statements like OUTFIL BUILD=(20:90,04,Y4X,TOGREG=(Y4W)) which was suggested by Frank
the error is thrown near Y4X. The SYNCSORT version being used is SYNCSORT FOR Z/OS 1.3.2.1R

Any help is appreciated.

Thank You,
Kimir.
kimir
 
Posts: 6
Joined: Sun Oct 23, 2011 7:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: To convert Julian date in packed format to Gregorian

 

Re: To convert Julian date in packed format to Gregorian

Postby bodatrinadh » Wed Mar 14, 2012 11:27 pm

yes, It can be acheived by using INREC and OUTREC.

Here is a sample code...
Input file :- Packed Decimal

DATE1                                                                         
4/P                                                                           
(1-4)                                                                         
1-------                                                                       
********************************* TOP OF DATA **********************-CAPS OFF-*
 2011031                                                                       
 2012031                                                                       
 2012076                                                                       
 2012074     ==> Today's Julian Date Value                                                               
 2012073                                                                       
******************************** BOTTOM OF DATA ********************-CAPS OFF-*


//STEP1    EXEC PGM=SORT,PARM='CENTWIN=1949'   
//SYSOUT   DD SYSOUT=*                         
//SYSPRINT DD SYSOUT=*                         
//SORTIN DD DSN=B1CDTB2.TEST.PS,DISP=SHR       
//SORTOUT  DD SYSOUT=*                         
//SYSIN DD *                                   
    SORT FIELDS=COPY                           
    INREC FIELDS=(1,4,PD,TO=ZD,LENGTH=7)       
    OUTREC FIELDS=(3,5,Y2T,DTNS=(MD4))         


And output :- MMDDYYYY Format
01312011 
01312012 
03162012 
03142012    ==> Today's Date
03132012 
Thanks
-3nadh
User avatar
bodatrinadh
 
Posts: 67
Joined: Thu Jan 12, 2012 9:05 pm
Has thanked: 0 time
Been thanked: 4 times


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post