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
 

 

Comparison within a file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
sriramd

New User


Joined: 02 Nov 2006
Posts: 10

PostPosted: Thu Nov 02, 2006 3:57 pm    Post subject: Comparison within a file
Reply with quote

Hi,

I have a sorted file (say it is sorted on Address). For this key, there can be multiple records in the file.

Say we have a date field in the file and this date can be either same or unique for the multiple records with the same key.

I want to pick a particular record for each key, in which the record with the greater date needs to written to the output file. In case the date is same, i can pick any record.

eg.

Code:

Address Name    Date
C-123    abc    2006-11-02
C-123    xyz    2006-10-01
A-123    abc    2006-10-31
A-123    xyz    2006-10-31


If the above is the input file, i need the Output as:

Code:

Address  Name     Date
C-123    abc      2006-11-02
A-123    abc/xyz  2006-10-31 ( it can be either of abc or xyz)


Is there any way that this can be done using JCL?
Urgent!
Back to top
View user's profile Send private message

ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Thu Nov 02, 2006 5:25 pm    Post subject:
Reply with quote

You can't do any programming from JCL.

I think REXX would be a great solution. Of course, you can invoke REXX as a batch job (written in JCL).

O.
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: Thu Nov 02, 2006 9:26 pm    Post subject:
Reply with quote

sriramd,

Here's a DFSORT/ICETOOL job that will do what you asked for. Note that the output records will be sorted by the Address as you mentioned in your post but didn't show in your output example.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD *
C-123    abc    2006-11-02
C-123    xyz    2006-10-01
A-123    abc    2006-10-31
A-123    xyz    2006-10-31
/*
//OUT DD SYSOUT=*
//TOOLIN   DD    *
SELECT FROM(IN) TO(OUT) ON(1,5,CH) FIRST USING(CTL1)
/*
//CTL1CNTL DD *
  SORT FIELDS=(1,5,CH,A,17,10,CH,D)
/*


OUT would have:

Code:

A-123    abc    2006-10-31
C-123    abc    2006-11-02
Back to top
View user's profile Send private message
sriramd

New User


Joined: 02 Nov 2006
Posts: 10

PostPosted: Fri Nov 03, 2006 12:00 pm    Post subject: Thanks
Reply with quote

Thank You very much for the help...
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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