Little or unknown "Debugger" functions
Page 1 of 1
Little or unknown "Debugger" functions
%SUBSTR Built-In Function
This function is great when you're working with large strings.
- You can view a segment of a string as shown below (assume that StringFldA = 'abcdefghijklmnopqrstuvwxyz'):
Debug command: EVAL %SUBSTR(StringFldA 12 5)
Displayed result: %SUBSTR(StringFldA 12 5) = 'lmnop'
- You can also use the %SUBSTR function to set the value of a specific portion of a string. For me, this is the more useful of these two functions.
Debug command: EVAL %SUBSTR(StringFldA 12 5) = 'xxxxx'
Displayed result: %SUBSTR(StringFldA 12 5) = 'xxxxx'
Debug command: EVAL StringFldA
Displayed result: StringFldA = 'abcdefghijkxxxxxqrstuvwxyz'
- You can also use %SUBSTR to set a conditional breakpoint or watch condition.
For example, the following code would stop execution only when positions 12 thru 16 of StringFldA are 'xxxxx':
Debug command: BREAK 100 when %SUBSTR(StringFldA 12 5) = 'xxxxx'
- Or you could watch for those same positions to change by using this watch condition:
Debug command: WATCH %SUBSTR(StringFldA 12 5)
This way, anytime the contents of positions 12 thru 16 change, program execution stops and you are notified.
________________________________________________________________________________________________________
%INDEX Built-In Function
The %INDEX function is handy when you're using multiple-occurrence data structures.
It's also useful in combination with _QRNU_DSI_xxxx (where xxxx = the name of a multi-occurrence data structure).
- The command EVAL _QRNU_DSI_xxxx returns the current occurrence of a multiple-occurrence data structure.
- Using the %INDEX function will change the current occurrence. See the example below:
d WorkDS1 ds occurs(3)
d StringA 10a
d StringB 25a
Debug command: EVAL _QRNU_DSI_WorkDS1
Displayed result: 1 (or whatever the current occurrence of WorkDS1 is)
Debug command: WorkDS1 = %INDEX(3)
Displayed result: WorkDS1 = %INDEX(3) = 3
(Interrogated subfields will now reflect the values the of third occurrence of the data structure.)
This function is great when you're working with large strings.
- You can view a segment of a string as shown below (assume that StringFldA = 'abcdefghijklmnopqrstuvwxyz'):
Debug command: EVAL %SUBSTR(StringFldA 12 5)
Displayed result: %SUBSTR(StringFldA 12 5) = 'lmnop'
- You can also use the %SUBSTR function to set the value of a specific portion of a string. For me, this is the more useful of these two functions.
Debug command: EVAL %SUBSTR(StringFldA 12 5) = 'xxxxx'
Displayed result: %SUBSTR(StringFldA 12 5) = 'xxxxx'
Debug command: EVAL StringFldA
Displayed result: StringFldA = 'abcdefghijkxxxxxqrstuvwxyz'
- You can also use %SUBSTR to set a conditional breakpoint or watch condition.
For example, the following code would stop execution only when positions 12 thru 16 of StringFldA are 'xxxxx':
Debug command: BREAK 100 when %SUBSTR(StringFldA 12 5) = 'xxxxx'
- Or you could watch for those same positions to change by using this watch condition:
Debug command: WATCH %SUBSTR(StringFldA 12 5)
This way, anytime the contents of positions 12 thru 16 change, program execution stops and you are notified.
________________________________________________________________________________________________________
%INDEX Built-In Function
The %INDEX function is handy when you're using multiple-occurrence data structures.
It's also useful in combination with _QRNU_DSI_xxxx (where xxxx = the name of a multi-occurrence data structure).
- The command EVAL _QRNU_DSI_xxxx returns the current occurrence of a multiple-occurrence data structure.
- Using the %INDEX function will change the current occurrence. See the example below:
d WorkDS1 ds occurs(3)
d StringA 10a
d StringB 25a
Debug command: EVAL _QRNU_DSI_WorkDS1
Displayed result: 1 (or whatever the current occurrence of WorkDS1 is)
Debug command: WorkDS1 = %INDEX(3)
Displayed result: WorkDS1 = %INDEX(3) = 3
(Interrogated subfields will now reflect the values the of third occurrence of the data structure.)
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|