Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Noreen Redden FOCUS Users of New England 2012 MFD_PROFILE PROFILE for Your Synonym:

Similar presentations


Presentation on theme: "1 Noreen Redden FOCUS Users of New England 2012 MFD_PROFILE PROFILE for Your Synonym:"— Presentation transcript:

1 1 Noreen Redden FOCUS Users of New England 2012 MFD_PROFILE PROFILE for Your Synonym:

2 MFD_PROFILE The Basics 2 2

3 MFD_PROFILE Why? Set the values of global variables defined in the Master File for use in Master and/or Access File Descriptions. Create a lookup file for Master File DEFINE commands or DBA attributes. Create a DBAFILE, which can be derived from an external data source and used to restrict access during execution of a request that references the Master File. Issue FOCUS commands such as JOIN or FILTER FILE. 3

4 4 MFD_PROFILE What and When FOCEXEC (.fex) file executed EACH TIME is opened for: TABLE TABLEF GRAPH MATCH FILE CHECK, ?f, ?ff Multiple MFD_PROFILES may be executed JOIN or Cross-References MORE MATCH FILE

5 MFD_PROFILE Global Variables VARIABLE NAME=[&&]var, USAGE=Aln, [DEFAULT=defvalue,][QUOTED={OFF|ON},] $ Master Attributes which may be parameterized include: POSITION OCCURS REMARKS DESCRIPTION TITLE HELPMESSAGE DBA USERID and VALUE Access Attributes which may be parameterized include: CONNECTION TABLENAME DIRECTORY EXTENSION 5

6 MFD_PROFILE: Global Variables FILE=GRPPOL,SUFFIX=SQLORA,MFD_PROFILE=GRPPOL VARIABLE NAME=LTD, USAGE=A30, DEFAULT='LTD or ETD',$ SEGNAME=GRPPOL,SEGTYPE=S0 FIELD=GROUP_CODE,GCODE,A8,TITLE='Group Code',$ FIELD=GROUP_NAME,,A30,TITLE='Group Policy Holder',$ FIELD=CONTRACT_NO,CONTRACT,A8,TITLE='Contract Number',$ FIELD=LONG_TERM,LTD,A1,TITLE=&<D, $ FIELD=EFFECT_DATE,,YYMD,TITLE='Effective,Date',$ -IF &1 NE ‘GRPPOL’ GOTO NOVAR1; -SET &<D = IF &&TEAM_NAME EQ ‘GM’ THEN ‘Extended Term’ ELSE - ‘Long Term’; - NOVAR1 6

7 Create or Point to Files FILE=GRPPOL,SUFFIX=SQLORA,MFD_PROFILE=GRPPOL VARIABLE NAME=LTD, USAGE=A30, DEFAULT='LTD or ETD',$ SEGNAME=GRPPOL,SEGTYPE=S0 FIELD=GROUP_CODE,GCODE,A8,TITLE='Group Code',$ FIELD=GROUP_NAME,,A30,TITLE='Group Policy Holder',$ FIELD=CONTRACT_NO,CONTRACT,A8,TITLE='Contract Number',$ FIELD=LONG_TERM,LTD,A1,TITLE=&<D, $ FIELD=EFFECT_DATE,,YYMD,TITLE='Effective,Date',$ FILTER SELECTGRPS = IF DECODE GROUP_CODE(TEAMRESP ELSE 2) EQ 0 THEN 1 ELSE 0 ; -IF &1 NE ‘GRPPOL’ GOTO NOVAR1; -SET &<D = IF &&TEAM_NAME EQ ‘GM’ THEN ‘Extended Term’ ELSE - ‘Long Term’; -NOVAR1 FILEDEF TEAMRESP DISK c:\userapp\teamresp.dat 7 MFD_PROFILE

8 Security FILE=GRPPOL,SUFFIX=SQLORA,MFD_PROFILE=GRPPOL SEGNAME=GRPPOL,SEGTYPE=S0 VARIABLE NAME=&<D, USAGE=A30, DEFAULT='LTD or ETD',$ VARIABLE NAME=&&UID, USAGE=A8, DEFAULT=‘ ‘,$ VARIABLE NAME=&&DBAVAL,USAGE=A50, DEFAULT=GROUP_CODE EQ ‘X’ AND GROUP_CODE EQ ‘Y’;,$ FIELD=GROUP_CODE,GCODE,A8,TITLE='Group Code',$ FIELD=GROUP_NAME,,A30,TITLE='Group Policy Holder',$ FIELD=CONTRACT_NO,CONTRACT,A8,TITLE='Contract Number',$ FIELD=LONG_TERM,LTD,A1,TITLE=&<D, $ FIELD=EFFECT_DATE,,YYMD,TITLE='Effective,Date',$ FILTER SELECTGRPS = IF DECODE GROUP_CODE(TEAMRESP ELSE 2) EQ 0 THEN 1 ELSE 0 ; END DBA=DBA,$ USER=&&UID,ACCESS=R,RESTRICT=VALUE_WHERE, NAME=GRPPOL,VALUE=&&DBAVAL,$ MFD_PROFILE 8

9 -IF &1 NE ‘GRPPOL’ GOTO NOVAR1; -SET &<D = IF &&TEAM_NAME EQ ‘GM’ THEN ‘Extended Term’ ELSE - ‘Long Term’; -NOVAR1 TABLE FILE TEAMS PRINT GRP_RESP WHERE TEAM EQ &&TEAM_NAME ON TABLE SAVE AS TEAMRESP END -ALL -SET &&DBAVAL= SELECTGRPS; MFD_PROFILE: Security 9

10 FILE=GRPPOL,SUFFIX=SQLORA,MFD_PROFILE=GRPPOL VARIABLE NAME=&<D, USAGE=A30, DEFAULT='LTD or ETD',$ SEGNAME=GRPPOL,SEGTYPE=S0 FIELD=GROUP_CODE,GCODE,A8,TITLE='Group Code',$ FIELD=GROUP_NAME,,A30,TITLE='Group Policy Holder',$ FIELD=CONTRACT_NO,CONTRACT,A8,TITLE='Contract Number',$ FIELD=LONG_TERM,LTD,A1,TITLE=&<D, $ FIELD=EFFECT_DATE,,YYMD,TITLE='Effective,Date',$ FILTER SELECTGRPS = IF DECODE GROUP_CODE(TEAMRESP ELSE 2) EQ 0 THEN 1 ELSE 0 ; END DBA=DBA,DBAFILE=MYFILE,$ MFD_PROFILE: Security 10

11 DEFINE FILE SYSCOLUM LINENO WITH TBNAME = LINENO + 1; LINED/A80 = IF LINENO EQ 1 THEN 'FILE=MYFILE,SUFFIX=FIX' ELSE IF LINENO EQ 2 THEN ' SEGNAME=ONE,SEGTYPE=S0' ELSE IF LINENO EQ 3 THEN ' FIELDNAME=ONE,,A1,A1,$' ELSE IF LINENO EQ 4 THEN 'END' ELSE IF LINENO EQ 5 THEN 'DBA=DBA,$' ELSE IF LINENO EQ 6 THEN 'USER='' '',ACCESS=R, RESTRICT=VALUE,NAME=SYSTEM, ' | ' VALUE= RECORDLIMIT EQ 5,$' ELSE IF LINENO EQ 7 THEN ' RESTRICT=VALUE,VALUE=' | 'SELECTGRPS,$' ELSE IF LINENO EQ 8 THEN 'USER=NORM,ACCESS=R,' | 'RESTRICT=VALUE,NAME=SYSTEM,' | 'VALUE=SELECTGRPS,$' ELSE ' '; END TABLE FILE SYSCOLUM PRINT LINED ON TABLE SAVE AS MYFILE WHERE LINENO LE 8 END MFD_PROFILE: Security 11

12 Prerequisites FILE=GRPPOL,SUFFIX=SQLORA,MFD_PROFILE=GRPPOL SEGNAME=GRPPOL,SEGTYPE=S0 … FIELD=EFFECT_DATE,,YYMD,TITLE='Effective,Date',$ FILTER SELECTGRPS = IF DECODE GROUP_CODE(TEAMRESP ELSE 2) EQ 0 THEN 1 ELSE 0 ; -NOVAR1 TABLE FILE TEAMS PRINT GRP_RESP WHERE TEAM EQ &&TEAM_NAME ON TABLE SAVE AS TEAMRESP END FILTER FILE GRPPOL DAYS/I5 = DATEDIFF(EFFECT_DATE,'&YYMD','D‘); NAME=CURRENT WHERE DAYS LE 5 END SET FILTER = CURRENT IN GRPPOL ON MFD_PROFILE 12

13 MFD_PROFILE GG Application 13

14 Application Requirements Validate all user access to the files. Only Managers have access to orders > 1 week old. Corporate users have access to GGORDERS and GGPRODs for all stores/regions. Store users have access to GGORDERS only for their store. Regional personnel have access to GGORDERS for all stores within the Region. 14

15 Application Synonyms 15

16 GGORDER FILENAME=GGORDER, SUFFIX=FOC,MFD_PROFILE=GGPROF,$ SEGNAME=ORDER01, SEGTYPE=S1,$ FIELD=ORDER_NUMBER, ALIAS=ORDNO1, FORMAT=I6, TITLE='Order,Number', DESC='Order Identification Number',$ FIELD=ORDER_DATE, ALIAS=DATE, FORMAT=MDY, TITLE='Order,Date', DESC='Date order was placed',$ FIELD=STORE_CODE, ALIAS=STCD, FORMAT=A5, TITLE='Store,Code', DESC='Store Identification Code (for order)',$ FIELD=PRODUCT_CODE, ALIAS=PCD, FORMAT=A4, TITLE='Product,Code', DESC='Product Identification Code (for order)',$ FIELD=QUANTITY, ALIAS=ORDUNITS, FORMAT=I8, TITLE='Ordered,Units', DESC='Quantity Ordered',$ SEGNAME=ORDER02, SEGTYPE=KU, PARENT=ORDER01, CRFILE=GGPRODS, CRKEY=PCD, CRSEG=PRODS01,$ FILTER CURRENT = DATEDIF(ORDER_DATE,'&YYMD','D') LE 5;,$ END DBA=DBA,DBAFILE=GGPROFP,$ 16

17 GGPRODS FILENAME=GGPRODS, SUFFIX=FOC,MFD_PROFILE=GGPROFP,$ SEGNAME=PRODS01, SEGTYPE=S1 FIELD=PRODUCT_ID, ALIAS=PCD, FORMAT=A4, INDEX=I, TITLE='Product,Code', $ FIELD=PRODUCT_DESCRIPTION, ALIAS=PRODUCT, FORMAT=A16, TITLE='Product', $ FIELD=VENDOR_CODE, ALIAS=VCD, FORMAT=A4, INDEX=I, TITLE='Vendor ID', $ FIELD=VENDOR_NAME, ALIAS=VENDOR, FORMAT=A23, TITLE='Vendor Name', $ FIELD=PACKAGE_TYPE, ALIAS=PACK, FORMAT=A7, TITLE='Package‘,$ FIELD=SIZE, ALIAS=SZ, FORMAT=I2, TITLE='Size', $ FIELD=UNIT_PRICE, ALIAS=UNITPR, FORMAT=D7.2, TITLE='Unit,Price', $ END DBA=DBA,DBAFILE=GGPROFP,$ 17

18 GGREGION FILENAME=GGREGION, SEGNAME=SALES01, SEGTYPE=DKU,CRFILE=GGSALES, CRINCLUDE=ALL,$ FOLDER=GGREGION,$ FIELD=REGION, ALIAS=E05, FORMAT=A11, INDEX=I, TITLE='Region', DESC='Region code',$ FIELD=STCD, ALIAS=E08, FORMAT=A05, INDEX=I, TITLE='Store ID', DESC='Store identification code (for sale)',$ 18

19 Human Resources File FILENAME=HR, SUFFIX=ORASQL,$ SEGNAME=HR1, SEGTYPE=S0 FIELD=EID, ALIAS=employeeid, FORMAT=A09, A09,$ FIELD=JOBCODE,jobcode,A8,A8,$ FIELD=DIVISION, ALIAS=division, FORMAT=A23, A23, DESC=CORP or Region name,$ FIELD=STORENUMBER, ALIAS=storeno, FORMAT=A5, A5,$ END DBA=pO02_can,$ USER=pOc02_an,ACCESS=R,$ 19

20 GGPROFP.fex -DYNAM ALLOC F HR DA PMSNMR.HR.FOCUS SHR REU -RUN SET MSG=OFF SET DBACSENSITIV = ON SET COLLATION=SRV_CI -RUN TABLE FILE HR PRINT * WHERE EID EQ '&&LOGON_ID' ON TABLE SAVE AS HR1 FORMAT ALPHA END -RUN -SET &LNES = &LINES; -RDIT -SET &FOUNDIT = IF &LNES EQ 0 THEN 'N' ELSE 'Y'; 20

21 GGPROFP.fex(cont) -SET &JOBCODE = '________'; -IF &FOUNDIT EQ 'N' GOTO WRITIT; -READ HR1 &EID.9. &JOBCODE.A8. &DIVISION.A23. &STNMBR.A5. -* could use –READFILE (RELEASE 7.7) -* Only build for current user, -SET &USER = 'USR' | &MDYY | EDIT(&JOBCODE, '$$$9'); -* rules based on last 2 digits of JOBCODE -SET &JOBL = EDIT(&JOBCODE,'$$$$$$99'); -RUN -PASS &USER 21

22 GGPROF.fex (cont) FILEDEF OUTFI DISK TEMP/GGPROFP.mas -RUN -WRITIT -* CREATES THE DBAFILE GGPROFP.MAS -WRITE OUTFI FILE=GGPROFP,SUFFIX=FIX -WRITE OUTFI SEGNAME=ONE,SEGTYPE=S0 -WRITE OUTFI FIELDNAME= ONE,,A1,A1,$ -WRITE OUTFI END -WRITE OUTFI DBA=DBA,$ -*ET &ECHO=ALL; -SET &RST = 'ACCESS = R,'; -WRITE OUTFI USER = &USER, &RST -IF &FOUNDIT EQ 'N' GOTO NOG; 22

23 GGPROF.fex (cont) -* CORP MANAGERS HAVE NO RESTRICTIONS -IF &DIVISION EQ 'CORP' AND &JOBL GE '09' GOTO END1; -* CORP NON-MANAGERS ARE RESTRICTED ONLY ON CURRENT -IF &DIVISION EQ 'CORP' GOTO NOST; -* ALL OTHERS ARE RESTRICTED ON STORE CODES -SET &RST2= 'RESTRICT=VALUE_WHERE,NAME=SYSTEM,'; -WRITE OUTFI &RST2 -WRITE OUTFI VALUE=STORE_CODE IN FILE STRS;,$ -* NON-MANAGERS RESTRICTED TO CURRENT INFORMATION -NOST -SET &RST2= 'RESTRICT=VALUE_WHERE,NAME=SYSTEM,'; -IF &JOBL GE '09' GOTO END1; -WRITE OUTFI &RST2| VALUE=CURRENT;,$ -GOTO END1; 23

24 GGPROF.fex (cont) -NOG -SET &RST2= 'RESTRICT=VALUE_WHERE,NAME=SYSTEM,'; -WRITE OUTFI &RST2 -WRITE OUTFI VALUE=STORE_CODE EQ 'A' -WRITE OUTFI VALUE= AND STORE_CODE EQ 'B';,$ -END1 -WRITE OUTFI,$ -CLOSE OUTFI 24

25 GGPROF.fex (cont) -* DBAFILE WRITTEN, BUT STORE_CODES SHOULD BE IN FILE -IF &DIVISION EQ 'CORP' GOTO NOM; TABLE FILE GGREGION PRINT STCD -IF &JOBL GE '06' GOTO REGT; WHERE STCD EQ '&STNMBR' ; -GOTO FINTEST -REGT WHERE REGION EQ '&DIVISION' ; -FINTEST ON TABLE SAVE AS STRS END -RUN 25

26 Output: Regional User Store Order Ordered Code Date Units R /30/ /01/ R /28/ /29/ /30/ /01/ R /28/ /29/ /30/ /01/ USER = USR X, ACCESS = R, RESTRICT=VALUE_WHERE,NAME=SYSTEM, VALUE=STORE_CODE IN FILE STRS;,$ RESTRICT=VALUE_WHERE,NAME=SYSTEM, VALUE=CURRENT;,$,$ 26

27 Output: Regional Manager Store Order Ordered Code Date Units R /02/ /03/ /04/ /08/ R /02/ /15/ /19/ R /02/ /15/ USER = USR X, ACCESS = R, RESTRICT=VALUE_WHERE,NAME=SYSTEM, VALUE=STORE_CODE IN FILE STRS;,$,$ 27

28 Output: Store User PAGE 1 Store Order Ordered Code Date Units R /30/ /01/ USER = USR X, ACCESS = R, RESTRICT=VALUE_WHERE,NAME=SYSTEM, VALUE=STORE_CODE IN FILE STRS;,$ RESTRICT=VALUE_WHERE,NAME=SYSTEM, VALUE=CURRENT;,$,$ 28

29 Output: Corporate Manager Store Order Ordered Code Date Units R /30/ /01/ R /28/ /29/ /30/ /01/ R /30/ /01/ R /28/ /29/ /30/ USER = USR X, ACCESS = R, RESTRICT=VALUE_WHERE,NAME=SYSTEM, VALUE=CURRENT;,$,$ 29

30 Output: Invalid User USER = USR , ACCESS = R, RESTRICT=VALUE_WHERE,NAME=SYSTEM, VALUE=STORE_CODE EQ 'A',$ VALUE= AND STORE_CODE EQ 'B';,$,$ (FOC047) THE USER DOES NOT HAVE SUFFICIENT ACCESS RIGHTS TO THE FILE: GGORDER 30

31 31


Download ppt "1 Noreen Redden FOCUS Users of New England 2012 MFD_PROFILE PROFILE for Your Synonym:"

Similar presentations


Ads by Google