|
View previous topic :: View next topic
|
| Author |
Message |
madmartinsonxx
New User

Joined: 10 Dec 2010 Posts: 96 Location: Massachusetts
|
|
|
|
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 |
|
 |
Akatsukami
Global Moderator

Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
| I presume that the initial 1 is a century indicator? |
|
| Back to top |
|
 |
madmartinsonxx
New User

Joined: 10 Dec 2010 Posts: 96 Location: Massachusetts
|
|
|
|
| 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 |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
 |
|
|