freeing these keys for another purpose. The assignment of these keys is done in the %PFKEYL and %PFKEYM insertion points of your online MMP's. It is done as (cont.) Default coding, you can override it by entering Customization for these insertion points. There is a copybook member named "PFKEYS/SAAMAGEC" which is included into your MMP's in the Default code for %PFKEYM. (cont.) It contains the code to assign all three of these PF keys (PF2 PF16, and PF17) to their meanings described above. You (cont.) could override it by: 1. keying the command: ALGADD nnn/PFKEYM (nnn = your MMP#) 2. pressing ENTER (the proforma code on the screen gets added as Customization) 3. erasing the line saying: -MAGECINC PFKEYS/SAAMAGEC 4. inserting code to replace it A sample of the code which might be entered to replace it is: ***** Substitute PF23 for PF2 (field-help) IF (TWA-MSK-PF23-HIT)      MOVE '2' TO TWA-MSK-AID      MOVE SFUNCT TO TWA-LAST-FUNCT      MOVE FTH-FUNCT TO TWA-NONTP-REQUEST      MOVE '**ERR1' TO SFUNCT      GO TO AA900-GOBACK. Note: ** Setting TWA-MSK-AID to '2' simulates that PF2 was hit, "fooling" the **ERR1 program into processing as if PF2 actually (cont.) were pressed. You can do the same type of logic to simulate PF16 and PF17 by using the equivalent TWA-MSK-AID codes. (cont.) They are: to simulate PF2        2 **to simulate PF16       D to simulate PF17       E to simulate PF24       < The insertion point %PFKEYL only contains the code to test for PF16 (Copy key). It can be overriden by adding (cont.) Customization for %PFKEYL and simply overkeying the code shown on the screen (similar to code shown (cont.) above). ## Assigning an Alternate Key In some cases you may wish to assign an alternate PF key to have the same meaning as another. An example of this might (cont.) be to make PF23 an alternate for PF13. PF13 is normally the "Hardcopy Key" in MAGEC programs, it causes the program to (cont.) route its output to the MAGEC spooler for printed output instead of to the screen. You could cause PF23 to have the (cont.) same effect by adding Customization coding into the insertion point %PREINIT, as: IF (TWA-MSK-PF23-HIT)     MOVE 'A' TO TWA-MSK-AID. The result would be that pressing either PF13 or PF23 would produce hardcopy output. If you wished to make PF23 produce hardcopy output and to make PF13 *not *produce hardcopy output, code: IF (TWA-MSK-PF13-HIT)     MOVE QUOTE TO TWA-MSK-AID. IF (TWA-MSK-PF23-HIT)     MOVE 'A' TO TWA-MSK-AID. The above makes PF13 simulate the ENTER key and PF23 simulate PF13. Similar assignments can be done for other keys. The codes used to set values into TWA-MSK-AID are: Key       Value        Key       Value ENTER     QUOTE        PF16      'D' PF1       '1'          PF17      'E' PF2       '2'          PF18      'F' PF3       '3'          PF19      'G' PF4       '4'          PF20      'H' PF5       '5'          PF21      'I' PF6       '6'          PF22      Cent Sign PF7       '7'          PF23      '.' PF8       '8'          PF24      '' PF11      '#'          PA3       ',' PF12      '@'          CLR       '_' PF13      'A'        SEL PEN     '=' PF14      'B'        TST REQ     ZERO PF15      'C'        VZN REQ     'V'   # Appendix M -- Using Patterns for Fields The Pattern handling facilities of MAGEC are embedded as performed routines within the generated programs. This enables (cont.) you to utilize these facilities yourself through customization coding, just as they are used by MAGEC for generated (cont.) pattern handling logic. You can apply a pattern to a data field to format for display, to validate (edit) a data (cont.) field's contents using a pattern, or to de-patternize (remove the pattern from) a data field in order to use it to (cont.) update the database or in calculations. ## Displaying Field With Pattern To apply a pattern to a data field in order to format it for display (either video or print), if it is not a numeric field, code the following (in %COMP, %LOCMOV, or other insertion points): MOVE 'XXX-AA99/9X-A'       (or any valid pattern)     TO PATTERN-MASK. MOVE data-field TO DE-EDITED-DATA. PERFORM CB200-INSERT-PATTERN THRU CB299-EXIT. MOVE SCREEN-FIELD TO target-display-field. if it is a numeric field, code: MOVE '99/999-9999' (or any valid numeric pattern)     TO PATTERN-MASK. MOVE SPACES TO DE-EDITED-DATA. MOVE data-field TO DE-EDITED-VALUE. PERFORM CB200-INSERT-PATTERN THRU CB299-EXIT. MOVE SCREEN-FIELD TO target-display-field. ## Editing Field Using Pattern To validate (edit) the format of an input data field using the Pattern editing, code (usually in %EDIT): MOVE data-field TO SCREEN-FIELD. MOVE 'XX-99-XXX-AA' (or any valid pattern)     TO PATTERN-MASK. PERFORM CB500-EDIT-PATTERN THRU CB599-EXIT. IF PATTERN-ERROR EQUAL E     MOVE E TO data-fieldE     PERFORM CA100-LOAD-ERR-CODE-TBL THRU CA199-EXIT ELSE     MOVE SCREEN-FIELD TO data-field. ## De-Patternizing a Field To remove the pattern insertion characters from a patternized field, code (usually in %CALC): MOVE 'XX99-A99/X' (or any valid pattern)     TO PATTERN-MASK. MOVE field-with-pattern TO SCREEN-FIELD. PERFORM CB600-STRIP-PATTERN THRU CB699-EXIT. MOVE DE-EDITED-DATA TO data-field.           - or -- MOVE DE-EDITED-VALUE TO data-field. DE-EDITED-VALUE is used for numeric data items, DE-EDITED-DATA is used for non-numeric items. # Appendix N -- Altering the Key Delimiter ## Delimiter Character The default logic generated by MAGEC for online MMP's stipulates that the key component fields (if there is more than (cont.) one component field) are separated by a slash (/). This should be a good standard in most cases, however, sometimes it (cont.) is desireable to use another character. One example of such a case is when the key data is a code which might contain a (cont.) slash as a valid data character (such as a part number). To alter the delimiter character used, you must enter a single line of Cobol customization coding into the %PREINIT insertion point. That line of code should say: MOVE '-' TO D-LIMITER. Where '-' is any valid character which you desire to be used as the new delimiter in place of the default slash. # Appendix O -- Converting Dates ## Date Conversion Subroutine The MAGDATE subroutine is provided with MAGEC in order to facilitate the conversions, comparisons, and validations of (cont.) dates. It accepts Gregorian, Julian, and alpha-numeric date formats as input and validates and converts to any/all (cont.) formats automatically. To use MAGDATE your program must include the MAGDATE request area. It may be included into both online and batch (cont.) programs in the Working Storage area (insertion point %LITERAL). Your program must fill in the appropriate fields (cont.) within the request area and then: CALL 'MAGDATE' USING MAGEC-DATE-REQUEST-AREA. You should always test the return code** to verify whether MAGDATE has encountered an error in your request or has successfully completed the request. To test for successful completion , code: IF (MAGDATE-OK) ... There are condition names (88-level names) for a variety of possible error codes. You might wish to test for which type (cont.) of error was found in the case that MAGDATE-OK is not true. The various return code values will be discussed later in (cont.) this appendix. ## Request Area The MAGDATE request area is defined in Cobol in a library include member (copybook). To include it into your Working Storage, code: -MAGECINC DATRQ-C The following format is an abbreviated version of the DATRQ-C copybook. *The actual copybook includes several (cont.) breakdowns of the various fields and lists of condition names (88-levels) for values.* These may be useful to you in (cont.) some cases, so you may wish to review the actual copybook to familiarize yourself with them. It is not necessary to do (cont.) so in order to use the basic functions of MAGDATE, however. The copybook is coded beginiing with a Cobol 04-level item. (cont.) That facilitates including it into %VARSTOR or %DATADEF, if you find a need to do so. If you are including it into (cont.) %LITERAL you might wish to precede the -MAGECINC statement with an 01-level item (i.e. "01 (cont.) MAGDATE-AREA.").   04 MAGEC-DATE-REQUEST-AREA. **    05 MAGEC-DATE-REQ-RESERVED      PIC X(04).     05 MAGEC-BIN-THRU REDEFINES MAGEC-DATE-REQ-RESERVED PIC S9(8) COMP.     05 MAGEC-DATE-FROM      PIC X(12).     05 FILLER  REDEFINES MAGEC-DATE-FROM.         07 MAGEC-DATE-FROM-N                PIC 9(8).     05 MAGEC-DATE-FORMAT      PIC X(12).     05  MAGEC-DATE-THRU      PIC   X(12).     05 MAGEC-DATE-THRU-FORMAT      PIC X(12).     05 MAGEC-PLUS-MINUS-DAYS      PIC S9(5).     05 MAGEC-LEAP-YEAR-CODE      PIC X.     05 MAGEC-DATE-RETURN-CODE      PIC X(02).       88 MAGDATE-OK      VALUE SPACES.     05 MAGEC-RETURNED-DATE-INFO.       07 MAGEC-DAY-OF-WK-CODE       PIC X(01).       07 MAGEC-DAY-OF-WK-NAME       PIC X(10).       07 MAGEC-MONTH-NAME       PIC X(10).       07 MAGEC-END-PERIOD-FLAG       PIC X(01).       07 MAGEC-GREG-DATES.         09 MAGEC-GREG-MDCY       PIC 9(8).         09 MAGEC-GREG-DMCY       PIC 9(8).         09 MAGEC-GREG-CYMD       PIC 9(8).         09 FILLER REDEFINES MAGEC-GREG-CYMD.           11 FILLER       PIC X(2).           11 MAGEC-GREG-YMD     PIC 9(6).         09 MAGEC-GREG-MDY     PIC 9(6).         09 MAGEC-GREG-DMY     PIC 9(6).       07 MAGEC-JUL-DATE.         09 MAGEC-JUL-DATE-CCYY     PIC 9(7).         09 FILLER REDEFINES MAGEC-JUL-DATE-CCYY.           11 MAGEC-JUL-DATE-CC     PIC 9(2).           11 MAGEC-JUL-DATE-YYDDD    PIC 9(5).       07 MAGEC-PERIOD-DATES-GREG.         09 MAGEC-BEG-END-MONTH.           11 MAGEC-BEG-MO-GREG     PIC 9(8).           11 MAGEC-END-MO-GREG    PIC 9(8).           11 MAGEC-BEG-MO-DAYOFWK     PIC X.           11 MAGEC-END-MO-DAYOFWK     PIC X.        09 MAGEC-BEG-END-QTR.           11 MAGEC-BEG-QTR-GREG     PIC 9(8).           11 MAGEC-END-QTR-GREG     PIC 9(8).           11 MAGEC-BEG-QTR-DAYOFWK     PIC X.           11 MAGEC-END-QTR-DAYOFWK    PIC X.         09 MAGEC-BEG-END-SEMI.           11 MAGEC-BEG-SEMI-GREG    PIC 9(8).           11 MAGEC-END-SEMI-GREG     PIC 9(8).           11 MAGEC-BEG-SEMI-DAYOFWK     PIC X.           11 MAGEC-END-SEMI-DAYOFWK     PIC X.        09 MAGEC-BEG-END-YR.           11 MAGEC-BEG-YR-GREG     PIC 9(8).           11 MAGEC-END-YR-GREG     PIC 9(8). Next: https://magec.com/DOC/markdown/cstm15.md.txt