Hi all,
I am having on scenario like.. I want to allow the records for the previous month and again after a month it has to be repeated with previous month incremented.
for example
there are 4 fields inthat Inlink.Field1 has value like 'May 08'
Inlink.Field1 Inlink.Field2 Inlink.Field3 Inlink.Field4
'May 08' '323' 'like' 'nike'
'Apr 08' '234' 'xmdjk' 'dkfadl'
next month the record coming is
Inlink.Field1 Inlink.Field2 Inlink.Field3 Inlink.Field4
'Jun 08' '432' 'dkdfa' 'dlkjfd'
'May 08' '323' 'like' 'nike'
'Apr 08' '234' 'xmdjk' 'dkfadl'
I want to allow the June month records only not all the records, like
Outlink.Field1 Outlink.Field2 Outlink.Field3 Outlink.Field4
'Jun 08' '432' 'dkdfa' 'dlkjfd'
'May 08' '323' 'like' 'nike'
'Apr 08' '234' 'xmdjk' 'dkfadl'
I am using the following transform to get the previous month first date
Oconv(Iconv(InLink.Field1,'D MY[A3,2]'),'DYMD')
But how to get previous month +1 , month ? is there any functions like NEXTMONTH() as in oracle ? or how to proceed with this? any suggestions are welcomed
thanks in advance
how to get next or previous month from existing one
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Take a look at the available Transforms, particularly MONTH.TAG, MONTH.FIRST and MONTH.LAST.
Since the latter two return internal format dates, if you subtract 1 from the result of MONTH.FIRST you have the date of the last day of the previous month.
If you insist on working with Iconv() and Oconv() then you could do worse than learn about date conversion
Since the latter two return internal format dates, if you subtract 1 from the result of MONTH.FIRST you have the date of the last day of the previous month.
If you insist on working with Iconv() and Oconv() then you could do worse than learn about date conversion
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
I am using the following code to get the next month starting date,ray.wurlod wrote:Take a look at the available Transforms, particularly MONTH.TAG, MONTH.FIRST and MONTH.LAST.
Since the latter two return internal format dates, if you subtract 1 from the result of MONTH.FIRST you ...
MONTH.FIRST(MONTH.TAG(Iconv (DSLink2.C_MONTH,'D MY[A3,2]')))+1
the value returned in Outlink.field1 is 14733
but it works for the above. If I add Oconv(MONTH.LAST(MONTH.TAG(Iconv (DSLink2.C_MONTH,'D MY[A3,2]')))+1,'D YMD')
i am getting the next month first date,i.e., '2008 06 01'
also i want last date also i.e, '2008 06 30'
for that i'm trying like this
Oconv(MONTH.LAST(MONTH.TAG(Iconv (DSLink2.C_MONTH,'D MY[A3,2]')))+1,'D YMD') written to stage variable 'NextMon'
Oconv(MONTH.LAST(MONTH.TAG(NextMon)))
the Outlink.Field1 is NULL for the above expression
why is so? is there any thing I am missing? your suggestions will be most welcomed
thanks in advance
can anyone tell me why it's not returning any value
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Open each of the supplied transforms and note the expected format of input.
Please also post a message showing how you resolved this, since you have marked the thread as Resolved.
Please also post a message showing how you resolved this, since you have marked the thread as Resolved.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.