OFIND
The OFIND (OFI) service searches a memory object for a specified string.
You can specify an end address as well as a beginning address. If you do not specify an end address, the search continues to the end of the memory object. For the search, you can also specify a boundary alignment and an offset from that alignment.
Syntax
The parameters are defined as follows:
Parameter | Description |
---|---|
StrExp | can be either an expression that denotes the location and length of the subject search string or a literal expressed as a character or hexadecimal value Character values are converted to uppercase unless enclosed in quotation marks. You must enclose character strings that contain special characters (for example, blanks, commas, and parentheses) in quotation marks. When enclosed in quotation marks, a 'C' can optionally precede character strings. Hexadecimal values must be enclosed in single quotation marks and preceded by an X (for example: X'0A0B'). Either an expression or a literal value is required for an initial search. You can specify an asterisk when resuming a search. The search string can be from 1 to 64 bytes in length. By using expressions, you can refer to the search string if it is already in storage, thereby avoiding the need to type in the string itself. Expressions are especially useful for large, hexadecimal values that can be up to 128 characters (64 bytes) in length. Expressions are differentiated from a character literal by the presence of the string length enclosed within parentheses at the end of the expression. For example, ASCB+4(4) indicates that the search string is four bytes in length and starts at ASCB+4. Also see Example 3. |
Begin | required for the initial search; defines the starting location for the search and can be any expression that resolves within a memory object; for example: MOBJ0002 or MOBJ0002+1M Omit the parameter or use * to resume the previous search. |
End | (optional) specifies the ending address for the search; can be an expression that resolves to a location within the memory object defined by the begin expression a value that when added to the beginning of the memory object defined by the begin expression, falls within the bounds of that memory object If omitted, the end-of-memory object is assumed. |
BNDRY | (optional) specifies the boundary alignment (m) and offset from that alignment (n) for the search An m can be 1 or any multiple of 2, for example: 1, 2, 4, 8, 16, 32, and 64. Larger alignments can also be expressed by using the scalars K, and M. For example: 1K for 1024, 4K for 4096, and 1M for 1,048,576. 1M is the largest valid boundary alignment. The offset value, n, is optional. If specified, it must be a value from 0 to m-1. The default for m is 1, which indicates single-byte alignment. The default value for n is 0. BNDRY(8) is equivalent to BNDRY(8,0) which is at the beginning of each double-word. BNDRY(8,2) means displaced two bytes from each double-word boundary. |
Example 1
Find the first occurrence of Obj within the first five megabytes of memory object MOBJ0001.
OFIND,'Obj',MOBJ0001,5M
AMTVY3I 00000001_
AMTVY4I 00000000 E2A39699 81878540 D68291F1 406040D7 *Storage Obj1 - P*
AMTVY4I 00000010 C9D5C9D6 D5406040 F1F061F1 F061F0F3 *INION - 10/10/03*
AMTVY4I 00000020 40F0F84B F3F54040 40404040 40404040 * 08.35 *
AMTVY4I 00000030 40404040 40404040 40404040 40404040 * *
AMTVY4I 00000040 00000000 00000000 00000000 00000000 *................*
AMTVY4I 00000050 00000000 00000000 00000000 00000000 *................*
AMTVY4I 00000060 00000000 00000000 00000000 00000000 *................*
AMTVY4I 00000070 00000000 00000000 00000000 00000000 *................*
Example 2
You suspect that memory object MOBJ0005 contains control blocks that are identified by the acronym WPHG. You also know that the control blocks begin on a page boundary and that the acronym is displaced four bytes from the beginning of the control block. You want to find the first occurrence of this block in the memory object, so you type
OF,WPHG.MOBJ0005,BNDRY(4K,4)
AMTVY3I 00000005_
AMTVY4I 41C01000 20711000 E6D7C8C7 00000005 41C00000 *....WPHG.....{..*
AMTVY4I 41C01010 00000005 41C02000 7F020D68 0202FFFF *.....{..'.......*
AMTVY4I 41C01020 FFF00000 FFFFFFF0 0000FFFF FFF00000 *.0.....0.....0..*
AMTVY4I 41C01030 7BB6168C 7BB61668 00000000 00000000 *#...#...........*
AMTVY4I 41C01040 00000000 00000000 80000000 00000000 *................*
AMTVY4I 41C01050 00000000 00000005 4001C000 00000000 *........ .{.....*
AMTVY4I 41C01060 80000000 00000000 00000000 00000000 *................*
AMTVY4I 41C01070 00000000 00000000 00000000 00000000 *................*
You notice that there are double-word address pointers at offsets +8 and +10 that point to locations within the memory object; you decide to examine the contents of the storage referenced by the second pointer. You know that the last-referenced address variable (*) is currently pointing to the beginning of the block that you just found, so you can use the expression *+10 to reference the second pointer. Because you want to display the storage at that 64-bit address, you add the 64-bit indirection indicator (!) to the end of that expression and use that expression as the first parameter of the DUMP service, as follows:
DUMP *+10!
AMTC1ZI 00000005_00002000 KEY= 7P DECEDBM1 (ASID 0166)
AMTC12I 41C02000 20711000 E6D7C8C7 00000005 41C01000 *....WPHG.....{..*
AMTC12I 41C02010 00000005 41C03000 7F020D68 0303FFFF *.....{..'.......*
AMTC12I 41C02020 FFF00000 FFFFFFF0 0000FFFF FFF00000 *.0.....0.....0..*
AMTC12I 41C02030 7BB6168C 7BB61668 00000000 00000000 *#...#...........*
Example 3
Suppose that you want to search the memory object for other occurrences of the eight-byte address pointer located at +10 in MOBJ0005 in the previous example. You do not want to type in the hexadecimal value X'0000000541C02000', so you elect to reference it by using an expression. Furthermore, you are only interested in finding occurrences that are on a double-word boundary. You want to search beginning immediately after the string that you are referencing, and search through the entire memory object, if necessary. So, you type
OFIND,MOBJ0005+10(8), MOBJ0005+18, BNDRY(8)
Related topic