Download presentation
Presentation is loading. Please wait.
Published bySherilyn Patterson Modified over 9 years ago
1
centric features In this presentation… –macro capabilities more sophisticated functionality –advanced macro features Inspector Debugging error trapping printing macros structures and user defined types –all features discussed in this session are also available with newlook developer (ND)
2
Advanced Macro Programming inspector –access to variables, objects and properties –read and modify access –remove variables –value and type information –arrays and collections –watch important values
3
Advanced Macro Programming inspector –All window
4
Advanced Macro Programming inspector –Auto window
5
Advanced Macro Programming inspector –Watch window
6
Advanced Macro Programming debugging –control and inspect execution –breakpoints –macro context list –observe execution of code even without errors
7
Advanced Macro Programming types of problems –error conditions –invalid input –macro logic errors
8
Advanced Macro Programming breakpoints –breakpoints halts the execution of a macro or script and gives you a snapshot of its condition at any moment. –variables and properties can be inspected to analyze the current state. –variables and property values can be changed to alter the execution of the macro or script.
9
Advanced Macro Programming breakpoints allow you to: –observe the condition of the user interface. –determine which active macros/scripts have been called. –watch the values of variables, properties, and objects. –change the values of variables and properties. –view which action the macro or script will run next.
10
Advanced Macro Programming breakpoints occur when: –execution reaches a line with a breakpoint –you choose Break from the Run menu –you click the Break button on the toolbar –a break expression defined in the Add Watch dialog box changes
11
Advanced Macro Programming debugging toolbar –debugging mode turn on or off the debugging features. When debugging mode is turned off breakpoints do not cause execution to halt. –start begin execution from current location and proceed until next breakpoint is reached.
12
Advanced Macro Programming debugging toolbar –break halt execution at the macros current location. –end terminate execution of the current macro/script at its current location.
13
Advanced Macro Programming debugging toolbar –step into continue execution by executing the next statement and move into the next macro/script being called. –step over continue execution by executing the next statement and move over the next macro/script being called.
14
Advanced Macro Programming debugging toolbar –step to cursor continues execution of the current macro/script until it reaches the current cursor position. –toggle breakpoint turns on or off the breakpoint at the current cursor position.
15
Advanced Macro Programming debugging toolbar –clear all breakpoints clears any breakpoints currently set –show next action displays the next action to be executed. the editor will display the action with the cursor located at the statement.
16
Advanced Macro Programming debugging toolbar –add watch add a variable, object or property to the Watch window to allow its current value to be seen. –context list while in break mode, presents a dialog box that shows all macros that have been called but not yet run to completion.
17
Advanced Macro Programming debugging toolbar
18
Advanced Macro Programming context list –displays the call stack. –shows all macros that have been called to get to this execution point. –allows you to easily select the macros calling the current macro to analyze their program logic.
19
Advanced Macro Programming error trapping –handling of error conditions. –actions to set error handlers, raise errors or resume execution. –error handler is called if an error is encountered in the macro when running. –default run-time error dialog if no error handler is set.
20
Advanced Macro Programming OnError macro action –used to set or clear the error handler. –error handlers can be nested. –default handling displays run-time error dialog. –error handler should test or copy the Err object properties before another error could be triggered.
21
Advanced Macro Programming OnError macro action –Arguments label name of location to execute if a macro error occurs. blank label disables the error handler. error handler automatically disabled when macro terminates.
22
Advanced Macro Programming Resume macro action –used to resume execution of a macro after a run-time error has been handled. –special value of Next to resume at the statement after the one that triggered the error. –other values allowed to resume at other points.
23
Advanced Macro Programming Resume macro action –Arguments label name of location to execute if a macro error occurs. Next value behavior depends upon whether the handler is in the same macro as where the error was triggered.
24
Advanced Macro Programming Raise macro action –Arguments Number error number to be raised. Description text description to be displayed in error dialog.
25
Advanced Macro Programming Raise macro action –generates a run-time error. –can be called from error handler or from general macros.
26
Advanced Macro Programming Err object –used to provide information about a run-time error. –only valid when a error handler is executing. –read-only but Raise can be used to set errors. –property of the App object.
27
Advanced Macro Programming printing macros –debugging –education –versioning –clipboard can also be used to bring macro contents across to another application (such as notepad)
28
printing macros OpenDBConnect (SampleConnection, DBServerDDM, ="Network Address=" & NetworkAddress & ";Network Port=447;Use Encryption for Data=False;Host CCSID=37;Mode=ReadWrite|ShareDenyNone;Isolation Level=ReadCommitted;Process Binary as Character=True") DBOpen (SampleRecordset, SampleConnection, /QSYS.LIB/QGPL.LIB/QAFCTUTDBF.FILE/DBFILE1.MBR, DBUseServer, DBOpenForwardOnly, DBLockReadOnly, DBCmdUnknown) RunMacro (Sample - Database actions.First,, ) StopMacro CloseDBClose (SampleRecordset) DBDisconnect (SampleConnection) StopMacro Advanced Macro Programming
29
user defined types –structures. –database records. –Call, RPCCall and WebCall
30
Advanced Macro Programming predefined data types –Byte –Boolean –Integer –Long –Single –Double –String –String * –WString –WString *
31
Advanced Macro Programming Type macro action –used to describe a user defined data type. –can have one or more elements. –multiple element data types are referred to as structures. –described using predefined data types.
32
Advanced Macro Programming Type macro action example Type (MyType, Code as Long, Description as String * 32)
33
Advanced Macro Programming Dim macro action –declares a variable and allocates storage. –convention is to put Dim actions at the beginning of the macro. –variable type can be a pre-defined type or a user defined type. –typically used in conjunction with the Type action and is not usually required for variable creation within macros.
34
Advanced Macro Programming Dim macro action example Dim (MyVariable, MyType)
35
Advanced Macro Programming referencing fields Type (MyType, Code as Long, Description as String * 32) Dim (MyVariable, MyType) SetValue (MyVariable.Code, 99) SetValue (MyVariable.Description, "Undefined error!")
36
Advanced Macro Programming referencing fields
37
Advanced Macro Programming Call example –Type (WIN32_FIND_DATA, dwFileAttributes as DWORD, ftCreationTimeLow as DWORD, ftCreationTimeHigh as DWORD, ftLastAccessTimeLow as DWORD, ftLastAccessTimeHigh as DWORD, ftLastWriteTimeLow as DWORD, ftLastWriteTimeHigh as DWORD, nFileSizeHigh as DWORD, nFileSizeLow as DWORD, dwReserved0 as DWORD, dwReserved1 as DWORD, cFileName as String * 260, cAlternateFileName as String * 14)
38
Advanced Macro Programming Call example –Declare (C:\Winnt\System32\Kernel32.dll, FindFirstFileA,, Long, ByVal lpFileName as String, ByRef lpFindFileData as WIN32_FIND_DATA) –Dim (FindFileData, WIN32_FIND_DATA) –Call (FindFirstFileA, fldFileName,FindFileData, iResult)
39
Advanced Macro Programming RPCCall example –Type (InfoTable2, p1 as String * 10, p2 as String * 1, p3 as String * 1, p4 as Long, p5 as String * 20) –Type (ChridReceiver, p1 as Long, p2 as Long, p3 as InfoTable2) –Dim (VarChrid, ChridReceiver)
40
Advanced Macro Programming RPCCall example –RPCDeclare (Connection1, QSYS, QWCRSVAL, QuerySystemChar,, Output prmRetVar as ChridReceiver, Input prmRetVarLen as Long, Input prmNumofValues as Long, Input prmValueName as String * 10, InputOutput prmError as String) –RPCCall (Connection1, QuerySystemChar, VarChrid, 44, 1, "QCHRID", fldError, )
41
centric 8 Training Workshop 1
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.