NCEPLIBS-bufr  12.2.0
borts.F90 File Reference

Log one or more error messages, then either return to or abort the application program. More...

Go to the source code of this file.

Functions/Subroutines

recursive subroutine bort (str)
 Log an error message, then either return to or abort the application program. More...
 
recursive subroutine bort2 (str1, str2)
 Log two error messages, then either return to or abort the application program. More...
 
integer function catch_borts (cbc)
 Specify whether subsequent bort errors should be caught and returned to the application program. More...
 
recursive subroutine check_for_bort (bort_str, bort_str_len)
 Check whether a bort error occurred during a previous call to an NCEPLIBS-bufr subroutine or function. More...
 

Detailed Description

Log one or more error messages, then either return to or abort the application program.

Author
J. Ator
Date
2009-04-21

Definition in file borts.F90.

Function/Subroutine Documentation

◆ bort()

recursive subroutine bort ( character*(*), intent(in)  str)

Log an error message, then either return to or abort the application program.

This subroutine is similar to subroutine bort2(), except that bort2() logs two error messages instead of one.

Parameters
str- Error message
Author
J. Woollen
Date
1998-07-08

Definition at line 14 of file borts.F90.

References moda_borts::bort_catch, moda_borts::caught_str, moda_borts::caught_str_len, errwrt(), and strsuc().

Referenced by adn30(), arallocf(), atrcpt(), binv(), bufr_c2f_interface::bort_c(), bvers(), chekstab(), cktaba(), closmg(), cmpbqm(), cmpmsg(), cmsgini(), cnved4(), codflg(), copybf(), copymg(), copysb(), cpdxmm(), cpymem(), cpyupd(), datebf(), datelen(), dumpbf(), dxdump(), dxmini(), getcfmng(), gettbh(), getwin(), idn30(), ifbget(), igetntbi(), igetrfel(), igetsc(), igettdi(), inctab(), invmrg(), ipkm(), isize(), iupm(), iupvs01(), jstnum(), lcmgdf(), lstjpb(), makestab(), minimg(), msgini(), msgwrt(), nemtba(), nemtbax(), nemtbb(), nemtbd(), nenubd(), newwin(), nmsub(), nvnwin(), nxtwin(), openbf(), openmb(), openmg(), pad(), padmsg(), parutg(), pkb(), pkb8(), pkbs1(), pkvs01(), posapx(), rcstpl(), rdbfdx(), rdcmps(), rdmemm(), rdmems(), rdmgsb(), rdmtbb(), rdmtbd(), rdmtbf(), readdx(), readerme(), readlc(), readmg(), readns(), reads3(), readsb(), rewnbf(), rtrcpt(), sinv(), sntbbe(), sntbde(), split_by_subset(), status(), stbfdx(), stdmsg(), stndrd(), stntbia(), strbtm(), strcpt(), tabent(), tabsub(), ufbcnt(), ufbcpy(), ufbcup(), ufbdmp(), ufbevn(), ufbget(), ufbint(), ufbinx(), ufbmem(), ufbmex(), ufbmms(), ufbmns(), ufbovr(), ufbpos(), ufbqcd(), ufbqcp(), ufbrep(), ufbrms(), ufbseq(), ufbstp(), ufbtab(), ufbtam(), ufdump(), upb8(), upds3(), upftbv(), uptdd(), usrtpl(), wrcmps(), wrdxtb(), writdx(), writlc(), writsa(), writsb(), and wtstat().

◆ bort2()

recursive subroutine bort2 ( character*(*), intent(in)  str1,
character*(*), intent(in)  str2 
)

Log two error messages, then either return to or abort the application program.

This subroutine is similar to subroutine bort(), except that bort() logs one error message instead of two.

Parameters
str1- First error message
str2- Second error message
Author
D. Keyser
Date
2003-11-04

Definition at line 47 of file borts.F90.

References moda_borts::bort_catch, moda_borts::caught_str, moda_borts::caught_str_len, errwrt(), and strsuc().

Referenced by elemdx(), getntbe(), ireadmt(), mtfnam(), parstr(), parusr(), parutg(), rdusdx(), seqsdx(), sntbbe(), sntbde(), sntbfe(), string(), ufbint(), ufbovr(), ufbrep(), and ufbstp().

◆ catch_borts()

integer function catch_borts ( character, intent(in)  cbc)

Specify whether subsequent bort errors should be caught and returned to the application program.

The use of this function allows for a more graceful exit from an application program in the event of any future bort error within the NCEPLIBS-bufr software. Specifically, whenever this capability is activated, and following any future call to any other library subroutine or function, the application program can immediately call subroutine check_for_bort() to check whether a bort error occurred within that previous subroutine or function and then react accordingly. Otherwise, and by default, any such bort error within the library will trigger an immediate abort of the application program, and with the same error information instead written to the location specified via subroutine errwrt().

This function can be called at any point from within an application program, and the specified value for cbc will remain in effect for all future calls to all NCEPLIBS-bufr subroutines and functions, unless a subsequent call is made to this function to reset the value of cbc again. If this function is never called, then a default value of 'N' is used for cbc.

Note
Application programs should exercise caution when the catching and returning of bort errors is enabled. Specifically, and depending on the nature or severity of any error caught or its depth within the internal call stack, there's no guarantee that the library remains fully functional or in a useable state (for example, certain intermediate values may not have been restored to previous settings, internal memory may not have been fully deallocated, etc.). Rather, the intent of this function is to allow an application program to gracefully exit if a serious NCEPLIBS-bufr error does occur, including potentially cleanly disengaging from other linked libraries or tasks. So unless the caught error is fairly benign and local to the subroutine or function in question, it may not be possible for the application program to make an adjustment and then reattempt another call to the library without leading to unpredictable results. Instead, and if the application program intends to continue running, the safest option in such cases may be to use subroutine exitbufr() to fully reset the NCEPLIBS-bufr software before attempting any future calls to the library.
Parameters
cbc- Flag indicating whether subsequent bort errors within the NCEPLIBS-bufr software should be caught and made available to the application program via subroutine check_for_bort():
  • 'N' = No (the default)
  • 'Y' = Yes
Returns
catch_borts - Return code:
  • 0 = Normal return
  • -1 = Illegal value was input for cbc
Author
J. Ator
Date
2025-08-25

Definition at line 118 of file borts.F90.

References moda_borts::bort_catch, moda_borts::bort_target_is_unset, capit(), and errwrt().

◆ check_for_bort()

recursive subroutine check_for_bort ( character*(*), intent(out)  bort_str,
integer, intent(out)  bort_str_len 
)

Check whether a bort error occurred during a previous call to an NCEPLIBS-bufr subroutine or function.

This subroutine should only be called if a prior call was made to function catch_borts() from an application program with cbc set to 'Y'

Parameters
bort_str- Error string, if such a bort error occurred; otherwise empty.
bort_str_len- Length of bort_str: -1 = Subroutine catch_borts() was not previously called 0 = No bort error occurred >0 = Length of bort_str, up to a maximum of 300 characters
Author
J. Ator
Date
2025-08-25

Definition at line 165 of file borts.F90.

References moda_borts::bort_catch, moda_borts::caught_str, moda_borts::caught_str_len, errwrt(), and x48().