131
Advantage:2E Training Contents •Introduction to Advantage:2E •Files And Fields •Access Paths •Functions (Basics Concepts and Device Design) •Functions (Action Diagram)

synon

Embed Size (px)

Citation preview

Page 1: synon

Advantage:2E Training

Contents•Introduction to Advantage:2E•Files And Fields•Access Paths•Functions (Basics Concepts and Device Design)•Functions (Action Diagram)

Page 2: synon

Advantage :2E Training INTRODUCTION TO ADVANTAGE 2E:

Page 3: synon

Introduction to Advantage:2EWhat is Advantage:2E?

An application development toolKnowledge of programming language not requiredPlatform independent application designAllows efficient design, development, implementation & maintenance of application software

Page 4: synon

Advantage:2EApplication development tool for AS/400Includes Advantage:2E/1E

Advantage:2E/2GProvides PC based GUI for Advantage:2E

Advantage:2E/CSG (Client Server Generator)Option to Advantage:2E which allows distributed functionality on multiple platforms

Introduction to Advantage:2EAdvantage:2E Products

Page 5: synon

Libraries NeededY1SYY2SYModel Library (e.g. JRKTESTMDL)

Library in which the model residesGeneration Library (e.g. JRKTESTGEN)

Associated with each model libraryContains source files, compiled programs, help text, access paths (created using DDS) and journalsFew Important Source Physical Files

QDDSSRC (Source Code of PFs, LFs, DSPFs …)QRPGLESRC (RPG Source code for functions generated)

Enter Command – M *Y2 – To start Synon

Introduction to Advantage:2E Getting Past Menus

Page 6: synon

Introduction to Advantage:2E Getting Past Menus (Contd..)

Page 7: synon

*DSNRCan be said SuperUser of SynonFiles/Access Paths – Read/Write/ChangeFunctions – Read/Write/Change

*PGMRFiles/Access Paths – Read OnlyFunctions – Read/Write/Change

*USERFiles/Access Paths – Read OnlyFunctions – Read Only

Introduction to Advantage:2EAdvantage:2E Main Menu

Page 8: synon

Introduction to Advantage:2EAdvantage:2E Main Menu

Page 9: synon

1 – Edit Database RelationsUsed to make changes in the Model(Actual Work)

2 – Services MenuUsed to generate and compile source codes(Generation Work)

Introduction to Advantage:2ESecond Level Menu

Page 10: synon

Introduction to Advantage:2ESecond Level Menu

Page 11: synon

Introduction to Advantage:2EDatabase Relations Panel

Page 12: synon

Advantage :2E TrainingSYNON FILES

Page 13: synon

Advantage:2E Files

Each Advantage:2E File has a Name and a File TypeAdvantage:2E File Naming rules

•must be valid Advantage:2E Name•unique within the model•up to 25 characters including embedded blanks•e.g. Purchase Order is a valid Advantage:2E file Name

Advantage:2E File TypesFile Attribute Description ExampleDatabase CPT Capture file Order Entry

REF Reference file Company fileNon-database STR Structure file Audit date & time

stamp

Page 14: synon

File Types-Reference (REF) files

•master files that contain non-volatile information•e.g. Product, Employee,Customer

Capture (CPT) files•contain transactional data that is recorded regularly•e.g. Order, Ledger Entry

Structure (STR) files•contain group of fields which can be included in other files using Includes relation•e.g. Audit Stamp file

Advantage:2E Files

Page 15: synon

Advantage:2E FilesDefault functions

•standard functions are automatically defined for files•default functions depend on file types

Default functions for REF files

Function Access PathCRTOBJ - Create Object UPDDLTOBJ - Delete Object UPDCHGOBJ - Change Object UPDSELRCD - Select Record RTVEDTFIL - Edit File RTV

Advantage:2E Files

Page 16: synon

Default functions for CPT filesFunction Access PathCRTOBJ - Create Object UPDDLTOBJ - Delete Object UPDCHGOBJ - Change Object UPD

Advantage:2E Files

Page 17: synon

Creating/Defining FilesAt the Edit Database Relations panel, press F10 to show Define Objects panelIn the Object type column, enter FILType File Name in Object Name columnType CPT or REF or STR in Object attr column depending on the file typeDefined as relation for the file is automatically created

Advantage:2E Files

Page 18: synon

Op: SYNGXM QPADEV0004 22/08/97 15:31:12 DEFINE OBJECTS GXMMDL Object Object Object Referenced Field Edit type name attr field usage field ___ ________________________ ___ ________________________ ___ _ ___ ________________________ ___ ________________________ ___ _ ___ ________________________ ___ ________________________ ___ _ ___ ________________________ ___ ________________________ ___ _ ___ ________________________ ___ ________________________ ___ _ ___ ________________________ ___ ________________________ ___ _ ___ ________________________ ___ ________________________ ___ _ ___ ________________________ ___ ________________________ ___ _ + F3=Exit

Advantage:2E Files

Page 19: synon

Advantage:2E FieldsEach Advantage:2E Field has a Name and a Field TypeAdvantage:2E Field Naming rules

•unique within the model•up to 25 characters including embedded blanks•e.g. Customer Code is a valid Advantage:2E Field Name•implementation name is different

Advantage:2E Field Types•depends on the type of values •broadly classified as alphanumeric, numeric & special field types

Advantage:2E Files

Page 20: synon

Advantage:2E Field Types Field Type Name Description Type Length ExampleCDE Code A 6 Stock CodeDTE Date P 7,0 Date of birthIGC Ideographic text A 20 Kanji nameNAR Narrative text A 30 CommentsNBR Number P 5.0 # of employeesPCT Percentage P 5.2 Profit marginPRC Price or tariff P 7.2 Unit PriceQTY Quantity P 5.0 Stock quantityREF Reference - - Field based on anotherSGT Surrogate P 7.0 System KeySTS Status A 1 Yes/NoTME Time P 6.0 Change TimeTXT Descriptive name A 25 Product nameVAL Monetary value P 11.2 Stock valueVNM Valid system name A 10 File name

Advantage:2E Files

Page 21: synon

Field Attribute ValuesBasic attributes: length, implementation nameText: Left Hand Side (LHS) text, Right Hand Side (RHS) Text, Column HeadingsValidation attributes: upper/lower case checking, Modulus checking, valid name checking, validation through a check condition

Advantage:2E Files

Page 22: synon

Field UsageTwo types: Database fields and Function fields

Database fields•Code (CDE) fields:- used for key fields e.g. Company Code•Data attribute (ATR) fields: used for non-key fields e.g. Company Name

Advantage:2E Files

Page 23: synon

Function fieldsFields used only in functions but do not reside in databasefields can be added to data dictionary and accessed in device designs and action diagrams6 function field usage types

CNT (count) DRV (derived)MAX (maximum) MIN (minimum)SUM (sum) USR (user-defined)

Advantage:2E Files

Page 24: synon

Default Conditionsupplies the default value for a field*NONE: no default conditioncondition name: Advantage:2E condition supplies default value*DTAARA: Default field value is retrieved from data area specified for the Dataarea field

Defining Field as a Data Areaspecify *DTAARA as default condition

Advantage:2E Files

Page 25: synon

Creating/DefiningIn the Object type column of Define Objects panel, enter FLDType Field Name in Object Name columnType Advantage:2E field type in the Object attr columnType Referenced field if the field refers to another field for domainIn the Field Usage column, type CDE (Code) or ATR (attribute) or a function field usage

Advantage:2E Files

Page 26: synon

Op: SYNGXM QPADEV0004 22/08/97 15:31:12 DEFINE OBJECTS GXMMDL Object Object Object Referenced Field Edit type name attr field usage field FIL Dealer FIL Dealer group FLD Dealer Code CDE FLD Dealer name ATR FLD Dealer Address 1 ATR FLD Dealer Address 2 ATR FLD Dealer Group Code CDE FLD Dealer Group Name ATR FLD Dealer Group Credit Limit ATR + F3=Exit

Advantage:2E Files

Page 27: synon

Advantage:2E ConditionSpecifies the values or set of values a field may takeCondition has a Name, a type and an associated valueCondition Types

•VAL (Value) and LST (Value List) are valid condition types for status fields•CMP (Compare) and RNG (Range) are valid condition types for non-status fields

Advantage:2E Files

Page 28: synon

Advantage:2E ConditionValue (VAL) Condition

used to specify single values that status field can taketwo related values:

internal value - value in the implemented databaseexternal value - value displayed/entered on the screen

e.g. Premium paid condition has file value “Y”List (LST) Condition

used to specify list of values that status field can takescreen functions implement prompt key (F4)e.g. Invoice Flag can have valid values U, D, P, H, C and the condition Invoice not due has file value “U”

Advantage:2E Files

Page 29: synon

Advantage:2E ConditionCompare (CMP) Condition

defined in terms of a fixed value and an operatorvalid operators: *EQ, *NE, *GT, *LT, *GE, *LEe.g. Order Quantity field can have an associated condition by name greater than 10 with operator *GT and value 10

Range (RNG) Conditiondefines range of values that field can takedefined in terms of From and To valuese.g. Stock Quantity field can have an associated condition by name between 10 and 100 with From value as 10 and To value as 100

Advantage:2E Files

Page 30: synon

Advantage:2E RelationsDatabase relations can be entered using Edit Database Relations panelExpresses association between two files or between a file and a fieldEight relation types

Defined as, Extended by, Has, Includes, Known by, Owned by, Qualified by and Refers to

3 different relation usage groupsDefinition relations - declare files to existKey relations - define the keys in filesAttribute relations - declare non-key fields in files

Advantage:2E Files

Page 31: synon

Advantage:2E RelationsUsage Type Relation Used forDefinition Defined as File-to-file relationshipKey Owned by File-to-file relationship

Known by File-to-field relationshipQualified by File-to-field relationship

Attribute Refers to File-to-file relationshipIncludes File-to-file relationshipHas File-to-field relationship

Other Extended by File-to-file relationship

Advantage:2E Files

Page 32: synon

Defined as RelationFile-to-file relationdeclares that a file existse.g.

Employee Defined as Employee

Defined as relation is automatically created for a file if a reference is made to a non-existing file

Advantage:2E Files

Page 33: synon

Owned by RelationFile-to-file relationdenotes a parent-child relationshipprimary key(s) of owning file become part of primary key of the owned by filekeys of owning file are incorporated as high order keys in the owned filee.g.

Order Detail Owned by Order

Advantage:2E Files

Page 34: synon

Known by RelationFile-to-field relationspecifies the key field(s) for a filee.g.

FIL Order Known by FLD Order Number FIL Order Has FLD Quantity

Qualified by RelationFile-to-field relationto qualify a file identifier by one or more variable factors like date, time, sequence number etc

Advantage:2E Files

Page 35: synon

Qualified by Relationused for entities which represent continuum of values like currency rates having effective dateappropriate fields of referring file can be redirected (RDR) to the effective field in referred file with a possibility of specifying *PREVIOUS or *NEXTfield in the relation must be ATR and not CDEe.g. Product Price Owned by Product Code Product Price Qualified by Effective date Product Price Has Product price

Advantage:2E Files

Page 36: synon

Refers to RelationFile-to-file relationspecifies that a file refers to another fileAllows access to any of the fields on the referred to file from a referring filePrimary key of the referred file becomes foreign key in the referring fileVirtual field is created in the referring file and cannot be updated from the referring filee.g. Order Detail Refers to Product

Advantage:2E Files

Page 37: synon

Includes RelationFile-to-file relationfile includes all the fields of a structure (STR) filee.g. Product Includes Audit Stamp

Has RelationFile-to-field relationdeclares a field to be present in a file as an attributee.g.

FIL Order Has FLD Quantity

Advantage:2E Files

Page 38: synon

Extended by RelationFile-to-file relationdeclares a file to be extension of another fileIf used with Owned by relation, the fields of the extended file are available as Virtual Fields in the file being extendedIt is recommended to use Extended by relation along with Owned by relatione.g. Customer Extended by Customer Detail

Advantage:2E Files

Page 39: synon

Advantage:2E RelationFor Text

For Text clause can be added to a relation to further clarify the description of a relationshipIf a file refers to another file more than once, For Text clause can be used for further clarificatione.g. Order Refers to Customer

For: Ordering Sharing: *ALL Order Refers to Customer

For: Invoicing Sharing: *ALL

Advantage:2E Files

Page 40: synon

Creating/Defining RelationsAt the Object column of Edit Database Relations panel, enter the file nameType the relationship in Relation columnType the referenced object (File or Field) in the Referenced Object column

Edit File EntriesType E in front of any relation to display Edit File Entries panel

Advantage:2E Files

Page 41: synon

*DSNR GXMMDL Op: SYNGXM QPADEV0004 22/08/97 15:25:26 EDIT DATABASE RELATIONS GXMMDL => Rel lvl: ? Typ Object Relation Seq Typ Referenced object FIL Dealer Owned by FIL Dealer group FIL Dealer Known by FLD Dealer Code FIL Dealer Has FLD Dealer name FIL Dealer Has FLD Dealer Address 1 FIL Dealer Has FLD Dealer Address 2 FIL Dealer Group Known by FLD Dealer Group Code FIL Dealer Group Has FLD Dealer Group Name FIL Dealer Group Has FLD Dealer Group Credit Limit + SEL: Z(n)-Details, N(n)-Narr, S(n)-Select, E(n)-Entries, V-Virt.fields, F-Funcs F3=Exit F5=Reload F7=Fields F9=Insert F10=Define obj. F17=Services 'Dealer' type FIL not found.

Advantage:2E Files

Page 42: synon

Op: SYNGXM QPADEV0004 22/08/97 16:11:55 EDIT FILE ENTRIES GXMMDL File . . . . . . : Dealer ? Field Type Ocr Et Ksq GEN name Length Renamed Dealer Group Code CDE K 1 AICD 6 Dealer Code CDE K 2 AHCD 6 Dealer name TXT A AJTX 25 Dealer Address 1 TXT A AKTX 25 Dealer Address 2 TXT A ALTX 25 SEL: Z-Details, R-Replace field, U-Usage, M-Mapped field parameters. F3=Exit

Advantage:2E Files

Page 43: synon

Edit Field DetailsType Z2 in front of the File-field relation to display Edit Field Details panel for the field ORType Z in front of the field entry in the Edit File Details panel

Advantage:2E Files

Page 44: synon

Op: SYNGXM QPADEV0004 22/08/97 16:11:55 EDIT FIELD DETAILS GXMMDL Field name . . . . . : Booking payment status Document’n seq . : Type . . . . . . . . : STS REF: Payment Status Field usage . : ATR Internal length. . . : 1 Data type : A lowercase: GEN name . : BKST

K’bd shift :

Headings . . . . . . : - Text . . . . . . . . : Booking payment status Left hand side . . . : Booking payment status Right hand side. . . : Value Column headings. . . : Booking

: payment : status

Validation . . . . . : - Default condition. . : *NONE Check condition. . . : *NONE Mandatory fill . . . : (Y, ) Valid System name. . : (Y,’ ‘) Translate cnd vlues : Blank (Y,’ ‘)

F3=Exit no update F8=Change name/type F9=Conditions F20=Narrative

Advantage:2E Files

Page 45: synon

Edit Field ConditionField condition can be added/modified using the Edit Field Condition and Edit Field Condition Detail panelsPress F9 on the Edit Field Details panel to display Edit Field Condition panelIn the Edit Field Condition panel, type condition name and condition type (VAL, LST, CMP, or RNG) and press Enter to display Edit Field Condition Details panelIn the Edit Field Condition Details panel, type the appropriate condition details like value, range etc.

Advantage:2E Files

Page 46: synon

Op: SYNGXM QPADEV0004 22/08/97 16:11:55 EDIT FIELD CONDITION DETAILS GXMMDL Field name . . . . . : Credit status Attr: STS Mode: *ADD Length of file . . . : 1 on display. . : 4

Condition. . . . . . : Blue chip Type . . . . . . . . : VAL

File value Display value Status value A A1

F3=Exit F8=Change name F20=Narrative

Advantage:2E Files

Page 47: synon

Advantage :2E Training ACCESS PATH

Page 48: synon

Access pathAn access path defines the physical file and/or the logical views of that file. When you build one, you  specify the following:the order in which you want to retrieve records from a filewhich fields will be presentyour select/omit criteria for deciding which records from the file will be retrieved by the access path

Page 49: synon

Six types of Access PathsPhysical (PHY) Update (UPD)Retrieval (RTV)Resequence (RSQ)Query (QRY)Span (SPN)

Building Access PathsIntroduction

Page 50: synon

Building Access PathsPhysical (PHY) Access Path

•Single format file containing fields derived from resolution of all relations on the file.

Not keyedNo virtual fieldsCreated automatically for every REF/CPT fileNot referenced directly by functionsNo additional PHY access paths allowed for a file

Page 51: synon

Building Access PathsUpdate (UPD) Access Path

•Uniquely keyed, single format access path which is used by functions for updation

Keyed on the fields that identify the fileNo Virtual fieldsCreated automatically for every REF/CPT fileAdditional UPD access paths may be created with the same key but subset of fields

Page 52: synon

Building Access PathsRetrieval (RTV) Access Path

•Uniquely keyed, single format access path used by functions to retrieve records

Keyed exactly as the UPD access pathAllows virtual fieldsCreated automatically for every REF/CPT fileAssociated with the UPD access pathNon-key fields can be droppedCan select/omit recordsPossible to define multiple RTV access paths for a given file, but all should have same key fields

Page 53: synon

Building Access PathsResequence (RSQ) Access Path

•Uniquely or non-uniquely keyed single format access path used by functions to retrieve records

Must be created explicitlyDefaults to the keys of the based on fileAllows default keys to be changed which need not be uniqueAllows virtual fieldsAssociated with RTV, which points to a UPDMany RSQ access paths possible for single file

Page 54: synon

Building Access PathsQuery (QRY) Access Path•Keyed single format access path used by functions to retrieve records•Must be created explicitly•Allows virtual fields on key & non-key fields•Available only for Print Object/Print File functions•Defaults to the keys of the based on file•Allows default keys to be changed•Associated with RTV, which points to a UPD•Many QRY access paths possible for single file•Implemented by OPNQRYF or Dynamic SQL

Page 55: synon

Span (SPN) Access PathA SPN access path can only be specified over files with Owned by or Refers to relationshipsA SPN access path must be created over an owning or referred to filePress F9 on Edit Access Path Details panel to first select the primary format and then the secondary format

Building Access PathsAdding an Access Path

Page 56: synon

Building Access PathsSpan (SPN) Access Path

•Keyed multi-format access path•Used by Edit & Display transaction functions to retrieve records from a pair of related files

Must be created explicitlyDefaults to keys of based on filesThese keys can be changedAllows virtual fieldsAssociated with RTV, which points to a UPDMany SPN access paths possible for single file

Page 57: synon

Building Access PathsAccess Path Summary

# AccessPath Type

RealFields

Key Fields VirtualFields

Virtual Keys

1. PHY x x x

2. UPD Relation x x

3. RTV Relation x

4. RSQ User x

5. QRY User

6. SPN User x

Page 58: synon

Building Access PathsAdding an Access Path

*DSNR SYNGXMMDL Op: SYNGXM QPADEV0007 11/02/98 12:02:11 EDIT DATABASE RELATIONS SYNGXMMDL => Rel lvl: ? Typ Object Relation Seq Typ Referenced object FIL Customer Known by FLD Customer Code FIL Customer Has FLD Customer Name FIL Customer Has FLD Customer Address 1 FIL Customer Has FLD Customer Address 2 FIL Customer Has FLD Customer Address 3 FIL Customer Has FLD Customer Credit Limit FIL Customer Has FLD Customer Limit Used FIL Inventory Known by FLD Item Code FIL Inventory Has FLD Item Name FIL Inventory Has FLD Item Quantity FIL Sales Order Header Known by FLD Sales Order Number FIL Sales Order Header Refers to FIL Customer FIL Sales Order Header Has FLD Sales Order Date FIL Sales Order Header Has FLD Shipment Date FIL Sales Order Lines Owned by FIL Sales Order Header + SEL: Z(n)-Details, N(n)-Narr, S(n)-Select, E(n)-Entries, V-Virt.fields, F-Funcs

F3=Exit F5=Reload F7=Fields F9=Insert F10=Define obj. F17=Services

Page 59: synon

Building Access PathsAdding an Access Path

Type Z against any relation on the Edit Database Relations panel for the file and press EnterOn the resulting Edit File Details panel, enter Access Path name and type and press EnterType Z to zoom into the new access path and specify details on the Edit Access Path Details panelType Z on the Edit Access Path Details panel to go to Edit Access Path Format Entries panel

Page 60: synon

Op: SYNGXM QPADEV0007 11/02/98 12:10:57 EDIT FILE DETAILS SYNGXMMDL File name . . . . . . . . : Customer Attribute . . . . . . . . : REF Field reference file. : *NONE Documentation sequence. . : Source library. . . . : SYNGXMGEN GEN format prefix . . . . : AB Distributed . . . . . : N (Y,N) Assimilated physical. . . : Record not found message. : Customer NF Msgid. : USR0001 Record exists message . . : Customer EX Msgid. : USR0002 ? Typ Access path Source mbr Key Maint Held PHY Physical file UUABREP NONE UPD Update index UUABREL1 UNIQUE IMMED RTV Retrieval index UUABREL0 UNIQUE IMMED RSQ Customer by Name SEL: Z-Details, G/J-Generate, E-STRSEU, D-Delete, N-Narrative, H-Hold/Release, O-Overrides, U-Usage, F-Function refs., L-Locks. F3=Exit F5=Reload F7=Functions F8=Change name F17=Services F20=Narrative

Building Access PathsAdding an Access Path

Page 61: synon

Op: SYNGXM QPADEV0007 11/02/98 12:17:29 EDIT ACCESS PATH DETAILS SYNGXMMDL File name . . . . . . . . : Customer Attribute . : REF Access path name. . . . . : Customer by Name Type. . . . : RSQ Unique key. . . . . . . . : (Y, blank) or Duplicate sequence . . : F (F-FIFO, L-LIFO, Maintenance . . . . . . . : I (I-IMMED, D-DLY, R-REBLD) Alternate collating table : Allow select/omit . . . . : (S-Static, D-Dynamic, ' '-None) Generation mode . . . : M (M-MDLVAL, D-DDS, E-EXP, S-SQL, X-UNX) Source member name . . : UUABREL2 Source member text . . : Customer Customer by Name Format Format text Associated ? Seq name (Based on file) Retrieval access path 1 FABREAO Customer Retrieval index SEL: Z-Acp.entries, R-Acp.relations, S-Select/omit sets, A-Associated Acps. F3=Exit F8=Rename F20=Narrative

Building Access PathsAdding an Access Path

Page 62: synon

Op: SYNGXM QPADEV0007 11/02/98 12:19:24 EDIT ACCESS PATH FORMAT ENTRIES SYNGXMMDL File name . . . . . . . . : Customer Attribute . : REF Access path name. . . . . : Customer by Name Type. . . . : RSQ Format text . . . . . . . : Customer Based on. . . . . . . . . : Customer Format No . : 1 GEN Key Altcol Ref ? Field Name Type no. Dsc seq cnt Customer Code CDE ABCD K 1 1 Customer Name TXT ABTX A 1 Customer Address 1 TXT ACTX A 1 Customer Address 2 TXT ADTX A 1 Customer Address 3 TXT AETX A 1 Customer Credit Limit VAL AAVA A 1 Customer Limit Used VAL ABVA A 1 SEL: Z-Field details. F3=Exit F7=Relations

Building Access PathsAdding an Access Path

Page 63: synon

FUNCTION

Page 64: synon

Building ApplicationsAdvantage:2E Functions

Advantage:2E function is a process that operates on files & fields Advantage:2E Functions can be linked to create larger processes that become the building blocks of an application Several Advantage:2E functions may be implemented in a single HLL program

Page 65: synon

Building ApplicationsImplementation of Functions

Advantage:2E functions are implemented in two ways

External - the function is implemented as a separate HLL programInternal - the function is implemented as source code inside the calling function

Page 66: synon

Building ApplicationsAdvantage:2E Function Types

4 Advantage:2E functions typesStandard FunctionsBuilt-In FunctionsFunctions FieldsMessage Functions

Standard functions specify the entire programs or subroutinesUser-defined processing can be specifiedProvide building blocks of an application

Page 67: synon

Standard FunctionsDivided into 3 categories

Database FunctionsDevice FunctionsUser Functions

Built-in FunctionsExecute functions like arithmetic operations, string manipulation, control operations like commitment control & program exit

Building ApplicationsAdvantage:2E Function Types

Page 68: synon

Built-in FunctionsSpecified within action diagramsImplemented as in-line source code within calling functionsThe Built-in functions are

1) Add 2) Commit3) Compute 4) CONCAT -Concatenation5) CVTVAR - Convert Variable6) DIV - Divide 7) DIV WITH REMAINDER8) Exit Program 9) Modulo

Building ApplicationsAdvantage:2E Function Types

Page 69: synon

Built-in FunctionsThe Built-in functions are (contd…)

10) Move 11) Move All12) MULT - Multiply 13) Quit14) RTVCND - Retrieve Condition15) Rollback 16) Set Cursor17) Substring 18) SUB - Subtract

Building ApplicationsAdvantage:2E Function Types

Page 70: synon

Function FieldsA field whose value is not physically stored in the databaseDerived from other fields or filesOne result parameter - the derived fieldVariable number of input parameters used to derive the valueAdvantage:2E provides ready-made function fields

1) SUM - Sum 2) MAX - Maximum 3) MIN - Minimum4) CNT - Count 5) DRV - Derived 6) USR - User

Building ApplicationsAdvantage:2E Function Types

Page 71: synon

Building ApplicationsAdvantage:2E Function Types

Message FunctionsDefine workstation messagesImplemented using OS/400 message descriptionsSent by a call to a CL subroutineCan make direct references to fields in the data model

Page 72: synon

Building ApplicationsAdvantage:2E Function Types

Message FunctionsThe Message functions are

1) SNDERRMSG - Send Error Message2) SNDINFMSG - Send Information Message3) SNDCMPMSG - Send Complete Message4) SNDSTSMSG - Send Status Message5) RTVMSG - Retrieve Message6) EXCMSG - Execute Message

Page 73: synon

Building ApplicationsStandard Functions

Database FunctionsBasic routines for accessing the databaseThere are 4 database functions1) CRTOBJ - Create Object2) CHGOBJ - Change Object3) DLTOBJ - Delete Object4) RTVOBJ - Retrieve Object

Page 74: synon

Building ApplicationsStandard Functions

Device FunctionsUsed in interactive & report programsConsist of panel/report design & action diagramAll device functions are external functions except for PRTOBJ functionImplemented as programs that operate over databases

Page 75: synon

Building ApplicationsStandard Functions

Device Functions (contd…)The Device Functions are1) DSPRCD - Display Record2) DSPRCD2 - Display Record 2 panels3) DSPRCD3 - Display Record 3 panels4) PMTRCD - Prompt Record5) EDTRCD - Edit Record6) EDTRCD2 - Edit Record 2 panels7) EDTRCD3 - Edit Record 3 panels

Page 76: synon

Building ApplicationsStandard Functions

Device Functions (contd…)The Device Functions are8) DSPFIL - Display File9) EDTFIL - Edit File10) SELRCD - Select Record11) DSPTRN - Display Transaction12) EDTTRN - Edit Transaction13) PRTFIL - Print File14) PRTOBJ - Print Object

Page 77: synon

Building ApplicationsStandard Functions

User FunctionsMeans of incorporating user programs or subroutines into Advantage:2E generated applicationsProcessing steps can be specified with action diagrams or user-written HLLImplemented as inline code (internal functions) or call to programs (external functions)

Page 78: synon

Building ApplicationsStandard Functions

User FunctionsThe User Functions are1) EXCINTFUN - Execute Internal Function2) EXCEXTFUN - Execute External Function3) EXCUSRPGM - Execute User Program4) EXCUSRSRC - Execute User Source

Page 79: synon

Building ApplicationsBasic Function Properties

Function Nameup to 25 characters long including embedded blanks & must be unique within a file

Function ComponentsFunction options

allow the user to customize function features like database changes, display features, exit control, commitment control, exception routines, generation options & environment options

Page 80: synon

Building ApplicationsBasic Function Properties

Function ComponentsFunction Parameters

specify the input and output parameters. Parameters are also used to define local variables for the function

Device Designsspecify the visual presentation of the 2 types of devices used by functions: Panels & Reports

Action Diagramsspecify the processing steps for function logic. This is a combination of default Advantage:2E supplied and optional user defined processing logic

Page 81: synon

Building ApplicationsBasic Function Properties

Function class Parameters DeviceDesign

ActionDiagrams

FunctionOptions

Device FunctionsDatabase FunctionsUser Functions

xx

x, x1

x, x3

MessagesFunction Fields

xx

x, x2

xx

Built-In Functions x x x

1 EXCINTFUN & EXCEXTFUN have action diagrams2 Only DRV (Derived) function fields have action diagrams3 EXCEXTFUN is the only user function with function options

Function Components

Page 82: synon

Building ApplicationsFunctions & Access Paths

Functions & Access pathsFunctions operating on a file are always attached to it by an access pathFunctions can access many files with access paths based on several filesA generated program can be made up of several functions each accessing a different access pathDefault panel/report formats are derived from the function’s access path

Page 83: synon

Building ApplicationsDefining Functions

Accessing FunctionsDisplay All Functions panel

select option from the Services MenuDisplay File Functions panel

option F on a file in Edit Database Relations panelShipped Files Fields

Advantage:2E shipped files contain the default data like built-in functions, messages etc.Type * in the Object field & DFN in relations field of Edit Database Relations panel to access

Page 84: synon

Op: SYNTHS QPADEV0004 18/02/98 13:52:40 DISPLAY ALL FUNCTIONS SYNSXT Application area. : Source library: SYNSXTGEN ? File Function Type GEN name Commodity Change Commodity CHGOBJ *N/A Commodity Create Commodity CRTOBJ *N/A Commodity Delete Commodity DLTOBJ *N/A Commodity Edit Commodity EDTFIL SXACEFR Commodity Select Commodity SELRCD SXABSRR Commodity Price Change Commodity Price CHGOBJ *N/A Commodity Price Create Commodity Price CRTOBJ *N/A Commodity Price Delete Commodity Price DLTOBJ *N/A Commodity Price Edit Commodity Price EDTFIL SXAEEFR Commodity Price Select Commodity Price SELRCD SXADSRR SEL: Z-Dtls, P-Parms, N-Narr., F-Action diagram, S-Device Design, T-Structure, A-Acp, G/J-Gen, E-STRSEU(pgm), L-Locks, D-Delete, U-Where used, 3-Doc. F3=Exit F5=Reload

Building ApplicationsDefining Functions

Page 85: synon

Op: SYNTHS QPADEV0004 18/02/98 13:48:09 EDIT FUNCTIONS SYNSXT File name. . . : Commodity ** 1ST LEVEL ** ? Function Function type Access path Change Commodity Change object Update index Create Commodity Create object Update index Delete Commodity Delete object Update index Edit Commodity Edit file Retrieval index Select Commodity Select record Retrieval index + SEL: Z-Details, P-Parameters, F-Action diagram, S-Device design, N-Narrative, T-Structure, A-Access path, U-Usage, G/J-Generate, D-Delete, C-Copy, L-Lock. F3=Exit F5=Reload F7=File details F9=Add F17=Services

Building ApplicationsDefining Functions

Page 86: synon

*DSNR SYNSXT Op: SYNTHS QPADEV0004 18/02/98 13:40:46 EDIT DATABASE RELATIONS SYNSXT => * Rel lvl: DFN ? Typ Object Relation Seq Typ Referenced object FIL *Arrays Defined as FIL *Arrays FIL *Built in functions Defined as FIL *Built in functions FIL *Configuration Table Defined as FIL *Configuration Table FIL *Distributed File Defined as FIL *Distributed File FIL *External Data Access API Defined as FIL *External Data Access API FIL *Field attribute types Defined as FIL *Field attribute types FIL *Job data Defined as FIL *Job data FIL *Messages Defined as FIL *Messages FIL *Program data Defined as FIL *Program data FIL *Standard header/footer Defined as FIL *Standard header/footer FIL *Advantage:2E reserved pgm data Defined as FIL *Advantage:2E reserved pgm data FIL Audit Information Defined as FIL Audit Information FIL Commodity Defined as FIL Commodity FIL Commodity Price Defined as FIL Commodity Price FIL Company Defined as FIL Company + SEL: Z(n)-Details, N(n)-Narr, S(n)-Select, E(n)-Entries, V-Virt.fields, F-Funcs F3=Exit F5=Reload F7=Fields F9=Insert F10=Define obj. F17=Services

Building ApplicationsDefining Functions

Page 87: synon

Building ApplicationsDatabase Functions

What are Database functions?means of performing actions on databasedefined as HLL subroutine

4 Database functions1) CRTOBJ - routine to add a record to a file.2) CHGOBJ - routine to update a record.3) DLTOBJ - routine to delete a record.4) RTVOBJ - routine to retrieve one or more records.

Page 88: synon

Default versions of CRT, CHG and DLT database functions are created for all REF & CPT files.

RTVOBJ must be created if needed.

Additional processing before and after database access may be specified in the action diagram.

Building ApplicationsDatabase Functions

Page 89: synon

Function Purpose Access PathCRTOBJCHGOBJDLTOBJ

Add a single recordUpdate a single recordDelete a single record

UPDUPDUPD

RTVOBJ Read a record or record(s) RTV, RSQ

Building ApplicationsDatabase Functions

Page 90: synon

Building ApplicationsDevice Functions

What are Device Functions?Interactive panels or reportsPanel device functions for interactive user interface between end user and applicationReport device functions for written presentation of dataAll device functions except PRTOBJ function are implemented as external functions

Can be accessed from Edit Functions, Edit All Functions, Edit Function Devices, or the Display All Functions panels

Page 91: synon

Single record device functionsPrompt Record (PMTRCD)

defines a program to prompt for a list of fields defined by a specified access pathvalidated values can be passed to another function

Display Record (DSPRCD)defines a program to display a single record from a specified database fileIf no key is specified, a key panel prompts for a key

Building ApplicationsDevice Functions

Page 92: synon

Single record device functions (contd...)Display Record 2 panels (DSPRCD2)Display Record 3 panels (DSPRCD3)

Building ApplicationsDevice Functions

Page 93: synon

Single record device functions (contd…)Edit Record (EDTRCD)

defines a program to maintain (add, change or delete) records one at a time.If no key is specified, a key panel prompts for a key.

Edit Record 2 panels (EDTRCD2)Edit Record 3 panels (EDTRCD3)

Building ApplicationsDevice Functions

Page 94: synon

Multiple record device functionsDisplay File (DSPFIL)

defines a program to display the records in a file many at a time, using a subfilethe subfile is loaded one page at a time when the user presses ROLLUP/F8

Edit File (EDTFIL)defines a program to maintain the records in a file many at a time, using a subfilethe subfile is loaded one page at a time when the user presses ROLLUP/F8.

Building ApplicationsDevice Functions

Page 95: synon

Multiple record device functions (contd…)Select Record (SELRCD)

defines a program to display the records in a file many at a time, using a subfileallows the user to select one record which is returned to the calling programcalled from a function that requests a selection list.

Building ApplicationsDevice Functions

Page 96: synon

What are User Functions?means of implementing additional user processing within an existing function or as an independent implementation along with an existing functione.g. batch functions for updating database having no associated device or a user-written HLL program which has to be integrated to Advantage:2E generated application

Building ApplicationsUser Functions

Page 97: synon

What are Message Functions?means of defining messages of various types, specifying different message files for the message, specifying substitution variables and changing message identifierscan be accessed by looking at functions of *MESSAGES file

Building ApplicationsMessage Functions

Page 98: synon

6 Message FunctionsSend Error Message (SNDERRMSG)

error message to be sent to a calling functionused for diagnostic messages arising from user validation

Send Information Message (SNDINFMSG)information message be sent to the message queue of the calling program

Send Completion Message (SNDCMPMSG)

Building ApplicationsMessage Functions

Page 99: synon

6 Message FunctionsSend Status Message (SNDSTSMSG)Retrieve Message (RTVMSG)Execute Message (EXCMSG)

Building ApplicationsMessage Functions

Page 100: synon

What are Function Fields?Special types of fields that can be used in device designs and action diagramsbased on other fieldsprocessing can be specified for a function field

Building ApplicationsFunction Fields

Page 101: synon

What are Function Options?Function options control the features of functionsFunction Options for

Database ChangesDisplay FeaturesExit ControlCommitment ControlException RoutineGenerationEnvironment

Building ApplicationsFunction Options

Page 102: synon

Database Changes Function optionsdetermine if program allows add, change or delete capabilities or a combination

Display Features Function optionsConfirmation - function prompts for confirmationInitial value for ConfirmationStandard Header/Footer selectionSubfile Selection ColumnDynamic Program Mode - function determines initial mode of execution

Building ApplicationsFunction Options

Page 103: synon

Display Features Function optionsExit after Add - for EDTRCD functionsRepeat Prompt - whether prompt (PMTRCD) to be redisplayed after user processingBypass Key Screen - whether key screen to be displayed before displaying detail screenPost Confirm Pass - to re-read database file and update subfile after confirmationSend All Messages - whether message subfile at bottom of panel for first or all errors

Building ApplicationsFunction Options

Page 104: synon

What are Function Parameters?Specifies the fields passed between functions

Basic properties of function parametersNameUsage Type

Input only, Output only, Both, NeitherFlag Error Status

specifies error in the called functionallowed in SNDERRMSG, EXCMSG or any external function

Building ApplicationsFunction Parameters

Page 105: synon

Neither ParametersNo value passed or returned for a parameterNeither parameters are available for use as local variables within the function

Default parameters of functionsFunction Default parameters UsageCHGOBJ All fields of Update index ICRTOBJ All fields of Update index IDLTOBJ Key fields of Update index IRTVOBJ Key fields of attached acc. path ISELRCD Key fields of Update index B

Building ApplicationsFunction Parameters

Page 106: synon

Return Code ParameterInforms the calling program of the state under which called program was exitedAll functions except EXCUSRPGM & EXCUSRSRC have implicit return code parameter as first parameterThe values of Return Code parameter are*DBF error; *Normal; *Record already exists;*Record does not exist; *Substring error;*User Quit requested

Building ApplicationsFunction Parameters

Page 107: synon

Parameter RolesSpecifies the use of parameter in functionFollowing are the parameter rolesMap Parameter - the parameter is added automatically to the

corresponding field on the receiving function’s panel design. Map Neither parameter adds field to panel design without passing a value

Restrictor Parameter - the parameter restricts the updation of field by making it input only field

Positioner Parameter - the parameter is used to position a function to start reading records from a particular record

Building ApplicationsFunction Parameters

Page 108: synon

Parameter RolesVary Parameter - the parameter can have a varying length.

Useful for interfacing with user-written functionsDefining Function Parameters

in the Edit Functions panel, type P next to the selected functionspecify a field or a set of fields in Edit Function Parameters panelType Z for a parameter to specify Role/Usage through Edit Function Parameter Details panel

Building ApplicationsFunction Parameters

Page 109: synon

Building ApplicationsFunction Parameters

Op: SYNTHS QPADEV0007 19/02/98 10:38:58 EDIT FUNCTION PARAMETERS SYNSXT Function name. . : Delete Commodity Type : Delete object Received by file : Commodity Acpth: Update index Passed ? File/*FIELD Access path/Field as Seq Commodity Update index KEY | Values FLD: One parameter per field RCD: One parameter for all fields KEY: One parameter for key fields only SEL: Z-Details (field selection). F3=Exit F5=Reload

Page 110: synon

Building ApplicationsFunction Parameters

Op: SYNTHS QPADEV0007 19/02/98 10:40:20 EDIT FUNCTION PARAMETER DETAILS SYNSXT Function name. . : Delete Commodity Type : Delete object Received by file : Commodity Acpth: Update index Parameter (file) : Commodity Passed as: KEY ? Field Usage Role Commodity Code I SEL: Usage: I-Input, O-Output, B-Both, N-Neither, D-Drop. Role: R-Restrict, M-Map, V-Vary length, P-Position. F3=Exit

Page 111: synon

Building ApplicationsDevice Designs

What are Device Designs?Specifies the layouts of fields and constants on the panels or report designs for a function

Basic properties of Device DesignsDevice Design Standard

depends on the function type and associated standard header/footer functions

Device Design FormatFormats are created from the fields of the based-on access path and their associated text

Page 112: synon

Building ApplicationsDevice Designs

Basic properties of Device DesignsDevice Design Field

fields come from access path, function parameters and Header/Footer

Editing Device Designin the Edit Functions panel, type S next to the selected function to display the device designuse function keys to edit the device design

F1 moves the field 40 columnsF3 exits the panel

Page 113: synon

Building ApplicationsDevice Designs

Editing Device Designuse function keys to edit the device design

F4 move the field 40 columns to the rightF5 edits device format detailsF6 cancels the pending operationsF7 displays Edit Device Design Format RelationsF8 moves the selected field to the cursor positionF9 wraps text onto next lineF10 moves text one column to the rightF11 removes the lineF12 aligns text below cursor position

Page 114: synon

Building ApplicationsDevice Designs

Editing Device Designuse function keys to edit the device design

F13 fast exits the panelF15 moves panel window to left marginF16 moves window to right marginF17 displays a list of device formatsF18 displays the Edit Field Attributes panelF19 adds new function field to the deviceF20 edits function field on the deviceF21 adds a line above cursorF22 moves text one column to the left

Page 115: synon

Building ApplicationsDevice Designs

Editing Device Designuse function keys to edit the device design

F23 adds constant field to the device designF25 aligns all fields under the cursor position

Page 116: synon

Advantage :2E Training ACTION DIAGRAMS

Page 117: synon

Building ApplicationsAction Diagrams

What are Action Diagrams?Action Diagrams record the basic constructs that make up a procedurethe procedural steps encompass a list of actions like call to another function or a low-level built-in function

Displaying Action Diagram of a functionType F next to the selected function in the Edit Functions panel

Page 118: synon

Building ApplicationsAction Diagrams

EDIT ACTION DIAGRAM Edit SYNSXT Commodity FIND=> Edit Commodity > Edit Commodity .-- . ...Initialize <-- . .=REPEAT WHILE . |-*ALWAYS . | ...Load first subfile page <-- . | PGM.*Reload subfile = CND.*NO . | > Conduct screen conversation . | .=REPEAT WHILE . | |-PGM.*Reload subfile is *NO . | | Display screen . | | ...Process response <-- . | '-ENDWHILE . '-ENDWHILE . ...Closedown <-- '-- F3=Exit F5=User points F6=Cancel pending moves F7=Forward F8=Backward F9=Edit parameters F15=Open Functions F16=Toggle Change Date F24=More keys

Page 119: synon

Building ApplicationsAction Diagrams

User Points• Advantage:2E/2 functions except EXCUSRSRC & EXCUSRPGM

have default action diagram• some portions of default action diagrams which depict essential

processing are not alterable• areas which can be modified and where business logic can be

entered are called User Points

Press F5 on the action diagram to display user points for the function

Page 120: synon

Building ApplicationsAction Diagrams

EDIT ACTION DIAGRAM Edit SYNSXT Commodity FIND=> Edit Commodity .............................................................. > Edit : ACTION DIAGRAM EXIT POINTS F3=Exit SEL:X,Z-Select. : .-- : USER: Initialize program : . ...I : USER: Initialize subfile header : <-- . .=RE : USER: Initialize subfile record (existing record) : . |-*A : USER: Initialize subfile record (new record) : . | .. : CALC: Subfile control function fields : <-- . | PG : USER: Validate subfile control : . | > : USER: Validate subfile record fields : . | .= : CALC: Subfile record function fields : . | |- : USER: Validate subfile record relations + : . | | :............................................................: . | | ...Process response <-- . | '-ENDWHILE . '-ENDWHILE . ...Closedown <-- '-- F3=Exit F5=User points F6=Cancel pending moves F7=Forward F8=Backward F9=Edit parameters F15=Open Functions F16=Toggle Change Date F24=More keys

Page 121: synon

Action Diagram Constructs Sequential - specify a list of actions or other constructs that are executed in a sequential order. Denoted by brackets enclosing dotted lines

Conditional - actions are conditionally executed and are called CASE blocks. Denoted by CASE and ENDCASE statements

Iterative - represents repetitive logic. Denoted by REPEAT WHILE and ENDWHILE statements

Building ApplicationsAction Diagrams

Page 122: synon

Building ApplicationsAction Diagrams

Contextinstances of a field that are available for use at a particular processing stepDatabase Contexts - instances of same database field available in more than one fileDevice Contexts - instances of same device field available in more than one formatLiteral Contexts - instances of field available from literals like condition etc.System Contexts - instances of fields available from various system valuesFunction Contexts - instances of field available from function attributes like parameter

Page 123: synon

Building ApplicationsAction Diagrams

Database ContextsDB1 - fields are in the first or the only format of the based-on access pathDB2 - fields are from second format of the based on access path e.g. in SPN access path

Page 124: synon

Building ApplicationsAction Diagrams

Device ContextsKEY - fields are from the key panel display in case of EDTRCD or DSPRCD functionsDTL - fields are from the first panel of EDTRCDn or DSPRCDn functions2ND - fields are from the second panel of EDTRCDn or DSPRCDn functions3RD - fields are from the third panel of EDTRCDn or DSPRCDn functions

Page 125: synon

Building ApplicationsAction Diagrams

Device ContextsCTL - fields are from the subfile control record formatRCD - fields are from the subfile record formatCUR - fields are from the current report format in PRTOBJ and PRTFIL functionsNXT - fields are from the next active report format in PRTOBJ and PRTFIL functions

Page 126: synon

Building ApplicationsAction Diagrams

Literal ContextsCND - particular field condition is specified as a valueCON - constant context contains a literal value for non-status type fields

System ContextsJOB - contains system fields having execution time information of the job e.g. *USER, *JOBPGM - contains system fields that control the execution like *Program Mode, *Return Code

Page 127: synon

Building ApplicationsAction Diagrams

Function ContextsPAR - parameter fields as field valuesWRK - program variables not declared as any context as field values e.g. any field in data dictionary

Page 128: synon

IAFCalling User Defined FunctionsCalling Built-In Functions

Shortcuts to Some Built-In FunctionsI(A,E,Q,*,+,-,=,=A)F=Insert action

Building ApplicationsCalling Functions

Page 129: synon

Building ApplicationsAction Diagrams

Action Diagram EditorLine Commands

* Activate/Inactivate construct (Comment out) ** Place block Activate/Inactivate boundary A Place copied or moved construct after this line B Place copied or moved construct before this line C Copy construct to a point indicated by 'A' or 'B' CC Place block Copy boundary D Delete this construct DD Place block Delete boundary F Edit action or condition details for line FF Edit action parameters H Hide construct I+ Insert *ADD built-in function I+F Insert and Prompt *ADD built-in function I* Insert Comment I*F Insert and Prompt Comment

Page 130: synon

Building ApplicationsAction Diagrams

Action Diagram EditorLine Commands

I- Insert *SUB built-in function I-F Insert and Prompt *SUB built-in function I= Insert *MOVE built-in function I=A Insert and Prompt *MOVE ALL built in function I=F Insert and Prompt *MOVE built-in fucntion IA Insert Action IAF Insert and prompt Action IC Insert Case condition ICF Insert and Prompt Case condition II Insert Iteration IIF Insert and Prompt Iteration IM Insert Message function IMF Insert and Prompt Message function IO Insert *OTHERWISE condition IOF Insert and prompt *OTHERWISE condition

Page 131: synon

Building ApplicationsAction Diagrams

Action Diagram EditorLine Commands

IS Insert Sequence ISF Insert and Prompt Sequence IX Insert New condition within Case IXF Insert and Prompt New condition within Case M Move construct to a point indicated by 'A' or 'B' MM Place block Move boundary NA Copy to notepad & append to contents of notepad NAA Place block notepad append boundary NI Insert entire contents of notepad after this line NR Copy to notepad & replace contents of notepad NRR Place block notepad replace boundary S Show construct T Return to top level of action diagram U Unzoom out of construct to previous construct Z Zoom into construct