View previous topic :: View next topic
|
Author |
Message |
mf_karthik
New User
Joined: 26 Jul 2005 Posts: 55
|
|
|
|
I have a file in that date positiion starts from 45 in the format of YYMMDD in packed decimal,now based on that date position i want to omit the records greater than 250 days.
the syntax i have used is below
SORT FIELDS=COPY
OMIT COND=(45,6,PD,GT,&DATE1P-250)
still i'm seeing some of the records in o/p..is this syntax is correct or i need add something.. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Which sort product are you using and what does the manual say.
One assumes it is SYNCSORT as this is posted in the JCL forum. |
|
Back to top |
|
|
mf_karthik
New User
Joined: 26 Jul 2005 Posts: 55
|
|
|
|
Syncsort |
|
Back to top |
|
|
bodatrinadh
Active User
Joined: 05 Jan 2007 Posts: 101 Location: chennai (India)
|
|
|
|
Karthik,
If the date(YYMMDD) is of PD, then the length should of 4 not 6.
Change length to 4 and check the output.
Thanks
-3nadh |
|
Back to top |
|
|
mf_karthik
New User
Joined: 26 Jul 2005 Posts: 55
|
|
|
|
Hi,
I tried by changing the length still its not working,the sort card used
SORT FIELDS=COPY
OMIT COND=(45,4,PD,GT,&DATE1P-180).
i want to remove the records which are 180 days older.
for example date in the input:
0826
012F is 08/12/26
but its not getting omitted,in input file it declared as pic9(06) comp-3. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Perhaps the format is Julian date, 81226F |
|
Back to top |
|
|
mf_karthik
New User
Joined: 26 Jul 2005 Posts: 55
|
|
|
|
No its not an julian date,in the o/p it showing as 08/12/26. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
since
0826
012F
is a PIC S9(6) comp-3 and not PIC 9(6) comp-3
perhaps the TS is not completely computer aware.
is 45 the ordinal position or the relative location? |
|
Back to top |
|
|
bodatrinadh
Active User
Joined: 05 Jan 2007 Posts: 101 Location: chennai (India)
|
|
|
|
Karthik,
Are you sure that the date value is sarting from 45th position?
Confirm the layout of the file using File-Aid. Also check whether the file is FB or VB.
Thanks
-3nadh |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
mf_karthik wrote: |
I have a file in that date positiion starts from 45 in the format of YYMMDD in packed decimal,now based on that date position i want to omit the records greater than 250 days.
the syntax i have used is below
SORT FIELDS=COPY
OMIT COND=(45,6,PD,GT,&DATE1P-250)
still i'm seeing some of the records in o/p..is this syntax is correct or i need add something.. |
Learn the difference between LT and GT |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
brought to my attention
0826
012F
is a PIC 9(6) comp-3
my bad......... thx Bill.. |
|
Back to top |
|
|
mf_karthik
New User
Joined: 26 Jul 2005 Posts: 55
|
|
|
|
Hi,
yes i have checked using file manager starting position is 45 and it ends at 48 length is 4 type pd picture class 9(006) comp-3.its FB only.
and my requirement is to remove the six months old data and the date field is in pd format (yymmdd) |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
&DATE1P generates a +YYYYMMDD constant. (as per the manual)
sooooooooooooooooooooooooooooooooooooooooooooo. |
|
Back to top |
|
|
bodatrinadh
Active User
Joined: 05 Jan 2007 Posts: 101 Location: chennai (India)
|
|
|
|
Karthik,
As suggested by Akatsukami, LT will give you the correct result.
Current Date - 180 will give you 20110826 (YYYYMMDD)
Here is the tested result.
Code: |
SORT FIELDS=COPY
OMIT COND=(12,4,PD,LT,&DATE1P-180)
|
Input File :-
Code: |
FNAME FILLER DATE1 FILLER
10/AN 1/AN 4/P 15/AN
(1-10) (11-11) (12-15) (16-30)
1--------- 2------- 3------- 4--------------
********************************* TOP OF DATA **********************-CAPS OFF-*
RECORD0 110825
RECORD1 120222
RECORD2 120201
RECORD3 100202
RECORD4 91221
RECORD5 81204
RECORD6 110826
|
Output :-
Code: |
FNAME FILLER DATE1 FILLER
10/AN 1/AN 4/P 15/AN
(1-10) (11-11) (12-15) (16-30)
1--------- 2------- 3------- 4--------------
********************************* TOP OF DATA ******************
RECORD1 120222
RECORD2 120201
RECORD6 110826
|
Thanks
-3nadh |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
so even though &DATE1P resolves to 20120222,
the 4 forces a right justified 4 byte compare on x'0120222C'.
thx
but that only works for CC 20, won't work next century.
but, i won't be around to say i told you so.... |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Easytrieve Plus does a similar type of thing with alphanumeric comparisons. Three-byte field "ABC", five-byte field, "ABCDE":
Code: |
IF field-1 EQ field-2 (true)
IF field-2 EQ field-1 (false) |
I know why I don't like it, so always ensure same lengths. Mostly people just aren't aware that it happens, and don't care until the user they so despise points out the problem.
I nearly PM'd -3nadh then noticed he'd tested :-) |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
still say it will not work in the last century or the next. |
|
Back to top |
|
|
mf_karthik
New User
Joined: 26 Jul 2005 Posts: 55
|
|
|
|
Its working fine after it changed to LT.
Thanks Bodatrinadh for your assistance. |
|
Back to top |
|
|
|