Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CAN U EXPALIN ABOUT OFFSET METHOD

Former Member
0 Likes
766

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.

4 REPLIES 4
Read only

Former Member
0 Likes
640

let us say spmon = '12345'

if you want 34, then say

spmon+2(2).

Regards,

ravi

Read only

Former Member
0 Likes
640

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

Read only

Former Member
0 Likes
640

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

Read only

Former Member
0 Likes
640

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