Information technology — Programming languages — Fortran — Part 2: Varying length character strings

This part of ISO/IEC 1539 defines facilities in Fortran for the manipulation of character strings of dynamically variable length. This part of ISO/IEC 1539 provides an auxiliary standard for the version of the Fortran language specified by ISO/IEC 1539-1: 1997 and informally known as Fortran 95. A program that conforms with 1539-2: 1994 also conforms with this standard. This part of ISO/IEC 1539 is an auxiliary standard to that defining Fortran 95 in that it defines additional facilities to those defined intrinsically in the primary language standard. A processor conforming to the Fortran 95 standard is not required also to conform to this part of ISO/IEC 1539. However, conformance to this part of ISO/IEC 1539 assumes conformance to the primary Fortran 95 standard. This part of ISO/IEC 1539 prescribes the name of a Fortran module, the name of a derived data type to be used to represent varying-length strings, the interfaces for the procedures and operators to be provided to manipulate objects of this type, and the semantics that are required for each of the entities made accessible by this module. This part of ISO/IEC 1539 does not prescribe the details of any implementation. Neither the method used to represent the data entities of the defined type nor the algorithms used to implement the procedures or operators whose interfaces are defined by this part of ISO/IEC 1539 are prescribed. A conformant implementation may use any representation and any algorithms, subject only to the requirement that the publicly accessible names and interfaces conform to this part of ISO/IEC 1539, and that the semantics are as required by this part of ISO/IEC 1539 and those of ISO/IEC 1539-1 : 1997. It should be noted that a processor is not required to implement this part of ISO/IEC 1539 in order to be a standard conforming Fortran processor, but if a processor implements facilities for manipulating varying length character strings, it is recommended that this be done in a manner that is conformant with this part of ISO/IEC 1539. A processor conforming to this part of ISO/IEC 1539 may extend the facilities provided for the manipulation of varying length character strings as long as such extensions do not conflict with this part of ISO/IEC 1539 or with ISO/IEC 1539-1 : 1997. A module, written in standard conforming Fortran, is referenced in Annex A. This module illustrates one way in which the facilities described in this part of ISO/IEC 1539 could be provided. This module is both conformant with the requirements of this part of ISO/IEC 1539 and, because it is written in standard conforming Fortran, it provides a portable implementation of the required facilities. This module is referenced for information only and is not intended to constrain implementations in any way. This module is a demonstration that at least one implementation, in standard conforming and hence portable Fortran, is possible. It should be noted that this part of ISO/IEC 1539 defines facilities for dynamically varying length strings of characters of default kind only. Throughout this part of ISO/IEC 1539 all references to intrinsic type CHARACTER should be read as meaning characters of default kind. Similar facilities could be defined for non-default kind characters by a separate, if similar, module for each such character kind. This part of ISO/IEC 1539 has been designed, as far as is reasonable, to provide for varying length character strings the facilities that are available for intrinsic fixed length character strings. All the intrinsic operations and functions that apply to fixed length character strings have extended meanings defined by this part of ISO/IEC 1539 for varying length character strings. Also a small number of additional facilities are defined that are appropriate because of the essential differences between the intrinsic type and the varying length derived data type.

Technologies de l'information — Langages de programmation — Fortran — Partie 2: Chaînes de caractères de longueur variable

General Information

Status
Published
Publication Date
07-Jun-2000
Current Stage
9093 - International Standard confirmed
Completion Date
29-Apr-2021
Ref Project

Relations

Buy Standard

Standard
ISO/IEC 1539-2:2000 - Information technology -- Programming languages -- Fortran
English language
20 pages
sale 15% off
Preview
sale 15% off
Preview

Standards Content (Sample)

INTERNATIONAL ISO/IEC
STANDARD 1539-2
Second edition
2000-06-01
Information technology — Programming
languages — Fortran —
Part 2:
Varying length character strings
Technologies de l'information — Langages de programmation — Fortran —
Partie 2: Chaînes de caractères de longueur variable
Reference number
ISO/IEC 1539-2:2000(E)
©
ISO/IEC 2000

---------------------- Page: 1 ----------------------
ISO/IEC 1539-2:2000(E)
PDF disclaimer
This PDF file may contain embedded typefaces. In accordance with Adobe's licensing policy, this file may be printed or viewed but shall not
be edited unless the typefaces which are embedded are licensed to and installed on the computer performing the editing. In downloading this
file, parties accept therein the responsibility of not infringing Adobe's licensing policy. The ISO Central Secretariat accepts no liability in this
area.
Adobe is a trademark of Adobe Systems Incorporated.
Details of the software products used to create this PDF file can be found in the General Info relative to the file; the PDF-creation parameters
were optimized for printing. Every care has been taken to ensure that the file is suitable for use by ISO member bodies. In the unlikely event
that a problem relating to it is found, please inform the Central Secretariat at the address given below.
© ISO/IEC 2000
All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form or by any means, electronic
or mechanical, including photocopying and microfilm, without permission in writing from either ISO at the address below or ISO's member body
in the country of the requester.
ISO copyright office
Case postale 56 � CH-1211 Geneva 20
Tel. + 41 22 749 01 11
Fax + 41 22 734 10 79
E-mail copyright@iso.ch
Web www.iso.ch
Printed in Switzerland
ii © ISO/IEC 2000 – All rights reserved

---------------------- Page: 2 ----------------------
ISO/IEC 1539-2:2000(E)
CONTENTS
1 Scope …………………………………………………………………………………………… 1
2 Normative References …………………………………………………………………………… 2
3 Requirements …………………………………………………………………………………… 3
3.1 The Name of the Module ……………………………………………………………… 3
3.2 The Type ………………………………………………………………………………… 3
3.3 Extended Meanings for Intrinsic Operators …………………………………………… 3
3.3.1 Assignment …………………………………………………………………… 3
3.3.2 Concatenation ………………………………………………………………… 4
3.3.3 Comparisons …………………………………………………………………… 4
3.4 Extended Meanings for Generic Intrinsic Procedures ………………………………… 5
3.4.1 ADJUSTL (string) …………………………………………………………… 5
3.4.2 ADJUSTR (string) …………………………………………………………… 5
3.4.3 CHAR (string [, length]) ……………………………………………………… 5
3.4.4 IACHAR (c) …………………………………………………………………… 6
3.4.5 ICHAR (c) …………………………………………………………………… 6
3.4.6 INDEX (string, substring [, back]) …………………………………………… 6
3.4.7 LEN (string) …………………………………………………………………… 7
3.4.8 LEN_TRIM (string) …………………………………………………………… 7
3.4.9 LGE (string_a, string_b) ……………………………………………………… 7
3.4.10 LGT (string_a, string_b) ……………………………………………………… 7
3.4.11 LLE (string_a, string_b) ……………………………………………………… 8
3.4.12 LLT (string_a, string_b) ……………………………………………………… 8
3.4.13 REPEAT (string, ncopies) …………………………………………………… 9
3.4.14 SCAN (string, set [, back]) …………………………………………………… 9
3.4.15 TRIM (string) ………………………………………………………………… 9
3.4.16 VERIFY (string, set [, back]) ……………………………………………… 10
3.5 Additional Generic Procedure for Type Conversion ………………………………… 10
3.5.1 VAR_STR (char) …………………………………………………………… 10
3.6 Additional Generic Procedures for Input/Output …………………………………… 11
3.6.1 GET (string [, maxlen, iostat]) or
GET (unit, string [, maxlen, iostat]) or
GET (string, set [, separator, maxlen, iostat]) or
GET (unit, string, set [, separator, maxlen, iostat]) ………………………… 11
3.6.2 PUT (string [, iostat]) or PUT (unit, string [, iostat]) ……………………… 12
3.6.3 PUT_LINE (string [, iostat]) or PUT_LINE (unit, string [, iostat]) ………… 12
3.7 Additional Generic Procedures for Substring Manipulation ………………………… 12
3.7.1 EXTRACT (string [, start, finish]) …………………………………………… 13
3.7.2 INSERT (string, start, substring) …………………………………………… 13
3.7.3 REMOVE (string [, start, finish]) …………………………………………… 13
3.7.4 REPLACE (string, start, substring) or
REPLACE (string, start, finish, substring) or
REPLACE (string, target, substring [,every, back]) ………………………… 14
 ISO/IEC 2000 – All rights reserved iii

---------------------- Page: 3 ----------------------
ISO/IEC 1539-2:2000(E)
3.7.5 SPLIT (string, word, set [, separator, back]) ………………………………… 15
Annex A (informative). Module ISO_VARYING_STRING……………………………………… 16
Annex B (informative). Two examples …………………………………………………………… 17
B.1 Word count ……………………………………………………………………………… 17
B.2 Vocabulary list …………………………………………………………………………… 18
iv  ISO/IEC 2000 – All rights reserved

---------------------- Page: 4 ----------------------
ISO/IEC 1539-2:2000(E)
Foreword
ISO (the International Organization for Standardization) and IEC (the International Electrotechnical Commission)
form the specialized system for worldwide standardization. National bodies that are members of ISO or IEC
participate in the development of International Standards through technical committees established by the
respective organization to deal with particular fields of technical activity. ISO and IEC technical committees
collaborate in fields of mutual interest. Other international organizations, governmental and non-governmental, in
liaison with ISO and IEC, also take part in the work.
International Standards are drafted in accordance with the rules given in the ISO/IEC Directives, Part 3.
In the field of information technology, ISO and IEC have established a joint technical committee, ISO/IEC JTC 1.
Draft International Standards adopted by the joint technical committee are circulated to national bodies for voting.
Publication as an International Standard requires approval by at least 75 % of the national bodies casting a vote.
Attention is drawn to the possibility that some of the elements of this part of ISO/IEC 1539 may be the subject of
patent rights. ISO and IEC shall not be held responsible for identifying any or all such patent rights.
International Standard ISO/IEC 1539-2 was prepared by Joint Technical Committee ISO/IEC JTC 1, Information
technology, Subcommittee SC 22, Programming languages, their environments and system software interfaces.
This second edition cancels and replaces the first edition (ISO/IEC 1539-2:1994), which has been technically
revised. The following summarises the changes made to the facilities provided by this part of ISO/IEC 1539:
The assignment, concatenation, and comparison operations are extended to describe elemental semantics.
CHAR is extended to describe pure semantics.
ADJUSTL, ADJUSTR, EXTRACT, IACHAR, ICHAR, INDEX, INSERT, LEN, LEN_TRIM, LGE, LGT, LLE, LLT,
REMOVE, REPEAT, REPLACE, SCAN, SPLIT, TRIM, VAR_STR, and VERIFY are all extended to describe
elemental semantics.
ISO/IEC 1539 consists of the following parts, under the general title Information technology — Programming
languages — Fortran:
� Part 1: Base language
� Part 2: Varying length character strings
Annexes A and B of this part of ISO/IEC 1539 are for information only.
© ISO/IEC 2000 – All rights reserved v

---------------------- Page: 5 ----------------------
ISO/IEC 1539-2:2000(E)
Introduction
This part of ISO/IEC 1539 has been prepared by ISO/IEC JTC1/SC22/WG5, the technical working group for
the Fortran language. This part of ISO/IEC 1539 is an auxiliary standard to ISO/IEC 1539-1 : 1997, which
defines the latest revision of the Fortran language, and is the first part of the multipart Fortran family of
standards; this part of ISO/IEC 1539 is the second part. The revised language defined by ISO/IEC 1539-1 :
1997 is informally known as Fortran 95.
This part of ISO/IEC 1539 defines the interface and semantics for a module that provides facilities for the
manipulation of character strings of arbitrary and dynamically variable length. Annex A refers to a possible
implementation, in Fortran 95, of a module that conforms to this part of ISO/IEC 1539. It should be noted,
however, that this is purely for purposes of demonstrating the feasibility and portability of this standard. The
actual code is not intended in any way to prescribe the method of implementation, nor is there any implication
that this is in any way an optimal portable implementation. The module is merely a fairly straightforward
demonstration that a portable implementation is possible.
This standard is a development from a previous version known as ISO/IEC 1539-2: 1994 that takes account of
the improvements introduced in Fortran 95. The most significant improvements in Fortran 95 for the present
standard were the introduction of pure and elemental procedures. Since pure and elemental functions can be
used in specification expressions, their introduction in this standard enhances the usability of the standard for
the end user. The ability to define many of the functions specified in this standard to be elemental improves the
compatibility of these functions with similar intrinsic functions defined by the main standard.
The improvements in type initialization provided in Fortran 95 have also enabled the sample implementation
referred to in Annex A to be written in such a way that significant leakage of memory is less likely to occur.
vi  ISO/IEC 2000 – All rights reserved

---------------------- Page: 6 ----------------------
ISO/IEC 1539-2:2000(E)
length character strings, it is recommended that this be done in a manner that is conformant with this part of
ISO/IEC 1539.
A processor conforming to this part of ISO/IEC 1539 may extend the facilities provided for the manipulation
of varying length character strings as long as such extensions do not conflict with this part of ISO/IEC 1539 or
with ISO/IEC 1539-1 : 1997.
A module, written in standard conforming Fortran, is referenced in Annex A. This module illustrates one way
in which the facilities described in this part of ISO/IEC 1539 could be provided. This module is both
conformant with the requirements of this part of ISO/IEC 1539 and, because it is written in standard
conforming Fortran, it providesa portable implementation of the required facilities. This module is referenced
for information only and is not intended to constrain implementations in any way. This module is a
demonstration that at least one implementation, in standard conforming and hence portable Fortran, is
possible.
It should be noted that this part of ISO/IEC 1539 defines facilities for dynamically varying length strings of
characters of default kind only. Throughout this part of ISO/IEC 1539 all references to intrinsic type
CHARACTER should be read as meaning characters of default kind. Similar facilities could be defined for
non-default kind characters by a separate, if similar, module for each such character kind.
This part of ISO/IEC 1539 has been designed, as far as is reasonable, to provide for varying length character
strings the facilities that are available for intrinsic fixed length character strings. All the intrinsic operations
and functions that apply to fixed length character strings have extended meanings defined by this part of
ISO/IEC 1539 for varying length character strings. Alsoa small number of additional facilities are defined that
are appropriate because of the essential differences between the intrinsic type and the varying length derived
data type.
2 Normative References
The following normative documents contain provisions which, through reference in this text, constitute
provisions of this part of ISO/IEC 1539. For dated references, subsequent amendments to, or revisions of, any
of these publications do not apply. However, parties to agreements based on this part of ISO/IEC 1539 are
encouraged to investigate the possibility of applying the most recent editions of the normative documents
indicated below. For undated references, the latest edition of the normative document referred to applies.
Members of ISO and IEC maintain registers of currently valid International Standards.
ISO/IEC 646 : 1991 Information technology – ISO 7-bit Coded character set for information interchange.
ISO/IEC 1539-1 : 1997 Information technology – Programming languages – Fortran – Part 1: Base
language.
2  ISO/IEC 2000 – All rights reserved

---------------------- Page: 7 ----------------------
ISO/IEC 1539-2:2000(E)
3 Requirements
3.1 The Name of the Module
The name of the module shall be
ISO_VARYING_STRING
Programs shall be able to access the facilities defined by this part of ISO/IEC 1539 by the inclusion of USE
statements of the form
USE ISO_VARYING_STRING
3.2 The Type
The type shall have the name
VARYING_STRING
Entities of this type shall represent values that are strings of characters of default kind. These character strings
may be of any non-negative length and this length may vary dynamically during the execution of a program.
There shall be no arbitrary upper length limit other than that imposed by the size of the processor and the
complexity of the programs it is able to process. The characters representing the value of the string have
positions 1,2,.,N, where N is the length of the string. The internal structure of the type shall bePRIVATE to
the module.
3.3 Extended Meanings for Intrinsic Operators
The meanings for the intrinsic operators of:
assignment =
concatenation //
comparisons ==, /=, <, <=, >=, >
shall be extended to accept any combination of operands of typeVARYING_STRING and typeCHARACTER.
Note that the equivalent comparison operator forms.EQ.,.NE.,.LT.,.LE.,.GE., and.GT. also have
their meanings extended in this manner.
3.3.1 Assignment
An elemental assignment of the form
var = expr
shall be defined with the following type combinations:
VARYING_STRING andVARYING_STRING
VARYING_STRING andCHARACTER
CHARACTER andVARYING_STRING
Action. The characters that are the value of the expressionexpr become the value of the variablevar. There
are two cases:
Case(i): Where the variable is of typeVARYING_STRING, the length of the variable becomes that of the
 ISO/IEC 2000 – All rights reserved 3

---------------------- Page: 8 ----------------------
ISO/IEC 1539-2:2000(E)
expression.
Case(ii): Where the variable is of type CHARACTER, the rules of intrinsic assignment to a Fortran
character variable apply. Namely, if the expression string is longer than the declared length of the
character variable, only the left-most characters are assigned. If the character variable is longer
than that of the string expression, it is padded on the right with blanks.
3.3.2 Concatenation
The elemental concatenation operation
string_a//string_b
shall be defined with the following type combinations:
VARYING_STRING andVARYING_STRING
VARYING_STRING andCHARACTER
CHARACTER andVARYING_STRING
The values of the operands are unchanged by the operation.
Result Characteristics. Of typeVARYING_STRING.
Result Value. The result value is a new string whose characters are the same as those produced by
concatenating the operand character strings in the order given.
3.3.3 Comparisons
Elemental comparisons of the form
string_a == string_b
string_a /= string_b
string_a < string_b
string_a <= string_b
string_a > string_b
string_a >= string_b
shall be defined for operands with the following type combinations:
VARYING_STRING andVARYING_STRING
VARYING_STRING andCHARACTER
CHARACTER andVARYING_STRING
The values of the operands are unchanged by the operation. Note that the equivalent operator forms .EQ.,
.NE.,.LT.,.LE.,.GE., and.GT. also have their meanings extended in this manner.
Result Characteristics. Of type defaultLOGICAL.
Result Value. The result value is true ifstring_a stands in the indicated relation tostring_b and is false
otherwise. The collating sequence used for the inequality comparisons is that defined by the processor for
characters of default kind. Ifstring_a andstring_b are of different lengths, the comparison is done as if
the shorter string were padded on the right with blanks.
4  ISO/IEC 2000 – All rights reserved

---------------------- Page: 9 ----------------------
ISO/IEC 1539-2:2000(E)
3.4 Extended Meanings for Generic Intrinsic Procedures
The generic intrinsic proceduresADJUSTL,ADJUSTR,CHAR,IACHAR,ICHAR,INDEX,LEN,LEN_TRIM,
LGE,LGT,LLT,LLE,REPEAT,SCAN,TRIM, andVERIFY shall have their meanings extended to include the
appropriate argument type combinations involving VARYING_STRING and CHARACTER. Detailed
descriptions of the extensions are given in this section.
3.4.1 ADJUSTL (string)
Description. Adjusts to the left, removing any leading blanks and inserting trailing blanks.
Class. Elemental function.
Argument.string shall be of typeVARYING_STRING.
Result Characteristics. Of typeVARYING_STRING.
Result Value. The result value is the same asstring except that any leading blanks have been deleted and
the same number of trailing blanks inserted.
3.4.2 ADJUSTR (string)
Description. Adjusts to the right, removing any trailing blanks and inserting leading blanks.
Class. Elemental function.
Argument.string shall be of typeVARYING_STRING.
Result Characteristics. Of typeVARYING_STRING.
Result Value. The result value is the same asstring except that any trailing blanks have been deleted and
the same number of leading blanks inserted.
3.4.3 CHAR (string [, length])
Description. Converts a varying string value to defaultCHARACTER.
Class. Pure transformational function.
Arguments.
string shall be scalar and of typeVARYING_STRING.
length (optional) shall be scalar and of type defaultINTEGER.
Result Characteristics. Scalar of type default CHARACTER. If length is absent, the result has the same
length asstring. Iflength is present, the result has the length specified by the argumentlength.
Result Value.
Case(i): Iflength is absent, the result is a copy of the characters in the argumentstring.
Case(ii): Iflength is present, the result is a copy of the characters in the argumentstring that may have
been truncated or padded. If string is longer than length, the result is truncated on the right. If
string is shorter thanlength, the result is padded on the right with blanks. Iflength is less than
one, the result is of zero length.
Note. This function is elemental in Fortran 95, where it has the formCHAR(i [,kind]), with
i of type integer.
 ISO/IEC 2000 – All rights reserved 5

---------------------- Page: 10 ----------------------
ISO/IEC 1539-2:2000(E)
3.4.4 IACHAR (c)
Description. Returns the position of a character in the collating sequence defined by the International
Standard ISO 646 : 1991.
Class. Elemental function.
Argument.c shall be of typeVARYING_STRING and of length exactly one.
Result Characteristics. Of type defaultINTEGER.
Result Value. The result value is the position of the character c in the collating sequence defined by the
International Standard ISO 646 : 1991 for default characters. If the characterc is not defined in the standard
set, the result is processor dependent but is always equal toIACHAR(CHAR(c)).
3.4.5 ICHAR (c)
Description. Returns the position of a character in the processor defined collating sequence.
Class. Elemental function.
Argument.c shall be of typeVARYING_STRING and of length exactly one.
Result Characteristics. Of type defaultINTEGER.
Result Value. The result value is the position of the characterc in the processor defined collating sequence for
default characters. That is, the result value isICHAR(CHAR(c)).
3.4.6 INDEX (string, substring [, back])
Description. Returns an integer that is the starting position of a substring within a string.
Class. Elemental function.
Arguments.
string andsubstring shall be of one of the type combinations:
VARYING_STRING andVARYING_STRING
VARYING_STRING andCHARACTER
CHARACTER andVARYING_STRING
back (optional) shall be of type defaultLOGICAL.
Result Characteristics. Of type defaultINTEGER.
Result Value.
Case(i): Ifback is absent or is present with the value false, the result is the minimum positive value ofI such
that
EXTRACT(string,I,I+LEN(substring)–1)==substring,
(where EXTRACT is defined in Section 3.7) or zero if there is no such value.
Case(ii): If back is present with the value true, the result is the maximum value of I less than or equal to
LEN(string)–LEN(substring)+1 such that
EXTRACT(string,I,I+LEN(substring)–1)==substring,
or zero if there is no such value.
6  ISO/IEC 2000 – All rights reserved

---------------------- Page: 11 ----------------------
TRIM (string) a, string b) a, string b)
ISO/IEC 1539-2:2000(E)
3.4.7 LEN (string)
Description. Returns the length of a character string.
Class. Elemental function.
Argument.string shall be of typeVARYING_STRING.
Result Characteristics. Of type defaultINTEGER.
Result Value. The result value is the number of characters instring.
Note. This function is not elemental forstring of typeCHARACTER.
3.4.8 LEN_TRIM (string)
Description. Returns the length of a string not counting any trailing blanks.
Class. Elemental function.
Argument.string shall be of typeVARYING_STRING.
Result Characteristics. Of type defaultINTEGER.
Result Value. The result value is the position of the last non-blank character in string. If the argument
string contains only blank characters or is of zero length, the result is zero.
3.4.9 LGE (string_a, string_b)
Description. Compares the lexical ordering of two strings based on the ISO 646 : 1991 collating sequence.
Class. Elemental function.
Arguments.
string_a andstring_b shall be of one of the type combinations:
VARYING_STRING andVARYING_STRING
VARYING_STRING andCHARACTER
CHARACTER andVARYING_STRING
Result Characteristics. Of type defaultLOGICAL.
Result Value. The result value is true if string_a is lexically greater than or equal to string_b, and is
false otherwise. The collating sequence used to establish the ordering of characters is that of the International
Standard ISO 646 : 1991. Ifstring_a andstring_b are of different lengths, the comparison is done as if
the shorter string were padded on the right with blanks. If either argument contains a characterc not defined
by the standard, the result value is processor dependent and based on the collating value for IACHAR(c).
Zero length strings are considered to be lexically equal.
3.4.10 LGT (string_a, string_b)
Description. Compares the lexical ordering of two strings based on the ISO 646 : 1991 collating sequence.
Class. Elemental function.
Arguments.
string_a andstring_b shall be of one of the type combinations:
 ISO/IEC 2000 – All rights reserved 7

---------------------- Page: 12 ----------------------
a, string b) a, string b)
ISO/IEC 1539-2:2000(E)
VARYING_STRING andVARYING_STRING
VARYING_STRING andCHARACTER
CHARACTER andVARYING_STRING
Result Characteristics. Of type defaultLOGICAL.
Result Value. The result value is true if string_a is lexically greater than string_b, and is false
otherwise. The collating sequence used to establish the ordering of characters is that of the International
Standard ISO 646 : 1991. Ifstring_a andstring_b are of different lengths, the comparison is done as if
the shorter string were padded on the right with blanks. If either argument contains a characterc not defined
by the standard, the result value is processor dependent and based on the collating value for IACHAR(c).
Zero length strings are considered to be lexically equal.
3.4.11 LLE (string_a, string_b)
Description. Compares the lexical ordering of two strings based on the ISO 646 : 1991 collating sequence.
Class. Elemental function.
Arguments.
string_a andstring_b shall be of one of the type combinations:
VARYING_STRING andVARYING_STRING
VARYING_STRING andCHARACTER
CHARACTER andVARYING_STRING
Result Characteristics. Of type defaultLOGICAL.
Result Value. The result value is true ifstring_a is lexically less than or equal tostring_b, and is false
otherwise. The collating sequence used to establish the ordering of characters is that of the International
Standard ISO 646 : 1991. Ifstring_a andstring_b are of different lengths, the comparison is done as if
the shorter string were padded on the right with blanks. If either argument contains a characterc not defined
by the standard, the result value is processor dependent and based on the collating value for IACHAR(c).
Zero length strings are considered to be lexically equal.
3.4.12 LLT (string_a, string_b)
Description. Compares the lexical ordering of two strings based on the ISO 646 : 1991 collating sequence.
Class. Elemental function.
Arguments.
string_a andstring_b shall be of one of the type combinations:
VARYING_STRING andVARYING_STRING
VARYING_STRING andCHARACTER
CHARACTER andVARYING_STRING
Result Characteristics. Of type defaultLOGICAL.
Result Value. The result value is true ifstring_a is lexically less thanstring_b, and is false otherwise.
The collating sequence used to establish the ordering of characters is that of the International Standard ISO
646 : 1991. If string_a and string_b are of different lengths, the comparison is done as if the shorter
string were padded on the right with blanks. If either argument contains a character c not defined by the
standard, the result value is processor dependent and based on the collating value for IACHAR(c). Zero
8  ISO/IEC 2000 – All rights reserved

---------------------- Page: 13 ----------------------
ISO/IEC 1539-2:2000(E)
length strings are considered to be lexically equal.
3.4.13 REPEAT (string, ncopies)
Description. Concatenates several copies of a string.
Class. Elemental function.
Arguments.
string – shall be of typeVARYING_STRING,
ncopies – shall be of type defaultINTEGER.
Result Characteristics. Of typeVARYING_STRING.
Result Value. The result value is the string produced by repeated concatenation of the argument string,
producing a string containing ncopies copies of string. If the value of ncopies is not positive, the
result is of zero length.
Note. This function is not elemental forstring of typeCHARACTER.
3.4.14 SCAN (string, set [, back])
Description. Scans a string for any one of the characters in a set of characters.
Class. Elemental function.
Arguments.
string andset shall be of one of the type combinations:
VARYING_STRING andVARYING_STRING
VARYING_STRING andCHARACTER
CHARACTER andVARYING_STRING
back (optional) shall be of type defaultLOGICAL.
Result Characteristics. Of type defaultINTEGER.
Result Value.
Case(i): Ifback is absent or is present with the value false and ifstring contains at least one character that
is inset, the value of the result is the position of the left-most character ofstring that is inset.
Case(ii): Ifback is present with the value true and ifstring contains at least one character that is inset,
the value of the result is the position of the right-most character ofstring that is inset.
Case(iii): The value of the result is zero if no character of string is in set or if the length of either
string orset is zero.
3.4.15 TRIM (string)
Description. Removes trailing blanks from a string.
Class. Elemental function.
Argument.string shall be of typeVARYING_STRING.
Result Characteristics. Of typeVARYING_STRING.
 ISO/IEC 2000 – All rights reserved 9

---------------------- Page: 14 ----------------------
STR (char)
ISO/IEC 1539-2:2000(E)
Result Value. The result value is the same asstring except that any trailing blanks have been deleted. If the
argumentstring contains only blank characters or is of zero length, the result is a zero-length string.
Note. This function is not elemental forstring of typeCHARACTER.
3.4.16 VERIFY (string, set [, back])
Description. Verifies that a string contains only characters from a given set by scanning for any character not
in the set.
Class. Elemental function.
Arguments.
string andset shall be of one of the type combinations:
VARYING_STRING andVARYING_STRING
VARYING_STRING andCHARACTER
CHARACTER andVARYING_STRING
back (optional) shall be of type defaultLOGICAL.
Result Characteristics. Of type defaultINTEGER.
Result Value.
Case(i): Ifback is absent or is present with the value false and ifstring contains at least one character that
is not inset, the value of the result is the position of the left-most character ofstring that is not in
set.
Case(ii): If back is present with the value true and if string contains at least one character that is not in
set, the value of the result is the position of the right-most character ofstring that is not inset.
Case(iii): The value of the result is zero if each character ofstring is inset or if the length ofstring is
zero.
3.5 Additional Generic Procedure for Type Conversion
An additional generic procedure shall be added to convert intrinsic fixed-length character values into
varying-length string values.
3.5.1 VAR_STR (char)
Description. Converts an intrinsic fixed-length character value into the equivalent varying-length string value.
Class. Elemental function.
Argument.char shall be of type defaultCHARACTER and may be of any length.
Result Characteristics. Of typeVARYING_STRING.
Result Value. The result value is the same string of characters as the argument.
10  ISO/IEC 2000 – All rights reserved

---------------------- Page: 15 ----------------------
ISO/IEC 1539-2:2000(E)
3.6 Additional Generic Procedures for Input/Output
The following additional generic procedures shall be provided to support input and output of varying-length
string values with formatted sequential files.
GET – input part or all of a record into a string
PUT – append a string to an output record
PUT_LINE – append a string to an output record and end the record
3.6.1 GET (string [, maxlen, iostat]) or
GET (unit, string [, maxlen, iostat]) or
GET (string, set [, separator, maxlen, iostat]) or
GET (unit, string, set [, separator, maxlen, iostat])
Description. Reads characters from an external file into a string.
Class. Subroutine.
Arguments.
string shall be scalar and of typeVARYING_STRING. It is an INTENT(OUT) argument.
maxlen (optional) shall be scalar and of type defaultINTEGER. It is an INTENT(IN) argument.
unit
...

Questions, Comments and Discussion

Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.