BadJournal class: Difference between revisions
m (tags and edits) |
m (few more tags) |
||
Line 6: | Line 6: | ||
<ol><li>The following example shows a "[[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: | <ol><li>The following example shows a "[[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 | ||
%sl is object stringlist | %sl is object [[Stringlist class|stringlist]] | ||
%rc is float | %rc is float | ||
%journal is object journal | %journal is object journal | ||
%bdjrnl is object badJournal | %bdjrnl is object badJournal | ||
try | [[try]] [[PrintText statement|printText]] {~} is: {%journal = new('OLD~RNL')} | ||
catch badJournal to %bdjrnl | [[catch]] badJournal to %bdjrnl | ||
print 'Failure!!! Reason code is: ' %bdjrnl:reasonCode | print 'Failure!!! Reason code is: ' %bdjrnl:reasonCode | ||
end try | end try |
Revision as of 04:53, 22 April 2011
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 "Journal Class New Constructor", or explicitly with the "BadJournal Class New Constructor".
Examples
- 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.
Usage Notes
- The BadJournal class is available as of "Sirius Mods" Version 7.8.
See Also
- For information about catching a thrown exception, see "Try and Catch".
- The methods in this class are listed at "List of BadJournal methods".