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

Omit records based on the date


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mf_karthik

New User


Joined: 26 Jul 2005
Posts: 55

PostPosted: Wed Feb 22, 2012 2:12 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Feb 22, 2012 2:26 pm
Reply with quote

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
View user's profile Send private message
mf_karthik

New User


Joined: 26 Jul 2005
Posts: 55

PostPosted: Wed Feb 22, 2012 2:41 pm
Reply with quote

Syncsort
Back to top
View user's profile Send private message
bodatrinadh

Active User


Joined: 05 Jan 2007
Posts: 101
Location: chennai (India)

PostPosted: Wed Feb 22, 2012 4:25 pm
Reply with quote

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
View user's profile Send private message
mf_karthik

New User


Joined: 26 Jul 2005
Posts: 55

PostPosted: Wed Feb 22, 2012 8:51 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Feb 22, 2012 8:56 pm
Reply with quote

Perhaps the format is Julian date, 81226F
Back to top
View user's profile Send private message
mf_karthik

New User


Joined: 26 Jul 2005
Posts: 55

PostPosted: Wed Feb 22, 2012 9:11 pm
Reply with quote

No its not an julian date,in the o/p it showing as 08/12/26.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Feb 22, 2012 9:38 pm
Reply with quote

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
View user's profile Send private message
bodatrinadh

Active User


Joined: 05 Jan 2007
Posts: 101
Location: chennai (India)

PostPosted: Wed Feb 22, 2012 9:44 pm
Reply with quote

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
View user's profile Send private message
Akatsukami

Global Moderator


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

PostPosted: Wed Feb 22, 2012 9:57 pm
Reply with quote

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 icon_razz.gif
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Feb 22, 2012 9:58 pm
Reply with quote

brought to my attention

0826
012F
is a PIC 9(6) comp-3

my bad......... thx Bill..
Back to top
View user's profile Send private message
mf_karthik

New User


Joined: 26 Jul 2005
Posts: 55

PostPosted: Wed Feb 22, 2012 9:59 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Feb 22, 2012 10:10 pm
Reply with quote

&DATE1P generates a +YYYYMMDD constant. (as per the manual)

sooooooooooooooooooooooooooooooooooooooooooooo.
Back to top
View user's profile Send private message
bodatrinadh

Active User


Joined: 05 Jan 2007
Posts: 101
Location: chennai (India)

PostPosted: Wed Feb 22, 2012 11:53 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Feb 23, 2012 3:08 am
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Feb 23, 2012 5:36 am
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Feb 23, 2012 9:46 am
Reply with quote

still say it will not work in the last century or the next.
Back to top
View user's profile Send private message
mf_karthik

New User


Joined: 26 Jul 2005
Posts: 55

PostPosted: Thu Feb 23, 2012 12:38 pm
Reply with quote

Its working fine after it changed to LT.

Thanks Bodatrinadh for your assistance.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
Search our Forums:

Back to Top