Application Development 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: 

CAN U EXPALIN ABOUT OFFSET METHOD

Former Member
0 Kudos

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

former_member181962
Active Contributor
0 Kudos

let us say spmon = '12345'

if you want 34, then say

spmon+2(2).

Regards,

ravi

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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