edit mask control

Hey,

Is there a wat using a map once as output and once as input, and a numeric filed in the output wil get edit mask (zzz,zzz) and in input map no separators will be checked?

Hezi

AFAIK: No!
If you define an Edit Mask with thousand separator on the map, the user has to write it - otherwise a NAT1143 occurs.

Workaround: The field on the mask is alphanumeric. In the program you convert it into a numeric.

hi again,

  1. how to convert an ascii with separator to a numeric?
  2. Is there a way to let the ascii variable in input mode to be right to left?

How would you get ASCII input into a map ???

For a description of RTL-support in Natural you may want to start here:
http://techcommunity.softwareag.com/ecosystem/documentation/natural/nat425mf/parms/pm.htm

I believe that Matthias was referring to the VAL function, but you’ll have to remove the commas.

DEFINE DATA LOCAL                    
1 #C (A20) INIT <'-1,234,567,890.12'>
1 #T (A20)                           
1 #N (N10.2)                         
END-DEFINE                           
ASSIGN #T = #C                       
EXAMINE #T FOR ',' DELETE            
ASSIGN #N = VAL (#T)                 
DISPLAY #C #T #N                     
END

And the output:

Page      1                                                  07/21/09  15:50:31
                                                                               
         #C                   #T                #N                             
-------------------- -------------------- --------------                       
                                                                               
-1,234,567,890.12    -1234567890.12       -1234567890.12                       

A few minutes ago, I read in the natural-mainframe-documentation for INPUT. There is a way using EMFM (Edit Mask Free Mode).

http://techcommunity.softwareag.com/ecosystem/documentation/natural/nat425mf/sm/input.htm#Entering_Data_in_Response_to_an_INPUT_Statement

Even EMFM has its limitations and “gotchas”. For example, if you have different editing for output purposes e.g. thousands delimiters and a dollar sign and some text, then the user must either do all or nothing; one of the three (e.g. just the thousands delimiter, will get you in trouble.

As Matthias indicated earlier, put an alpha field on the Map. In your program, take a numeric field and used MOVE EDITED to create the alpha field for the Map. Reverse the procedure for data entered by the user. This gives you more flexibility in terms of what the user is allowed to do, and you can create very specific error messages if the user has not provided valid input.

steve

Here is one more “gotcha” from EMFM.

A slight variation on the example in the documentation:

SET CONTROL ‘FM+’ /* activate numeric Edit Mask Free Mode
RESET N (N7.3)
move 2 to N
INPUT N (AD=M EM=Z’,‘ZZZ’,'ZZZ.999EUR)
END

When you see the screen it will show:

N 2.000EUR

put the cursor to the right of the 2 and hit left arrow and 2 (leaving the screen the same). This will work.

Now do the same except type a 3 rather than a 2. You will get an error message 1143 which says input does not correspond to edit mask. Rather confusing for some poor enduser.

steve