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

compare 2 fields within a single file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Apr 27, 2007 8:27 pm
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
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 Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Apr 27, 2007 9:43 pm
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
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 Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Apr 28, 2007 1:16 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 3
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top