‎2006 Jul 03 11:58 AM
i am trying to offset spmon to get the month field but it is giing error. can u please rectify.
i am writing like spmon+7(2).
but it is giving eror that it will have only 6 fields.
‎2006 Jul 03 12:00 PM
let us say spmon = '12345'
if you want 34, then say
spmon+2(2).
Regards,
ravi
‎2006 Jul 03 12:01 PM
The data type of SPMON is numc6, and hence you cannot read from the 7th position. That is the error you are getting.
spmon+7(2) will read the value in the spmon field, starting at the 7th position and reading the next 2 chars after that.
Sudha
‎2006 Jul 03 12:01 PM
SPMON is :
Period YYYYxx (xx = week/month/accounting period)
so u start counting from 0....
if spmon = 200403
if u want year:
spmon+0(4)will fetch u 2004
spmon+4(2) will give u 03
reward points if it helps
Regards
gunjan
‎2006 Jul 03 12:01 PM
The error is obvious, you are mentioning a length where in the lenght of the variable does not exist so much.
Variable+m(n).
This will give you n characters of variable starting from mth position.
So, in your case if you want to the meonth field you should use spmon+4(2).
Regards,
Ravi
Note : Please mark the helpful answers