340 likes | 594 Views
Migrating 4GL to Genero A Case Study Tom Smith Fourth Generation Software WAIUG/SEIUG Washington 2006. Introduction. Tom Smith Senior Tools Developer Fourth Generation Software. Agenda. Our Goals. The Planning Process. The Conversion Process. Differences from Four J’s BDL.
E N D
Migrating 4GL to Genero A Case Study Tom Smith Fourth Generation Software WAIUG/SEIUG Washington 2006
Introduction Tom Smith Senior Tools Developer Fourth Generation Software
Agenda Our Goals The Planning Process The Conversion Process Differences from Four J’s BDL Technical Topics and Examples Question & Answer
Our Starting Point • Software company • Tool (RAD/CASE) • Accounting Package • Single code stream
Our Goals • Goal #1: Standard Windows UI • Other goals: • Major Update NOT Rewrite • Clean Code • Customer Migration Path
Big Concessions • Not Backward Compatible • Drop Text UI
Key Features Required • Standard Windows Key Strokes • Windows Look & Feel • Top Menu • Tool Bars • Right Click
The Planning Process • Levels of Conversion • Level 1: Almost no conversion
The Planning Process • Levels of Conversion • Level 2: Minimum conversion
The Planning Process • Levels of Conversion • Level 3: Extended conversion
The Planning Process • Levels of Conversion • Level 4: Full conversion • Do Extended conversion plus: • Localized strings • TEXTEDIT • COMBOBOX • RADIOGROUP • CHECKBOX • FOLDER/PAGE ( screen tabs) • GROUP • STRING
The Planning Process • Analysis • Scope • Programming Consistency • Generated Code? • Can Code Changes Be Automated. • Retain Dual Environments? • Convert all-at-one-time?
The Conversion Process • Low level code (libraries) • UI statements: • Window/form: • OPEN WINDOW, OPEN FORM... • Interactive instructions: • MENU, INPUT, INPUT ARRAY, CONSTRUCT and DISPLAY ARRAY • 4gl and 'C' routines. • Remove references to 'PROMPT' and 'DISPLAY AT' statements • High level code (applications) • Test • Deploy
Differences from Four J’s BDL • What Has NOT changed • Language structure • Tools: • fgl2p, fglform, fglcomp, fgllink, fglmkrun, fglrun, fglschema (fgldbsch), fglWrt • Environment variables
Differences from Four J’s BDL • What HAS changed • Style Sheets • FGLPROFILE
endangered species animal animal name weight subspecies subspecies tiger 500 name region population siberian russia 445 What you need to now about XML The 'DOM' (Document Object Model) tree. XML <endangered_species> <animal> <name>Tiger</name> <weight>500</weight> <subspecies> <name>Siberian</name> <region>Russia</region> <population>445</population> </subspecies> <subspecies> <name>Bengal</name> <region>India</region> <population>3159</population> </subspecies> </animal> <animal> <name>Black Rhino</name> <subspecies> <name>Southern Black Rhino</name> <region>Zimbabwe</region> <population>1365</population> </subspecies> <subspecies> <name>Southwestern Black Rhino</name> <region>Namibia</region> <population>740</population> </subspecies> </animal> </endangered_species>
Initial considerations • What tools do you need ? • Will automating a task save time ? • Where to use Style Sheets ? • XML based Style Sheets: • Styles: 4st • Action defaults: 4ad • ToolBar: 4tb • TopMenu: 4tm
Technical Specifics • How to change an application's form files • OPEN WINDOW • ON ACTION • Localized strings
How to change an application's form file • After • Before SCHEMA standard LAYOUT VBOX GRID { : : Ordinary Text and fields : } END -- GRID TABLE { : : Arrays - Single-line : } END -- TABLE SCROLLGRID { : : Arrays - Multi-line : } END -- SCROLLGRID END -- VBOX END -- LAYOUT ATTRIBUTES : INSTRUCTIONS : DATABASE standard SCREEN { : : Ordinary Text, fields and arrays : } ATTRIBUTES : INSTRUCTIONS :
How to change an application's form file SCREEN section • After • Before SCHEMA standard LAYOUT VBOX GRID { Test Example Code...:[A0 ] Name...:[A1 ] Address:[A2 ] City-State-Zip:[A3 |A4|A5 ] Date...:[A6 ] } END -- GRID TABLE { Contact Description [A7 ][A8 ] [A7 ][A8 ] [A7 ][A8 ] [A7 ][A8 ] } END -- TABLE END -- VBOX END -- LAYOUT DATABASE standard SCREEN SIZE 20 BY 80 { ------------ Test Example ---------- Code...:[A0 ] Name...:[A1 ] Address:[A2 ] City-State-Zip:[A3 |A4|A5 ] Date...:[A6 ] Contact Description [A7 ][A8 ] [A7 ][A8 ] [A7 ][A8 ] [A7 ][A8 ] }
How to change an application's form file Tables section:Unchanged. Attributes section: • After • Before ATTRIBUTES A0 = tsthead.ccode; A1 = tsthead.cname; A2 = tsthead.caddress; A3 = tsthead.ccity; buttonedit A4 = tsthead.cstate, image="gn_arrdn.png", action=ac_zoom; A5 = tsthead.czip"; dateedit A6 = tsthead.cdate; A7 = tstdetl.ctype; A8 = tstdetl.cdescription; A0 = tsthead.ccode; A1 = tsthead.cname; A2 = tsthead.caddress; A3 = tsthead.ccity; A4 = tsthead.cstate; A5 = tsthead.czip; A6 = tsthead.cdate; A7 = tstdetl.ctype; A8 = tstdetl.cdescription; dateedit field: buttonedit field: Instruction section:Unchanged: Delimiters: Remove
How to change an application's form file Problem areas: What if: One space Contact Description [A7 ] [A8 ] This results in: The column heading should not be: 'Contact Description'. The rule is that at least two (2) spaces must separate column titles.
How to change an application's form file Fix 1: Two spaces Contact Description [A7 ] [A8 ] This results in the correct: Fix 2: TABLE (WIDTH=46) { [A7 ][A8 ] [A7 ][A8 ] [A7 ][A8 ] [A7 ][A8 ] } : : : A7 = tstdetl.ctype, TITLE="Contact"; A8 = tstdetl.cdescription,TITLE="Description";
How to change an application's form file BUTTON Standard push button with a label or a picture. Replaces WIDGET="BMP" BUTTONEDIT Line edit box with a button on the right side. Replaces WIDGET="FIELD_BMP" CANVAS Area reserved for drawing. Replaces WIDGET="CANVAS" CHECKBOX Boolean entry with a box and a text label. Replaces WIDGET="CHECK" COMBOBOX Text edit box with a button that opens a list of values. Replaces WIDGET="COMBO" DATEEDIT Line edit box with a button that opens a calendar window. EDIT Simple line edit box for data input or display. GROUP Attributes of a GROUP container specified with a layout tag. IMAGE Area where a picture file can be displayed. Replaces WIDGET="IMAGE" LABEL Area reserved to display a value. PROGRESSBAR Progress bar widget to display an integer value. RADIOGROUP Field presented with a set of radio buttons. Replaces WIDGET="RADIO" SCROLLGRID Attributes of a SCROLLGRID container specified with a layout tag. TABLE Attributes of a TABLE container specified with a layout tag. TEXTEDIT Multi-line edit box for data input or display.
How to change an application's form file • Before sh =FORMONLY.shipto, widget="BMP", config="shipto.bmp Control-P"; • After BUTTON sh : ac_shipto, image="shipto.bmp";
OPEN WINDOW • Before open window w_shiptod at y_pos, x_pos with form "ship_oe" attribute (blue, border) • After OPEN WINDOW w_shiptod AT y_pos, x_pos WITH FORM "ship_oe" ATTRIBUTES(TEXT="OE Shipto",STYLE="gn_main")
OPEN WINDOW Previously the system-wide 'Style' 'Style sheet' was loaded with: CALL ui.Interface.loadStyles("gn_default") [gn_default.4st] <Style name="Window.gn_main"> <StyleAttribute name="windowType" value="normal" /> <StyleAttribute name="startMenuPosition" value="menu" /> <StyleAttribute name="ringMenuPosition" value="bottom" /> <StyleAttribute name="ringMenuButtonSize" value="shrink" /> <StyleAttribute name="ringMenuButtonSpace" value="tiny" /> <StyleAttribute name="sizable" value="yes" /> <StyleAttribute name="hideToolBar" value="0" /> <StyleAttribute name="hideStatusBar" value="0" /> <StyleAttribute name="actionPanelPosition" value="bottom" /> <StyleAttribute name="position" value="center" /> <StyleAttribute name="statusBarType" value="lines2" /> </Style>
ON ACTION ON ACTION replaces ON KEY" and "ON COMMAND" • Before on key (control-p) CALL zmShipto() • After ON ACTION ac_shipto CALL zmShipto()
ON ACTION A program-wide 'ToolBar' 'Style sheet' was loaded with: CALL fmMain.loadToolBar("gn_shipto") [gn_shipto.4tb] <ToolBar name="custom" buttonTextHidden="1"> <ToolBarItem name="ac_shipto" image="gn_shipto.png" text="Ship To"/> </ToolBar> A program-wide 'TopMenu' 'Style sheet' was loaded with: CALL fmMain.loadTopMenu("gn_shipto") [gn_shipto.4tm] <TopMenuGroup text="Custom"> <TopMenuCommand name="ac_shipto" text="Ship To" /> </TopMenuGroup> A program-wide 'Action Defaults' style sheet was loaded with: CALL fmMain.loadActionDefaults("gn_shipto") [gn_shipto.4ad] <ActionDefaultList name="custom"> <ActionDefault name="ac_shipto" acceleratorName="Control-p"/> </ActionDefaultList>
Localized strings Localized strings. Form File [lb01]: [nm ] : LABEL lb01 : TEXT=%"lb_cust_name"; $ fglform -m test.per > test.str Code ATTRIBUTES(TEXT=%"cust_maint", ERROR %"no_record" $ fglcomp -m test.4gl >> test.str $ vi test.str "lb_cust_name"="Customer name" "cust_maint"="Customer Maintenance Screen" "no_record"="No record satisfies query" $ fglmkstr test.str test.42s
More info For more info… toms@fourthgeneration.com www.fourthgeneration.com