View previous topic :: View next topic |
Author |
Message |
vij Beginner
Joined: 13 Dec 2002 Posts: 6 Topics: 2
|
Posted: Mon May 19, 2008 11:41 am Post subject: Convert the special date using SORT |
|
|
We use a special date field in our application (stores in Dataset/file), sometime it need to convert into Gregorian date YYYYMMDD in the output file or report. Normally we invoke a special internal program to convert it.
Input special date is a 3 bytes packed number from X'99999D', X'99998D' X'99997D' |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Mon May 19, 2008 12:42 pm Post subject: |
|
|
vij,
Sort can handle fixed pos fields. However you can use symbols to dynamically generate the position of the string and then convert it. But the name of the field should remain the same in all layouts.
Kolusu |
|
Back to top |
|
|
Frank Yaeger Sort Forum Moderator
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
|
Posted: Mon May 19, 2008 2:31 pm Post subject: |
|
|
Quote: | We use a special date field in our application |
Vij,
Where do you use them? In fields to be sorted? In fields to be included? In fields to be displayed?
Are your input dates X'yyddds' dates or X'dddyys' dates?
You show dates from X'99999D' to X'99999C' but you only say what the first few represent. What would X'00000C' and X'99999C' represent? Surely every date can't be considered a "special date" ... what about X'99001C' ... wouldn't that be a real yyddd date?
You need to be more specific about what the special dates actually are, what they represent, and what you're trying to do with them. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort |
|
Back to top |
|
|
vij Beginner
Joined: 13 Dec 2002 Posts: 6 Topics: 2
|
Posted: Tue May 20, 2008 3:16 am Post subject: |
|
|
Hi Kolusu/Frank Yaeger
Thanks for your reply
The special date is invented as a Y2K solution. It is NOT a Julian format (YYDDDS or DDDYYS). It is just +ive or -ive number.
X'99999C' represents 1900/01/01
X'99998C' represents 1900/01/02
X'99997C' represents 1900/01/03
|
|
Back to top |
|
|
vij Beginner
Joined: 13 Dec 2002 Posts: 6 Topics: 2
|
Posted: Tue May 20, 2008 3:29 am Post subject: |
|
|
sorry, typing mistake
X'99999C' represents 1900/01/01
X'99998C' represents 1900/01/02
X'99997C' represents 1900/01/03
should be
X'99999D' represents 1900/01/01
X'99998D' represents 1900/01/02
X'99997D' represents 1900/01/03 |
|
Back to top |
|
|
Frank Yaeger Sort Forum Moderator
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
|
Posted: Tue May 20, 2008 10:06 am Post subject: |
|
|
Given that your shop "invented" this strange Y2K solution which I've never heard of anyone else using, why would you expect DFSORT to have a built-in function for converting it? DFSORT has extensive Y2x formats for Y2K functions for that kind of thing.
If you want to make your E15 or E35 generic for converting this date in different locations, why not have the E15 or E35 read a control statement that gives the location and use that in the E15 or E35.
Note that D1 is only used for SORT or MERGE fields, not for converting fields. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort |
|
Back to top |
|
|
vij Beginner
Joined: 13 Dec 2002 Posts: 6 Topics: 2
|
Posted: Tue May 20, 2008 11:05 am Post subject: |
|
|
Good idea Frank Yaeger.
I can use E15/E35 exit routine as your suggestion.
I will code "SPLDATE" in my SYSIN card, like
OUTREC FIELDS=(1,3,SPLDATE |
|
Back to top |
|
|
Frank Yaeger Sort Forum Moderator
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
|
Posted: Tue May 20, 2008 12:54 pm Post subject: |
|
|
I don't think you understood my suggestion. Or maybe I don't understand what you're trying to do.
You said you wanted a generic E15 that could convert the date in a given position. My suggestion was to pass the position to the E15 in a control statement, not in SYSIN. For example, if the date starts in position 25 for one run, you could pass it using:
//DATEPOS DD *
00025
/*
If the date starts in position 31 for another run, you could pass it using:
//DATEPOS DD *
00031
/*
The first time the E15 is called, it OPENs DATEPOS, reads the card, saves the position it finds there, and CLOSEs DATEPOS. Then it can use the saved position on that (first) call and every other call to the E15. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort |
|
Back to top |
|
|
vij Beginner
Joined: 13 Dec 2002 Posts: 6 Topics: 2
|
Posted: Tue May 20, 2008 3:11 pm Post subject: |
|
|
Thanks Frank Yaeger,
I am clear now. Thanks lot for your help. |
|
Back to top |
|
|
|
|