IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Packed date field conversion ( 4 bytes ) to mm/dd/yy


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Thu May 03, 2012 1:58 am
Reply with quote

hi,
I having a little trouble getting a date field that is input to a user friendly date field as output.
the copybook field is:

Code:

10  ADLINE-TSADD-DATE   PIC S9(7)  COMP-3.


The hex field ( last 4 bytes of this block) looks like:

Code:

   7000220011203190233234....
    FFFFFFFFFFFFFFFFFFFFFF1239
    7000220011203190233234101C


File manager here shows it as:
Code:

TSADD-DATE S9(7)      PD     4       1120319


I have tried the following (and more) but cannot seem to get the right combination:

Code:

SORT FIELDS=COPY                                 
 INREC BUILD=(024,04,PD,EDIT=(IIIIIIIIT),C' ',   
              342,04,Y4T,TOJUL=Y4T)                         
                     $                                     
ICE111A E REFORMATTING FIELD ERROR                         
           
ICE751I 0 C5-K62149 C6-K90026 C7-K58148 C8-K67572 E7-K70685


this is probably a quick and dirty but it looks like ALL the dates here are in that format which I think they must of done that due to space considerations back in the day.
Thanks Mucho for assistance.[/code]
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Thu May 03, 2012 2:12 am
Reply with quote

I presume that the initial 1 is a century indicator?
Back to top
View user's profile Send private message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Thu May 03, 2012 2:19 am
Reply with quote

Code:

Field             Picture    Typ  Len   Data   
ADLINE-TSADD-DATE S9(7)      PD     4   1120319
what is that date in mm/dd/yy
and is the first digit a century indicator ?


and....
Code:

Yes.  CyymmDD.
Current-date - 19000000.
Will be '1' for 2000+
Add 19000000 to make YYYYMMDD
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu May 03, 2012 2:38 am
Reply with quote

The DTx formats will work for P'cyyddd', but there is NO specific format for P'cyymmdd'. However, you can convert X'cyymmddC' to C'yymmdd' using PD0 and then rearrange it to C'mm/dd/yy' with IFTHEN clauses like the following - I assumed your X'cyymmddC' value starts in position 23 and you are only dealing with 20yy dates (c=1):

Code:

  OPTION COPY                                             
  INREC IFTHEN=(WHEN=INIT,BUILD=(23,4,PD0)),             
    IFTHEN=(WHEN=INIT,BUILD=(3,2,C'/',5,2,C'/',1,2))     


For your example, the output date would be:

03/19/12

If c can be anything other than 1, this would require some modifications.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts 10 byte RBA conversion DB2 2
No new posts 10 byte RBA conversion -non applicati... JCL & VSAM 1
Search our Forums:

Back to Top