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

Reg:DFSORT/ICETOOL.....itz Urgent....


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ykishore

New User


Joined: 12 Aug 2005
Posts: 53
Location: USA

PostPosted: Mon Aug 29, 2005 6:36 pm
Reply with quote

HI

Here is my requirement ...

i've a sequential file....which has following contents..

123kishore 20050910-----(ccyymmdd)
123kishore 20051030
111sachin 19980121
111sachin 19991030

i want the output as below:
-----------------------------------
123kishore 20051030
111sachin 19991030

i want the latest record from the above input.

please provide me the jcl for the same ...
Back to top
View user's profile Send private message
ykishore

New User


Joined: 12 Aug 2005
Posts: 53
Location: USA

PostPosted: Mon Aug 29, 2005 6:45 pm
Reply with quote

HI

Here is my requirement ...

i've a sequential file....which has following contents..

123kishore 20050910-----(ccyymmdd...Valuation date)
123kishore 20051030
111sachin 19980121
111sachin 19991230



among the above input ,the output should have the latest valuation date.and also we suppose to add 1 month to the Month part .for eg:

123kishore 20051010---(after adding 1 month to the month part)
111sachin 20000130---(---------do---------------------------icon_cool.gif

please provide me the JCL for the same......
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Mon Aug 29, 2005 8:18 pm
Reply with quote

Hi Kishore,

After looking at the sample you provided.... It seems the latest valuation Date comes in the last most recod for the name.....If this is correct as per your Input File...

Code:
//S030     EXEC PGM=ICETOOL                   
//TOOLMSG   DD SYSOUT=*                       
//DFSMSG    DD SYSOUT=*                       
//IN     DD DSN=RECORDS.INPUT,DISP=SHR
//OUT    DD DSN=RECORDS.OUT,     
//          DISP=(,KEEP,DELETE),             
//TOOLIN DD *                                 
  SELECT FROM(IN) TO(OUT) ON(1,3,CH) LASTDUP 
//


P.S. Here I assumed the number appearing before Name is unique to that name.

Now comes the part to increase the date field by one month...

Do you have date field located in a specific length only.
I mean...what is the starting & ending position for that...

Regards,

Priyesh.
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: Mon Aug 29, 2005 8:54 pm
Reply with quote

Kishore,

You requirement, as stated, is confusing and doesn't make a whole lot of sense.

You said
Quote:
the output should have the latest valuation date
.
In your first post, you show the output as:

123kishore 20051030
111sachin 19991030

which does have the latest date for each key. But in your second post, you show the output as:

123kishore 20051010
111sachin 20000130

Subtracting 1 month from the dates would give:

123kishore 20050910
111sachin 19991230

which would be the earliest date for 123kishore and the latest date for 111sachin. So we don't know if you actually want the latest date or the earliest date.

In addition, adding 1 month to a yyyymmdd date will NOT always give a valid date. For example, if the original date is 20050131 and you add 1 month to it, you get 20050231 which is NOT a valid date.

You need to rethink and restate your requirement so it makes sense.
Back to top
View user's profile Send private message
ykishore

New User


Joined: 12 Aug 2005
Posts: 53
Location: USA

PostPosted: Thu Sep 01, 2005 6:33 pm
Reply with quote

HI Frank

this is extension to my requirement posted on sometime before....

i want the latest Valuation date and i suppose to one month(Month part of the field) to those records which are to be reported...


Eq:

123kishore 20051031
123kishore 20001201
111sachin 19980220
111sachin 19991230

output:
--------
123kishore 20051031
111sachin 19991230

but i want to increase one month for the above output records..

please advise me !!
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: Thu Sep 01, 2005 8:45 pm
Reply with quote

Quote:
but i want to increase one month for the above output records..



As I stated before:

Quote:
adding 1 month to a yyyymmdd date will NOT always give a valid date. For example, if the original date is 20050131 and you add 1 month to it, you get 20050231 which is NOT a valid date.


So you need to define what you mean by adding 1 month to the date. In the example output records you show, adding 1 to the mm field would give:

123kishore 20051131
111sachin 19991330

Those are both invalid dates. November only has 30 days. Changing 19991330 to 20000130 would happen to give a valid date, but that won't always be the case when you add 1 to mm and bump yyyy by 1 when mm=13.

So you really need to think about how to get valid dates and let us know what rules you want to use for that.
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 Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
No new posts Shift left VB record without x00 endi... DFSORT/ICETOOL 11
Search our Forums:

Back to Top