NCEPLIBS-bufr 11.7.1
chrtrna.f
Go to the documentation of this file.
1C> @file
2C> @brief Copy a specified number of characters from an array into
3C> a string.
4
5C> This subroutine copies a specified number of characters from an
6C> array of characters into a character string.
7C>
8C> <p>The characters in the input array CHR are assumed to be ASCII,
9C> so for cases where the native machine is EBCDIC, an
10C> ASCII-to-EBCDIC translation is done on the final character string
11C> before it is output as STR.
12C>
13C> @author J. Woollen
14C> @date 1994-01-06
15C>
16C> @param[in] CHR -- character(*): Array of characters in ASCII
17C> @param[in] N -- integer: Number of characters to be copied
18C> from CHR, starting from the beginning of
19C> the array
20C> @param[out] STR -- character*(*): Character string in ASCII or
21C> EBCDIC, depending on native machine
22C>
23C> @remarks
24C> - The determination as to whether the native machine is ASCII or
25C> EBCDIC is made via an internal call to subroutine wrdlen().
26C>
27C> <b>Program history log:</b>
28C> | Date | Programmer | Comments |
29C> | -----|------------|----------|
30C> | 1994-01-06 | J. Woollen | Original author |
31C> | 2003-11-04 | J. Ator | Added documentation |
32C>
33 SUBROUTINE chrtrna(STR,CHR,N)
34
35 COMMON /charac/ iascii,iatoe(0:255),ietoa(0:255)
36
37 CHARACTER*(*) STR
38 CHARACTER*1 CHR(N)
39
40C----------------------------------------------------------------------
41C----------------------------------------------------------------------
42
43C Loop on N characters of CHR
44
45 DO i=1,n
46 str(i:i) = chr(i)
47
48C If this is an EBCDIC machine, then translate the character
49C from ASCII -> EBCDIC.
50
51 IF(iascii.EQ.0) CALL ipkm(str(i:i),1,iatoe(iupm(str(i:i),8)))
52 ENDDO
53 RETURN
54 END
subroutine chrtrna(STR, CHR, N)
This subroutine copies a specified number of characters from an array of characters into a character ...
Definition: chrtrna.f:34
subroutine ipkm(CBAY, NBYT, N)
This subroutine encodes an integer value within a specified number of bytes of a character string,...
Definition: ipkm.f:28
function iupm(CBAY, NBITS)
THIS FUNCTION UNPACKS AND RETURNS A BINARY INTEGER WORD CONTAINED WITHIN NBITS BITS OF A CHARACTER ST...
Definition: iupm.f:41