400 likes | 553 Views
Model Building Made Easy Presented by. Sandi McDonald ExcelSys, Inc. Why?. SAG Models are inappropriate Re-engineering Mainframe GUI Web Browser SAG Models are insufficient Separate Data Validation Web Configuration. How?. How CONSTRUCT Generates How the Model is defined
E N D
Model Building Made EasyPresented by Sandi McDonald ExcelSys, Inc.
Why? • SAG Models are inappropriate • Re-engineering • Mainframe GUI • Web Browser • SAG Models are insufficient • Separate Data Validation • Web Configuration
How? • How CONSTRUCT Generates • How the Model is defined • How the Model is built • How the Code Frames are built • How the Model Components are created
Sample Model - Validation Batch Maint Validation Object Subp Object Dialog
Model OBJECT-MAINT-DIALOG-SUBP displayed successfully CSDFM N A T U R A L C O N S T R U C T 4.1.2 CSDFM0 Aug 10 Maintain Models 1 of 1 Action ..................... __ A,B,C,D,M,N,P,R Model ...................... OBJECT-MAINT-DIALOG-SUBP________ Description ........ *0201_____________________________________________________ OBJECT-MAINT-DIALOG-SUBP Subprogram PDA name ................. CUOMPDA_ Status window ............ Y Programming mode ......... S_ Comment start indicator .. **_ Type ..................... N Subprog. Comment end indicator .... ___ Code frame(s) ............ COMA?___ COMB?___ COMC?___ COMD?___ ________ Modify server specificatn CUOMMA__ CUOMMB__ CUOMMC__ CUOMMD__ ________ ________ ________ ________ ________ ________ Modify client specificatn CUOMMA__ CUOMMB__ CUOMMC__ CUOMMD__ CUOMME__ ________ ________ ________ ________ ________ Clear specification ...... CUOMCS__ Post-generation .......... CUOMPS__ Read specification ....... CUOMR___ Save specification ....... CUOMS___ Pre-generation ........... CUOMPR__ Document specification ... CUOMD___ Command ............ __________________________________________________________ Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12--- help retrn quit frame main How the Model is Defined
Prototype • Design, Write and Test Sample Program • Control logic • Interface with menu • PF-keys • Update logic • Confirmation prompts • etc. • Read program into Code Frame Editor • Convert specifics to variables
CSDMAIN N A T U R A L C O N S T R U C T 4.1.2 CSDMNM0 Aug 10 Administration Main Menu 1 of 1 Functions ----------------------------------------------- M Maintain Models F Code Frame Menu S Maintain Subprograms R Maintain Control Record C Compare Menu D Drivers Menu (CUA) ? Help . Return ----------------------------------------------- Function ........... _ Command ............ __________________________________________________________ Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12--- help retrn quit lang Administration MenuIn SYSCST, enter MENU
Code Frame Editor Code Frame ......... COMA9 SIZE 11061 Description ........ Object Maint Dialog* define data area FREE 57308 > > + ABS X X-Y _ S 166 L 2 ....+....1....+....2....+....3....+....4....+....5....+....6....+....7.. T C DEFINE DATA GDA-SPECIFIED 1 GLOBAL USING &GDA &WITH-BLOCK " SUBPROGRAM 1 PARAMETER " 01 #PDA-KEY(&KEY-NAT-FORMAT) " 01 #PDA-ACTION(A&ACTION-LENGTH) " NOT GDA-SPECIFIED 2 PARAMETER USING CDPDA-D /* Dialog Information. " PARAMETER USING CDPDA-M /* Message Information. " PARAMETER USING CDPDA-P /* Other Information. " RETURN-TO-CONDITION 1 PARAMETER-DATA U " NOT GDA-SPECIFIED AND NOT SUBPROGRAM 1 LOCAL USING CDPDA-D /* Dialog Information. " LOCAL USING CDPDA-E /* Error Information. " LOCAL USING CDPDA-M /* Message Information. " LOCAL USING CDPDA-P /* Pass Information. " ....+....1....+....2....+....3....+....4....+....5....+....6....+....7.. T help retrn quit main
Read into Code Frame & Convert Specifics Code Frame not found. New member started Code Frame : EXCLC1 Line: 1 of 1 Description: Size: 4 Free: 120141 Cmd: read excelsys Abs: X x-y: _ Dir: + All...+....1....+....2....+....3....+....4....+....5....+....6....+....7.. T C Code Frame : EXCLC1 Line: 1 of 146 Description: Size: 3688 Free: 119921 Cmd: Abs: X x-y: _ Dir: + Top...+....1....+....2....+....3....+....4....+....5....+....6....+....7.. T C DEFINE DATA PARAMETER 1 #ACTION (A1) 1 #KEY (A8) 1 #MSG (A79) LOCAL 1 #HEADER (A30) INIT <'Employees Maintenance'> 1 #CV1 (C) 1 #CV2 (C) 1 #CV3 (C) 1 #CV4 (C)
Convert Specifics to Variable • Substitution parameters Substitute one for one • Conditional Code Frame Lines Code is only in program based on condition • Generator Process Calls Code which is more complex • User Exit Definition Code which cannot be anticipated
Substitution Parameters * * View to obtain data for map and to be used for update * 1 UPDATE-VIEW VIEW OF EMPLOYEES ***** FIND-1. FIND UPDATE-VIEW WITH PERSONNEL-ID = #KEY IF NO RECORDS FOUND COMPRESS 'Employee' #KEY 'Does Not Exist' INTO #MSG ESCAPE BOTTOM (PROG.) END-NOREC * * View to obtain data for map and to be used for update * 1 UPDATE-VIEW VIEW OF &PRIME-FILE ***** FIND-1. FIND UPDATE-VIEW WITH &PRIME-KEY = #KEY IF NO RECORDS FOUND COMPRESS '&PRIME-KEY' #KEY 'Does Not Exist' INTO #MSG ESCAPE BOTTOM (PROG.) END-NOREC
Conditional Code Frame Line Description: BROWSE CODE 2 (MAIN BODY) Size: 54125 Free: 67900 Cmd: Abs: X x-y: _ Dir: + ....+....1....+....2....+....3....+....4....+....5....+....6....+....7.. T C MAP-USED 1 MAP-CONTAINS-STAR 2 Subprogram: CUSCGIN1 Parameter: N " ELSE 2 USE-MSG-NR 3 INPUT WITH TEXT *MSG-INFO.##MSG-NR, " ELSE 3 INPUT WITH TEXT MSG-INFO.##MSG, " RETURN-TO-CONDITION 2 MSG-INFO.##MSG-DATA(1), MSG-INFO.##MSG-DATA(2), " MSG-INFO.##MSG-DATA(3) " USING MAP '&MAP-NAME' " ELSE 1 Subprogram: CUSCGIN1 Parameter: N " RESET MSG-INFO
Generator Process Calls Code Frame : CUOBC2 Line: 91 of 273 Description: OBJECT SUBPROGRAM SUBROUTINES Size: 16516 Free: 103189 Cmd: Abs: X x-y: _ Dir: + ....+....1....+....2....+....3....+....4....+....5....+....6....+....7.. T C /* /* Shift primary entity information to object MOVE BY NAME &PRIME-FILE TO &OBJECT-NAME MULTIPLE-ENTITIES 1 Subprogram: CUOBGET Parameter: LEVEL-1-PERFORMS N " ASSIGN &RESTRICTED-PDA.HELD-ID = &OBJECT-PDA-ID END-FIND AFTER-GET U END-SUBROUTINE /* GET-OBJECT MULTIPLE-ENTITIES 1 Subprogram: CUOBGET Parameter: GET-SUBROUTINES N "
Called Subprogram 0210 DEFINE DATA 0220 PARAMETER USING CUOBPDA 0230 PARAMETER USING CU--PDA 0240 PARAMETER USING CSASTD 0550 **SAG DEFINE EXIT GENERATE-CODE 0560 DECIDE ON FIRST VALUE OF CU--PDA.#PDA-FRAME-PARM 0570 VALUE 'LEVEL-1-PERFORMS' 0580 ASSIGN #I = 1 0590 PERFORM GEN-PERFORM-GET-SUBROUTINE 0600 VALUE 'LEVEL-1-AFTER-GET' 0610 PERFORM GEN-LEVEL-1-AFTER-GET 0620 VALUE 'GET-SUBROUTINES' 0630 PERFORM GEN-GET-SUBROUTINE 0640 NONE 0650 ASSIGN CSASTD.RETURN-CODE = 'E' 0660 COMPRESS 'Invalid parameter:' CU--PDA.#PDA-FRAME-PARM 'passed to' 0670 *PROGRAM TO CSASTD.MSG 0680 END-DECIDE 0690 *
Generate the Code > > + Subprogram CUOBGET Lib SYSCST ....+....1....+....2....+....3....+....4....+....5....+....6....+....7.. 1120 FOR #I = 2 TO CUOBPDA.C#RELATIONSHIP-INFO 1130 ASSIGN #PARENT-I = CUOBPDA.#PDA-PARENT-FILE-ELEM(#I) 1140 PRINT(SRC) NOTITLE '*' 1150 PRINT(SRC) NOTITLE '*'(72) 1160 PRINT(SRC) NOTITLE 'DEFINE SUBROUTINE' 1170 CUOBPDA.#PDA-RELATED-FILE-NAME(#I)(EM=' G-'X(30)) 1180 PRINT(SRC) NOTITLE '*'(72) 1190 PRINT(SRC) NOTITLE '*' 1200 PRINT(SRC) NOTITLE '* Get' CUOBPDA.#PDA-RELATED-FILE-NAME(#I) 1210 'related to' CUOBPDA.#PDA-RELATED-FILE-NAME(#PARENT-I)
User Exit Definition .eTER-OBJECT-CALL U * * If object detected an invalid field, reinput the screen IF MSG-INFO.##ERROR-FIELD NE ' ' THEN CSMUSEX NATURAL CONSTRUCT Aug 10 Maintain User Exit 1 of 1 User exit name ......... AFTER-OBJECT-CALL Code frame name ........ COMC9 Conditional N User exit required ..... X Generate as subroutine . _ Sample subprogram ...... ________ Default user exit code . *_______________________________________________________________________ * Additional processing upon returning from object subprogram, for______ * example, MSG-INFO.##ERROR-FIELD or MSG-INFO.##MSG/MSG-NR could be_____ * overriden.____________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________
Define Model Model OBJECT-MAINT-DIALOG-SUBP displayed successfully CSDFM N A T U R A L C O N S T R U C T 4.1.2 CSDFM0 Aug 10 Maintain Models 1 of 1 Action ..................... __ A,B,C,D,M,N,P,R Model ...................... OBJECT-MAINT-DIALOG-SUBP________ Description ........ *0201_____________________________________________________ OBJECT-MAINT-DIALOG-SUBP Subprogram PDA name ................. CUOMPDA_ Status window ............ Y Programming mode ......... S_ Comment start indicator .. **_ Type ..................... N Subprog. Comment end indicator .... ___ Code frame(s) ............ COMA?___ COMB?___ COMC?___ COMD?___ ________ Modify server specificatn CUOMMA__ CUOMMB__ CUOMMC__ CUOMMD__ ________ ________ ________ ________ ________ ________ Modify client specificatn CUOMMA__ CUOMMB__ CUOMMC__ CUOMMD__ CUOMME__ ________ ________ ________ ________ ________ Clear specification ...... CUOMCS__ Post-generation .......... CUOMPS__ Read specification ....... CUOMR___ Save specification ....... CUOMS___ Pre-generation ........... CUOMPR__ Document specification ... CUOMD___ Command ............ __________________________________________________________ Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12--- help retrn quit frame main
PDAs • Common PDA • CU--PDA • Headers, Title, etc. • #PDA-FRAME-PARM Pass Parameter from Frame Code • Standard PDA • CSASTD • Message Fields • Model Specific PDA
Model Specific PDA • Condition Codes • #PDAC- (Logical) • Fields from Map(s) • #PDAX- • Derived Fields • #PDA-
Generate PDA Use CST-PDA 01 PDA-name 02 #PDA-CONDITION-CODES (L/75) 02 #PDA-USER-AREA (A100/40) 02 REDEFINE #PDA-USER-AREA 03 #PDAC-ADD-ACTION (L) 02 REDEFINE #PDA-USER-AREA 03 #PDAX-PRIME-FILE (A32) 03 #PDAX-PRIME-KEY (A32) 03 #PDAX-..... FIND. FIND (1) &PRIME-FILE WITH &PRIME-KEY = #KEY MOVE *ISN (FIND.) TO #UPDATE-ISN ESCAPE BOTTOM (FIND.) END-FIND
Modify PDA • EDIT PDA-name • Use the editor to change the PDA 01 #KEY (&KEY-FORMAT) 01 PDA-name 02 #PDA-CONDITION-CODES (L/75) 02 #PDA-USER-AREA (A100/40) 02 REDEFINE #PDA-USER-AREA 03 #PDAX-PRIME-FILE (A32) 03 #PDAX-PRIME-KEY (A32) 03 #PDAX-..... ** 03 #PDA-KEY-FORMAT (A15)
Design & Build Modify Map(s) • Minimize User Parameters-System • Globals • Direct Command Processing • Vertical Scroll Pages • etc. • Minimize User Parameters-Module • Use PREDICT • Use Maps • Supplied PREDICT & NATURAL Objects • Use Standard Helproutines
Minimize User Parameters CUSCMA BROWSE Program CU--MA0 Aug 10 Standard Parameters 1 of 4 Module ............. MYBROWSE System ............. NATURAL-CONSTRUCT_______________ Global data area ... CDGDA___ With block ......... ________________________________ Title .............. Browse ..._______________ Description ........ This program is used to browse the ..._________________ _______________________________________________________ _______________________________________________________ _______________________________________________________ First heading ...... ________________________________________________ Second heading ..... ______________________________________________________ Command ............ _ Message numbers .... _ Password ........... _ Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12--- right help retrn quit right main
Use Standard Helproutines Parameter data area is required CUGRMA CST-READ Subprogram CUG-MA0 of 1 Position cursor or enter screen value to select CNHOBJN NATURAL CONSTRUCT CNHOBJ0 Aug 10 Select Parameter 1 of 1 Module Type SM Vers Level User Date Time -------- ------------ ---- ---- -------- -------- -------- -------- ____ CD-MKEY Parameter 2.2 0008 CST412 98-02-26 18:17:09 ____ CDAAACTA Parameter 2.2 0008 CST412 98-02-26 18:17:09 ____ CDACTA Parameter 2.2 0008 CST412 98-02-26 18:17:10 ____ CDACTD Parameter 2.2 0008 CST412 98-02-26 18:17:10 CDACURS Parameter 2.2 0008 CST412 98-02-26 18:17:13 CDADEBUG Parameter 2.2 0008 CST412 98-02-26 18:17:13 CDAMARK Parameter 2.2 0008 CST412 98-02-26 18:17:14 CDAOBJ Parameter 2.2 0008 CST412 98-02-26 18:17:15 CDAOBJ2 Parameter 2.2 0008 CST412 98-02-26 18:17:15 CDAPPFKA Parameter 2.2 0008 CST412 98-02-26 18:17:15 Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10- help retrn bkwrd frwrd
Generate Subprograms CSGMAIN ***** N A T U R A L C O N S T R U C T 4.1.2 ***** CSGMNM1 Aug 10 - GENERATION MAIN MENU - 05:00 PM Code Function Spec Panel Model Options ---- ------------------------------------- ---- ----- ----- ------- R Read specification and object R O M Modify specification panel(s) O O R U User exit editor R G Generate source from specification R R O T Test generated source R E Edit generated source R S Save specification and source R O W Stow specification and source R O L List generated programs for selection O C Clear specification and edit buffer O ?/. Help/Terminate ---- ------------------------------------- ---- ----- ----- ------- Code...: _ Specification/Program: EXCELRD_ Panel..: __ Library....: SYSTEM Model..: CST-READ________________________ Options: _ Object type: Subprog. Desc...: MODEL READ Subprogram
Generate Subprograms • No User Exits Needed • POSTGENERATE • READ • User Exits - Optional • CLEAR • DOCUMENT • User Exits - Required • PREGENERATE • SAVE
Subprograms - No User Exits • POSTGENERATE • Substitute values for ‘&’ in Code Frame • READ • Retrieve #PDAX- values from the most recently generated object
Subprograms - Optional User Exits • CLEAR • Initialize PDA fields • Optionally provide defaults for PDA fields • DOCUMENT - Suggestions • Description • Inputs • Non-standard PF Keys • Miscellaneous details of interest
Clear Subprogram CSGSAMPL CST-CLEAR Subprogram CSGSM0 Aug 10 User Exits 1 of 1 User Exits Exists Sample Required Conditional -------------------------------- -------- ---------- -------- ------------ _ CHANGE-HISTORY Subprogram _ PARAMETER-DATA _ BEFORE-CHECK-ERROR Example _ LOCAL-DATA _ PROVIDE-DEFAULT-VALUES Subprogram _ ADDITIONAL-INITIALIZATIONS Example _ END-OF-PROGRAM Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12--- help retrn quit bkwrd frwrd
Document Subprogram CSGSAMPL CST-DOCUMENT Subprogram CSGSM0 Aug 10 User Exits 1 of 1 User Exits Exists Sample Required Conditional -------------------------------- -------- ---------- -------- ------------ _ CHANGE-HISTORY Subprogram _ PARAMETER-DATA _ BEFORE-CHECK-ERROR Example _ LOCAL-DATA _ START-OF-PROGRAM _ ADDITIONAL-TRANSLATIONS _ ADDITIONAL-INITIALIZATIONS Example _ DESCRIBE-INPUTS Example _ PF-KEYS Subprogram _ MISCELLANEOUS-VARIABLES Subprogram _ END-OF-PROGRAM Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12--- help retrn quit bkwrd frwrd
Document Subprogram CUGDSKEY ***** MODEL DOCUMENT Subprogram ***** CUGDSM1 - SUPPORTED PF KEYS - 05:19 PM Mark the keys to be supported by the generated Validation for Update Edits subprogram _ help _ pref _ retrn _ confm _ quit _ add _ flip _ place _ bkwrd _ frwrd _ left _ right _ main _ print
Subprograms - Required User Exits • PREGENERATE • Set #PDAC- Condition Codes to True • Derive #PDA- variables • SAVE • Save supplied #PDAX- values by writing them to the source (**SAG ...)
PreGenerate Subprogram CSGSAMPL CST-DOCUMENT Subprogram CSGSM0 Aug 10 User Exits 1 of 1 User Exits Exists Sample Required Conditional -------------------------------- -------- ---------- -------- ------------ _ CHANGE-HISTORY Subprogram _ PARAMETER-DATA _ BEFORE-CHECK-ERROR Example _ LOCAL-DATA _ START-OF-PROGRAM _ ADDITIONAL-TRANSLATIONS _ ADDITIONAL-INITIALIZATIONS Example _ DESCRIBE-INPUTS Example _ PF-KEYS Subprogram _ MISCELLANEOUS-VARIABLES Subprogram _ END-OF-PROGRAM Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12--- help retrn quit bkwrd frwrd
PreGenerate Subprogram 0010 DEFINE EXIT SET-CONDITION-CODES 0020 * Set conditions in PDA. 0030 DECIDE FOR EVERY CONDITION 0040 WHEN #PDAX-GDA NE ' ' 0050 ASSIGN #PDAC-GDA-SPECIFIED = TRUE 0060 WHEN NONE 0070 IGNORE 0080 END-DECIDE 0090 END-EXIT 0100 DEFINE EXIT GENERATE-CODE 0110 IF #PDAX-PDA NE ' ' 0120 ASSIGN #PDA-PRIMARY-DATA = #PDAX-PDA 0130 ELSE 0140 ASSIGN #PDA-PRIMARY-DATA = #PDAX-LDA 0150 END-IF 0160 END-EXIT
Save Subprogram CSGSAMPL CST-SAVE Subprogram CSGSM0 Aug 10 User Exits 1 of 1 User Exits Exists Sample Required Conditional -------------------------------- -------- ---------- -------- ------------ _ CHANGE-HISTORY Subprogram _ PARAMETER-DATA _ BEFORE-CHECK-ERROR Example _ LOCAL-DATA Example _ START-OF-PROGRAM X SAVE-PARAMETERS Subprogram X _ ADDITIONAL-INITIALIZATIONS Example _ END-OF-PROGRAM