Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

compare 2 fields within a single file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Apr 27, 2007 7:58 pm    Post subject: compare 2 fields within a single file
Reply with quote

Hi all

I have a file which contains some date fields.
like
Code:

datefield1 datefield2
datefield1 datefield2

i need to copy the records into o/p file, only if datefield1 < datefield2
can this be done by sort?
please let me know
thanks
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: Fri Apr 27, 2007 8:27 pm    Post subject:
Reply with quote

Yes, but how you would do it depends on the actual format of the date fields. In the simple case of C'yyyymmdd' dates and in some other cases, you could these DFSORT control statements:

Code:

   OPTION COPY
   INCLUDE COND=(datefield1,LT,datefield2)


But for a date like C'mmddyyyy' some more data manipulation would be required to get the date as C'yyyymmdd'.

If you need more help with this, tell me the format of the date fields (show some examples) and the starting position of each date field.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Apr 27, 2007 8:47 pm    Post subject:
Reply with quote

the date is in yyyymmdd...
eg : pos 25, length 8 needs to be compared with pos 45, length 8
may i know the syntax for it
[/code]
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: Fri Apr 27, 2007 9:43 pm    Post subject:
Reply with quote

Assuming that's a character yyyymmdd, you would use:

Code:

   OPTION COPY
   INCLUDE COND=(25,8,CH,LT,45,8,CH)
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Apr 27, 2007 11:32 pm    Post subject:
Reply with quote

Used
Code:
INCLUDE COND=(22,3,CH,EQ,C'610',AND,   
             ((25,8,CH,LT,55,8,CH),OR,
             (55,8,CH,LT,85,8,CH),OR, 
             (85,8,CH,LT,115,8,CH),OR,
             (115,8,CH,LT,145,8,CH),OR,
             (145,8,CH,LT,175,8,CH),OR,
             (175,8,CH,LT,205,8,CH),OR,
             (205,8,CH,LT,235,8,CH),OR,
             (235,8,CH,LT,265,8,CH),OR,
             (265,8,CH,LT,295,8,CH)))


but got this record which doesnt seem to satisfy the criteria
Code:

20060702    20050703    20040620    20030622    20021110
20020929    20010902    20010527           0           0

But the field is actually a packed decimal data.
So tried giving PD in the place of CH and length 5 instead of 8, but got no results.
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: Sat Apr 28, 2007 1:16 am    Post subject:
Reply with quote

When I run DFSORT using that INCLUDE statement with a record containing '610' in 22-24 and the date values you show (assuming the first one starts at 25, the second starts at 55, etc), that record is NOT included as I wouldn't expect it to be.

So if you got that record, something is not as you said it is. Given that you can't decide if your fields are CH or PD, I would suggest that you don't have the correct starting position, length or format for one or more of your fields.

Quote:
So tried giving PD in the place of CH and length 5 instead of 8, but got no results.


What does "no results" mean?
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 Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 4 Wed Jul 26, 2017 7:35 pm
No new posts Extra character appears in file when ... Balu5491 All Other Mainframe Topics 1 Wed Jul 26, 2017 2:39 pm
No new posts SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 2 Wed Jul 26, 2017 2:10 am
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us