Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Packed date field conversion ( 4 bytes ) to mm/dd/yy

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Packed date field conversion ( 4 bytes ) to mm/dd/yy
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: 1783
Location: Bloomington, IL

PostPosted: Thu May 03, 2012 2:12 am    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Thu May 03, 2012 2:38 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm
No new posts Conversion of UTF-8 to EBCDIC muralikrishnan_new COBOL Programming 1 Tue Nov 21, 2017 5:33 pm
No new posts Mainframe Blocks to Tracks conversion upendrasri JCL & VSAM 1 Sat Nov 18, 2017 10:52 am
No new posts Date in where clause - Windows Karthikeyan Subbarayan DB2 9 Wed Nov 15, 2017 9:07 pm
This topic is locked: you cannot edit posts or make replies. Incrementing current time field by 30... arunsoods DFSORT/ICETOOL 11 Thu Oct 26, 2017 3:22 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us