BadJournal class: Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
 
 
(2 intermediate revisions by one other user not shown)
Line 5: Line 5:
An instance of the <var>BadJournal</var> exception class may be automatically thrown by the <var>[[New (Journal constructor)|New]]</var> constructor of the <var>Journal</var> class; it is explicitly created with the <var>[[New (BadJournal constructor)|New]]</var> constructor of the <var>BadJournal</var> class.</p>
An instance of the <var>BadJournal</var> exception class may be automatically thrown by the <var>[[New (Journal constructor)|New]]</var> constructor of the <var>Journal</var> class; it is explicitly created with the <var>[[New (BadJournal constructor)|New]]</var> constructor of the <var>BadJournal</var> class.</p>
   
   
The following example shows a "[[Exceptions#Try and Catch|Try and Catch]]" of a <var>Journal</var> class, <var>New</var> method, exception. An invalid journal name is specified to generate the <var>BadJournal</var> exception.  
The following example shows a [[Exceptions#Try and Catch|Try and Catch]] of a <var>Journal</var> class, <var>New</var> method, exception. An invalid journal name is specified to generate the <var>BadJournal</var> exception.  


<p class="code">begin
<p class="code">begin
Line 32: Line 32:
  0
  0
</p>
</p>
<b>Note:</b> In order to display the reason code associated with the request, the exception is caught to a <var>BadJournal</var> object variable, against which the <var>[[ReasonCode_(BadJournal_property)|ReasonCode]]</var> method runs.
<p class="note"><b>Note:</b> In order to display the reason code associated with the request, the exception is caught to a <var>BadJournal</var> object variable, against which the <var>[[ReasonCode_(BadJournal_property)|ReasonCode]]</var> method runs. </p>
   
   
The <var>BadJournal</var> class is available as of <var class="product">[[Sirius Mods]]</var> Version 7.8.
The <var>BadJournal</var> class is available as of <var class="product">[[Sirius Mods]]</var> Version 7.8.
Line 41: Line 41:
The methods in the class are described in the subsections that follow. In addition:
The methods in the class are described in the subsections that follow. In addition:
<ul>
<ul>
<li>[[Notation conventions for methods|"Notation conventions for methods"]] has information
<li>[[Notation conventions for methods]] has information about the conventions followed. </li>
about the conventions followed.  
<li>[[BadJournal methods syntax]] is a single page that contains the syntax diagrams of all the methods in the class. </li>
<li>[[BadJournal methods syntax|"BadJournal methods syntax"]] is a single page that contains the syntax diagrams of all the methods in the class.
</ul>
</ul>


Line 56: Line 55:


====Syntax terms====
====Syntax terms====
<table class="syntaxTable">
<table>
<tr><th>%badJournal</th>
<tr><th>%badJournal</th>
<td>A reference to an instance of a <var>[[BadJournal_class|BadJournal]]</var> object.
<td>A reference to an instance of a <var>[[BadJournal_class|BadJournal]]</var> object.
Line 62: Line 61:


<tr><th><var>[%(BadJournal):]</var></th>
<tr><th><var>[%(BadJournal):]</var></th>
<td>The class name in parentheses denotes a <var>[[Notation conventions for methods#Constructors|Constructor]]</var>. See [[#Usage notes|"Usage notes"]], below, for more information about invoking a <var>BadJournal</var> <var>Constructor</var>.</td></tr>
<td>The class name in parentheses denotes a <var>[[Notation conventions for methods#Constructors|Constructor]]</var>. See [[#Usage notes|Usage notes]], below, for more information about invoking a <var>BadJournal</var> <var>Constructor</var>.</td></tr>


<tr><th><var>ReasonCode</var></th>
<tr><th><var>ReasonCode</var></th>
<td>This optional, but [[Methods#Named parameters|name required]] parameter <var class="term>ReasonCode</var>, specifies the numeric reason code to be assigned to the <var>BadJournal</var> exception object's <var>ReasonCode</var> property when a daemon thread is lost.
<td>This [[Methods#Named parameters|name required]] parameter specifies the numeric reason code to be assigned to the <var>BadJournal</var> exception object's <var>ReasonCode</var> property when a daemon thread is lost.
<p>The possible values are described below in [[ReasonCode (BadJournal property)#Syntax terms|"ReasonCode property"]].</p>
<p>
The possible values are described below in [[ReasonCode (BadJournal property)#Syntax terms|ReasonCode property]].</p>
</td></tr></table>
</td></tr></table>


===Usage notes===
===Usage notes===
<ul>
<ul>
<li>As described in [[Object variables#Using New or other Constructors|"Using New or other Constructors"]], <var>New</var> can be invoked with no object, with an explicit class name, or with an object variable in the class, even if that object is <var>Null</var>:<p class="code">%badJournal = new
<li>As described in [[Object variables#Using New or other Constructors|Using New or other Constructors]], <var>New</var> can be invoked with no object, with an explicit class name, or with an object variable in the class, even if that object is <var>Null</var>:<p class="code">%badJournal = new


%badJournal = %(BadJournal):new
%badJournal = %(BadJournal):new

Latest revision as of 14:48, 20 June 2018


The BadJournal exception class reports errors in CCAJRNL or CCAJLOG datasets or streams, including naming errors, that are encountered by the Journal class constructor.

An instance of the BadJournal exception class may be automatically thrown by the New constructor of the Journal class; it is explicitly created with the New constructor of the BadJournal class.

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.

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

AppendJournalData does not cancel if its Journal parameter is null. The request result shows the reason code stored in the exception object:

%journal = new('OLD~RNL') is: Failure!!! Reason code is: 1 0 0

Note: In order to display the reason code associated with the request, the exception is caught to a BadJournal object variable, against which the ReasonCode method runs.

The BadJournal class is available as of Sirius Mods Version 7.8.

The BadJournal methods

The following are the available BadJournal class methods.

MethodDescription
NewCreate a new BadJournal object
ReasonCodeNumeric code indicating cause of BadJournal exception

The methods in the class are described in the subsections that follow. In addition:


New constructor

Create a new BadJournal object (BadJournal class)

[Introduced in Sirius Mods 7.8]

The New constructor generates an instance of a BadJournal exception object, optionally also setting the ReasonCode property.

Syntax

%badJournal = [%(BadJournal):]New( ReasonCode= number)

Syntax terms

%badJournal A reference to an instance of a BadJournal object.
[%(BadJournal):] The class name in parentheses denotes a Constructor. See Usage notes, below, for more information about invoking a BadJournal Constructor.
ReasonCode This name required parameter specifies the numeric reason code to be assigned to the BadJournal exception object's ReasonCode property when a daemon thread is lost.

The possible values are described below in ReasonCode property.

Usage notes

  • As described in Using New or other Constructors, New can be invoked with no object, with an explicit class name, or with an object variable in the class, even if that object is Null:

    %badJournal = new %badJournal = %(BadJournal):new %badJournal = %badJournal:new


ReasonCode property

Numeric code indicating cause of BadJournal exception (BadJournal class)

[Introduced in Sirius Mods 7.8]

Syntax

%number = badJournal:ReasonCode

Syntax terms

%number This is a numeric variable to receive the code describing the reason the exception was thrown. Possible values include:
1Either the dataset or stream name is invalid, or the journal is invalid.
2The dataset or stream is empty.
3The journal was created with a different Model 204 version than the current Online.
4The content of the merged journal is invalid.
badJournal A reference to an instance of a BadJournal object.