You are on page 1of 40

Let Data Types Work For You

Let Data Types Work For You

Agenda
Data Type Definition Screens External Length Calculation Program Mapping Functions Additional Mapping Parameters Examples

Let Data Types Work For You

Object Attributes Display


._______________________________________________________________________________. | Op: SYNDSNR WISRMT2S1 1/26/92 8:52:06| | DISPLAY OBJECT ATTRIBUTES Windsor, Inc. WISDMMDL | | Object type. . . : FLD | | | | | | <== Position display | | ? Attr Description | | CDE Alphameric code value | | CYY Century Year - int:CYY ext:YY | | DMD Date in month/day format. MM/DD | | DMY Date in month/year format. int-YY/MM ext-MM/YY | | DTB Birth Date format. Like DTE but 1900 - 1999 | | DTE Date in system date format - (YYMMDD internally) | | DT8 8-Digit Date: int-CCYYMMDD ext-MMDDCCYY | | IGC Ideographic text | | NAR Narrative text | | NBR Pure numeric value (eg line number). | | PCT Percentage or market index. | | PRC Price or tarrif | | QTY Quantity | | REF Field is based on another field. | | SGT Surrogate (number representing an object) +| | SEL: N-Narrative, Z-Details. | | F3=Exit F9=Add | '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'

Field Attributes
._______________________________________________________________________________. | *ADD Op: SYNDSNR WISRMT2S1 1/26/92 8:52:50| | EDIT FIELD ATTRIBUTE. Windsor, Inc. WISDMMDL | | Field attribute. . . . : CC# | | Text . . . . . . . . . : Credit Card Number | | Right hand side text . : | | Allow user Initial Allowed Override | | entry value values value | | Internal data type . . : O (I,O,H) A (A,P,S,B,F) | | Internal length. . . . : O (I,O,H) 16 | | External data type . . : A (A,S) | | External length. . . . : O (I,O,H) 19 (Output| | Keyboard shift . . . . : O (I,O,H) M XANWIDM (XANWIDM/NSYID| | Lowercase. . . . . . . : H (I,O,H) (Y,' ') | | Check valid system name: H (I,O,H) (Y,' ') | | Mandatory fill . . . . : O (I,O,H) (Y,' ') | | Modulus check 10/11. . : H (I,O,H) (10,11,' ') | | | | | | Allow value mapping. . : N (Y,N) Y (Y,' ') | | Int/ext len conv. . : (I,C,V,' ') | | Int/ext function. . : Convert Credit Card # | | Ext/int function. . : Check Credit Card # | | | 2

Let Data Types Work For You | F3=Exit | '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'

Let Data Types Work For You

Field Attribute Defaults


._______________________________________________________________________________. | Op: SYNVG WISDM395A 2/10/92 13:09:32| | EDIT FIELD ATTRIBUTE DEFAULTS. Test1 Model | | | | | | Attribute. . . . : ZIP Zip code data Type (requires Country) | | | | | | Internal length. . . . . : 10 Data type . . . . : A | | External length. . . . . : 12 | | | | | | Mnemonic code. . . . . . : ZI | | Allow lower case . . . . : | | | | | | Keyboard shift . . . . . : A (XANWIDM) | | | | | | | | Field exit options . . . : (Blank = Not required, Y = Required, | | Z = Right adjust, fill with zeroes | | B = Right adjust, fill with blanks | | R = Right-to-left) | | F3=Exit F9=Full details | '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'

YxxxLENR1C Function Requirements


Calculate External Integers Calculate External Decimals Calculate External Length Ensure minimum sizes No mechanism for flagging erroneous internal size values Must be created before Data Type can be defined xxx is the ID of the Data Type

Let Data Types Work For You

YxxxLENR1C Parameters
Input Parameters
Object attribute Keyboard shift Value mapped status Internal data type Internal length Internal no. of integers Internal no. of decimals External data type CDE CDE CDE CDE NBR NBR NBR CDE NBR NBR NBR 3 1 1 1 5.0 2.0 1.0 1 5.0 2.0 1.0

Output Parameters
External length External no. of integers External no. of decimals

Define as a STR file for use in parameter definition

Mapping Functions
External/Internal always invoked when field may be entered on screen Internal/External always invoked prior to displaying or printing value When re-displaying on error, Internal/External is invoked and must be capable of dealing with data in error. May have external value, internal value, and mapping data parameters

Let Data Types Work For You

External/Internal Function Requirements


Attach to "*Field Attribute Types" file May not be EXTFUN function (gen will fail) May be INTFUN that calls EXTFUN Validate input data
- Issue error message - Set Return Code

If value-mapping, convert from external to internal format (this must be done even if there is an error) If data loss occurs on mapping and there is an error, pass error indicator in internal format rather than mapping. Consider EXCUSRSRC if a routine is large and called often, particularly in the same function. This will reduce generated code.

External/Internal Function Parameters


External Parameter
- Input or Both (usually input; use both if defaulting a value) - Define as NBR, CDE, or TXT - Always first parameter

Internal Parameter
Output or Both (usually output; use both if constructing a value) Define as NBR, CDE, TXT or data type Always second parameter if used Not required if function only validates (no value mapping)

Additional Mapping parameters


- Any usage valid - May use Neither parms for work variables - Not required unless validation or mapping based on an additional piece of data

Let Data Types Work For You

Internal/External Function Requirements


Attach to "*Field Attribute Types" file May not be EXCEXTFUN (gen will fail) May be EXCINTFUN that calls EXCEXTFUN Convert from internal to external format If data loss occurs on external/internal mapping and there is an error, test for error indicator in internal format (rather than mapping) and merely exit routine Consider EXCUSRSRC if a routine is large and called often, particularly in the same function. This will reduce generated code.

Internal/External Function Parameters


External Parameter
- Output or Both (usually output; use both if constructing a value) - Define as NBR, CDE, or TXT - Always first parameter

Internal Parameter
Input or Both (usually Input) Define as NBR, CDE, TXT or data type Always second parameter if used Not required if function only validates (no value mapping)

Additional Mapping parameters


- Any usage valid - May use Neither parms for work variables - Not required unless mapping based on an additional piece of data

Let Data Types Work For You

Supplying Mapping Function Additional Parameters


Default context and source specified at file entry level
- May be locked to prevent device level override - May allow device level override - May require device level override

Limited/Special contexts for default


- FIL context specifies another field in the same format as the field of the data type - CND context specifies a condition value of a field in the same format as the field of the data type - JOB context - CON context

Actual context and source specified at device entry level

Accessing Mapping Parameters at File Entry Level


._______________________________________________________________________________. | Op: SYNVG WISRMT1S1 2/23/92 22:17:19| | EDIT FILE ENTRIES Test1 Model | | | | | | File . . . . . . : test zip | | | | | | ? Field Attr Ocr Et Ksq GEN name Length Renamed | | | | | | test zip id CDE K 1 EMCD 6 | | Country Cd CDE A EKCD 3 | | M test zip code ZIP A AEZI 10 | | test date DT8 A AED8 8.0 | | | | | | | | | | | | SEL: Z-Details, R-Replace field, U-Usage, M-Mapped field parameters. | | F3=Exit | | | 8

Let Data Types Work For You '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'

Let Data Types Work For You

Specifying Mapping Parameters at File Entry Level


._______________________________________________________________________________. | Op: 2/23/92 22:18:51| | FIELD MAPPING FUNCTION PARAMETERS. | | File . . : test zip Field. . : test zip code | | (N-Fixed ) | | (Y-Overridable ) | | (R-Ovr required) | | Parameter Ctx Field Permit override | | Country Cd FIL Country Cd Y | | | | | | | | | | | | | | | | | | | | | | | | | | F3=Exit | | | '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'

Accessing Mapping Parameters at Device Entry Level


._______________________________________________________________________________. | Op: SYNVG WISRMT1S1 2/23/92 22:21:19| | EDIT SCREEN ENTRY DETAILS Test1 Model | | | | | | Field name . . . . . . : test zip code | | GEN name . . . . . . . : AEZI | | | | Label location . . . : B (Above,Before,Column,blank) Label spacing. : 13 | | Lines before . . . . : 1 | | Spaces before. . . . : 1 Screen text. . . . : F (M, L, F) | | Column Headings. . . : test zip | | code | | | | Left hand side text. : test zip code | | Right hand side text : ZIP | | Display RHS text . . : Y RHS spaces . . . . : 2 | | Fill LHS text. . . . : Y | | I/O Usage. . . . . . : I | | | | Check condition. . . : *NONE | | Allow blank. . . . . : Y | | Field exit option. . : | | | | F3=Exit, no update F7=Relations F9=Mapping parameters F18=Screen attr | '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' 10

Let Data Types Work For You

Specifying Mapping Parameters at Device Entry Level


._______________________________________________________________________________. | Op: 2/23/92 22:21:53| | SCREEN FIELD MAPPING PARAMETERS. | | Format. . . : Detail format 1. | | Field . . . : test zip code | | | | | | | | Parameter Ctx Field | | Country Cd DTL Country Cd | | | | | | | | | | | | | | | | | | | | | | | | F3=Exit | | | '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'

11

Let Data Types Work For You

8-Digit Date data type (DT8)


All field attributes are fixed Requires input and displays output in MMDDCCYY format Stored internally in CCYYMMDD format Accounts for leap years and century non-leap years

DT8 Attributes
._______________________________________________________________________________. | *CHANGE Op: SYNVG WISDM395A 2/10/92 13:09:17| | EDIT FIELD ATTRIBUTE. Test1 Model | | Field attribute. . . . : DT8 | | Text . . . . . . . . . : 8-Digit Date: int-CCYYMMDD ext-MMDDCCYY | | Right hand side text . : | | Allow user Initial Allowed Override | | entry value values value | | Internal data type . . : O (I,O,H) P (A,P,S,B,F) | | Internal length. . . . : O (I,O,H) 8.0 | | External data type . . : S (A,S) | | External length. . . . : O (I,O,H) 8.0 (Output| | Keyboard shift . . . . : I (I,O,H) DYN (XANWIDM/NSYID| | Lowercase. . . . . . . : H (I,O,H) (Y,' ') | | Check valid system name: H (I,O,H) (Y,' ') | | Mandatory fill . . . . : H (I,O,H) (Y,' ') | | Modulus check 10/11. . : H (I,O,H) (10,11,' ') | | | | | | Allow value mapping. . : N (Y,N) Y (Y,' ') | | Int/ext len conv. . : I (I,C,V,' ') | | Int/ext function. . : Convert DT8 | | Ext/int function. . : Check DT8 | | | | F3=Exit F11=Delete | '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' ** Note the setting of Value mapping 12

Let Data Types Work For You

Check DT8 - Validate and Convert Ext/Int


Parameters: $DT8 External I $DT8 Internal O ** Note Parameter Usage $DT8 Month N Cond: April August December February January July June March May November October September Valid Month $DT8 Day N Cond: February - Leap Year February - Non-Leap Year Long Month Short Month $DT8 Century N Cond: Valid Century $DT8 Year N $DT8 Leap Indicator N Cond: Leap Year NBR NBR NBR CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP RNG RNG RNG RNG RNG RNG 8.0 8.0 2.0 EQ EQ EQ EQ EQ EQ EQ EQ EQ EQ EQ EQ 2.0 4 8 12 2 1 7 6 3 5 11 10 9

1 to 12 1 1 1 1 to to to to 29 28 31 30

NBR

NBR NBR NBR

2.0

18 to 21 2.0 1.0 CMP EQ *ZERO

1 > Check DT8 1 .->>1 . > Check DT8 >>1 . .->>1 . . * Initialize Return Code >>1 . . PGM.*Return code = CND.*Normal ** Note use of *Return code >>1 . . >>1 . . * First we will convert the date from external to internal form. >>1 . . This is necessary because the internal form is converted to >>1 . . the external form when the screen is redisplayed, regardless >>1 . . of any errors. >>1 . . * After we have converted the date, we will validate it. Each >>1 . . portion of the date (CC, YY, MM, DD) is validated. Any error >>1 . . will result in an error message signifying an invalid 8-digit >>1 . . date. ** This would be the general flow of a validation program unless circumstances dictate otherwise >>1 . . >>1 . . > Exit with no error if incoming date is zero. >>1 . . .-CASE >>1 . . -PAR.$DT8 External is Equal to Zero >>1 . . PAR.$DT8 Internal = CON.*ZERO >>1 . . <-- *QUIT >>1 . . '-ENDCASE ** Remember to code for optional fields. The validation will still be called. >>1 . . >>1 . . * Break out Date elements 13

Let Data Types Work For You >>1 . . PAR.$DT8 Month = PAR.$DT8 External / CON.1000000 * >>1 . . PAR.$DT8 Day = PAR.$DT8 External / CON.10000 * >>1 . . PAR.$DT8 Century = PAR.$DT8 External / CON.100 * >>1 . . PAR.$DT8 Year = PAR.$DT8 External

14

Let Data Types Work For You

Check DT8 - contd


>>1 . . >>1 . . * Construct Internal date from Date elements >>1 . . WRK.$DT8 Internal = PAR.$DT8 Century >>1 . . WRK.$DT8 Internal = WRK.$DT8 Internal * CON.100 * >>1 . . WRK.$DT8 Internal = WRK.$DT8 Internal + PAR.$DT8 Year >>1 . . WRK.$DT8 Internal = WRK.$DT8 Internal + PAR.$DT8 Month >>1 . . WRK.$DT8 Internal = WRK.$DT8 Internal * CON.100 * >>1 . . WRK.$DT8 Internal = WRK.$DT8 Internal + PAR.$DT8 Day >>1 . . PAR.$DT8 Internal = WRK.$DT8 Internal ** Constructing external value prior to validation (if possible) can simplify exiting on errors >>1 . . >>1 . . > Test for Valid Month >>1 . . .-CASE >>1 . . -PAR.$DT8 Month is Valid Month >>1 . . -*OTHERWISE >>1 . . PGM.*Return code = CND.$Invalid 8-digit date ** Note use of *Return code to signal errors >>1 . . '-ENDCASE >>1 . . >>1 . . > Test for Valid Century >>1 . . .-CASE >>1 . . -PAR.$DT8 Century is Valid Century >>1 . . -*OTHERWISE >>1 . . PGM.*Return code = CND.$Invalid 8-digit date >>1 . . '-ENDCASE >>1 . . >>1 . . * All year 00-99 are valid >>1 . . >>1 . . > Test for Valid Days in each month >>1 . . .-CASE >>1 . . -PAR.$DT8 Month is January >>1 . . > Test January >>1 . . .-CASE >>1 . . -PAR.$DT8 Day is Long Month >>1 . . -*OTHERWISE >>1 . . PGM.*Return code = CND.$Invalid 8-digit date >>1 . . '-ENDCASE >>1 . . -PAR.$DT8 Month is February >>1 . . PAR.$DT8 Leap Indicator = PAR.$DT8 Year / CON.4 $DT8 Leap Indicator >>1 . . > Process Leap year based on divisible by 4 rule >>1 . . .-CASE >>1 . . -PAR.$DT8 Leap Indicator is Leap Year >>1 . . > Process Century Leap year based on divisible by 400 rule >>1 . . .-CASE >>1 . . -PAR.$DT8 Year is Century Year >>1 . . PAR.$DT8 Leap Indicator = PAR.$DT8 Century / CON.4 $DT8 Leap Indicator ** Dividing the Century by 4 when the year is 00 is the same as dividing CCYY by 400 but allows the remainder to be a single digit >>1 . . > Test February in Century Year >>1 . . .-CASE >>1 . . -PAR.$DT8 Leap Indicator is Leap Year >>1 . . > February in Century Leap year >>1 . . .-CASE >>1 . . -PAR.$DT8 Day is February - Leap Year >>1 . . -*OTHERWISE >>1 . . PGM.*Return code = CND.$Invalid 8-digit date 15

Let Data Types Work For You >>1 . . '-ENDCASE >>1 . . -*OTHERWISE >>1 . . > February in Century Non-Leap year >>1 . . .-CASE

16

Let Data Types Work For You

Check DT8 - contd


>>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . -PAR.$DT8 Day is February - Non-Leap Year -*OTHERWISE PGM.*Return code = CND.$Invalid 8-digit date '-ENDCASE '-ENDCASE -*OTHERWISE > Test February in Non-Century Leap year .-CASE -PAR.$DT8 Day is February - Leap Year -*OTHERWISE PGM.*Return code = CND.$Invalid 8-digit date '-ENDCASE '-ENDCASE -*OTHERWISE > Test February in Non-Century Non-Leap year .-CASE -PAR.$DT8 Day is February - Non-Leap Year -*OTHERWISE PGM.*Return code = CND.$Invalid 8-digit date '-ENDCASE '-ENDCASE -PAR.$DT8 Month is March > Test March .-CASE -PAR.$DT8 Day is Long Month -*OTHERWISE PGM.*Return code = CND.$Invalid 8-digit date '-ENDCASE -PAR.$DT8 Month is April > Test April .-CASE -PAR.$DT8 Day is Short Month -*OTHERWISE PGM.*Return code = CND.$Invalid 8-digit date '-ENDCASE -PAR.$DT8 Month is May > Test May .-CASE -PAR.$DT8 Day is Long Month -*OTHERWISE PGM.*Return code = CND.$Invalid 8-digit date '-ENDCASE -PAR.$DT8 Month is June > Test June .-CASE -PAR.$DT8 Day is Short Month -*OTHERWISE PGM.*Return code = CND.$Invalid 8-digit date '-ENDCASE -PAR.$DT8 Month is July > Test July .-CASE -PAR.$DT8 Day is Long Month -*OTHERWISE PGM.*Return code = CND.$Invalid 8-digit date 17

Let Data Types Work For You >>1 . . '-ENDCASE >>1 . . -PAR.$DT8 Month is August >>1 . . > Test August >>1 . . .-CASE

18

Let Data Types Work For You

Check DT8 - contd


>>1 . . -PAR.$DT8 Day is Long Month >>1 . . -*OTHERWISE >>1 . . PGM.*Return code = CND.$Invalid 8-digit date >>1 . . '-ENDCASE >>1 . . -PAR.$DT8 Month is September >>1 . . > Test September >>1 . . .-CASE >>1 . . -PAR.$DT8 Day is Short Month >>1 . . -*OTHERWISE >>1 . . PGM.*Return code = CND.$Invalid 8-digit date >>1 . . '-ENDCASE >>1 . . -PAR.$DT8 Month is October >>1 . . > Test October >>1 . . .-CASE >>1 . . -PAR.$DT8 Day is Long Month >>1 . . -*OTHERWISE >>1 . . PGM.*Return code = CND.$Invalid 8-digit date >>1 . . '-ENDCASE >>1 . . -PAR.$DT8 Month is November >>1 . . > Test November >>1 . . .-CASE >>1 . . -PAR.$DT8 Day is Short Month >>1 . . -*OTHERWISE >>1 . . PGM.*Return code = CND.$Invalid 8-digit date >>1 . . '-ENDCASE >>1 . . -PAR.$DT8 Month is December >>1 . . > Test December >>1 . . .-CASE >>1 . . -PAR.$DT8 Day is Long Month >>1 . . -*OTHERWISE >>1 . . PGM.*Return code = CND.$Invalid 8-digit date >>1 . . '-ENDCASE >>1 . . '-ENDCASE >>1 . . >>1 . . > Issue Error message if date is invalid >>1 . . .-CASE >>1 . . -PGM.*Return code is $Invalid 8-digit date >>1 . . Send error message - '$Invalid 8-digit date' >>1 . . I $DT8 External = PAR.$DT8 External >>1 . . '-ENDCASE ** Issuing error message only once reduces generated code >>1 . '-1 '--

19

Let Data Types Work For You

Convert DT8 - Convert Int/Ext


Parameters: $DT8 $DT8 ** Note Parameter Usage $DT8 $DT8 $DT8 $DT8 External Internal Century Year Month Day O I N N N N NBR NBR NBR NBR NBR NBR 8.0 8.0 2.0 2.0 2.0 2.0

1 > Convert DT8 1 .->>1 . > Convert DT8 >>1 . .->>1 . . * Break out Date elements >>1 . . PAR.$DT8 Century = PAR.$DT8 Internal / CON.1000000 * >>1 . . PAR.$DT8 Year = PAR.$DT8 Internal / CON.10000 * >>1 . . PAR.$DT8 Month = PAR.$DT8 Internal / CON.100 * >>1 . . PAR.$DT8 Day = PAR.$DT8 Internal >>1 . . >>1 . . * Construct External Date from Date elements >>1 . . WRK.$DT8 External = PAR.$DT8 Month >>1 . . WRK.$DT8 External = WRK.$DT8 External * CON.100 * >>1 . . WRK.$DT8 External = WRK.$DT8 External + PAR.$DT8 Day >>1 . . WRK.$DT8 External = WRK.$DT8 External * CON.100 * >>1 . . WRK.$DT8 External = WRK.$DT8 External + PAR.$DT8 Century >>1 . . WRK.$DT8 External = WRK.$DT8 External * CON.100 * >>1 . . WRK.$DT8 External = WRK.$DT8 External + PAR.$DT8 Year >>1 . . PAR.$DT8 External = WRK.$DT8 External >>1 . '-1 '-** Note that no type of validation is done when converting. The database is assumed to be correct.

20

Let Data Types Work For You

Zip Code data type (ZIP)


External field size is 12 characters; Internal field size is 10 characters; All other attributes are also fixed. Mapping functions are EXCEXTFUN called by EXCINTFUN to allow changes or new formats with minimum impact Input format dependent on format specified by country
- US format: 5 or 9 digits are required with or without separator character of space or dash - Canadian format: 6 alphanumeric characters are required with or without separating space - Other format: up to 10 characters

Output format dependent on country


- US format: 5 digits or 5+4 digits with separating dash - Canadian format: 3+3 characters with separating space - Other format; as entered

Internal format
- US or Canadian format: left justified, separators removed - Other format: as entered

Country Code is specified as additional mapping parameter on mapping functions Context for Country Code is determined at the file level and is locked Mapping functions read Country file to get ZIP code format Mapping functions read System Control file to get default Country if input parameter is blank or invalid Special internal values identified for error reporting to prevent data loss when excess characters are entered

21

Let Data Types Work For You

ZIP Attributes
._______________________________________________________________________________. | *CHANGE Op: SYNVG WISDM395A 2/10/92 13:09:37| | EDIT FIELD ATTRIBUTE. Test1 Model | | Field attribute. . . . : ZIP | | Text . . . . . . . . . : Zip code data Type (requires Country) | | Right hand side text . : ZIP | | Allow user Initial Allowed Override | | entry value values value | | Internal data type . . : O (I,O,H) A (A,P,S,B,F) | | Internal length. . . . : O (I,O,H) 10 | | External data type . . : A (A,S) | | External length. . . . : O (I,O,H) 12 (Output| | Keyboard shift . . . . : O (I,O,H) A XANWIDM (XANWIDM/NSYID| | Lowercase. . . . . . . : O (I,O,H) (Y,' ') | | Check valid system name: H (I,O,H) (Y,' ') | | Mandatory fill . . . . : H (I,O,H) (Y,' ') | | Modulus check 10/11. . : H (I,O,H) (10,11,' ') | | | | | | Allow value mapping. . : N (Y,N) Y (Y,' ') | | Int/ext len conv. . : (I,C,V,' ') | | Int/ext function. . : Convert Zip Int | | Ext/int function. . : Check zip Int | | | | F3=Exit F11=Delete | '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' ** Length Conversion must be blank to allow different sizes for internal and external

22

Let Data Types Work For You

Check ZIP - Validate and Convert Ext/Int


Parameters: $Zip External.u $Zip Internal.u Cond: Zip is in error B B B TXT TXT CDE 12 10 RNG 3 ZIE0001 to ZIE0003

Country Cd ** All other parameters referenced are usage of Neither

1 > Check zip Int 1 .->>1 . Check Zip - *Field attribute types * >>1 . B $Zip External.u = PAR.$Zip External.u >>1 . B $Zip Internal.u = PAR.$Zip Internal.u >>1 . B Country Cd = PAR.Country Cd 2 . > Check Zip 2 . .->>2 . . > Set all fields to blank that are altered when an error occurs >>2 . . .->>2 . . . PAR.$Zip Internal.u = CON.*BLANK >>2 . . . PGM.*Return code = CND.*Normal >>2 . . '-** Remember to completely cleanup after yourself and plan for valid and invalid exits >>2 . . > If the External has a value continue processing... >>2 . . .-CASE >>2 . . -PAR.$Zip External.u NE WRK.Blank Space.u >>2 . . $Count string characters - Utility Functions * (User Source to count String characters) >>2 . . > IF 10 or less char are present proceed... >>2 . . .-CASE >>2 . . -WRK.$String Char Total is Greater than 10 >>2 . . Send error message - 'Zip Length is invalid' >>2 . . PGM.*Return code = CND.Zip Length is invalid >>2 . . PAR.$Zip Internal.u = PGM.*Return code ** When data loss occurswhen mapping invalid values, communicate with the convert routine through the internal value >>2 . . -*OTHERWISE >>2 . . > If Country is not present, default it from the sys standard file >>2 . . .-CASE >>2 . . -PAR.Country Cd EQ WRK.Blank Space.u (RTVOBJ to get Default Country from system file) >>2 . . '-ENDCASE ** Write bulletproof code. If a needed parameter is missing an error message can get the user to enter it. But remember that the field you need may not be on the screen. Especially if the system is expected to default values. The programmer has no opportunity to default a missing value before a data type expects to use that defaulted value >>2 . . > Retrieve the country and, based on Zip format, convert it >>2 . . .-(RTVOBJ to get ZIP format from Country file) >>2 . . . > Based on the Zip format convert for internal storage. >>2 . . . .-CASE >>2 . . . -PAR.Zip Format is USA Zip+4 >>2 . . . Cvt Zip USA to Int - Country * >>2 . . . B $Zip External.u = PAR.$Zip External.u >>2 . . . B $Zip Internal.u = PAR.$Zip Internal.u ** The following imbedded function is located on the Country file. You are not limited to functions on the *Field attribute types file. This also makes the conversion routines available to other functions. 3 . . . > Cvt Zip USA to Int 3 . . . .-23

Let Data Types Work For You >>3 . . . . * All of the Action diagram is inbedded in a Sequence to allow >>3 . . . . * *Quit opcode to correctly exit to the end of the Sequence if >>3 . . . . * an error occurs.

24

Let Data Types Work For You

Check ZIP - contd


>>3 >>3 >>3 . . . . > Validate that Zip is valid length for USA format . . . . .-. . . . . $Count string characters - Utility Functions * (User Source to count String characters) >>3 . . . . . > If Zip is incorrect length then, exit this routine >>3 . . . . . .-CASE >>3 . . . . . -WRK.String Count.u is Nine >>3 . . . . . * Length is valid and should be processed. >>3 . . . . . -WRK.String Count.u is Five >>3 . . . . . * Length is valid and should be processed. >>3 . . . . . -*OTHERWISE >>3 . . . . . Send error message - 'Zip Length nValid for USA' >>3 . . . . . I $Zip External.u = PAR.$Zip External.u >>3 . . . . . PGM.*Return code = CND.Zip Length nValid for USA >>3 . . . . . PAR.$Zip Internal.u = PGM.*Return code >>3 . . . . . <-- *QUIT ** Error Message for first format length error. >>3 . . . . . '-ENDCASE >>3 . . . . . $Subst (Substring) - Utility Functions * (User Source to substring retrieves 6th character) >>3 . . . . . > If the String passed in contains a '-', strip it out. >>3 . . . . . .-CASE >>3 . . . . . -PAR.Dash.u is Equal to Dash >>3 . . . . . $Subst (Substring) - Utility Functions * (User Source to substring retrieves characters 1 - 5) >>3 . . . . . $Subst (Substring) - Utility Functions * (User Source to substring retrieves characters 1 - 10 >>3 . . . . . $Concat without sep - Utility Functions * (User Source to concatenate combines two pieces of ZIP) >>3 . . . . . -*OTHERWISE >>3 . . . . . PAR.Zip+4 USA Format = PAR.$Zip External.u >>3 . . . . . '-ENDCASE >>3 . . . . . > Check Zip to see if properly cropped >>3 . . . . . .->>3 . . . . . . $Test Numeric - Utility Functions * (User Source to test each character for numeric) >>3 . . . . . . .-CASE >>3 . . . . . . -WRK.$Field is Numeric?.u is *No >>3 . . . . . . Send error message - 'Zip Format is Not Valid' >>3 . . . . . . I $Zip External.u = PAR.$Zip External >>3 . . . . . . PGM.*Return code = CND.Zip Format is Not Valid >>3 . . . . . . PAR.$Zip Internal.u = PGM.*Return code >>3 . . . . . . <-- *QUIT ** Error message for invalid characters in format >>3 . . . . . . -*OTHERWISE >>3 . . . . . . PAR.$Zip Internal.u = PAR.Zip+4 USA Format >>3 . . . . . . '-ENDCASE >>3 . . . . . '->>3 . . . . '-3 . . . '->>2 . . . -PAR.Zip Format is Canadian Postal >>2 . . . Cvt Zip Canada to Int - Country * >>2 . . . B $Zip External.u = PAR.$Zip External.u >>2 . . . B $Zip Internal.u = PAR.$Zip Internal.u 3 . . . > Cvt Zip Canada to Int 25

Let Data Types Work For You 3 . . . .->>3 . . . . $Count string characters - Utility Functions * (User Source to count String characters) >>3 . . . . > IF Zip is Valid length process it, otherwise send an error

26

Let Data Types Work For You

Check ZIP - contd


>>3 >>3 >>3 >>3 >>3 . . . . .-CASE . . . . -WRK.String Count.u is Six . . . . > Substring for a Center ' ' (Blank). . . . . .-. . . . . $Subst (Substring) - Utility Functions * (User Source to substring retrieves character 4) >>3 . . . . . > If the zip contains a blank break it down for storage. >>3 . . . . . .-CASE >>3 . . . . . -PAR.Blank Space.u is Equal to Blank >>3 . . . . . $Subst (Substring) - Utility Functions * (User Source to substring retrieves characters 1 - 3 >>3 . . . . . $Subst (Substring) - Utility Functions * (User Source to substring retrieves characters 1 - 7 >>3 . . . . . $Concat without sep - Utility Functions * (User Source to concatenate combines two pieces of ZIP) >>3 . . . . . -*OTHERWISE >>3 . . . . . PAR.$Zip Internal.u = PAR.$Zip External.u >>3 . . . . . '-ENDCASE >>3 . . . . '->>3 . . . . -*OTHERWISE >>3 . . . . Send error message - 'Zip Ltgh Valid for Canda' >>3 . . . . I $Zip External.u = PAR.$Zip External.u >>3 . . . . PGM.*Return code = CND.Zip Ltgh Valid for Canda >>3 . . . . PAR.$Zip Internal.u = PGM.*Return code ** Error message for second format length error >>3 . . . . '-ENDCASE 3 . . . '->>2 . . . -*OTHERWISE >>2 . . . * Because the Zip format is unknown for the country specified s >>2 . . . * move the external format to internal format. >>2 . . . PAR.$Zip Internal.u = PAR.$Zip External.u ** Simply store values for which no format is specified in Country file >>2 . . . '-ENDCASE >>2 . . '->>2 . . '-ENDCASE >>2 . . > If error occured exit program to return the return code. >>2 . . .-CASE >>2 . . -PGM.*Return code is *Normal >>2 . . Do Nothing.... >>2 . . -*OTHERWISE >>2 . . Exit program - return code PGM.*Return code ** Remember this is in an External function. Passing back the Return Code is required to flag the fields in error. Error messages sent by this program were copied back to the calling program by specifying the corresponding function option. >>2 . . '-ENDCASE >>2 . . '-ENDCASE 2 . '-1 '--

27

Let Data Types Work For You

Convert ZIP - Convert Int/Ext


Parameters: $Zip External.u $Zip Internal.u ** Note Parameter Usage Country Cd B B B TXT TXT CDE 12 10 3

1 > Convert Zip Int 1 .->>1 . Convert Zip - *Field attribute types * >>1 . B $Zip External.u = PAR.$Zip External.u >>1 . B $Zip Internal.u = PAR.$Zip Internal.u >>1 . B Country Cd = PAR.Country Cd 2 . > Convert Zip 2 . .->>2 . . .-CASE >>2 . . -PAR.$Zip Internal.u is Zip is in error >>2 . . * Do nothing to the Zip the external needs to stay intact. ** Recall that errors were communicated to this routine by special values in the internal field. Simply exiting leaves the external value (which may be too long) intact. Compare this with Synon's handling of value-mapped STS fields. >>2 . . -PAR.$Zip Internal.u EQ WRK.Blank Space.u >>2 . . PAR.$Zip External.u = CON.*BLANK ** Remember to code for optional fields >>2 . . -*OTHERWISE >>2 . . > If Country Code is not supplied default it from the sys control fil >>2 . . .-CASE >>2 . . -PAR.Country Cd EQ WRK.Blank Space.u (RTVOBJ to get Default Country from system file) >>2 . . '-ENDCASE >>2 . . > Rtv country for zip format and build zip for display >>2 . . .-(RTVOBJ to get ZIP format from Country file) >>2 . . . > Based on zip format, convert the internal format to external >>2 . . . .-CASE >>2 . . . -PAR.Zip Format is USA Zip+4 >>2 . . . Convert Zip to USA Zip+4 - Country * >>2 . . . I $Zip Internal.u = PAR.$Zip Internal.u >>2 . . . B $Zip External.u = PAR.$Zip External.u 3 . . . > Convert Zip to USA Zip+4 3 . . . .->>3 . . . . $Count string characters - Utility Functions * (User Source to count String characters) >>3 . . . . .-CASE >>3 . . . . -WRK.String Count.u is Five >>3 . . . . PAR.$Zip External.u = PAR.$Zip Internal.u >>3 . . . . -*OTHERWISE >>3 . . . . > Break the Zip Code Down into Base components >>3 . . . . .->>3 . . . . . $Subst (Substring) - Utility Functions * (User Source to substring retrieves characters 1 - 5) >>3 . . . . . $Subst (Substring) - Utility Functions * (User Source to substring retrieves characters 6 - 9) >>3 . . . . '->>3 . . . . > Reassemble the Zip with the edit character(s) in place. >>3 . . . . .->>3 . . . . . $Concat without sep - Utility Functions * (User Source to concatenate combines first piece of ZIP and '-') 28

Let Data Types Work For You >>3 . . . . . $Concat without sep - Utility Functions * (User Source to concatenate combines previous string with second piece of ZIP) >>3 . . . . '->>3 . . . . '-ENDCASE

29

Let Data Types Work For You

Convert ZIP - contd


3 >>2 >>2 >>2 >>2 3 3 >>3 >>3 >>3 3 >>2 >>2 >>2 >>2 >>2 >>2 >>2 >>2 >>2 >>2 >>2 2 1 . . . '-. . . -PAR.Zip Format is Canadian Postal . . . Convert Zip to Canadian - Country * . . . I $Zip Internal.u = PAR.$Zip Internal.u . . . B $Zip External.u = PAR.$Zip External.u . . . > Convert Zip to Canadian . . . .-. . . . $Subst (Substring) - Utility Functions * (User Source to substring retrieves characters 1 - 3) . . . . $Subst (Substring) - Utility Functions * (User Source to substring retrieves characters 4 - 6) . . . . $Concat with blank sep - Utility Functions * (User Source to concatenate combines two pieces of ZIP) . . . '-. . . -*OTHERWISE . . . PAR.$Zip External.u = PAR.$Zip Internal.u . . . '-ENDCASE . . . > If error occured exit program to return the return code. . . . .-CASE . . . -PGM.*Return code is *Normal . . . -*OTHERWISE . . . Exit program - return code PGM.*Return code . . . '-ENDCASE . . '-. . '-ENDCASE . '-'--

30

Let Data Types Work For You

Credit Card Number data type (CC#)


Modulus and type-to-number checking deemed unnecessary at our location External field size is 19 characters; Internal field size is 16 characters Input format allows entry of up to 16 numeric digits in any format Output format is four 4-character segments with a space separator for readability Internal format is all digits entered left-justified with separators removed Special internal values identified for error reporting to prevent data loss when excess characters are entered

CC# Attributes
._______________________________________________________________________________. | *ADD Op: SYNDSNR WISRMT2S1 1/26/92 8:52:50| | EDIT FIELD ATTRIBUTE. Windsor, Inc. WISDMMDL | | Field attribute. . . . : CC# | | Text . . . . . . . . . : Credit Card Number | | Right hand side text . : | | Allow user Initial Allowed Override | | entry value values value | | Internal data type . . : O (I,O,H) A (A,P,S,B,F) | | Internal length. . . . : O (I,O,H) 16 | | External data type . . : A (A,S) | | External length. . . . : O (I,O,H) 19 (Output| | Keyboard shift . . . . : O (I,O,H) M XANWIDM (XANWIDM/NSYID| | Lowercase. . . . . . . : H (I,O,H) (Y,' ') | | Check valid system name: H (I,O,H) (Y,' ') | | Mandatory fill . . . . : O (I,O,H) (Y,' ') | | Modulus check 10/11. . : H (I,O,H) (10,11,' ') | | | | | | Allow value mapping. . : N (Y,N) Y (Y,' ') | | Int/ext len conv. . : (I,C,V,' ') | | Int/ext function. . : Convert Credit Card # | | Ext/int function. . : Check Credit Card # | | | | F3=Exit | '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' ** Note internal and external sizes. Again, value mapping is required to allow use of mapping functions. ** Keyboard shift M allows least number of non-numeric keys while still allowing blanks to be keyed. 31

Let Data Types Work For You

Check CC#- Validate and Convert Ext/Int


Parameters: CC# External Value CC# Internal Value CC# Digit/Char Cond: Invalid Character I B N TXT TXT STS 19 16 1 LST + , . any Field- char *Blank 1 to 19

Ignored Character CC# Digit Check Control Cond: Between 1 and 19 CC# Char Count

N N

NBR NBR

VAL RNG

2.0 2.0

1 > Check CC# 1 .->>1 . * Check CC# data type for invalid length and invalid characters. >>1 . After validating, convert to internal format. >>1 . >>1 . * Prepare to count and process individual characters >>1 . PAR.CC# Char Count = CON.*ZERO >>1 . PAR.CC# Digit Check Control = CON.1 >>1 . PAR.CC# Internal Value = CON.*BLANK >>1 . >>1 . > Process characters in string >>1 . .=REPEAT WHILE >>1 . |-PAR.CC# Digit Check Control is Between 1 and 19 >>1 . | $Substring - (Utility Functions) * >>1 . | I VRY $String Length.u = CON.1 >>1 . | I VRY $String.u = PAR.CC# External Value >>1 . | I VRY $String start pos.u = PAR.CC# Digit Check Control >>1 . | O VRY $String result.u = PAR.CC# Digit/Char >>1 . | >>1 . | > Issue error message if invalid character encountered >>1 . | .-CASE >>1 . | -PAR.CC# Digit/Char is Invalid Character >>1 . | Send error message - '$Invalid CC# character' >>1 . | I CC# External Value = PAR.CC# External Value >>1 . | I CC# Digit/Char = PAR.CC# Digit/Char >>1 . | PAR.CC# Internal Value = CND.Invalid Number on Edit ** Again note the use of the internal value to communicate errors. This time conditionson the parameter field are used. >>1 . | '-ENDCASE >>1 . | >>1 . | > If character is not an ignored character (blank), count it. >>1 . | .-CASE >>1 . | -PAR.CC# Digit/Char is Ignored Character >>1 . | -*OTHERWISE >>1 . | PAR.CC# Char Count = PAR.CC# Char Count + CON.1 >>1 . | '-ENDCASE >>1 . | >>1 . | * Increment loop counter >>1 . | PAR.CC# Digit Check Control = PAR.CC# Digit Check Control + CON.1 >>1 . '-ENDWHILE >>1 . 32

Let Data Types Work For You >>1 . > Issue error if number is too long >>1 . .-CASE >>1 . -PAR.CC# Char Count is Greater than 16

33

Let Data Types Work For You

Check CC# - contd


>>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 1 . Send error message - '$Invalid CC# length' . I CC# External Value = PAR.CC# External Value . I CC# Char Count = PAR.CC# Char Count . PAR.CC# Internal Value = CND.Invalid Number on Edit . '-ENDCASE . . > If no errors were encountered, convert the number to internal. . .-CASE . -PAR.CC# Internal Value is Invalid Number on Edit . -*OTHERWISE . PAR.CC# Digit Check Control = CON.1 . . > Reconstruct number in internal format . .=REPEAT WHILE . |-PAR.CC# Digit Check Control is Between 1 and 19 . | $Substring - (Utility Functions) * . | I VRY $String Length.u = CON.1 . | I VRY $String.u = PAR.CC# External Value . | I VRY $String start pos.u = PAR.CC# Digit Check Control . | O VRY $String result.u = PAR.CC# Digit/Char . | $Concat without sep - (Utility Functions) * . | I VRY $Concat String 1 = PAR.CC# Internal Value . | I VRY $Concat String 2 = PAR.CC# Digit/Char . | O VRY $Concat Result = PAR.CC# Internal Value . | . | * Increment loop counter . | PAR.CC# Digit Check Control = PAR.CC# Digit Check Control + CON.1 . '-ENDWHILE . '-ENDCASE '--

34

Let Data Types Work For You

Convert CC# - Convert Int/Ext


Parameters: CC# External Value CC# Internal Value CC# Segment B I N TXT TXT TXT 19 16 4

1 > Convert CC# 1 .->>1 . * Convert Internal to External for CC# Data Type >>1 . >>1 . > If edit error, return ext value else convert int to ext. >>1 . .-CASE >>1 . -PAR.CC# Internal Value is Invalid Number on Edit >>1 . >>1 . * Do nothing: This allows external value to remain intact on error >>1 . ** Remember to test for error condition communicated from the Check function >>1 . -*OTHERWISE >>1 . * Perform 4 substring and concatenates to break 16 digit internal >>1 . value into 4 segments with 1 space separator. >>1 . PAR.CC# External Value = CON.*BLANK >>1 . $Substring - (Utility Functions) * >>1 . I VRY $String Length.u = CON.4 >>1 . I VRY $String.u = PAR.CC# Internal Value >>1 . I VRY $String start pos.u = CON.1 >>1 . O VRY $String result.u = PAR.CC# Segment >>1 . $Concat without sep - (Utility Functions) * >>1 . I VRY $Concat String 1 = PAR.CC# External Value >>1 . I VRY $Concat String 2 = PAR.CC# Segment >>1 . O VRY $Concat Result = PAR.CC# External Value >>1 . $Substring - (Utility Functions) * >>1 . (Other Parms same as above) >>1 . I VRY $String start pos.u = CON.5 >>1 . $Concat with blank sep - (Utility Functions) * >>1 . (Parms same as above) >>1 . $Substring - (Utility Functions) * >>1 . (Other Parms same as above) >>1 . I VRY $String start pos.u = CON.9 >>1 . $Concat with blank sep - (Utility Functions) * >>1 . (Parms same as above) >>1 . $Substring - (Utility Functions) * >>1 . (Other Parms same as above) >>1 . I VRY $String start pos.u = CON.13 >>1 . $Concat with blank sep - (Utility Functions) * >>1 . (Parms same as above) >>1 . '-ENDCASE 1 '--

35

Let Data Types Work For You

Rate Per Thousand data type (RPT)


Programmer defined Internal length and decimals Length conversion programs calculates External length and decimals Allows entry of price in rate per thousand units Displays and prints as price in rate per thousand units Internal format is stored as rate per unit to allow per unit pricing calculations Minimum number of internal decimals required and enforced

RPT Attributes
._______________________________________________________________________________. | *CHANGE Op: SYNVG WISRMT2S1 2/15/92 17:37:56| | EDIT FIELD ATTRIBUTE. Test1 Model | | Field attribute. . . . : RPT | | Text . . . . . . . . . : External: Rate per 1000 Internal: Rate per Unit | | Right hand side text . : per 1000 | | Allow user Initial Allowed Override | | entry value values value | | Internal data type . . : O (I,O,H) P (A,P,S,B,F) | | Internal length. . . . : I (I,O,H) 6.3 | | External data type . . : S (A,S) | | External length. . . . : O (I,O,H) 6.0 (Output| | Keyboard shift . . . . : I (I,O,H) NSYID (XANWIDM/NSYID| | Lowercase. . . . . . . : H (I,O,H) (Y,' ') | | Check valid system name: H (I,O,H) (Y,' ') | | Mandatory fill . . . . : I (I,O,H) (Y,' ') | | Modulus check 10/11. . : H (I,O,H) (10,11,' ') | | | | | | Allow value mapping. . : N (Y,N) Y (Y,' ') | | Int/ext len conv. . : C (I,C,V,' ') | | Int/ext function. . : Convert RPT | | Ext/int function. . : Check RPT | | | | F3=Exit F11=Delete | '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' ** Length Conversion requires C to use length conversion program 36

Let Data Types Work For You

YRPTLENR1C - length conversion program


Parameters: Object attribute Keyboard shift Value mapped status Internal data type Internal length Internal no. of integers Internal no. of decimals External data type External length External no. of integers External no. of decimals I I I I I I I I O O O CDE CDE CDE CDE NBR NBR NBR CDE NBR NBR NBR 3 1 1 1 5.0 2.0 1.0 1 5.0 2.0 1.0

1 1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1 >>1

integers = CON.3 - PAR.Internal no. of decimals integers = PAR.Internal no. of integers + WRK.Exter (nal no. of integers) >>1 . WRK.External no. of decimals = CON.*ZERO ** This causes the Integer portion to be increased by the number of digits needed to offset the movement of the decimal point. >>1 . '-ENDCASE >>1 . >>1 . PAR.External length = WRK.External no. of integers >>1 . PAR.External no. of integers = WRK.External no. of integers >>1 . PAR.External no. of decimals = WRK.External no. of decimals 1 '--

> Calc RPT length .-. Size . ** Examples: 5.0 . 5.2 . 5.4 . 5.5 . .-CASE . -PAR.Internal no. of . WRK.External no. of . WRK.External no. of . -*OTHERWISE . WRK.External no. of . WRK.External no. of

Value 99999 999.99 9.9999 .99999

int int int int

--> --> --> -->

Size 8.0 6.0 5.1 5.2

Value 99999000 999990 9999.9 999.99

ext ext ext ext

decimals is greater than 3 decimals = PAR.Internal no. of decimals - CON.3 integers = PAR.Internal no. of integers

37

Let Data Types Work For You

Check RPT - Convert Ext/Int


Parameters: 1 1 >>1 >>1 1 RPT external RPT internal I O NBR NBR 5.0 5.0 > Check RPT .-. ** Map Per Thousand Rate to Unit Rate . PAR.RPT internal = PAR.RPT external / CON.1000 * '--

Convert RPT - Convert Int/Ext


Parameters: 1 1 >>1 >>1 1 RPT external RPT internal O I NBR NBR 5.0 5.0 > Convert RPT .-. ** Map Unit Rate to Per Thousand Rate . PAR.RPT external = PAR.RPT internal * CON.1000 * '--

38

Let Data Types Work For You

Other Ideas
Use in place of Derived fields for name formatting, etc
- Allows multiple fields of different sizes to be constructed all using the same action diagram - Allows parameters values supplied to function to be changed at the device level rather than visiting action diagram - Internal/External conversion routine only

True Julian Date


- MMDDYY Externally, number of days since base date Internally - Easier date calculations

20th Century Date


- MMDDYY Externally, YYMMDD (no century) Internally - Use for birthdates not requiring century (DT8) format

Auto-Spacing routine for user supplied report headings


- Allow user to specify report heading in XXXbXXX format - Convert to XbXbXbbbXbXbX format upon printing

New Standard data types to simplify shop standards


- Simply provide adequate default sizes for new fields - Reduces requirements for field sizes to be modified upon creation

39

Let Data Types Work For You

Other Ideas continued


True percentage field
- Allow entry as whole number 75 (%) - Store as decimal number .75 for calculations

Fast Path control field


- Provide field on all screens that allows "fast pathing" through system - Command and data could be parsed out of a character string and returned to a driver program to determine next action

40

You might also like