KeyEQ (Dataset function): Difference between revisions
RPuszewski (talk | contribs) No edit summary |
RPuszewski (talk | contribs) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Template:Dataset:KeyEQ subtitle}} | {{Template:Dataset:KeyEQ subtitle}} | ||
<var>KeyEQ</var> returns a <var>[[Boolean enumeration]]</var> to indicate whether the specified <var>key</var> was found within the <var>Dataset</var> object. If true, the object is positioned to that record | <var>KeyEQ</var> returns a <var>[[Boolean enumeration]]</var> to indicate whether the specified <var>key</var> was found within the <var>Dataset</var> object. If true, the object is positioned to that record. A subsequent read of the <var>Dataset</var> object will return the specified record. | ||
==Syntax== | ==Syntax== | ||
Line 14: | Line 9: | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>%boolean</th> | <tr><th>%boolean</th> | ||
<td>An enumeration object of type <var>Boolean</var> to contain the result of the positioning of the <var> dataset</var> object to key <var> | <td>An enumeration object of type <var>Boolean</var> to contain the result of the positioning of the <var> dataset</var> object to key <var> Key </var>. <var>KeyEQ</var> returns <code>True</code> if the specified key is found; otherwise it returns <code>False</code>. | ||
</td></tr> | </td></tr> | ||
<tr><th>Key</th> | <tr><th>Key</th> | ||
Line 26: | Line 21: | ||
Setting the value to nulls will cause reads to begin from the first record.</li>. | Setting the value to nulls will cause reads to begin from the first record.</li>. | ||
</ul> | </ul> | ||
==Examples== | ==Examples== | ||
ALLOCATE DATASET VSAMALT WITH SCOPE=SYSTEM DSN=RDP.VSAM.AIX - | <p class="code">ALLOCATE DATASET VSAMALT WITH SCOPE=SYSTEM DSN=RDP.VSAM.AIX - | ||
VSAM KEYED OLD SHARE | VSAM KEYED OLD SHARE | ||
ALLOCATE DATASET VSAMDS WITH SCOPE=SYSTEM DSN=RDP.VSAM - | ALLOCATE DATASET VSAMDS WITH SCOPE=SYSTEM DSN=RDP.VSAM - | ||
Line 61: | Line 57: | ||
FREE VSAMALT | FREE VSAMALT | ||
FREE VSAMDS | FREE VSAMDS | ||
</p> | |||
==See also== | ==See also== | ||
{{Template:Dataset:KeyEQ footer}} | {{Template:Dataset:KeyEQ footer}} |
Latest revision as of 16:49, 14 April 2021
Template:Dataset:KeyEQ subtitle
KeyEQ returns a Boolean enumeration to indicate whether the specified key was found within the Dataset object. If true, the object is positioned to that record. A subsequent read of the Dataset object will return the specified record.
Syntax
Syntax
Template loop detected: Template:Dataset:KeyEQ syntax
Syntax terms
%boolean | A Boolean enumeration value |
---|---|
key | A key object. |
Syntax terms
%boolean | An enumeration object of type Boolean to contain the result of the positioning of the dataset object to key Key . KeyEQ returns True if the specified key is found; otherwise it returns False .
|
---|---|
Key | The value used to position the Dataset object. |
Usage notes
- The default for Key is nulls. Setting the value to nulls will cause reads to begin from the first record. .
Examples
ALLOCATE DATASET VSAMALT WITH SCOPE=SYSTEM DSN=RDP.VSAM.AIX - VSAM KEYED OLD SHARE ALLOCATE DATASET VSAMDS WITH SCOPE=SYSTEM DSN=RDP.VSAM - VSAM KEYED OLD SHARE Begin %l is longstring %ds is object dataset %ds = new('VSAMALT') if %ds:open then print "Error opening dataset" stop end if %key is string len 4 initial('AAAA') print %ds:keyeq(%key) %l = %ds:readRecord %ds:close %ds = new('VSAMDS') if %ds:open then print "Error opening dataset" stop end if print %ds:keyge(%l:Substring(10,8)) repeat forever %l = %ds:readRecord if %ds:state eq afterEnd then print 'end of rec' loop end end if print %l end repeat %ds:close End FREE VSAMALT FREE VSAMDS