my requirement is (p4,2) i want to do validation for this.iam using EM mask it is showing error.
This posting typifies a problem that should be addressed. We have the same problem on SAG-L, but it seems worse here where we have more language problems.
I refer to an “incomplete” question which could be easily clarified.
YSSR, is this an alpha field on a Map that you wish to be entered as P4.2? Or is the field on the map A7 and you wish to test for whether VAL (field) will be P4.2? Or is it a field that has come from a work file (say alpha) and you want to test to see if it has a format of P4.2. Or is it an existing alpha field that has been REDEFINEd as P4.2? etc etc etc
Please clarify your question. Helmut has guessed at one possible interpretation of your question, and posted an address of an article that addresses one possible meaning for the post. There are many others.
I better like to answer questions instead of asking questions what you could have meant by your question.
The rule is: you check numeric (packed and unpacked) variables for correct contents with mask (combinations of N and a trailing Z), if you want to transfer the value of an alphanumeric value you check the value with IS and transfer it with VAL.
So, if your variable is (P4,2) check it with mask (999999Z) (all packed numbers consist of an odd number of digits!). This is also true if your packed variable is a redefinition of an alphanumeric variable. Don’t check the alpha in this this case!
If you have a alphanumeric variable and you want to know if you can transfer its value into a (P4,2) variable, use
IF alpha IS (P4,2) THEN packed := VAL(ALPHA) END-IF