Janus SOAP ULI V7.8 changes: Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
m (Content removed to M2o4Int page of same name)
 
(109 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Hierarchy header}}
Content moved to M204Int, but history preserved here.
 
The following sections describe changes in the [[Janus SOAP User Language Interface|Janus SOAP ULI]]
in this release.
 
==New arguments for Record class ToXmlDoc method==
The [[ToXmlDoc]] method in the Record class has the following new
arguments:
<dl>
<dt><b>CodepageTable= </b><i>bool</i>
<dd>This Boolean argument, which defaults to <tt>False</tt>,
specifies whether to use the base codepage
translation table when creating the XmlDoc.
For more details, see the description of the <tt>CodepageTable=False|True</tt> argument in [[Janus SOAP XmlDoc API V7.8 changes#LoadFromRecord subroutine in XmlDoc and XmlNode classes|LoadFromRecord subroutine in XmlDoc and XmlNode classes]].
Note that this argument was actually introduced in version 7.6 of
the ''Sirius Mods''.
<dt><b>AllowNull=</b><i> bool</i>
<dd>The value of this Boolean argument, which defaults to <tt>False</tt>,
is copied to the AllowNull property of the XmlDoc created by ToXmlDoc.
The XmlDoc's AllowNull property, in turn, determines whether field values that contain the X'00' character are stored in the
XmlDoc with base64 encoding. Such values are base64 encoded if AllowNull is <tt>False</tt>.
For more information, see the description of the <tt>AllowNull=</tt> argument in [[Janus SOAP XmlDoc API V7.8 changes#NewFromRecord shared function in XmlDoc class|NewFromRecord shared function in XmlDoc class]].
Note that this argument was actually introduced in version 7.7 of the ''Sirius Mods''.
</dl>
==Field references in Record class CurrentRecord methods==
For methods declared with a CurrentRecord attribute, it was the case under ''Sirius Mods'' 7.7 that field references were an exception to the following rule:
<br>
''Statements within the method definition, even a CurrentRecord method call, may reference the record without having to be wrapped inside a record For loop.''
Under ''Sirius Mods'' 7.8, field references are no longer an exception to this rule.
You may reference a record field from within a method declared with
CurrentRecord without being inside a record For loop.
For example, for the field COLOR,
the <tt>For Record currentRecord</tt> and <tt>End For</tt>
statements containing the
<tt>print COLOR</tt> statement in the method definition below
may be discarded under ''Sirius Mods'' 7.8:
<pre>
    local subroutine (Record in file myproc):printField currentRecord in file myproc
      for record currentRecord
          print COLOR
      end for
    end subroutine
</pre>
 
==New exception class: BadJournal==
The BadJournal exception class reports
errors in CCAJRNL or CCAJLOG datasets or streams, including naming errors.
The [[New]] method of the [[Journal]] system class is the
system method that automatically throws a BadJournal exception.
The following example shows a Try and Catch of a Journal class, New method,
exception. An invalid journal name is specified to generate the BadJournal exception:
<pre>
    Begin
    %sl        is object stringlist
    %rc        is float
    %journal  is object journal
    %bdjrnl    is object BadJournal
    try printtext {~} is: {%journal = new('OLD~RNL')}
      catch BadJournal to %bdjrnl
      Print 'Failure!!! Reason code is: ' %bdjrnl:reasonCode
    end try
    %rc = %sl:appendJournalData( -
              Options='MAXIO=1000 WIDTH=138 ST AA USER', -
              Threads='*', Journal=%journal)
    Print %rc
    Print %sl:count
    %sl:print
    End
</pre>
The Stringlist AppendJournalData method does not cancel if its Journal
parameter is null.
The request result shows the reason code (ReasonCode property value)
stored in the exception object:
<pre>
    %journal = new('OLD~RNL') is: Failure!!! Reason code is: 1
    0
    0
</pre>
The methods of the BadJournal class are described in the following subsections.
===New constructor===
This constructor generates an instance of a BadJournal exception.
As shown below, the optional argument of the New method is a setting of
the ReasonCode property.
 
====New constructor syntax====
  [%bdJrnl =] [%(BadJournal):] New(ReasonCode=num)
===ReasonCode property===
This readOnly property returns a numeric reason code that indicates the
cause of the BadJournal exception.
====ReasonCode syntax====
  %rc = %bdJrnl:ReasonCode
Possible reason codes are:
<dl>
<dt>1
<dd>Either the dataset or stream name is invalid, or the journal is invalid.
<dt>2
<dd>The dataset or stream is empty.
<dt>3
<dd>The journal was created with a different ''Model 204'' version than the
current Online.
<dt>4
<dd>A merged journal is invalid.
</dl>
==New SelectionCriterion methods: IsNull and IsNotNull==
These shared methods take no parameters and create a new [[SelectionCriterion]] object.
The methods provide control for Null objects in the [[collection]] you are searching.
They also let you determine whether a collection contains items that are objects,
because they cancel the request if the collection being searched contains
non-object (intrinsic type) items.
An IsNull criterion selects a collection item if the item is a Null object;
an IsNotNull criterion selects an item objects if it is not Null.
The syntax of the methods follows:
  %selc = IsNull
  %selc = IsNotNull
The examples below test a variety of searches against
arraylist <tt>%al</tt> of objects of class <tt>T</tt>:
<pre>
    class T
      public
        variable x is float
      end public
    end class
    %al is arraylist of object t
    %t  is object t
    %t1 is object t
    %t2 is object t
    %t1 = null
    %t2 = new
    %al = list(%t1, %t2)
</pre>
<ol>
<li>The Arraylist class [[FindNextItem]] method, which throws an exception
if its selection criterion
matches no item, fails in the Try clause below when it tests the Null object item.
The method's exception is not thrown because the test failure prevents the method
from completing its search:
<pre>
    try  %t = %al:findNextItem(EQ(x,1))
      printtext found t
      printtext {~} = {%t:x}
    catch itemNotFound
      printText None!
    end try
</pre>
The result is:
<pre>
    CANCELLING REQUEST: MSIR.0750: Class ARRAYLIST, function
      FindNextItem: reference to null object in line xx
</pre>
To complete this request without cancellation,
you can use an IsNotNull criterion to bypass Null items:
<pre>
    try  %t = %al:findNextItem(AND(isNotNull, EQ(x,1)))
      printtext found t
      printtext {~} = {%t:x}
    catch itemNotFound
      printText None!
    end try
</pre>
The search finds no matching items, so the Catch clause above catches the
method's ItemNotFound exception, and the result is:
<pre>
    None!
</pre>
<li>Instead of bypassing Null items, you might instead want the search to
include them:
<pre>
    try  %t = %al:findNextItem(OR(isNull, EQ(x,1)))
      printtext found t
      printtext {~} = {%t:x}
    catch itemNotFound
      printText None!
    end try
</pre>
The Null item is found, but the Try clause PrintText invocation
of <tt>%t:x</tt> fails, and the result is:
<pre>
    CANCELLING REQUEST: MSIR.0561: Text output:
      reference to null object in line xx
</pre>
If you want to search exclusively for the next Null item in a collection,
you can simply use this:
<pre>
    %t = %al:findNextItem(isNull)
</pre>
<li>To successfully locate the non-Null item in <tt>%al</tt>,
you could use either of the following method calls in the Try clause:
<pre>
    %t = %al:findNextItem(isNotNull)
    %t = %al:findNextItem(AND(isNotNull, EQ(x,0)))
</pre>
Thanks to the change in the EQ criterion in the second call above,
the result of trying either of these searches is:
<pre>
    found t
    %t:x=0
</pre>
</ol>
 
{{Hierarchy footer}}

Latest revision as of 21:38, 17 October 2013

Content moved to M204Int, but history preserved here.