NCEPLIBS-bufr 11.7.1
hold4wlc.f File Reference

Write a long character string (greater than 8 bytes) to a data subset. More...

Go to the source code of this file.

Functions/Subroutines

subroutine hold4wlc (LUNIT, CHR, STR)
 This subroutine writes a long character string (greater than 8 bytes) to a data subset. More...
 

Detailed Description

Write a long character string (greater than 8 bytes) to a data subset.

Definition in file hold4wlc.f.

Function/Subroutine Documentation

◆ hold4wlc()

subroutine hold4wlc (   LUNIT,
character*(*)  CHR,
character*(*)  STR 
)

This subroutine writes a long character string (greater than 8 bytes) to a data subset.

Normally, subroutine writlc() is used to write a long character string to a data subset. However, subroutine writlc() can only be called after a call to one of the subset-writing subroutines, so it will not work for cases when one of those subroutines flushes the message containing the data subset in question to logical unit LUNIT during the same call to that subroutine, such as when the data subset contains more than 65530 bytes. When this happens, there is no longer any way for a subsequent writlc() call to write a long character string into that data subset, because the data subset has already been flushed from internal memory. This subroutine solves that problem, by allowing a long character string to be specified before calling one of the subset-writing subroutines, and the string value will be held and stored automatically (via an internal call to subroutine writlc()) at the proper time during the subsequent call to the subset-writing subroutines.

Author
J. Ator
Date
2014-02-05
Parameters
[in]LUNIT– integer: Fortran logical unit number for BUFR file
[in]CHR– character*(*): Value corresponding to STR
[in]STR– character*(*): Table B mnemonic of long character string to be written, possibly supplemented with an ordinal occurrence notation

If there is more than one occurrence of STR within the data subset definition, then each occurrence can be written via a separate call to this subroutine, and by appending the ordinal number of the occurrence to STR in each case. For example, if there are 5 occurrences of mnemonic LSTID within a given data subset definition, then 5 separate calls should be made to this subroutine, once each with STR set to 'LSTID#1', 'LSTID#2', 'LSTID#3', 'LSTID#4' and 'LSTID#5'. However, the first notation is superfluous, because omitting the ordinal number always defaults to the first occurrence of a particular string, so a user could just specify 'LSTID' instead of 'LSTID#1'.

Remarks
  • Character strings which are 8 bytes or less in length can be written by converting the string into a real*8 value within the application program, and then using the real*8 USR array within a call to one of the BUFRLIB values-writing subroutines prior to calling one of the subset-writing subroutines for the data subset.

Program history log:

Date Programmer Comments
2014-02-05 J. Ator Original author

Definition at line 62 of file hold4wlc.f.

References errwrt(), and strsuc().