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

Convert current date to last month's


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
lekshmi_ci

New User


Joined: 14 Mar 2007
Posts: 60
Location: Thiruvananthapuram

PostPosted: Mon Sep 24, 2007 10:22 am
Reply with quote

Can anyone help me in solving this issue:

I want to convert the date (used in the record) to last month's. For eg if the date is 24th Sep, I need to change it to 24th Aug. The no. of records is huge and each record has a date field.

Thanks
LC
Back to top
View user's profile Send private message
Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Mon Sep 24, 2007 11:21 am
Reply with quote

Is it just subtract one to your month in the record?

What happens if the date is 03/31/2007 the new date should be 02/28/2007 right?
What happens if the date is 09/30/2007 the new date should be 08/30/2007 or 08/31/2007?

I believe you should use date routine if available in your site.
Back to top
View user's profile Send private message
lekshmi_ci

New User


Joined: 14 Mar 2007
Posts: 60
Location: Thiruvananthapuram

PostPosted: Mon Sep 24, 2007 11:27 am
Reply with quote

yep devzee . u r absolutely right
we need to subtract one from the month
if u cn provide me tht piece of code, i would be grateful.
Rexx is totally new to me.
I started learning tht.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10833
Location: italy

PostPosted: Mon Sep 24, 2007 11:34 am
Reply with quote

Quote:
yep devzee . u r absolutely right


It looks like You read only the first line of devzee reply !

What format has the date ?
subtracting one from the month with brute force is let's say OK if the date string contains only the year and the month,
will result in a serious application troubles if the dtae string contains also the day

regards

e.s
Back to top
View user's profile Send private message
lekshmi_ci

New User


Joined: 14 Mar 2007
Posts: 60
Location: Thiruvananthapuram

PostPosted: Mon Sep 24, 2007 11:40 am
Reply with quote

I totally agree with devzee. The date to be converted is as he has mentioned. If the date is 09/30/2007 then the new date should be 08/30/2007
we need to handle two more additional conditions in the program:
if the date is 03/31/2007 and
if the date is 09/30/2007
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10833
Location: italy

PostPosted: Mon Sep 24, 2007 11:45 am
Reply with quote

Quote:
I totally agree with devzee.


OK, OK....
You keep agreeing with devzee, but it is the application logic which should tell what to do when the current day is not in the previous month !

The only thing we can remark, from the ino You posted, is to flag the request as ILLOGIC..

regards

e.s
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2359
Location: Israel

PostPosted: Mon Sep 24, 2007 11:50 am
Reply with quote

Why are you doing it with REXX, if "The no. of records is huge " as you said? For your needs, I believe Assembler should be the choice.

O.
Back to top
View user's profile Send private message
lekshmi_ci

New User


Joined: 14 Mar 2007
Posts: 60
Location: Thiruvananthapuram

PostPosted: Mon Sep 24, 2007 12:01 pm
Reply with quote

can you suggest me a code if i want to change the file name having a date to another file name having next month's date.
For eg, if the filename is aa20071212, i need the filename to be changed to aa20071111.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10833
Location: italy

PostPosted: Mon Sep 24, 2007 12:08 pm
Reply with quote

Quote:
can you suggest me a code if i want to change the file name having a date to another file name having next month's date.
For eg, if the filename is aa20071212, i need the filename to be changed to aa20071111.


Now You ask to change the file name, nothing wrong with that;
but the logic flaw is still there;

WHAT IF the destination month does not have the day Yo ask for ???

please clarify or desist

regards

e.s
Back to top
View user's profile Send private message
lekshmi_ci

New User


Joined: 14 Mar 2007
Posts: 60
Location: Thiruvananthapuram

PostPosted: Mon Sep 24, 2007 12:20 pm
Reply with quote

if the day doesnt exist for tht month, then put one day before
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10833
Location: italy

PostPosted: Mon Sep 24, 2007 12:21 pm
Reply with quote

Quote:
f the day doesnt exist for tht month, then put one day before


That's a nice way of getting duplicate records and/or duplicate file names!

regards

e.s
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2359
Location: Israel

PostPosted: Mon Sep 24, 2007 2:59 pm
Reply with quote

lekshmi_ci -

No one is going to "give you the code". People here will help you to write your own code, as long as you make your requirements clear. Till now, I believe you confused us all...

O.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Sep 26, 2007 2:52 pm
Reply with quote

If the data resides in a DB2 table, you can do:
UPDATE table SET MYDATE = MYDATE - 1 MONTH

If it's not DB2, certainly SORT or SYNCSORT can do the job for you,
faster and better than any REXX or Assembler program.
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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts SMF Record Date conversion failing CLIST & REXX 1
No new posts Removal of date value records DFSORT/ICETOOL 12
No new posts String has hex character need to conv... COBOL Programming 3
No new posts Help, trying to use OVERLAY to get a ... DFSORT/ICETOOL 3
No new posts JCL to read ps and convert it to read... DFSORT/ICETOOL 1
Search our Forums:

Back to Top