Page 1 of 1

Validating a numeric 'monetary' BMS field

PostPosted: Mon Jan 31, 2011 12:56 am
by David Jackson
Been away from CICS for a few years, so apologies for what is a basic question.
I have a BMS field defined as follows:
DEPAMT DFHMDF POS=(6,25),LENGTH=8,ATTRB=(UNPROT,NUM)
Note this is a CL8 field with NUM set - NUM implies JUSTIFY RIGHT and ZEROS but does not stop the user from entering 'Shifted' garbage if he so chooses. So the field still has to be validated.
The MAP is being RECEIVED by an ASM program.
Within the ASM program, I have written a small routine that validates each byte for x'F0'-'F9' validity, checks for the presence of a decimal point x'4B' and it being in the correct place (based on the number of permitted decimal places etc and of course that only one decimal point be present etc etc and if valid, removes the decimal point (if present) and PACKS the resultant field into a PL5.

Is there a more 'elegant' way of handling a numeric 'monetary' amount validation of a BMS field from an ASM program - these days - or is a homegrown routine still the way to go?

Re: Validating a numeric 'monetary' BMS field

PostPosted: Mon Jan 31, 2011 2:14 am
by dick scherrer
Hello,

As far as i know there is no automagic validator for assembler - one must still "roll one's own".

Having said that, the places i've been that use assembler for "business" code (rather than system/utility code) have various "edit" routines that are invoked when needed. These include editing dates, money, plain numeric, etc and have been standard at these places for many years.

So the code is not re-written for each edit needed, but invoked and returns an indicator of good/why bad and if valid the value in a proper format for use within the code. Depending on how much of this you are going to do, you may want to create these if they are not already available.

Re: Validating a numeric 'monetary' BMS field

PostPosted: Mon Jan 31, 2011 2:46 am
by David Jackson
Yes thanks. I agree most of these routines should pre-exist in most shops.
I wasn't sure if anything was available "canned" these days that removed the need for inhouse stuff for for CICS/ASM programs.

Cheers