The following example shows the display of a character string. The array must be dereferenced by the '*' operator. If the * operator is not entered, the array is displayed as a space pointer. If the dereferencing operator is used, but the ':s' is not appended to the expression, only the first array element is displayed.
+--------------------------------------------------------------------------------+ | Display Module Source | | Program: TEST3 Library: DEBUG Module: MAIN | | 1 #include <string.h> | | 2 char array1 [11]; | | 3 int i; | | 4 int main(){ | | 5 strcpy(array1,"0123456789"); | | 6 i = 0; | | 7 return 0; | | 8 } | | Bottom | | Debug . . . eval *array1: s____________________________________________ | | ________________________________________________________________________ | | F3=Exit program F6=Add/Clear breakpoint F10=Step F11=Display variable | | F12=Resume F17=Watch variable F18=Work with watch F24=More keys | +--------------------------------------------------------------------------------+
The following shows the value of the array. A string length of up to 65535 can follow the s character. Formatting will stop at the first null character encountered. If no length is specified, formatting will stop after 30 characters or the first null, whichever is less.
+--------------------------------------------------------------------------------+ | Display Module Source | | Program: TEST3 Library: DEBUG Module: MAIN | | 1 #include <string.h> | | 2 char array1 [11]; | | 3 int i; | | 4 int main(){ | | 5 strcpy(array1,"0123456789"); | | 6 i = 0; | | 7 return 0; | | 8 } | | Bottom | | Debug . . . ___________________________________________________________ | | ________________________________________________________________________ | | F3=Exit program F6=Add/Clear breakpoint F10=Step F11=Display variable | | F12=Resume F17=Watch variable F18=Work with watch F24=More keys | |*array1: s = "0123456789" ... | +--------------------------------------------------------------------------------+
The following example shows the usage of the :f syntax to specify that the newline character (x'15') should be scanned for while displaying string output. If the end of the display line occurs, the output is wrapped to the next display line.
When the :f formatting code is used, the text string will display on the current line until a newline is encountered. If no newline character is encountered before the end of the display screen line, the output is wrapped until a newline is found. DBCS SO/SI characters are added as necessary to make sure they are matched.
An example of :f format code usage is shown:
|
This program will result in the following screen output:
+--------------------------------------------------------------------------------+ |> EVAL *testc:s 100 | | *testc:s 100 = | | "This is the first line. This is the second line. This is the" | | "third line." | |> EVAL *testc:f 100 | | *testc:f 100 = | | This is the first line. | | This is the second line. | | This is the third line. | +--------------------------------------------------------------------------------+
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.