Skip to main content

Full text of "ibm :: 360 :: tss :: GY28-2020-2 Time Sharing System FORTRAN IV Library Subprograms PLM Sep71"

See other formats


File No. 360-25 
GY28-2020-2 



Program Logic 



Version 8.1 



IBM System/360 Time Sharing System 
FORTRAN IV Library Subprograms 



This publication describes the internal logic of the 
IBM System/360 Time Sharing System FORTRAN IV 
mathematical and I/O libraries, including the 
mathematical, service, and I/O routines. 

This material is intended for persons involved in 
program maintenance, and system" programmers who are 
altering the program design. It can be used to locate 
specific areas of the program, and it enables the 
reader to relate these areas to the corresponding 
program listings. Program logic information is not 
necessary for the use and operation of the program. 



PREFACE 



This publication is organized into six 
sections and two appendixes. 

Section 1 is an introduction to the 
FORTRAN mathematical and I/O libraries, 
including service subprograms, and provides 
a brief description of their contents and 
functions . 



Appendix A describes those aspects of 
FORTRAN data management that are unique to 
the FORTRAN environment. Appendix B is a 
guide to external names of FORTRAN library 

routines . 



PREREQUISITE PUBLICATIONS 



Section 2 contains descriptions, in 
figure form, of how the library routines 
interact in fulfilling user requests. 



Familiarity with the material contained 
in the following publications is essential 
to the use of this manual: 



Section 3 describes each mathematical 
subprogram -~ its entry names, function, 
attributes , entry , exit, storage 
requirement^ error checks, and (where 
applicable) accuracy figures. 



IBM System/360 Time Sharing System : 
Concepts and Facilities , GC28-2003 
IBM FORTRAN IV , GC28-2007 
FORTRAN Programmer's Guide , GC28-2025 



Section 4 describes the service routines 
residing £n~*the mathematical and I/O 
libraries — their subprograms, attributes, 
entry names and entry parameters, storage 
requirements, error checks, and their 
operation. 



REFERENCE PUBLICATIONS 

Knowledge of the following publications 
will be helpful in understanding the 
concepts and logic of the FORTRAN Library 
routines : 



Section 5 describes each I/O routine - 
its purpose, entry point and entry 
parameters, external references, and the 
details of its operation. 



Section 6 gives the flowcharts of the 
service and I/O routines. 



IBM System/360 Time Sharing System : 
FORTRAN IV Library Subprograms , 
GC28-2026 

System Programmer's Guide , GC28-2008 
Assembler User Macro Instructions , 
GC28-2004 

FORTRAN IV Compiler PLM , GY28-2019 
System Control Blocks PLM , GY28-2011 
System Logic Summary , GY28-2009 



Third Edition (September 1971) 

Significant changes or additions to this publication will 
be provided in new editions or Technical Newsletters. 

This edition is current with Version 8, Modification 1 of 
IBM System/360 Time Sharing System (TSS/360) and remains in 

effect for all subsequent versions or modifications of IBM 
System/360 Time Sharing System unless otherwise indicated. 
Before using this publication, refer to the latest edition of 
IBM System/360 Time Sharing System: Addendum , GC 2 8 - 2 H 3 , 
which may contain information pertinent to the topics covered 
in this edition. The Addendum also lists the editions oi all 
TSS/360 publications that are applicable and current. 

This publication was prepared for production using an IBM 
computer to update the text and to control the page and line 

format. Page impressions for photo-offset printing were 
obtained from an IBM 14Q3 Printer using a special print 
chain* 

Requests for copies of IBM publications should be made to 
your IBM representative or to the IBM branch office serving 

your locality. 

A form is provided at the back of this publication for 
reader's comments. If the form has been removed, comments 
may be addressed to IBM Corporation,, System/360 Time Sharing 
System Programming Publications, Department 64 3 , Neighborhood 
Road, Kingston, New York 12401 



Copyright International Business Machines Corporation 1969, 1970, 1971 



CONTENTS 



SECTION 1: INTRODUCTION • 1 

SECTION 2: OVERVIEW . . . . . 2 

Mathematical Library .......... 2 

Subdivisions 2 

Internal Relationships ......... . . 2 

I/O Library ....... ...... 2 

Subdivisions . . . . . * . . 3 

I/O Language Control Routines 3 

Data Conversion Routines ..... 3 

Internal Relationships ...•••....•. .... 3 

SECTION 3: MATHEMATICAL SUBPROGRAM DESCRIPTIONS 14 

General Information 14 

Routine Names 14 

Attributes .14 

Entry Parameters ...........14 

Error Action 14 

Exit Parameters ••..•••.••... ..14 

Subprogram Summaries ........••• 14 

Tables . 14 

CHCBZ — Error Processor •........••.... 25 

SECTION 4: SERVICE SUBPROGRAM DESCRIPTIONS 26 

General Information 26 

Subprogram Summaries . 26 

CHCBE — interrupt and Machine Indicator Routine ........ 26 

CHCIV — Dump Routine 28 

CHCIW — Exit Routine 29 

SECTION 5: I/O ROUTINE DESCRIPTIONS . 30 

General Information •.... 30 

Attributes ........... 30 

Work Areas and Register Save Areas . 30 

Routine Summaries . 30 

CHCIA — I/O Initialization . 30 

CHCIB — DCB Maintenance .31 

CHCIC — I/O Control ............... 32 

CHCID — NAMELIST Processor . 34 

CHCIE — List Item Processor 36 

CHCIF — Format Processor ..;. 36 

CHCIH — Integer Output Conversion ... 37 

CHCII — Real and Integer Input Conversion . 37 

CHCIJ « Real Output Conversion ........ .... 39 

CBCIM — Complex Input Conversion . ..... 39 

CHCIN — Complex Output Conversion ...39 

CBCIO — Alphameric and Hexadecimal Input Conversion ...... 39 

CHCIP — Alphameric and Hexadecimal Output Conversion ...... 40 

CHCIQ — Logical Input Conversion 40 

CHCIR — Logical Output Conversion 40 

CHCIS — General Input Conversion ......... 40 

CHCIT — - General Output Conversion 41 

CBCIU — ■ List Termination 41 

CHCIW -- Exit 41 

CHCBD — * I/O Interruption and Machine Indicator Routine 41 

SECTION 6: FLOWCHARTS ........... 42 

APPENDIX A: FORTRAN DATA MANAGEMENT ........ ... 89 

DCB Use 89 

DCB Content .89 

DCB Initialization 89 



Combinations of DSORG and RECFM ..•..•••89 

Unformatted FORTRAN Logical Records • . • • . 90 

APPENDIX B5 EXTERNAL NAMES SUMMARY ................. 91 

INDEX . . . . . . • • . . • 92 



ILLUSTRATIONS 



Figure 1. Functional flow of mathematical library subprograms . . • 4 

Figure 2. Functional flow of I/O library routines . • • 7 

Figure 3. Formatted READ with list ....... 8 

Figure 4. Formatted READ without list ....... 8 

Figure 5. READ with NAMELIST ........ ..... 9 

Figure 6. Unformatted READ with list 9 

Figure 7. Unformatted READ without list . 10 

Figure 8. Formatted WRITE with list . 10 

Figure 9. Formatted WRITE without list .............. 11 

Figure 10. WRITE with NAMELIST ...... ..... 11 

Figure 11. Unformatted WRITE with list .............. 12 

Figure 12. Unformatted WRITE without list . . . • 12 

Figure 13. BACKSPACE, REWIND, and END FILE 13 

Figure 14. EXIT and STOP ..................... 13 

Table 1. I/O library calling relationships . .- 6 

Table 2. Summary of directly referenced mathematical subprograms . 15 

Table 3. Summary of indirectly referenced mathematical subprograms 21 

Table 4. Exponentiation with integer base and exponent 24 

Table 5. Exponentiation with real or double-precision base and 

integer exponent 24 

Table 6, Exponentiation with real or double- precision base and - 

exponent .................... 24 

Table 7. Entry names of indirect-reference mathematical routines . 24 

Table 8. Mathematical library macro instruction . summary 25 

Table 9. Summary of service subprogram characteristics, ...... 27 

Table 10. Format and content of DCB prefix ............. 32 

Table 11. Translation of FORMAT codes . 38 

Table 12. Combinations of DSORG and RECFM values .......... 89 

Table 13. External names of FORTRAN IV library subprograms 91 

Chart BD. I/O interruption and machine indicator routine CCHCBD) . . 43 

Chart BE. Interrupt and machine indicator routine (CHCBE) 44 

Chart BZ. Error processor, math library (CHCBZ) ..... 47 

Chart IA. I/O initialization CCHCIA) 48 

Chart IB. DCB maintenance (CHCIB) 49 

Chart IC. I/O control CCHCIC) 50 

Chart ID. NAMELIST processor (CHCID) ....... 68 

Chart IE. List item processor (CHCIE) • 7 ^ 

Chart IF. FORMAT processor CCHCIF) 71 

Chart IH. Integer output conversion CCHCIH) - 74 

Chart II. Real and integer input conversion (CHCII) ........ 75 

Chart U. Real output conversion (CHCIJ) 76 

Chart IM. Complex input conversion (CHCIM) 7 8 

Chart IN. Complex output conversion CCHCIN) ..... .79 

Chart IO. Alphameric and hexadecimal input conversion (CHCIO) ... 80 

Chart IP. Alphameric and hexadecimal output conversion (CHCIP) ... 81 

Chart IQ» Logical input conversion (CHCIQ) ............. 82 

Chart IR. Logical output conversion (CHCIR) .... ..83 

Chart IS. General input conversion CCHCIS) ... 84 

Chart IT. General output conversion (CHCIT) . 85 

Chart IU. List termination CCHCIU) ................. 86 

Chart IV. Dump routine (CBCIV) .......... - 87 

Chart IW. Exit routine (CHCIW) ....... 88 



SECTION li 



INTRODUCTION 



The two FORTRAN IV libraries, mathemat- 
ical and input/output CI/O) , are written in 
assembler language and stored in the system 
library (SYSLIB) . They are available to 
all users. 

Each routine in the mathematical library 
is a collection of one or more subprograms. 
In this publication, the term subprogram 
means a routine or part of a routine that 
has a single entry point and performs or 
controls the performance of a single func- 
tion. Mathematical library subprograms are 
generally mathematical or computational in 
nature, and generally return one answer 
(function value) to the calling program. 
Mathematical subprograms can be categorized 
by use: 

1. Direct reference , as in reference to 
the sine subprogram in the statement 

X = SIN(Y) 

2. Indirect reference , as in reference to 
an exponentiation subprogram in the 
statement 

X = Y**I 

The I/O library is a group of routines 
that function as a single program complex 



for processing the I/O statements READ, 
WRITE, PRINT, PUNCH, BACKSPACE, REWIND, and 
END EILE. Processing cf READ and WRITE 
statements can include list control, NAME- 
LIST control, FORMAT ccntrcl, or none of 
these controls. The routines within this 
complex can be categorized by function: 

1. Language control routines , which ana- 
lyze the user's I/O request. 

2. Data conversion Routines , which con- 
vert data froir internal to external 
form or from external to internal 
form. 

Both libraries also contain service rou- 
tines, each of which is a collection of 
subprograms. Service subprograms are 
called with CALL statements or are implic- 
itly called by the occurrence of certain 
situations during execution. The service 
subprograms in the mathematical library 
handle machine exceptions and test program- 
simulated machine indicators. The service 
subprograms in the I/O library dump program 
data onto SYSOUTs and terminate execution 
cf user programs. 

Each of the two libraries also contains 
an error-handling routine. 



Section 1: Introduction 1 



SECTION 2s OVERVIEW 



This section explains the subdivisions 
of the FORTRAN IV mathematical and I/O 
libraries and gives in figure forir an over- 
view of each library. Note that the ser- 
vice subprograms are divided between the 
two libraries. 



MATHEMATICAL LIBRARY 

SUBDIVISIONS 

The FORTRAN IV mathematical library con- 
sists of two types of relocatable routines: 
mathematical and service. Each routine 
contains one or more subprograms; there is 
a separate entry point for each subprogram. 

Like a FORTRAN subprogram defined with a 
FUNCTION statement, a mathematical subpro- 
gram always returns an answer (function 
value) to the calling program. Mathemati- 
cal subprograms can be categorized as 
direct reference or as indirect reference. 

Since the user refers to direct- 
reference subprograms by name, they are 
explicitly called . For example, in the 
statement X = SIN(Y), the user invokes the 
SIN subprogram. The direct- reference math- 
ematical subprograms are the logarithmic, 
trigonometricr hyperbolic, square root, 
absolute value, gamma function, and error 
function subprograms, and some exponentia- 
tion subprograms . 

Since the user does not refer to 
indirect- reference subprograms by name, 
they are implicitly called . For example, 
to invoke an exponentiation subprogram, the 
user employs the exponentiation operator 
(i.e., **)• The FORTRAN compiler then 
causes the user program to call the appro- 
priate exponentiation subprogram. To 
invoke CHCBZA, the error-handling subpro- 
gram, the user invokes a mathematical sub- 
program without specifying the proper argu- 
ments. With the exception of CHCBZA, all 
indirect-reference mathematical subprograms 
are exponential (compute powers of 
numbers) . 

The mathematical library service subpro- 
grams can also be categorized as direct- 
reference or as indirect- reference. The 
direct-reference subprograms SLITE, SLITET, 
OVERFL, and DVCHK test program- simulated 
machine indicators. The indirect-reference 
subprograms CHCBD1, CHCBD2, CHCBD3 , CHCBD4, 
CHCBD5, and CHCBE1 handle interruptions 
resulting from machine exceptions. 



Each entry to an indirect-reference 
mathematical subprogram (and some entries 
to service subprograms) in the mathematical 
library is made with two entry names: 

1. Compiler-generated entry name. When 
the user employs the exponentiation 
operator, the compiler examines the 
terms en both sides of the operator 
and determines which exponentiation 
subprogram to call. It then generates 
an entry name that is later translated 
into the system entry name. 

2. System entry name. This is the name 
defined by the subprogram itself, the 
name of the entry point. 

Each entry to a direct-reference subpro- 
gram is made with the name employed by the 
user. (The system entry name is the same 
as the user-employed name.) 



INTERNAL RELATIONSHIPS 

Figure 1 gives a functional overview of 
the mathematical library. The subprogram 
entry names of each routine are shown under 
the name of the routine. The entry names 
shown for the directly referenced subpro- 
grams are the user entry names. System 
entry names of these subprograms are shown 
in Table 7. The entry names shown for the 
indirectly referenced subprograms are the 
system entry names of these subprograms are 
shown in Table 8. The error-processing 
routine CHCBZ is not included in Figure 1. 



I/O LIBRARY 



Since the user has 10 entry points to 
the FORTRAN IV I/O library, this library 
can be thought of as 10 subprograms and a 
number of subroutines for these subpro- 
grams. The I/O library can also be 
| described as a group of 21 routines that 
interact in various ways, depending upon 
the user's request. Except in "Section 4: 
Service Subprograms," this publication 
describes the I/O library in terms of its 
routines • 

Three of the ten entry points to the I/O 
library are for processing the I/O state- 
ments READ, WRITE, REWIND, BACKSPACE, END 
FILE, PRINT, and PUNCH. Processing of READ 
or WRITE statements can include list con- 
trol, NAMELIST control, FORMAT control, or 
none of these controls. The other seven 
entry points are to service subprograms, in 



two routines, that execute the statements 
STOP, PAUSE, CALL DUMP, CALL PDUMP, and 
CALL EXIT, and act upon requests by other 
library routines for termination of program 
execution. 



SUBDIVISIONS 

There are two groups of I/O routines : 
I/O language control routines and data con- 
version routines. These groups interact, 
in fulfilling an I/O request, by means of a 
common communication and work region. 

I/O Language Control Routines 

There are three types of I/O language 
control routines: I/O operation control, 
I/O list control, and I/O services control. 
These routines analyze the user's I/O 
requests to determine information such as: 
the type of I/O operation to be performed; 
the number and type of list items present, 
if any? the type of NAMELIST or FORMAT con- 
trol, if any; and the I/O statement rela- 
tionships with a user-specified DDEF 
command. 

I/O OPERATION CONTROL ROUTINES : These rou- 
tines control the I/O request by creating, 
if necessary, a data control block (DCB) f 
and analyzing FORMAT and NAMELIST control 
specified by the user. After this informa- 
tion is processed, the I/O operation con- 
trol routines interface with the TSS/360 
data management routines that actually ful- 
fill the I/O request. The interface with 
data management is accomplished by the rou- 
tines CHCIB and CHCIC, via the data manage- 
ment macro instruction facilities. 

I/O LIST CONTROL ROUTINES : These routines 
examine the list items, if any, in each I/O 
request to determine the type of conversion 
to be performed. After the type of data 
conversion is determined, control is given 
to the I/O operation control routines which 
in turn call the appropriate data conver- 
sion routines for final processing. 

I/O SERVICES CONTROL ROUTINES : These rou- 
tines are responsible for creating user- 
requested dumps, initiating a pause in the 
user program, and terminating a user pro- 
gram as a result of either normal proces- 
sing completion or program errors. I/O 
services control routines also interact 
with the I/O operation control and with the 
group of data conversion routines for the 
preparation of the user's data in virtual 
storage for subsequent output on SYSOUT. 



Data Conversion Routines 

The data conversion routines are subdi- 
vided into routines used for input proces- 
sing and routines used for the preparation 
of output. These routines can process all 
the permissible types of FORTRAN-formatted 
data specified in either a FORMAT or NAME- 
LIST statement. 

When converting a user's data, the data 
conversion routines interact with each 
other according to the requirements of the 
user-specified FORMAT or NAMELIST control. 
For example, for input data that is defined 
by a G- format conversion code. General 
Input Conversion (CHCIS) is called. This 
routine analyzes the data to determine 
whether it is integer, real, logical, or 
alphameric and calls the appropriate data 
conversion routine. 



INTERNAL RELATIONSHIPS 

Figure 2 gives a functional overview of 
the I/O library. 

Table 1 shows the calling relationships 
between the user program, the FORTRAN I/O 
library routines, Data Management, and the 
Supervisor. 

Since the routine functions and interre- 
lationships vary, depending on the kind of 
I/O operation being performed, separate 
diagrams (Figures 3-14) describe the dif- 
ferent kinds of I/O operations. Exceptions 
to the logical flows shown in Figures 3-14 
are covered under the individual routine 
descriptions in "Section 5: I/O Routine 
Des cript ions . * 

The types of I/O operations and their 
figure references are: 



Type of Operation (Function) 

Formatted READ with List 
Formatted READ without List 
READ with NAMELIST 
Unformatted READ with List 
Unformatted READ without List 
Formatted WRITE with List 
Formatted WRITE without List 
WRITE with NAMELIST 
Unformatted WRITE with List 
Unformatted WRITE without List 
REWIND, BACKSPACE, and END FILE 
EXIT and STOP 



Figure 




Reference 


Figure 


3 


Figure 


4 


Figure 


5 


Figure 


6 


Figure 


7 


Figure 


8 


Figure 


9 


Figure 


10 


Figure 


11 


Figure 


12 


Figure 


13 


Figure 


14 



Section 2: Overview 3 



ARCTANGENT 



r 



I 




r~" 



MATHEMATICAL 


SERVICES CONTROL 






INTERRUPT AND 


CHCBE* 


MACHINE INDICATOR 


ROUTINE 


CHCBE2 




CHCBE3 




CHCBE4 




CHCBE5 




OVERFL 




DVCHK 




SLITE 




SLITET 



I 



CHCBR 
DATAN 
DATAN2 



CHCBQ 

ATAN 

ATAN2 



1 



I J 

COMMON & NATURAL LOGARITHM 





TRIGONOMETRIC 
TANGENT 



L. 



C HCAZ 

DTAN 

DCOTAN 



CHCAY 

TAN 

COTAN 



Figure 1. Functional flow of mathematical library subprograms (page 1 of 2) 



GAMMA; 
LOG-GAMMA 



U.OC 
J 



REAL OR INTEGER 
BASE TO REAL 
POWER 



WBT 



GAMMA 
ALGAMMA 



L_. 



CHCSV 



DGAMMA 
DLGAMMA 



1 



ERROR FUNCTION; 
COMPLEMENTED 
ERROR FUNCTION 



J 



r 



CHCBU 

ERF 

ERFC 



I 



CHCBW 

DERF 

DERFC 



. I 



HYPERBOLIC TANGENT 



CHCAK 
TANH 



CHCAL 
DTANH 



L.. 



J 



EXPONENTIAL 




INTEGER BASE 


CHCBG* 


TO INTEGER 


CHCBGA 


POWER 


CHCBG B 




CHCBGC 




CHCBGD 



REAL BASE TO 
INTEGER POWER 



COMPLEX BASE 
TO INTEGER 
POWER 



CHCBH* 
CHCBHA 
CHCBHB 



CHCBC* 
CHCBCA 
CHCBCB 



TRIGONOMETRIC 
SINE & COSINE 

r~ ' 1 



CHCAQ 
CSIN h 
CCOS 



CHCAI 
SIN 

COS 



L_T 



CHCAR 
CDSIN 
CDCOS 



CHCAJ 

DSIN 

DCOS 



SIN) (COS) (DSIN) foCOS 



J 



HYPERBOLIC 
SINE & COSINE 



r 



CHCBA 

SINH 

COSH 



CHCBB 
DSINH 
DCOSH 



"i 



5 LOG) 

4 



CHCBK* 
CHCBKA 
CHCBKB 
CHCBKC 
CHCBKD 
CHCBKE 



CHCBI* 
CHCBIA 
CHCBIB 



CHCBM* 
CHCBMA 
CHCBMB 



REAL DOUBLE 
PRECISION BASE 
TO REAL DOUBLE 
PRECISION POWER 



DOUBLE PRECISION 
BASE TO INTEGER 
POWER 



COMPLEX, DOUBLE 
PRECISION BASE TO 
INTEGER POWER 



Note: Asterisk (*) denotes 
that following subprograms 
are implicitly called 
(Indirect reference). 



i_. 



_f 



Figure 1. Functional Flow of Mathematical Library Subprograms (Page 2 of 2) 



Section 2: Overview 5 



Table 1. I/O library calling relationships 



n. Routines 
\. Called 

Calling \ 
Routines \^ 


< 

u 

X 

u 


CO 

u 

X 

u 


u 

X 

u 


9 
u 

X 

u 


u 

u 


U 

X 

u 


u 

X 

u 


u 

X 

u 


"—5 

u 

X 

u 


1 

u 

X 

u 


z 
u 

X 

u 


g 

u 

X 

u 


u 

X 

u 


a 

u 

X 

u 


as: 

U 

X 

u 


U 

X 

u 


u 

X 

u 


u 

X 

u 


> 
u 

X 

u 


u 

X 

u 


o 

QD 

u 

X 

u 


c 

E 
a* 

2 ? 
Q 2 


o 

Ql 

3 


USER 
PROGRAM 


X 








X 


























X 


X 


X 


X 






CHCfA 




X 


X 


X 




X 




























X 








CHCIB 


















1 [ " 




















X 




X 


X 


CHC1C 




X 




































X 




X 


X 


CHCID 






X 














X 


























CHCIE 






X 






X 




























X 









CHCIF 






X 








X 


X 


X 


X 


X 


X 


X 


X 


X 


X 


X 






X 






CHCIH 












































CHCII 










— - T i "i " 






























CHC1J 












' 






























CHCIM 












| 


X 






























CHC1N 
































X 














CHCIO 


















— 




























CHCIP 
















































CHCIQ 














































CHCIR 






































"■ f ~ 

I 






CHCIS 
















X 






X 




X 




















CHCIT 














X 


X 












X 


















CHCIU 






X 






X 
































CHCIV 




> 


X 








x 




X 


X 




X 




X 






X 






CHCIW 




X 


X 


[ 
































X 


CHCBD 









































i 





G'j 
O 



o 
< 








ft 

o 

0) 



o 



70 

o 



I/O tongue Con fro f Routines 



U*er Program 



DUMP, POUMP, READ, WRITE, PRINT, 

EXIT, STOP, . PUNCH, BACKSPACE, List I 

REWIND, END FILE I 



PAUSE 



Data Conversion 
Routines 




Input 

r 



General 
(CHCIS) 



Integer and 

Real 

(CHCII) 



Complex 
(CHCIM) 



Alphameric and 

Hexadecimal 
(CHCIO) 



Output 




General 
(CHCIT) 



integer 
(CHCIH) 



Real 
(CHCIJ) 



Complex 
(CHCIN) 



Logical 
(CHCIR) 



Alphameric and 

Hexadecimal 

(CHCIP) 







































User 
Program 






m _ 


7 




i 






t 


T ____, ' 








_i 


1 


1 




t V 






A 


♦ I 




CHCIA 
I/O Initial- 
ization 






CHCSE 

List Processing 

Enter for each 

item 


1 

1 
I 




2 


1 


t 

J 


\ 








Is f 


1 

i 






1 
1 

1 3 

1 

\ 1 




if 1 


i 




< 


1 

p I 






CHCIF 

FORMAT Processor 

process each item 
according to 
FORMAT speci- 
fication 




1 • 






CHCIB 

Find a DCB 

defining associ- 
ated data set 




1 


r 
i 


— 




CHCIU 

List 

Termination 






CHCIC 

Read o logical 

record 


1 
i 
I 
i 
_i 




















5A 


-.~r~ 






CHCII, IM, IO, 

jQ, IS 

Appropriate data 
conversion routine 

for each item 




Read sub- 
sequent records 
if necessary 





































Figure 3. Formatted READ With List 







































User 

Program 








i 




t 






1 


f 


r~ - 

i 


— 


1 
1 








CHCIA 
I/O Ini 

ization 


hial- 


4 


CHCIF 

FORMAT Processor 
move data items 
from buffer into 
FORMAT 




m . 






t 


♦ 








2 


3 










„ ... .1 


r~ - 
f i 


— 


1 

_l 


1 

L 


1 

1 


I 






CHCIB 
Find a DCB 

defining associ- 
ated data set 






CHCIC 

Read a foglca I 
record 


Read 

subsequent 
record if 
necessary 



























Figure 4. Formatted READ Without List 

























User Program 








■ ! 






2 


CHCtA 
1 /O Initialization 




4 












_ 1 




1 


1 1 








"I 


1 






CHCIB 
Find a DCB 




3 
1 


1 
1 1 




CHCID 

NAMELIST 

Processor 




i 

J5A 

1 

1 

_J 








CHCIC 

Read a logical 

record 




•..! 






CHCU, IM, 
iO, IQ # IS 
Appropriate 
data conversion 
routine 




Read 
subsequent 

records if 
necessary 






















Figure 5, READ With NAMELIST 































User Program 






"~l 






"1 


| 5 
| 








I 

1 


t 

i i 


4 


1 


1 
1 1 








CHCIA 

I/O Initialization 




CHCIU 

List Termination 






1 




2 

i 


1 
1 
1 

' 1 




3 


t 
1 

- 1 


, 1 










CHCI8 
Find a DCB 




CHCIC 

Read a logical 
record 






CHCiE 

List Processor 
{Enter for 
each item) 






r 

1 4A 
J 








Read 

subsequent 
records If 

necessary 

































Figure 6. Unformatted READ With List 



Section 2: Overview 9 



User Program 



CHCIA 

I/O Initialization 




CHCIB 
Find a DCB 




Figure 7. Unformatted READ Without List 



CHCIC 

Read a logical 

record 



L 



CHCIB 
Find a DCB 

defining asso- 
ciated data set 



User 

Prograrr 



1 



CHCiA 
I/O Initial 

ization 



L 



CHCIC 

Initialize pointers 

to buffer in which 

to construct data 
record 



Write buffer in 
output data set, 
when ful I 



1 



± 



CHCJE 



List Processingsenter 
for each item f pyf- 
list in buffer 



r 



T 



JZ. 



C HCIF 

FORMAT Processor 
process each item 
according to 
FORMAT speci- 
fication 



6A 



-A L_ 

CHCIU 

List 

Termination 



_1_ 



CHCIhl, U_, IN, U>, 

NR^ IT 

Appropriate data con- 
version routine for 
each item in buffer 



_l 



Figure 



Formatted WRITE with 



..ist 



10 













































1 




User 
Program 














t 










f 


1 


_ - 


1 
1 












1 


I 




4 




CHCIF 

FORMAT Processor 
move data items 
into buffer from 
FORMAT 






CHCIA 
I/O Initio 


ization 




















f 


t 










I 


"3 








♦ 










1 

f 1 





1 
-J 


i 


1 

I 


1 


» 






1 


5 




CHCIB 
Find a DCB 
defining associ- 
ated data set 






CHCIC 

Initialize pointers 
to buffer in which 
to construct data 
record 


Write buffer 
output data 

when full 


In 
set, 






















































Figure 9. Formatted WRITE Without List 



























User 
Program 








1 

1 


t 

1 

» I 






2 


CHCIA 
I/O Initial- 
ization 




4 












' 






' 


i i 








i 

i 


i 






CHCIB 
Find a DCB 




3 

1 


t 
i 






CHCID 

NAMELIST 

processor 




r~~ 








CHCIC 

Initialize pointers 
to buffer for data 
record construction 




i 


5 


\ 

i 






ISA 


CHCIH, |J, IN, 

ify IBxil 
Appropriate data 
conversion routine 
for each item 




Write buffer in 
output data set, 
when full 


— 





















Figure 10 • WRITE With NAMELIST 



Section 2: Overview 11 



r 






































User Program 






'~l 






4 


1 

1 

I 




i 


1 ♦ 


L 






J 






1 6 










1 
W 1 




T 1 






CHCIA 
f/O Initial- 
ization 




CHCIE 

List Processor 

(enter for each 

item) 




CHCIU 

List Termination 
insure last 
record is written 






2 




♦ 1 

1 


I 








t 

1 
I 

1 

l 
_ J 






t 








' 


r " " 


_J 




CHCJC - Initialize 

pointers to buffer 

in which to con- 
struct data record 




5 1 
1 
1 
1 

1 


7 




" """ "' 

CHCIB 
Find a DCB 










Write buffer in 
output data set, 
when full 










1 




m 











































Figure 11. Unformatted WRITE With List 



























User Program 






s 


_! 4 






1 


! I 


1 






CHCIA 
I/O Initial- 
ization 


- 1 




1 

1 

1 

U 

1 

1 
1 






t 

1 


L 


3 

! 




2 


I 




* 1 




1 


I 

r 1 




CHCIC - initial- 
ize pointers to 
buffer in which 
to construe t 
dummy record 






CHCfB 

Find a DCB 




Write buffer 

consisting of 
two bytes of 
zeros 










. 


_l 

























Figure 12- Unformatted WRITE Without List 



12 



\ 
















User Program 


V 3 


t 

i i 
1 


CHCIA 
I/O Initial- 
ization 














CHCIC - Perform 
REWIND and 
BACKSPACE opera- 
tion. END FILE is 

performed on subse- 
quent WRITE 




CHCIB 

Find a DCB 



















Fiorure 13. BACKSPACE f RFWIND, and END FILE 







2 




3 








User Program 








1 

1 


r 








CHCIB 

Find all DCBs 

currently open 


CHCIC 

For each open 
DCB found by 
CHCIB, the 
DCB is closed 




CHCIW 
Exit Routine 




a» — .-_ 


4 


i 












f Exit to Com- \ 
I mand System J 















Figure m. EXIT and STOP 



Section 2: Overview 13 



SECTION 3: MATHEMATICAL SUBPROGRAM DESCRIPTIONS 



This section gives the following infor- 
mation on each mathematical library subpro- 
gram # excluding the service subprograms, 
which are described in Section 4: 



Directly referenced subprograms. The 
order is the same as that in the list 
of operands within the parentheses in 
the corresponding FORTRAN source state- 
ment. For example the source statement 



Maine 

Name of containing routine 

Function 

Attributes 

Entry 

Exit parameter (function value) 

Storage requirement 

Error check 

Accuracy figures (where applicable) 



Since mathematical subprograms perform 
standardized computations, a detailed 
description of operation is given only for 
CHCBZ, the error-handling routine. The 
algorithms of direct-reference mathematical 
subprograms are described in FORTRAN IV 
Library Subprograms , GC28-2026. 



GENERAL INFORMATION 

Certain information is common to all 
mathematical routines and their subpro- 
grams. This information includes; 

• Routine names 

• Attributes 

• Entry parameters 
® Error action 

• Exit parameters 



Routine Names 

All mathematical library routines have 

five-letter names beginning with ' CHCA* or 
f CHCB f . 



Attributes 

All mathematical library routines use 
type-I linkage and are nonprivileged* 
reenterable r and closed. 



ANS=SIN( RADIAN) 

in FORTRAN coding corresponds to an 
assembler-language call containing one 
address in the parameter list — the 
address of RADIAN. The FORTRAN 
statement 

ANS=ATAN2(X, Y) 

produces a linkage with a parameter 
list containing the addresses of X and 
Y, in that order. The assembler lan- 
guage programmer's linkage to ATAN2 
must do the same. 

• Indirectly referenced subprograms. The 
order for the exponentiation subpro- 
grams is s address of the number to be 
raised to a power and the address of 
the power itself. 

Error Action 

All mathematical subprograms that check 
for error call CHCBZ upon finding such 
error. CHCBZ then prints an error message 
and terminates execution. See the descrip- 
tion of CHCBZ at the end of this section. 

Exit Parameters 

All subprogram results are returned in 
registers, as follows? 

Integer - General register 

Real - Floating register 

Complex - Real part in floating register 
f complex part in floating 
register 2 



SUBPROGRAM SUMMARIES 



Entry. Parameters 

Each mathematical subprogram receives 
one or two arguments from the calling pro- 
gram, in the form of a parameter list 
pointed to by register 1. The parameter 
list must contain the addresses of the 
arguments in the proper order: 



TABLES 

Tables 2 and 3 give the following infor- 
mation concerning the mathematical 
subprograms: 

FUNCTION ; A brief description of the type 
of mathematical operation performed. 



14 



I Table 2. Summary of directly referenced mathematical subprograms (page 1 of 3) 



I 


2 


3 






4 


5 


6 


7 




8 


9 








10 






Function 


Entry 
Name 


Definition 


Arguments) 


Function 

Value 

Returned 


Error Condition 


Storage 
Estimates 


Other Subprograms Required 


Routine 

Name 


Accuracy Figures 


Argument 
Range 


Sample 
E/U 


relative 


absolute 


No, 


Type 


Range 


Hex 


Dec 


M(«) 


<r(t) 


m(e) 


*(E) 


COMMON AND 

NATURAL 

LOGARITHM 


CDLOG 


Ln (arg) or Log e (org) 
See Note 8 


1 


COMPLEX * 16 


arg # + Oi 


COMPLEX * 16 


Argument -0 + 0! 


1E8 


488 


CDABS, DLOG, DATAN2, DSQRT 


CHCAP 


The full range 
except (1 + Oi) 


Note 1 


2-72 x 10' 16 


5.38x 10"' 7 






CLOG 


Ln (arg) or Log e (arg) 
See Note 8 


1 


COMPLEX * 8 


arg * + Oi 


COMPLEX * 8 


Argument » + Oi 


1D0 


464 


CABS, ALOG, ATAN2, SORT 


CHCAO 


The full range 
except (1 + 0?) 


Note 1 


7.15x 10" 7 


1.36x 10" 7 






DLOG 


Ln (arg) or Log e (arg) 


1 


REAL * 8 


arg > 


REAL * 8 


Argument S 


21A 


538 




CHCAF 


0.5 £ X £ 1.5 


U 






4.60 x 10" 17 


2.09 x 10" 17 


X<0.5, X > 1.5 


E 


3.32x 10" 16 


5.52x 10" 17 






DLOG10 


Log 1Q (arg) 


1 


REAL* 8 


arg > 


REAL * 8 


Argument 5 


21A 


538 




CHCAF 


0.5 i X£ 1.5 


U 






2.73x 10" 17 


l.07x 10" 


X<0,5, X > 1.5 


E 


3.02 x 10' 16 


6.65 x 10~ 17 






ALOG 


Ln (arg) or Log e (arg) 


1 


REAL * 4 


arg > 


REAL * 4 


Argument S 


1D0 


464 




CHCAE 


0.5 i X <1.5 


U 






6.85 x 10" 8 


2.33 x 10' 8 


X< 0.5, X >1.5 


E 


8.32 x 10" 7 


1.19x 10" 7 






ALOGIO 


Log 10 (org) 


1 


REAL * 4 


arg > 




1D0 


464 




CHCAE 


0.5 i X $1.5 


U 






7. 13 x 10" 8 


2.26 x 10* 8 


REAL * 4 


Argument 5 


X< 0.5, X > 1.5 


E 


1.05 x 10" 6 


2.17x 10" 7 






EXPONENTIAL 


CDEXP 


e arg 


1 


COMPLEX * 16 


reol arg < 174.673 
|imag arg| < 2 w 


COMPLEX * 16 


Real Argument > 174.673 

i 50 

pmaginary Argumentj 2t 2 


2710 


624 


DEXP, DSIN, DCOS 


CHCAN 


|X,| < 1, |X2)S | 


U 


3.76x !0" 16 


l.lOx io" 16 






|X,|<20, |X2J ^ 20 


U 


2.74 x 10~ 15 


9,64x 10" 16 






CEXP 


e arg 


1 


COMPLEX * 8 


real arg 174,673 
Jimag arg| < 2 7f 


COMPLEX * 8 


Real Argument > 174.673 
(imaginary Argument) i 2 


250 


592 


EXP, SIN, COS 


CHCAM 


N<,70,|X2|Sf 


U 


9.93 x 10" 7 


2.67 x 10~ 7 






|X,| S 170, 
! <|*$|£20 


u 


1.07x 10" 6 


2.73 x 10" 7 






DEXP 


e ar 9 


1 


REAL * 8 


arg < 174,673 


REAL * 8 


Argument > 174,673 


2C0 


704 




CHCAD 


|x|Si 


u 


2.04x 10* 16 


5.43x 10" 17 






1 < |x| £20 


U 


2.03 x 10' 16 


4.87x 10~ 17 






20 < | X|$170 


u 


1.97x 10* 16 


4.98x 10" 17 






EXP 


e °*9 


1 


REAL * 4 


arg < 174.673 


REAL • 4 


Argument > 174,673 


1A8 


424 




CHCAC 


|x|ii 


U 


4.65 x I0" 7 


128x 10" 7 








1< |X| i 1 70 


U 


4.42 x 10" 7 


1.15 x 10" 7 






SQUARE ROOT 


CDSQRT 


(arg) or ^J arg 


1 


COMPLEX * 16 


Any 


COMPLEX • 16 


None 


148 


328 


CDABS, DSQRT 


CHCAT 


The full range 


Note 1 


1.76* 10" 16 


4.06x 10" 17 






CSQRT 


(arg) or *J arg 


1 


COMPLEX * 8 


Any 


COMPLEX * 8 


None 


138 


312 


CABS, SORT 


CHCAS 


The full range 


Note 1 


7.00x 10" 7 


1.71 x 10" 7 






DSQRT 


(arg) or *J arg 


I 


REAL * 8 


arg #0 


REAL * 8 


Negative Argument 


160 


352 




CHCAB 


The full range 


E 


1.06x 10" 16 


2-16x 10"' 7 






SORT 


(arg) ' or -/ arg 


1 


REAL * 4 


arg #0 


REAL * 4 


Negative Argument 


158 


344 




CHCAA 


The full range 


E 


4.45 x 10" 7 


8.43 x 10" 8 






ARCSINE 

AND 

ARCCOSINE 


DARSIN 


arcsine (arg) 


1 


REAL * 8 


arg < 1 


REAL * 8 


Argument > 1 


288 


648 


DSQRT 


CHCAX 


-l £ x <+i 


U 


2.04 xlO" 16 


5.15x 10" 17 






DARCOS 


arecosine (arg) 


1 


REAL * 8 


arg £ 1 


REAL * 8 


Argument > 1 


288 


648 


DSQRT 


CHCAX 


-i < x S + i 


U 


2.07x 10" 16 


7.05 x 10' 17 






ARSIN 


arcsine (arg) 


1 


REAL * 4 


largl <1 


REAL * 4 


JArgumentj > 1 


1F0 


496 


SORT 


CHCAW 


-i < x S+i 


U 


9.34 x 10" 7 


2.06x 10* 7 






ARCOS 


arecosine (arg) 


1 


REAL * 4 


|arg| <1 


REAL * 4 


Argumenr > 1 


1F0 


496 


SQRT 


CHCAW 


-1 < X < + 1 


u 


8.85 x 10" 7 


3.19x 10" 7 






ARCTANGENT 


DATAN 


arctan (arg) 


1 


REAL * 8 


Any 


REAL * 8 


None 


288 


648 




CHCBR 


The full range 


Note 7 


2.18x 10" 16 


7.04x 10" 17 






DATAN2 


arctan (argi/arg2) 


2 


REAL * 8 


arg *0 


REAL * 8 


x, = x 2 = 


288 


648 




CHCBR 


The full range 


Note 7 


2.18 x 10" 16 


7.04 x IO* 17 






ATAN 


arctan (arg) 


1 


REAL * 4 


Any 


REAL * 4 


None 


1E8 


488 




CHCBQ 


The full range 


Note 7 


1.01 x 10* 6 


4.68 x 10* 7 






ATAN2 


Cretan (arg,/arg„) 


2 

1 


REAL * 4 


arg *0 


REAL * 4 


Xl -x 2 =o 


1E8 


488 




CHCBQ 


The full range 


Note 7 


1.01 x 10" 6 


4.68 x 10" 7 








CDSIN 


sin (arg), arg in 
radians 


COMPLEX * 16 


|realorg| < T^ » 
limag argl < 174,673 


COMPLEX * 16 


|Real Argument] > 2 5 * w 

Imaginary Argument > 174,673 


340 


832 


DSIN, DCOS, DEXP 


CHCAR 


|Xl|*io,|x 2 |Sl 


U 


2.35 x 10" 15 
See Note 4 


2.25 xlO" 16 






TRIGONOMETRIC 
SINE & COSINE 


CDCOS 


cos (arg), arg in 
radians 


1 


COMPLEX * 16 


|realarg| < 2 50lr 
|imag arg| < 174,673 


COMPLEX * 16 


|Real Argument] * 2 ^ w 
Imaginary Argument > 174,673 


340 


832 


DSIN, DCOS, DEXP 


CHCAR 


N - ]0 >\*2\- ] 


U 


3.98 x 10" 15 
See Note 3 


2.50 x 10" 16 






CSIN 


sin (arg) , arg in 
radians 


1 


COMPLEX * 8 


|real arg| < 2 18 » 
imag org < 1 74,673 


COMPLEX • 8 


|Rea! Argument] > 2 18 » 2F8 
Imaginary Argument > 174,673 

. . i 


760 


SIN, COS, EXP 


CHCAQ 


|X,| S I0,|X2|S1 


U 


1.92 x 10" 6 
See Note 6 


7.38 x 1Q~ 7 







Section 3; Mathematical Subprogram Descriptions 15 



I Table 2. Summary of directly referenced mathematical subprograms (page 2 of 3) 



1 


2 


3 






4 


5 


6 


7 




8 


9 








10 






Function 


Entry 
Nome 


Definition 


Argumenf(s) 


Function 

Value 

Returned 


Error Condition 


Storage 
Estimates 


Other Subprograms Required 


Routine 


Accuracy Figures 


A 


Sample 
E/U 


Relative 


Absolute 


No. 


Type 


Range 


Hex 


Dec 


Range 


M (f) 


<r( «) 


M (E) 


»(E) 


TRIGONOMETRIC 
SINE & COSINE 
(Continued) 


CCOS 


cos (org), org in 
radians 


1 


COMPLEX * 8 


i 1 I < o 18 » 
real arg ** / 

imag arg < 1 74,673 


COMPLEX * 8 


JReal Argument 2 2 18 » 
Imaginary Argument > 174.673 


2F8 


760 


SIN, COS, EXP 


CHCAQ 


|x,|Sio,|x 2 |< i 


U 


2.50 x IO" 6 
See Note 2 


7.66 x IO" 7 






DSIN 


sin (org), arg in 
radians 


1 


REAL * 8 


1 1 < -)50 , 

arg * 2 


REAL * 8 


[Argument! > 2 50 * 


2B8 


696 




CHCAJ 


l*l*f 


U 


3.60x IO" 16 


4.82 x IO* 7 


7.74 x IO" 17 


1.98 x IO** 17 


I<|X|<10 


U 






1.64x IO" 16 


6.49 x IO** 17 


10 < | X | < 100 


U 






2-68 x IO" 15 


1.03 x IO" 15 


DCOS 


cos (org), arg in 
rodians 


1 


REAL * 8 


|arg| < 2 50 » 


REAL * 8 


Argument - 2 * 


2B8 


696 




CHCAJ 


< x< » 


U 






1.79x IO" 16 


6.53 x IO" 17 


-10 i X < 
w < X < 10 


U 






1.75 x IO" 16 


5.93 x IO" 17 


io < | x| S ioo 


U 






2.64 x IO" 15 


1.01 x io" 15 


SIN 


sin (arg), arg in 
rod i am 


1 


REAL * 4 


|arg| < 2 18 tr 


REAL * 4 


Argument t 2 w 


1F8 


504 




CHCAI 


1*1*1 


U 


1.32 x IO" 6 


1.82x IO" 7 


1.18x IO" 7 


4.55 x 10~ 8 


* <|x|Sio 
10 < | x| - 100 


U 






1.15 x IO" 7 


4.64 x 10" 8 


U 






1.28 x 10~ 7 


4.52 x IO** 8 


COS 


cos (arg), arg in 
radians 


1 


REAL * 4 


|org| <2 18 " 


REAL * 4 


1 Argument 1 > 2 18 * 


1F8 


504 




CHCAI 


OiXif 


U 






1.19x IO" 7 


4.60 x IO* 8 


-10 S X < 

» < X £ 10 


U 






1.28 x IO" 7 


4.55 x IO" 8 


10 < | x | Sioo 


U 






1.14 x IO" 7 


4.60 x IO* 8 


TRIGONOMETRIC 
TANGENT 


DTAN 


ran (arg), arg in 
radians 


I 


REAL * 8 


|«rfl| < 2 50 * 


REAL * 8 


1 Argument > 2 50 * 

Argument too close to a Singularity 
(i.e. , too close to an odd 
multiple of?r/2) 


2F8 


760 




CHCAZ 


1*1*1 

;<|x|s« 


U 


3.41 x IO" 16 


6-27 x IO** 17 






U 


-12 
1.43x 10 l£ 

See Note 5 


2.95 x IO" 14 






f <|x|Sio 


U 


2.78x IO* 13 
See Note 5 


7.23x IO* 15 






io <| x|Sioo 


U 


-12 
3.79 x 10 {i 

See Note 5 


9.50x 10** 14 






OCOTAN 


cofan (arg), arg in 
rod ions 


1 


REAL * 8 


|arg| < 2 50 * 


REAL * 8 


i 1 50 
Argument it 2 v 

Argument too close to a Singularity 
(i.e. , too close to a 
multiple of w) 


2F8 


760 




CHCAZ 


1*1* J 


U 


2.46x IO" 16 
See Note 5 


8.79 x IO" 17 






;<|x|S f 


U 


2.78 x 10" 13 

See Note 5 


8.61 x IO** 15 






f <| x | S io 


U 


5.40x 10** 13 
See Note 5 


1 

1.13x 10" M 






to <| x| S 100 


U 


-13 
8.61 x 10 

See Note 5 


4.61 x IO" 14 






TAN 


tan (arg), arg in 
radians 


1 


REAL * 4 


|arg| < 2 18 " 


REAL * 4 


1 Argument 1 > 2 18 * 

Argument too close to a Singularity 
(i.e. , too close to an odd 
multiple of it/2) 


288 


648 




CHCAY 


1*1*4* 


U 


1.71k IO* 6 


2.64 x 10* 7 






J<l*l s 5 


U 


1.05 x IO" 6 
See Note 5 


3.59 x 10" 7 






J <|x|Sio 


U 


6.49 x IO" 6 
See Note 5 


3.38 x IO" 7 






io<| x | S ioo 


u 


1.57x IO" 6 
See Note 5 


3.07 x IO** 7 






COTAN 


cotan (arg), arg in 
radians 


1 


REAL * 4 


1 1 < o 18 * 

arg * 2 


REAL * 4 


Argument 2 2 * 

Argument too close to a Singularity 
(i.e. , too close to a 
multiple of it) 




648 




CHCAY 


|x|S f 


u 


1.07x IO" 6 


3.58 x IO" 7 






J<l*l*5 


u 


1.40x IO** 6 
See Note 5 


2.56 x 10" 7 






f <|x|Sio 


u 


1.30x IO" 6 
See Note 5 


3.11 x IO -7 






10 < | X | ^ 100 


u 


1.49 x IO" 6 
See Note 5 


3.15x IO** 7 






HYPERBOLIC 
SINE & COSINE 


DSINH 


sinh (arg) 


1 


REAL * 8 


|org| < 175.366 


REAL * 8 


Argument 2 174,673 


250 


592 


DEXP 


CHCBB 


|x| - 0.88137 


u 


2.06 x IO" 16 


3.74 x IO** 17 






0.88137 <| x|£ 5 


u 


3.80 x IO** 16 


9.21 x 10" 17 






DCOSH 


cosh (arg) 


1 


REAL * 8 


|arg|< 175.366 


REAL * 8 


Argument 1 174,673 


250 


592 


DEXP 


CHCBB 


-5 £ X £ +5 


u 


3.63 x 10* 16 


9.05 x 10*"' 7 






SINH 


sinh (org) 


1 


REAL * 4 


|arg| < 175.366 


REAL * 4 


Argument t 174,673 


1F8 


504 


EXP 


CHCBA 


-5 S X < + 5 


u 


1.26 x IO" 6 


2.17x 10** 7 






COSH 


cosh (arg) 


1 


REAL * 4 


|arg|< 175.366 


REAL * 4 


1 Argument 1 > 174,673 


1F8 


504 


EXP 


CHCBA 


-5 < X < +5 


u 


1.27 x IO** 6 


-7 
2.63 x 10 







Section 3: Mathematical Subprogram Descriptions 17 



I Table 2. Summary of directly referenced mathematical subprograms (page 3 of 3) 



1 


2 


3 






4 




5 


6 


7 




8 


9 








10 






Function 


Entry 


Definition 


Argument(s) 


Function 

Value 

Returned 


Error Condition 


Storage 

Estimates 


Other Subprograms Required 


Routine 

Name 


Accuracy Figures 


Argument 
Range 


c , | relative 


absolute 


No. 


Type 


Range 


Hex 


Dec 


Sample i 

E/U M( ° 


*(«) 


M (E) 


»(E) 


HYPERBOLIC 
TANGENT 


DTANH 


tanh (org) 


1 


REAL * 8 


Any 


REAL * 8 




130 


304 


DEXP 


CHCAL 


|x| S 0.54931 


U | 1.91 , 10"' 6 


3.86x 10" 17 






0.54931 < |x| i 5 


U 1 1.54k 10" 16 


1.87, I0 _1/ 






TANH 


tanh (org) 


1 


REAL * 4 


1 Anv 




REAL * 4 




164 


356 


EXP 


CHCAK 


|x|< 0.7 


U 1 8.48 x 10~ 7 


1.48x 10" 






0.7< |x| <5 


U 2,44 x 10 -7 


4.23x 10~ 8 






ABSOLUTE 
VALUE 


CDAB5 


hi 


1 


COMPLEX * 16 


Any 

See Note 9 




REAL * 8 




C8 


200 


DSQRT 


CHCAV 


The full range 


Note 1 


2-03x 10~ 16 


4.83 x 10* 17 






CABS 


ar 9 


1 


COMPLEX * 8 


Any 

See Note 9 


| REAL * 4 




CO 


192 


SORT 


CHCAU 


The full range 


Note 1 


9.15 x 10 _/ 


2.00 x 10" 7 






ERROR 
FUNCTION 


ERF 


2 /"V^du 


1 


REAL * 4 


Any 


1 REAL * 4 




208 


520 


EXP 


CHCBU 


M<i 


U 


8.16x 10* 7 


1 . 1 x 1 o" 7 










I < jxj < 2.04 


U 


1 13.x 10~ 7 


3.70 x 10" 8 










2.04 < |x|< 3. 91 oo 


U 


5.95 x 10" 8 


3.41 x 10" 8 






DERF 


* iy« 


1 


Real * 8 


Any 


Real * 8 




328 


808 


DEXP 


CHCBW 


•mTi 


U 


!.89x 10" 16 


2.60x 10" 17 






1 < |x| S 2,04 


u 


2.87* 10" 17 


9.84 x 10" 18 






2.04 <|x| < 6.092 


u 


1.39* 10" 17 


8.02x 10"' 8 






COMPLEMENTED 
ERROR FUNCTION 


ERFC 


1 -erf (x) or 

if .^ 

Vtr x 


1 


REAL * 4 


Any 


| REAL * 4 

| 

1 1 


208 


520 


EXP 


CHCBU 


-3.8 < X < 


u 


9.10x 10" 7 j 2-96x 10*" 7 






£ X < 1 


u 


7.42x 10" 7 


1.27x 10" 7 






1 < Xi 2.04 


u 


1.54 * 10" 6 


-7 
3 7R y 10 






2.04 < X< 4 


u 


2-28 x 10~ 6 


3.70 x 10" 










4 < X < 13,3 


u 


1.55 x 10" 5 


8.57x 10" 6 






DERFC 


1 - erf (x) or 

— 1 -u du 
-Jit J% 


1 


Real * 8 


Any 




328 


808 


DEXP 


CHCBW 


-6 < X< 


u 


2.08 x 10" 16 


6.52x 10" 17 






Real * 8 




i X i 1 


u 


1.40x 10" 16 


2.59x 10" 17 






i < X !j ■/. 04 


u 


4.11 x Uf 16 


8.86 x 10" 17 






2,04 < X<4 


u 


r 3.26x 10" i6 


H.65 , 10" 1 ' 






4 < X < 13.3 


u 


3.51 x 10" 15 


1.96x 10" 15 






GAMMA (r) 


GAMMA 


1 u e du 
J 


1 


REAL * 4 


X> 2~ 252 
X < 57.5744 


REAL • 4 


Real Argument > 57,5744 
Real Argument < 2" 252 


350 


848 


EXP, ALOG 


CHCBT 


< X < 1 


u 


9.86 x 10~ 7 


3.66 x 10" 7 






1 -: X < ; 2 


u 


1 .13 x 10* 7 


3.22x 10* 8 






2 < X < 4 


u 


9.47 k !0" 7 


3.79x 10" 7 






4 < X < 8 


u 


2-26x 10" 6 


8-32 x 10"'' 






8 < X < 16 


u 


2-20x 10* 5 


7.6! x 10" 6 






16 < X < 57 


u 


4-62 x 10" 5 


1.51 x 10" 5 






DGAMMA 


^0 


1 


REAL* 8 


X > 2" 252 
X < 57.5744 


REAL * 8 


Real Argument > 57.5744 
Real Argument < 2" 252 


420 


1 056 


DEXP, DLOG 


CHCBV 


< X < 1 


u 


2.14x 10"' 6 


7.84 x 10" 17 






1 < X < 2 


u 


2.52a 10" 17 


6.07 x 10"' 8 






2 < X < 4 


u 


2.21 x 10" 16 


8-49x 10" 17 






4 < X < 8 


u 


5.05 x !0" 16 


1 . 90 x 10 






8 < X < 16 


u 


6.02 x 10" 15 


1.78 x 10" 15 






16 < X < 57 


u 


-14 
1 - 16 x 10 


4.11 x 10" 15 






LOG - GAMMA 


ALGAMA 


/*°° x-1 -u , 
log e / u e du 




1 


REAL * 4 


X > 

X < 4,2913 x 10 73 


REAL * 4 


Real Argument > 4.2937 x IQ 73 
Real Argument < 


350 


848 


EXP, ALOG 


CHCBT 


< X < 0.5 


u 


1.16x 10' 6 


3.54 x 10" 7 






0.5 < X < 3 


u 






9.43 x 10~ 7 


3.42 x 10' 7 


3 < X < 8 


u 


1.25 x 10~ 6 


3.04 x 10" 7 






8 < X < 16 


u 


1.18 x 10" 6 


3.80 x 10" 7 






16 < X < 500 


u 


9.85 x 10" 7 


1.90x 10" 7 






DLGAMA 


log e / u e du 


I 


REAL * 8 


X > 

X < 4.2913 x I0 73 


REAL * 8 


73 
Real Argument > 4,2937 x 10 

Real Argument < 


420 


1 056 


DEXP, DLOG 


CHCBV 


< X £ 0.5 


u 


2.77x 10~ 16 


9.75 x 10" 17 






0.5 < X < 3 


u 






2.24 x 10* 16 


7.77x 10" 17 


3 £ X < 8 


u 


2.89x 10" 16 


8.80x 10"' 7 






8 S X < 16 


u 


2.86x 10" 16 


8.92x 10" 17 






16 £ X < 500 


u 


1.99x 10" 16 


3.93 x 10" 17 








Notes 1 . 
2. 


The distribution of sample arguments upon which 
these statistics are based is exponential radially 
and is uniform around the origin. 

The maximum relative error cited for the CCOS 
function is based upon a set of 2000 random 
arguments within the range. In the immediate 
proximity of the points (n + 1/2)* + Oi (where 
n = 0, ±1 , ±2, . . . ,) the relative error can be 
quite high, although the absolute error is small. 


3 
4 


The maximum relative error cited for the CDCOS 
function is based upon a set of 1500 random arguments 
within the range. In the immediate proximity of the 
points (n + ]/2)ir + 0i (where n = 0, ± 1 , ±2, . . . ,) 
the relative error can be quite high although the 
absolute error is small. 

The maximum relative error cited for the CDSIN 
function is based upon a set of 1500 random arguments 
within the range. In the immediate proximity of the 
points mr + Oi (where n = ± l, ±2, . . . ,) the relative 
error can be quite high although the absolute error is small. 


5. The figures cited as the maximum relative errors are 
those encountered in a sample of 2500 random arguments 
within the respective ranges. See the appropriate 
section in Appendix F for a description of the behnvioi 
of errors when the argument is near a singularity or a 
zero of the function. 

6. The maximum relative error cited for the GSIN function 
is based upon a set of 2000 random arguments within the 
range, !n the immediate proximity of the points 

n w + Oi (where n = ± I , ± 2, . , , ,) the relative error 
can be quite high although the absolute error is small. 




7 , The sample arguments were tangents of numbers 
uniformly distributed between - w/2 and + w/2. 

1, The answer given is the principal value, i.e. , 
the one whose imaginary part lies between 

- w and + tr , 

9, Floating-point overflow can occur. 





Section 3: Mathematical Subprogram Descriptions 19 



J Table 3. Summary of indirectly referenced mathematical subprograms 





2 


3 




4 


5 


6 


7 


8 


10 


Function 


Entry 
Name 


Definition 


Argument(s) 


Function 

Value 

Returned 


Error Condition 


Storage 
Estimates 


Other Subprograms Required 


Routine 
Name 


No. 


Type 


Hex 


Dec 


RAISE AN INTEGER 
BASE TO AN 
INTEGER POWER 


CHCBGA 


y = i * * I 


2 
2 


i = INTEGER * 4 


INTEGER * 4 


Base is zero 


1B4 


436 




CHCBG 




CHCBGB 


y= j* * j 


j = INTEGER * 2 


INTEGER * 2 


Base is zero and exponent is 
zero or negative 


1B4 


436 




CHCBG 




CHCBGC 


y=i**i 


2 


j = INTEGER * 2 
i = INTEGER * 4 


INTEGER * 4 


Base is zero and exponent is 
zero or negative 


1B4 


436 




CHCBG 




CHCBGD 


y = \ ** j 


2 


i = INTEGER * 4 
j = INTEGER * 2 


INTEGER * 4 


Base is zero and exponent is 
zero or negative 


1B4 


436 




CHCBG 




RAISE A REAL 
BASE TO AN 
INTEGER POWER 


CHCBHA 


y=a**i 


2 


a =REAL * 4 
i = INTEGER * 4 


REAL * 4 


Base is zero and exponent is 
zero or negative 


144 


324 




CHCBH 




CHCBHB 


y = a * * ] 


2 


a = REAL * 4 
j = INTEGER * 2 


REAL * 4 


Base is zero and exponent is 
zero or negative 


144 


324 




CHCBH 




RAISE A DOUBLE 
PRECISION BASE TO 
AN INTEGER POWER 


CHCBIA 


y = a * * i 


2 


a =REAL * 8 
= INTEGER * 4 


REAL * 8 


Base is zero and exponent is 
zero or negative 


14C 


332 




CHCBI 




CHCBIB 


y =a * * j 


2 


a = REAL * 8 
j = INTEGER * 2 


REAL * 8 


Base is zero and exponent is 
zero or negative 


14C 


332 




CHCBI 




RAISE A REAL 
BASE TO A REAL 
POWER 


CHCBJA 


y = a * * b 


2 


a - REAL * 4 
b = REAL * 4 


REAL * 4 


Base is zero and exponent is 
zero or negative 


ICO 


448 


EXP ALOG 


CHCBJ 


RAISE AN INTEGER 
BASE TO A REAL 
POWER 


CHCBJB 


y = i * * b 


2 


b = REAL * 4 
i = INTEGER * 2 


REAL * 4 


Base is zero and exponent is 
zero or negative 


ICO 


448 


EXP, ALOG 


CHCBJ 


CHCBJC 


y = I**b 


2 


b = REAL * 4 
i = INTEGER * 4 


REAL * 4 


Base is zero and exponent is 
zero or negative 


ICO 


448 


EXP, ALOG 


CHCBJ 


RAISE A REAL OR 
INTEGER BASE TO 
A REAL POWER; 
BASE AND/OR 
EXPONENT 
DOUBLE 
PRECISION 


CHCBKA 


y =a * * b 


2 


a = REAL * 8 
b = REAL *8 


REAL * 8 


Base is zero and exponent is 
zero or negative 


230 


560 


DEXP, DLOG 


CHCBK 


CHCBKB 


y = j* *b 


2 


b = REAL * 8 
i = INTEGER * 2 


REAL * 8 


Base is zero and exponent is 
zero or negative 


230 


560 


DEXD, DLOG 


CHCBK 


CHCBKC 


y = i * * b 


2 


b = REAL * 8 
i = INTEGER *4 


REAL * 8 


Base is zero and exponent is 
zero or negative 


230 


560 


DEXP, DLOG 


CHCBK 


CHCBKD 


y = * * b 


2 


a =REAL * 4 
b = REAL * 8 


REAL * 8 
See Note. 


Base is zero and exponent is 
zero or negative 


230 


560 


DEXP, DLOG 


CHCBK 


CHCBKE 


y =a * * b 


2 


a =REAL * 8 
b = REAL * 4 


REAL * 8 


Base is zero and exponent is 
zero or negative 


230 


560 


DEXP, DLOG 


CHCBK 


RAISE A COMPLEX 
BASE TO AN 
INTEGER POWER 


CHCBMA 


y = a * * 1 


2 


a = COMPLEX * 16 
i = INTEGER * 4 


COMPLEX * 16 


Base is zero and exponent Is 
zero or negative 


274 


628 




CHCBM 




CHCBMB 


y =a * * j 


2 


a = COMPLEX * 16 
i = INTEGER * 2 


COMPLEX * 16 


Base is zero and exponent is 
zero or negative 


274 


628 




CHCBM 




CHCBCA 


y =a * * i 


2 


a = COMPLEX * 8 
i - INTEGER * 4 


COMPLEX * 8 


Base is zero and exponent Is 
zero or negative 


24C 


588 




CHCBC 




CHCBCB 


y =a * * j 


2 


a = COMPLEX * 8 
i = INTEGER * 2 


COMPLEX * 8 


Base is zero and exponent Is 
zero or negative 


24C 


588 




CHCBC 




PRODUCE ERROR 
MESSAGE AND 
TERMINATE 
EXECUTION 


CHCBZA 












E8 


232 


As required by use of the 
EXIT macro instruction 


CHCBZ 



NOTE: The REAL*8 function value returned by CHCBKD 
given as an argument. 



s not more accurate than the REAL*4 base 



Section 3: Mathematical Subprogram Descriptions 21 



ENTRY NAME : In Table 2, this column shows 
the user entry name. In Table 3 , this 
column shows the system entry name. 



409 6 bytes. The routines are link edited, 
and their CSECTs are combined,) 



DEFINITION : This column gives a mathemati- 
cal equation that represents the computa- 
tion, (It is not meant to represent the 
way the subprogram is called.) An alterna- 
tive equation is given when there is anoth- 
er way of representing the computation in 
mathematical notation. For example, the 
square root can be represented as either 



Vx" or x 



X- 



OTHER SUBPROGRAMS REQUIRED : Many mathemat- 
ical subprograms require other mathematical 
subprograms to perform their function. The 
entry names of the other subprograms are 
listed in this column. (This column does 
not include CHCBZA, which is called by all 
mathematical subprograms where error exit 
is possible.) 



ARGUMENT (S) : These columns describe the 
values (s) for which the function value is 
to be computed. 

• Argument Number — The number of argu- 
ments Cone or two) that the user must 
supply. 

• Argument Type — The type and length of 
the argument. Integer , real, and com- 
plex represent the type of number? the 
notations *4, *8, and *16 represent the 
length, in bytes, of the argument. 



Note : In FORTRAN IV f a real argument is a 
REAL*** argument, and a double-precision 
argument is a REAL*8 argument- A single- 
precision complex argument is a COMPLEX* 8 
argument, and a double-precision complex 
argument is a COMPLEX* 16 argument. 

• Argument Range — The valid range for 
an argument. (See the Error Condition 
and Error Message column descriptions 
below. ) 



FUNCTION VALUE RETURNED: 



This column 



describes the function value returned by 
the subprogram; the notation is the same as 
that used for the argument type. 



ERROR CONDITION : This column shows the 
argument range not allowed when using the 
subprogram. If the argument is within this 
range, the subprogram will call CHCBZ . 
(See the description of CHCBZ, at the end 
of this section.) 



STORAGE ESTIMATES : This column shows the 
approximate number of bytes required for 
each mathematical routine: the approximate 
total size of each routine's CSECT and 
PSECT. (FORTRAN IV mathematical routines 
each contain one public, read-only, reent- 
erable CSECT and one PSECT. The length of 
each of the control sections is less than 



ROUTINE NAME : The name of the routine con- 
taining the subprogram. 



ACCURACY FIGURES (TABLE 2 ONLY) : These 
columns give accuracy figures for one or 
more representative segments within the 
valid argument range. The accuracy figures 
are based upon the assumption that the 
arguments are perfect (that is, without 
error and, therefore, having no error- 
propagation effect on the answers) . The 
only errors in the answers are those intro- 
duced by the subprograms. Information 
given in the accuracy-figures columns is : 

• Argument Range — This column gives the 
argument range used to obtain the 
accuracy figures. For each function, 
accuracy figures are given more repre- 
sentative segments within the valid 
argument range. These figures are the 
most meaningful to the function and 
range under consideration. 

The maximum relative error and standard 
deviation of the relative error are 
generally useful and revealing statis- 
tics. However, they are useless for 
the range of a function where its value 
becomes 0, because the slightest error 
in the argument can cause an unpredict- 
able fluctuation in the magnitude of 
the answer. When a small argument 
error would have this effect, the maxi- 
mum absolute error and standard devia- 
tion of the absolute error are given 
for the range. For example, absolute 
error is given for sin (x) for values 
of x near * . 

• Sample — This column indicates the 
type of sample used for the accuracy 
figures; the type depends upon the 
function and range under consideration. 
The statistics may be based either upon 
an exponentially (E) distributed argu- 
ment sample or a uniformly (U) distrib- 
uted argument sample. 



Section 3: Mathematical Subprogram Descriptions 23 



* Statistical results: 



M(e)=Max 

*>= Vis 



f(x)-g(x) 



f(x) 



f(x.)- S (x.) 



f(x.) 



M(E)=Max | f(x)-g(x) 



'(=)=\n 



l V 



V 



f(xj)— g(xj) 



Maximum relative error 
produced during testing 

Standard deviation (root- 
mean-square) of the rela- 
tive error 

Maximum absolute error 
produced during testing 



2 Standard deviation (root- 
mean-square) of the ab- 
solute error, 



I Table 5- Exponentiation with real or 

double- precis ion base and inte- 
ger exponent 



Base (A) 


Exponent (J) 


J>o 


J = o 


r j < o 


A>0 


Compute 
function value 


Function 
value = 1 


Compute 
function value 


A = 


Function 
value = 


Error message 


Error message 


A<0 


Compute 
function value 


Function 
value = 1 


Compute 
function value 



In the formulas for the standard devia- 
tion 9 N represents the total number of 
arguments in the sample; i is a subscripr 

that varies from 1 to N. 

Test ranges, where they do not cover the 
entire legal range of a subroutine, were 
selected so that users may infer from the 
accuracy figures presented the trend of 
errors as an argument moves away from the 
principal range. The accuracy of the an- 
swer deteriorates substantially as the 
argument approaches the limit of the per- 
mitted range in several of the subroutines. 
This is particularly true for trigonometric 
functions. However, an error generated by 
any of these subroutines is, at worst, com- 
parable in order of magnitude to the effect 
c-. the inherent rounding error of the 
argument. 

Tables 4, 5, and 6 show how the values 
of the base and exponent affect the 
exponentiation subprograms* 

Table 7 shows the system entry names and 
compiler- generated entry names of indirect- 
reference mathematical routines. 



( Table 4. Exponentiation with integer base 
and exponent 



| Table 6. Exponentiation with real or 
double-precision base and 
exponent 



Base (I) 


Exponent (J) 


J > 


J = 


J < 


I > 1 


Compute the 

function value 


Function 
value - 1 


Function 
value -.- i. 


I = 1 


Compute the 

function value 


Function 
value = 1 


value ■■■ 1 


I = 


Function 
value = 


Error Message 
241 


Err,,r Messag* 


I = -1 


Compute the 
function value 


Function 
value = 1 


If J is an odd 

number, function 

value - -1 
If J is an even 

number, function 

value - 1 


I < -1 


Compute the 
function value 


Function 
value = 1 


Function 

value = 



Base (A) 


Exponent (B) 


B >0 


B = 


B< 


A>0 


Compute 
function value 


Function 
value = 1 


Compute 
function value 


A = 


Function 
value = 


Error message 


Error message 


A < 


Error Message 


Function 
value = 1 


Error message 


Table 

r~ 


7. Entry names of indirect- 
reference mathematical routines 

r T 



1 Compiler- 






| Generated 


Routine 


System | 


| Entry Name 
| FCXPJ 


Name 
CHCBC 


Entry Name | 
CHCBCA | 


| FCXPI 


CHCBC 


CHCBCB | 


| F1XPI 


| CHCBG 


CHCBGA I 


| FJXPJ 


CHCBG 


CHCBGB | 


| FJXPI 


| CHCBG 


CHCBGC | 


| FIXPJ 


CHCBG 


CHCBGD | 


| FRXPI 


1 CHCBH 


CHCBHA | 


1 FRXPJ 


CHCBH 


CHCBHB | 


| FDXPI 


CHCBI 


CHCBIA J 


1 FDXPJ 


| CHCBI 


CHCBIB | 


| FRXPR 


CHCBJ 


CHCBJA | 


1 FJXPR 


1 CHCBJ 


CHCBJB | 


| FIXPR 


CHCBJ 


CHCBJC 1 


1 * FDXPD 


| CHCBK 


CHCBKA | 


| FJXPD 


CHCBK 


CHCBKB | 


1 . FIXPD 


| CHCBK 


CHCBKC | 


| FRXPD 


CHCBK 


CHCBKD | 


| FDXPR 


| CHCBK 


CHCBKE I 


| FCDXI 


CHCBM 


CHCBMA I 


| FCDXJ 


1 CHCBM 


CHCBMB | 




CHCBZ 


CHCBZA* | 


L J 


L J 


L. 1 



1* Called by mathematical 



library routines | 



24 



Table 8 describes the macro instructions 
used by mathematical library routines. The 
mathematical library makes extensive use of 
macro instructions for code similarity, 
programming efficiency, and ease of inter- 
face modification. 

CHCBZ — Error Processor 

Entry Parameters ; CHCBZ expects general 
register 1 to point to a two-word parameter 
list. The first word is the address of a 
one-byte code indicating the error condi- 
tion; codes and meanings are: 



the name, CHCBZ does a trace back to 
obtain the address of the call to the math- 
ematical routine in the user's program. 
CHCBZ issues a standard message, inserting 
the supplied values and issues the EXIT 
macro instruction. The message is: 

CHCBZ100 TERMINATED: ARGUMENT $1 FOR 

$2 AT $3 

where $1 represents the code 
$2 represents the name 
$3 represents the trace- 
back address 



- zero 

1 - not positive 

2 - exceeds limit 

3 - negative 

4 - absolute value exceeds limit 

5 - zero or negative 

6 - close to singularity 

The second word is a pointer to the name of 
the mathematical routine in which the error 
occurred, with a one-byte length preceding 



Entry Poin t: CHCBZ A 

Operation : CHCBZ adds the error code to 
the standard system message and issues the 
EXIT macro instruction. The standard sys- 
tem message is: 

OUT OF RANGE PARAMETER GIVEN A FORTRAN 
IV SUPPLIED SUBPROGRAM. ERROR CODE IS 
nnn. 



Table 8. Mathematical library macro instruction summary 

Purpose 



r r 

| Macro Name | 



H- 



t— 



CEKZA 



Generates the V-Con/R-Con pair required when other TSS/360 subrou- 
tines must be called. 



H 



CEKZD 









CEKTl 






CEKT2 
CEKT3 






Generates the code following a SAVE macro instruction, to add to the 
backward and forward chains and load register 13 with the current 
PSECT location. 

Generates the CSECT label, register EQUs, ENTRY statement, and other 
code duplicated at the beginning of every subroutine. 

Used for error exits. 

Generates PSECT label and save area. 



CEKT4 



+- 



|. 



Generates code similar to that of CEKTl, for additional entry 
points. 



CEKT5 I Similar to CEKT3, but used for PSECT items required for additional 

entry points. 
_. + _ _ . _ 

CEKT6 | Used to reload register 13, stop the forward chain, and return. 



™t 



Section 3: Mathematical Subprogram Descriptions 25 



SECTION 4 



SERVICE SUBPROGRAM DESCRIPTIONS 



This section gives the following infor- 
mation on each service subprogram: 

* Name 

* Name of containing routine 

* Function 

* Attributes 

* Entry 

* Routines called 

* Error checks 

* Data references 

* Operation 

GENERAL INFORMATION 

The three service routines are: 

* CHCBE — • interrupt and machine indica- 
tor subprograms 

* CHCIV — DUMP and PDUMP subprograms 

* CHCIW -- EXIT, STOP, and PAUSE 

subprograms 

CHCBE resides in the mathematical 
library; CHCIV and CHCIW reside in the I/O 
library. 

Like other FORTRAN IV library routines, 
the service routines use type-I linkage and 
are nonprivileged, reenterable, and closed. 

Service subprograms that are user- 
referenced have user entry names. No ser- 
vice subprograms have compiler-generated 
entry names. 

Information on entry parameters is con- 
tained in the individual routine summaries. 
Service subprograms do not pass exit param- 
eters, except for the calls to CHCBZ (math- 
ematical library error -handling routine) by 
the SLITE and SLITET subprograms . CSee 
subprogram s ummaries - ) 

SUBPROGRAM SUMMARIES 

Table 9 briefly describes all service 
subprograms except the Exit Routine subpro- 
grams CHCIWU and CHCIW5, which are 
referenced by the I/O library routines. 



The following summaries should be read 
in conjunction with flowcharts BD, BE f IV, 
and IW. 

CHCBE — Interrupt and Machine Indicator 
Routine 

Subprograms : 

CHCBE2 — Specification Exception Handler 

CHCBE3 — Exponent Overflow Handler 

CHCBE4 — Exponent Underflow Handler 

CHCBE5 — Divide Check Handler 

OVERFL — Exponent Overflow and Underflow 

Tester 

DVCHK — Divide Check Tester 

SLITE — Sense Light Handler 

SLITET « Sense Light Tester 

Function : To simulate certain machine 
indicators, and to mask off or process 
interruptions caused by these exceptions: 

• Fixed point overflow 

• Fixed point divide 

• Exponent overflow 

• Exponent underflow 

• Significance 

• Floating point divide 

(See Chart BE.) 

Entry Parameters : CHCBE2 through CHCBE5 
have no entry parameters. OVERFL, DVCHK, 
and SLITE each receive one parameter, the 
address of an integer variable, A pointer 
to this address is passed in register 1. 
For SLITET, register 1 points to two 
addresses, the address of the integer vari- 
able indicating the sense light number and 
the address of the integer variable to 
receive the result code. 



Routines Called : 
(CHCBZ) 



CHCBZ 



Error Processor 



Error Checks : If entered at either SLITE 
or SLITET, this routine tests the integer 
variable and notes an error condition if it 
is any value but to 1 for SLITE, or 1 to 



26 



Table 9. Summary of service subprogram characteristics 

1 " 2 3 



Function 


Entry Name 


Error 
Condition 


Storage 
Estimates 


Module 
Name 




HEX 


DEC 


Pseuoo sense light 
subprograms 


Turn all sense lights 
off or one sense 
light on 


SLITE 


Argument 
other than 
0, 1, 2, 3, 4 


324 


804 


CHCBE 


Test a sense light 
or record Its status 


SL1TET 


Argument 
other than 
1,2,3,4 






CHCBE 


Overflow and 

underflow 

subprogram 


Test and record 
status of exponent 
overflow and 
underflow indicators 


OVERFL 








CHCBD 


Divide check 
subprogram 


Test and record 
status of divide 
check indicator 


DVCHK 








CHCBD 


Exception 
processing 
subprograms 


Process 

arithmetic exceptions 


CHCBE3 (EXPONENT OVERFLOW) 
CHCBE4 (EXPONENT UNDERFLOW) 
CHCBE5 (DIVIDE CHECK) 








CHCBE 


Process specification 
exceptions 


CHCBE2 (SPECIFICATION) 








CHCBE 


Exit subprogram 


Terminate execution 


EXIT 

CHCIW2 (STOP) 
CHC1W3 (PAUSE) 




1AC 


428 


CHC1W 


Dump subprogram 


Dump specified 
storage area 
with or without 
termination 


DUMP, PDUMP 




48 


168 


CHCIV 



t* for SLITET. If there is an error condi- 
tion, CHCBE calls CHCBZA, passing the 
appropriate error code as a parameter, 
CHCBZA terminates the task after printing 
the error code. If entered at CHCBE2 f 
CHCBE checks for an interruption that 
should not occur and allows the standard 
system action for such an interruption. 

Operation : At the beginning of all FORTRAN 
main programs, the compiler generates code 
that calls CHCBD1, the exception processing 
enabler and I/O initialization routine 
included in the I/O library. 

The system interruption handler, CHCBDl f 
calls one of the CHCBE2 through CHCBE5 sub- 
programs whenever an exception occurs. 

CHCBE2 passes control to CHCBE1 to con- 
trol fixup of a specification exception. 



CHCBE2 checks the interruption address 
and the instruction that caused the inter- 
ruption to determine whether the interrup- 
tion was due to a condition that should not 
occur. If so, the standard system action 
is invoked. If not, CHCBE1 interprets the 
instruction causing the interruption and 
executes it as though the alignment restr- 
iction was removed. The save area referred 
to by register at entry is changed to 
reflect instruction execution. 



CHCBE3 sets to one the flag which CHCBD6 
tests if an "OVERFL (j>* statement occurs 
in the user program. 



CHCBE4 does the same as CHCBD3, except 
that the flag is set to three. 



Section 4: Service Subprogram Descriptions 27 



CHCBE5 sets to one the flag which CHCBD7 
tests if a "DVCHK (j)" statement occurs in 
the user program. 

OVERFL puts the value of the overflow- 
underflow indicator into the user- specif ied 
variable, resets the indicator, and returns 
control to the user. 

DVCHK puts the value of the divide check 
indicator into the user-specified variable, 
resets the indicator, and returns control 

to the user, 

SLITE tests the user-specified variable 
for a value of zero. If it is zero, all 
four indicators are set to zero and control 
is returned to the user. If the variable 
is not zero, it is tested for values of 
one, two, three, and four. If it is one of 
these values, the corresponding indicator 
is set to one and control is returned ro 
the user- If the variable is not one of 
these values, SLITE calls CHCBZA and then 
returns control to the user. 

SLITET tests the first user-specified 
variable to see that it is within the prop- 
er range. If the variable is in error, 
CHCBD9 calls CHCBZA and returns control to 
the user. If the variable is from one to 
four, the corresponding indicator is 
tested. If the indicator is zero, SLITET 
sets the second user-specified variable to 
two and returns control to the user. If 
the indicator is one, SLITET sets the 
second variable to one, resets the indica- 
tor to zero, and returns control to the 
user. 



CHCIV 



Dump Routine 



This routine causes the user- indicated 
limits of storage to be dumped in the for- 
mat desired, with or without program ter- 
mination- The user calls this module ijy 
specifying either of the statements CALL 
DUMP (A ±r B ±i F ±r . .., A n , B nr F n ) or CALL 
PDUMP (A ± , B ± , F ±t . .., A n , B n , F n > in his 
source program. The variable data names, A 
and B, indicate the limits of storage to be 
dumped and the integer, F, indicates the 
dump format desired. (See Chart IV.) 

For sample printouts by the DUMP and 
PDUMP subprograms, see FORTRAN IV Library 
Subprograms , GC28-2026, "Appendix D: DUMP 
and PDUMP Sample Storage Printouts." 



Entry ; There are two entry points: CHCIV1 
and CHCIV2, for DUMP and PDUMP, respective- 
ly. Standard type-I linkage is used with 
register 1 pointing to the first address 
constant in the parameter list. The param- 
eter list is variable- length and has the 
following format : 



h 



Word 1 



Word 2 



Word 3 



Word 4 



First 



Group 



Word 5 

Second 
Word 6 

Group 
Word 7 

L 



Word size of this parameter 
list, minus one. 



Address constant pointing 
to the starting location 
symbol for the dump. 



Address constant pointing 
to the end location symbol 
for the dump. 

Address constant pointing 
to the FORMAT code word. 
When FORMAT code is zero, 
the FORMAT code word is 
divided into two parts: 
first half-length of end 
location symbol minus one 
second half - 0. 



Same as words 2, 3, and 4 
respectively. 






The entries in the parameter list 
(excluding the first word) are groups of 
three words. There may be more than one 
group depending on the number of different 
areas of virtual storage the user wants 
dumped. The first two words of a group may 
be in either order; but the dump is always 
taken in ascending order. The third word 
of a group, the format code word, repre- 
sents the type of data conversion to be 
performed, as follows: 



hexadecimal 



real* 4 



1 


logical*l 


6 


real*8 


2 


logical*** 


7 


compl ex* 8 


3 


integer*2 


8 


complex* 16 


4 


integer* 4 


9 


literal 



The format code is the default value. 
Routines Called : 

• Integer Output Conversion (CHCIH) 

• Complex Output Conversion (CHCIN) 

• Logical Output Conversion (CHCIR) 

• General Output Conversion (CHCIT) 

• Exit (CHCIW) 

• GATE facilities (GATWR macro 
instruction) 



28 



Error Checks : CHCIV makes no error checks; 
all error checking is done by the called 
data conversion routines. 

Operation : CHCIV scans the parameter list 
to locate a parameter group. The specified 
dump area is then formatted and written on 
SYS0UT using the GATE macro instruction 
facility. After the parameter list has 
been completely processed, control returns 
to the user program, if PDUMP was speci- 
fied. If DUMP was specified, control 
passes to the exit routine (CHCIW) for pro- 
gram termination. 

CHCIV determines the presence of the 
third word in a parameter group by testing 
the value of the word in storage to which 
it refers. If the value is 9 or less, it 
is assumed to be the format code. If the 
value is greater than 9 (or if it is nega- 
tive) , it is assumed that the third word 
was omitted and a format code of zero 
(hexadecimal) is taken as a default. If 
the format code is either or 9 (hexade- 
cimal or literal) , the conversion format- 
ting is done within this routine; other- 
wise, the appropriate output conversion 
routine is called. 



CHCIW3 Execution of a PAUSE statement 

CHCIW** Exit requested by other I/O 
library routines 

CHCIW5 Exit requested by a user subpro- 
gram error 

Standard type-1 linkage is used with all 
entries except CHCIW**, which uses type-4 
restricted linkage. In the case of STOP 
and PAUSE statements, the address of a pa- 
rameter list is passed in register 1. The 
parameter list is fixed- length and has the 
following format: 

r T . , 

| Word 1 | Address of byte containing the 

I length of the integer or message 
| (n or 'message*). A length of 
| zero indicates that no integer or 
(message was defined by the user. 
j. + _ i 

(Word 2 [Address of the integer or message, 
j if any. 

i- . — x . . . . i 

There is no parameter list for entry to 
CHCIW1, CHCIW4, or CHCIW5. 



CHCIW — Exit Routine 

This routine performs user-program exit 
functions whenever any of the following 
FORTRAN statements are executed: 

CALL EXIT 

STOP n 

PAUSE n 

PAUSE •message* 

In the case of a STOP or PAUSE state- 
ment, this module causes a one- through 
five-digit integer (n) or a message ('mes- 
sage') to be produced at the user's SYSOUT. 
With the exception of the PAUSE statement, 
CHCIW causes all DCBs in use in the DCB 
table to be closed. (See Chart IW.) 

Entry : The five entry points and their 
associated causes of entry are as follows: 

CHCIW1 Execution of a CALL EXIT 
statement 

CHCIW2 Execution of a STOP statement 



Routines Called : 

• DCB Maintenance (CHCIB) 

• I/O Control (CHCIC) 

• Task Supervisor Routines (CZAFQ1) , 
entered by use of a supervisor call 

| (SVC) 

• I/O Communication (CHCIY) 

• PRMPT (CZATJ1) 

Operation : If this routine is entered via 
CHCIW4 or CHCIW5, a message is issued to 
| the user indicating the reason it was 
called. If this routine is entered via 
CHCIW1, CHCIW2, or CHCIW3, a message is 
issued (including a user-supplied message, 
if any) to the user by the PRMPT macro 
instruction facility (CZATJ1) indicating 
the reason it was called. In the case of 
PAUSE, return is then made to the user pro- 
gram. If entry to this routine was not 
caused by a PAUSE statement, the DCB table, 
maintained by CHCIB, is searched and each 
open DCB is closed. The DCB table pointers 
are then cleared, and exit is made to the 
system exit routine. 



Section 4: Service Subprogram Descriptions 29 



SECTION 5: 



I/O ROUTINE DESCR IPTIONS 



This section gives the following infor- 
mation on each I/O library routine, exclud- 
ing the service routines, which are 
described in Section 4s 

• Name 

• Function 

• Attributes 

• Entry 

» Routines called (where applicable) 

• Error checks (where applicable) 

• Data references (where applicable) 

• Operation 

The routines are described in the alpha- 
betical order of their names . 



ROUTINE SUMMARIES 



CHCIA 



I/O Initialization 



This routine is the initial FORTRAN I/O 
library interface with the user. It 
manages the disposition of each I/O request 
by setting switches about formatted and 
unformatted I/O for the information of 
other I/O routines, by allocating a buffer 
area for output requests, and by obtaining 
a logical record for input requests. 

Every I/O request in the FORTRAN user 
program causes the compiler to generate one 
call to CHCIA. On this call, if there is 
no list, CHCIA supervises the complete 
execution of an I/O request. If the I/O 
request is a READ, WRITE, PRINT, or PUNCH 
with list, CHCIA simply prepares the I/O 
library for compiler-generated calls to 
List Item Processor (CHCIE) and List Ter- 
mination (CHCIU) . 



GENERAL INFORMATION 

Certain information is common to most 
I/O routines. This information includes: 

• Names 

• Attributes 

• Format of parameters passed to data 
conversion routines 



Attributes 

All FORTRAN I/O routines are nonprivi- 
leged, reenterable, and closed. CHCIA, 
CHCIE, CHCIU, CHCIW1, CHCIW2, CHCIW3, 
CHCIW5, CHCIV1, CHCIV2, and CHCBDl are 
entered by standard type-1 linkage with the 
address of a parameter list (where applic- 
able) in register 1? exit is a return to 
the calling routine. All of the other I/O 
routines are entered by restricted type- 4 
linkage. 



Work Areas and Register Save Areas 

The FORTRAN I/O routine has one common 
PSECT — CHCRWW — which contains all 
necessary work and storage areas and a 19- 
word register save area. All parameters 
used by the data conversion routines are 
stored in this PSECT. 



Entry : The entry point is CHCIA1. The pa- 
rameter list is variable- length and has 
this formats 



H _ -[ 1 

| Word 2 | Address of a control byte in I/O ] 
Control (CHCIC) indicating type of 
operation: READ, WRITE, PRINT, 
PUNCH, REWIND, BACKSPACE, ENDFILE. 

Word 3 (Address of a control byte in I/O 

Control (CHCIC) indicating whether 
a list was present in the I/O 
statement and whether any of the 
following parameters in this list 
are present. 



Word 1 



h 



h 



Word 
(Op- 
tion- 
al) 



Address of a fullword containing 
the user-specified data set 
reference number. 



H 



Word 4 | Address of a FORMAT string or 
(Op- |NAMELIST table. This parameter 
tion- J is included only if the I/O source 
al) I statement has an associated FORMAT 
or NAMELIST source statement. 

Word 5 [Address of an error exit. 

(Op- | Included only if the I/O source 

tion- | statement has an ERR operand. 

al) 






Address of an end-of-file exit. 
Included only if the I/O source 
statement has an END operand. 



30 



If any optional parameter is missing, 
any parameters following it are moved up in 
the list and the list is shortened. For 
example, if there is no FORMAT or NAMELIST 
address and no error exit address, word *t 
of the parameter list would be the end- of - 
file exit address. 

Routines Called : 

• DCB Maintenance (CHCIB) 

• I/O Control (CHCIC) 

• FORMAT Processor (CHCIF) 

• NAMELIST Processor (CHCID) 



Entry : The entry point is CHCIB1. CHCIA 
stores the address of the user-supplied 
data set reference number and the data set 
reference number itself if present in the 
I/O common PSECT. 



Routines Called : 

• Data management routines used to search 
for and read JFCBs (CZAEB) 

• Data management routines used to allo- 
cate storage for DCB construction 
(CZCGA) 



• Exit (CHCIW) 



• Exit (CHCIW) 

• PRMPT (CZATJ1) 

Error Checks : If the user-specified data 
set reference number is negative, an error 
message is issued by the PRMPT macro 
instruction facility (CZATJ1), and CHCIW is 
entered to terminate the user program. 

Operation : Upon entry, the FORTRAN I/O 
PSECT switches are cleared, control parame- 
ters are set, and CHCIB is called to find a 
DCB corresponding to a user-specified data 
set reference number (or to create a DCB if 
one is not found) . CHCIC is then called to 
complete the I/O request. 

If the operation is a REWIND, BACKSPACE, 
or ENDFILE, return is made to the user. If 
the operation is READ or WRITE according to 
a NAMELIST, CHCID is called before return- 
ing to the user. 

If the operation is a WRITE with no list 
and no format, a dummy record containing 
two bytes of zeros is written with a call 
to CHCIC before returning to the user. If 
a FORMAT statement is involved, CHCIF is 
called. If the operation is a WRITE with 
no list and CHCIF is called for construc- 
tion of a record anyway, CHCIC is called to 
write the record before returning to the 
user? otherwise, return is made immediately 
after calling CHCIF. If a FORMAT statement 
is not involved, return is made to the 
user. 

CHCIB — DCB Maintenance 

This routine finds or initializes the 
data control block (DCB) that contains a 
description of the data to be transmitted 
by a user-specified I/O operation. If an 
appropriate DCB is not found, this routine 
allocates the necessary space in the DCB 
table and constructs a new DCB, including 
within it information about the data to be 
transmitted that the user defined in his 
DDEF command. (See Chart IB.) 



• PRMPT (CZATJ1) 

Error Checks : If the user-specified data 
set reference number exceeds 99, an error 
message is issued by the PRMPT macro 
instruction facility (CZATJ1) , and CHCIW is 
entered to terminate the user program. No 
alternate data set reference number is 
established. 

If a discrepancy exists in the user DDEF 
command between permissible RECFM, KEYLEN, 
and DSORG values, an error message is 
issued by the PRMPT macro instruction faci- 
lity (CZATJ1), and CHCIN is called to ter- 
minate processing. A description of the 
assumptions FORTRAN I/O makes an initializ- 
ing associated DCBs is contained in Appen- 
dix A. 

Format and Content of the DCB Prefix : The 
DCB Prefix is used by the FORTRAN I/O rou- 
tines, in conjunction with the DCB, when 
performing any type of I/O operation. The 
DCB Prefix, created by the DCB Maintenance 
routine (CHCIB) , is eight words long and 
always immediately precedes the DCB itself. 
(See Table 10.) 

Operation : This routine is called to per- 
form one of three functions: to supply the 
address of an initialized DCB corresponding 
to a specified data set reference number; 
to locate the first open DCB in the DCB 
table used by the I/O library routines; or 
to obtain a GATE DCB. The first function 
is performed by searching the table of DCB 
entries. If the appropriate DCB is found, 
the address of that DCB is returned. If 
the search fails, the data management rou- 
tine CZAEB is called to determine whether 
the user has issued a DDEF command (which 
causes the creation of a Job File Control 
Block ~ JFCB) for the specified data set 
reference number. If CZAEB finds a JFCB 
that corresponds, space is reserved in the 
DCB table, a DCB is constructed, and the 
new DCB is "chained" into the DCB table. 
If CZAEB cannot locate a corresponding JFCB 
(meaning that the user did not supply a 



Section 5: I/O Routine Descriptions 31 



Table 

r- 

Word 



10, 



Format and content of DCB prefix 



I 

Word 



I- 



Address of the starting location 
in the buffer area for the current 
logical record. 



Word 3 



Address of the current location in 
the buffer area for the current 
logical record. 



Address of the end location in the 
buffer area for the current logic- 
al record. 

Byte Is Current operation (READ, 
WRITE, etc.) 

Byte 2: Control flags (FORMAT, 

NAMELIST, List, ERR exit, 
END exit) 



Word 4 



.-+ 



Word 5 



h 



Word 6 



k 

Word 

\~ 

Word 



\ 

Word 



~\ 



Byte 3s Control flags (Span, GATE, 
recent READ, END or ERR 
encountered) 

Byte 4: Previous operation (byte 1 
from last call on CHCIC 
with this DCB) 



Address of current DECB, if 
required (BSAM) . 



H 



User-specified data set reference 
number, plus one. 



Address of the next DCB. 



Address of last DCB associated 
with this data set reference 
number. 

9 j DCB begins here. 



1 

— j 



DDEF command) , a GATE DCB is constructed 
and initialized* 



The GATE DCB causes SYSIN and SYSOUT to 
be treated as the input origin and output 
destination, respectively. 

CHCIB performs its second function, 
locating the first open DCB in the DCB 
table, when a negative data set reference 
number has been specified by CHCIW at 
final close of the file. If an open DCB 
is not found in the DCB table, normal 
return is made to the calling routine. 



CHCIB performs its third function, 
obtaining a GATE DCB, when the address of 
the data set reference number is zero. In 
this case, the I/O request is assumed to 
be for the first data set reference number 
that this routine defines by a GATE DCB. 



Therefore, as before, SYSIN and SYSOUT are 
treated as the input origin and output 
destination, respectively. Note that the 
GATE DCB is a dummy DCB (with a prefix) , 
used to allow other I/O routines to treat 
the case of GATE I/O the same as the case 
of data sets defined by a DDEF command • 



CHCIC — I/O Control 

This routine fulfills I/O requests made 
through other I/O library routines by 
using the data management macro instruc- 
tion facilities of TSS/360. The particu- 
lar data management facilities to be used 
are determined both by the type of I/O 
statement issued in the user program, and 
by related DDEF commands, if any, defining 
such things as the type of records being 
transferred and the manner in which they 
should be processed. 



The following list identifies the more 
significant macro instructions used by 
CHCIC for each of the FORTRAN I/O state- 
ments. Other macros used in conjunction 
with those listed below (e.g., OPEN and 
CLOSE) are identified in the "Operation" 
section of this routine description. (See 
Chart IC.) 



FORTRAN I/O 

Statement 
READ 



WRITE 



REWIND 



BACKSPACE 



ENDFILE 



CHCIC Function 

Obtains a logical record 

from a user- specif ied input 

source by using the READ, 

GATRD, or GET macro 

instruction. 

Initializes the writing of a 
logical record by establish- 
ing pointers to the output 
buffer area. Subsequent 
output processing is per- 
formed by using the WRITE, 
GATWR, or PUT macro 
instruction. 

Repositions the user- 
specified volume of one or 
more data sets to the first 
record of the first data set 
by using the POINT or SETL 
macro instruction. 

Repositions the user- 
specified data set to the 
previous logical record by 
using the NOTE, POINT, SETL, 
and BSP macro instructions. 

Defines the end of the user- 
specified data set by using 
the WRITE and STOW macro 
instructions . 



32 



Entry : The entry point is CHCIC1. 
Routines Called : 

• DCB Maintenance (CHCIB) 

• Exit (CHCIW) 

• Data management routines to perform 
I/O functions as determined by the 
macro instruction issued. 

• PRMPT (CZATJ1) 

Error Checks : If the I/O operations per- 
formed by data management cause either a 
SYNAD or EODAD exit, and if the user pro- 
vides an ERR or END return point, CHCIC 
locates the adcons for these return points 
in the work area CHCRWW, and locates the 
register save area for the user's program 
registers. Return is then made to the ERR 
or END return point rather than to the 
calling I/O routine. 

If the user does not provide return 
points (or if the operation is other than 
a READ statement) f an error message is 
issued and the program is terminated. 

If an invalid character is encountered 
in hexadecimal input from a GATRD opera- 
tion performed for an unformatted READ 
statement, an error message is issued and 
the erroneous character is treated as the 
termination of the hexadecimal input. 
Processing then continues. 

In addition to the above error checks, 
error messages are issued (PRMPT macro 
instruction) and the user program is ter- 
minated by CHCIW for any of the following 
reasons : 

1. The record is not format- V for unfor- 
matted READ statement. 

2. Error return code received from the 
use of the FIND or STOW macro 
instruction for a member in a VPAM 
data set. 

3 . Invalid sequence of I/O operations 
for a user-specified data set 
reference number. The invalid 
sequences are: READ preceded by END 
FILE; END FILE preceded by READ? and 
READ preceded by WRITE (except when 
using GATE I/O) . 

Operation : In fulfilling the I/O request, 
this module ensures that the DCB asso- 
ciated with the DDEF command is properly 
opened by examining the access qualifier 
(for example, read-only) of the data set. 
If the data set is read-only, the OPEN 
macro instruction is issued for INPUT. 
Otherwise, the OPEN macro instruction is 



issued for UPDAT, when the Virtual Access 
Methods (VAM) are specified, or INOUT, 
when the Basic Sequential Access Method 
(BSAM) is specified. When a data set is 
opened for UPDAT or INOUT, both reading 
and writing may be performed. However, if 
an attempt is made to write on a read-only 
data set that is opened for INPUT, the 
user program is abnormally terminated. 
When the user does not issue a DDEF com- 
mand for a given I/O request, CHCIC uses 
the GATE macro instruction facility to 
perform reading and writing. This facili- 
ty does not require issuance of an asso- 
ciated OPEN macro instruction. CHCIC 
first checks whether the I/O operation 
requested is compatible with the previous 
operation. If it is not, an error message 
is issued and the user program is ter- 
minated. If it is compatible, processing 
continues according to the particular type 
of I/O request involved (that is, READ, 
WRITE, WRITE Initialize, REWIND, BACKS- 
PACE, and ENDFILE). 



If a READ is issued, the data set is 
opened, if necessary, and the pointers in 
the DCB prefix are set to the beginning 
and end of the data. CHCIC then checks 
which access method is being used. If VAM 
is used, a GET macro instruction is 
issued. If the GATE macro instruction 
facility is used, a GATRD macro instruc- 
tion is issued. If BSAM is used, the 
record format is examined to determine 
whether the records are blocked. If they 
are not blocked or if the previous record 
was the last record of the block, a READ 
is issued; otherwise, the next logical 
record within the current block is used. 
In any case, after the data is located, 
the beginning and end are determined and 
the pointers are saved in the DCB prefix. 
Return is then made to the calling 
routine. 

If a WRITE Initialize is issued for an 
open data set for which the last operation 
was an END FILE, the data set is closed 
and an end file lockout indicator is set 
on in the DCB prefix, indicating to DCB 
Maintenance (CHCIB) that this DCB should 
be ignored when looking for a DCB for this 
data set reference number. As a result of 
this indicator being set, any subsequent 
WRITE statements referring to the same 
data set reference number causes the crea- 
tion of a new data set. A call is then 
made to CHCIB to obtain a new DCB describ- 
ing the new data set. 

Whether or not the previous operation 
was an END FILE, the DCB is opened, if 
necessary. If VAM is used, a SETL macro 
instruction is issued to point to the 
beginning of the specified data set. In 
all cases, the pointers to the output 



Section 5: I/O Routine Descriptions 33 



buffer area are then set in the DCB prefix 
and return is made to the calling routine. 

If a WRITE is issued, CHCIC checks the 
record format type. For non-format-V rec- 
ords, fill characters (padding) are 
inserted, if necessary, to the end of the 
record. Blanks are used for NAMELIST or 
formatted WRITE; binary zeros are used 
otherwise. For format-V records, the 
record length and any needed spanning bits 
are set. The spanning bits are used to 
define the relationship between the FOR- 
TRAN logical record and the data manage- 
ment logical record when the FORTRAN log- 
ical record exceeds the length of the 
maximum record supported by the access 
methods being employed. CSee Appendix A 
for more details on spanning bits.) 

CHCIC next checks the access method 
being used for the write request. For 
VAM, a PUT macro instruction is issued. 
For the GATE macro instruction facility, a 
GTWRC is issued. For BSAM, the record 
format is examined to determine whether 
the records are blocked. If the records 
are not blocked or the block is full, a 
WRITE macro instruction is issued. For 
blocked records, where the block is not 
full, the output area pointers in the DCB 
prefix are updated to the next record area 
in the block. In all cases, the DCB pre- 
fix is re-initialized and return is made 
to the calling routine. 

If a REWIND is issued, CHCIC searches 
the DCB table for all DCBs relating to the 
user-specified data set reference number. 
For each such DCB found, the end file 
lockout indicator within it is turned off* 
The POINT macro instruction is then used 
to reposition the volume to the first 
record of the first data set, if the data 
set is BSAM; the SETL macro instruction is 
used for VAM. Return is then made to the 
calling routine. 



If a BACKSPACE is iss 
the access method being 
VAM, CHCIC checks to see 
operation was an ENDFILE 
macro instruction is iss 
OPEN macro instruction a 
instruction pointing to 
data set. In either cas 
instruction is then issu 
previous record. 



ued, CHCIC checks 
employed. For 
whether the last 
If so, a CLOSE 
ued followed by an 
nd a SETL macro 
the end of the 
e, a SETL macro 
ed to point to the 



If BSAM is used, CHCIC examines the 
record format to determine whether the 
records are blocked. If unblocked and if 
the last operation was an END FILE, a NOTE 
macro instruction is issued to establish 
the current location, CLOSE and OPEN macro 
instructions are issued, and a POINT macro 
instruction is issued to reposition the 
data set to the position prior to closing. 



A BSP macro instruction is then issued to 
backspace. If double buffering is used, a 
second BSP is issued. If the last opera- 
tion was not an END FILE, only the BSP 
macro instruction is issued. If the rec- 
ords are blocked, a scan is made backwards 
through the block to locate the beginning 
of the previous record. In some cases it 
may be necessary to issue a BSP macro 
instruction and then read the previous 
block in order to position to the previous 
record. In all cases, it is not possible 
to position to a record in a previous data 
set if a READ or WRITE was issued after an 
END FILE operation. Upon completion of 
processing, return is made to the calling 
routine. 

If an END FILE is issued, it is noted 
but otherwise ignored; the actual END FILE 
operation is performed only when the next 
operation is a WRITE Initialize or a 
BACKSPACE. 



CHCID 



NAMELIST Processor 



This routine interacts with CHCIC to 
control the I/O for each NAMELIST record 
and interacts with the appropriate data 
conversion routines to effect the desired 
item-by-item conversion. CSee Chart ID.) 

Entry : The entry point is CHCID1. 

R outines Called : 

• I/O Control CCHCIC) 

• Complex Input Conversion (CHCIM) 

• Complex Output Conversion (CHCIN) 

• General Input Conversion (CHCIS) 

• General Output Conversion (CHCIT) 

• Exit (CHCIW) 

• PRMPT (CZATJ1) 

Error Checks : There are no error checks 
for output. For input, if errors are 
detected in the NAMELIST table, a message 
is issued via PRMPT, and CHCIW is called 
to terminate the user program. Other 
error messages are generated for any of 
the conditions listed below. In these 
cases, processing continues with the next 
entry of the input record. 

• Name exceeds six characters 

• First character of each input record 
is not blank 

• Subscripts appear on a name that is 
not an array name 



34 



• Incorrect number or range of 
subscripts 

• Subscripting causes array size to be 
exceeded 

• Multiple constants or repeated con- 
stants appear with a name that is not 
an array or a subscripted array name 

• Multiple constants or repeated con- 
stants exceed the size of an array or 
the size of an array portion beginning 
at a specified element 

• An equal sign or left parenthesis is 
not preceded by the variable or array 
name for that item 

• An invalid character appears in a 
repeat constant 

• End of a logical record caused an item 
to be logically incomplete 

• The NAMELIST name is not in the NAME- 
LIST table 



NAMELIST Table : The address of the NAME- 
LIST table generated by the FORTRAN com- 
piler is communicated in the call to I/O 
Initialization CCHCIA) and then passed to 
this routine. The table is made up of 
two-word entries, each of which contains 
an identifier in the first halfword. 



NAMELIST Name Entry: 

Bytes 0-1 Identifier (X'OIOO 1 ) 
2-7 Name (left- justified) 



Variable Name Entry: 

Bytes 0-1 Identifier (X f 0200 f > 
2-7 Name Clef t- justified) 



Variable Type and Location Entry: 

Bytes 0-1 Identifier (X^OO*) 

2 Length and Type (4 bits each) 



Length: 
Type: 

3 Class : 



Number of bytes 
minus 1 

X'Ql 1 Logical 

X , 02 i Integer 

X f 03 f Real 

X , 04 f Complex 

Letter A for array ; 
otherwise, an S 



Array Size Entry: 

Bytes 0-1 Identifier (X , 0400 i ) 
2-3 Not used 
4-7 Number of bytes in array 



Dimension Product Entry: 

Bytes 0-1 Identifier (X'OSOO 1 ) 
2-3 Not used 

4-7 Dimension Product (see 
explanation below) 



Terminal Entry: 



Bytes 0-3 
4-7 



Zero 
Not used 



4-7 Storage Location 



A dimension is a level of subdivision, 
or level of subscripting, within an array. 
For example, an array could be a string of 
seven thirty-word elements (first dimen- 
sion), each subdivided into six five-word 
elements (second dimension) , each subdi- 
vided, into five one-word elements (third 
dimension). An array may have as many as 
seven dimensions. 

For each dimension there is a corres- 
ponding dimension product , which is the 
product of: (1) the byte-size of the 
array's smallest element, (2) the number 
of elements within all lower dimensions 
except the first dimension, and (3) the 
number of elements within that dimension. 
In the example just given, the dimension 
product for the third dimension would be 
4x6x5, or 120. This dimension product 
would be seven times greater if there were 
another dimension before the seven- element 
dimension. The dimension product for the 
first dimension is always the byte-size of 
the array's smallest element — this 
dimension product is never entered. If 
there is only one level of subdivision, 
there is no Dimension Product Entry. 

Operation : For a WRITE, CHCID calls CHCIT 
to write, in the following format, the 
data for each variable or array in the 
NAMELIST: 

For Variables: 

variable name = constant 

For Ar r a ys : 

array name or array element name = 
constantl, constant2, ... 

In the second case, each constant may 
have a repetition notation appended in the 
form that is also usable for input. 

CHCID also produces header and trailer 
records so that the information can be 
read with the same NAMELIST. 



Section 5: I/O Routine Descriptions 35 



For a READ, CHCID reads records until a 
correct header record is located. It then 
uses a scanning procedure to locate the 
input entries. As each is found, the rou- 
tine locates the variable or array name in 
the NAMELIST Table, determines its size 
and type f and converts the input. 

Error checking functions performed by 
CHCID for a READ operation have already 
been described under "Error Checks", 



CHCIE — List Item Processor 

Every I/O statement in the user's 
source program generates one or more calls 
to this routine if there is a list asso- 
ciated with a READ, WRITE, PRINT, or 
PUNCH. A list item may be a simple vari- 
able, an array element (a subscripted 
variable), or an entire array. If a FOR- 
MAT statement is specified, this routine 
calls on FORMAT Processor (CHCIF) to con- 
trol any necessary conversion. If there 
is no FORMAT statement, CHCIE is directly 
responsible for filling or emptying the 
output or input buffer area. (See Chart 
IE.) 



Entry : The entry point is CHCIE1. Regis- 
ter contains either zeros, if the list 
item is a single element, or a number 
expressing the array length, in bytes, if 
the list item is an entire array. The pa- 
rameter list is fixed- length and has the 
following format: 



Address of a control byte. The 
first four bits of the control 
byte contain the size of the 
element, minus one. The second 
four bits contain a flag 
indicating the type of item as 
follows : 




Flaq 


Type of Item 


01 


logical 


02 


integer 


03 


real 


04 


complex 



Address of a first (or only) ele- 
ment of the list item. 



Error Check ; With unformatted input, if a 
list item is requested after the logical 
record is exhausted, an error message is 
transmitted to the user via PRMPT, and 
CHCIW is called to terminate the user's 
program. 

Operation : At entry, register either 
contains zeros if the list item is a single 
element, or a number expressing the array- 
length, in bytes, if the list item is an 
entire array. Another parameter indicates 
the length of the list item (in the case of 
an array, the length of each individual 
item in the array) . The transfer of data 
between I/O buffers and item storage loca- 
tions is performed by CHCIE if there is no 
FORMAT statement,- if there is a FORMAT 
statement, the transfer of data is accomp- 
lished by a call to CHCIF. After the 
transfer of information between the I/O 
buffer and the storage location specified 
for the item, the item length is subtracted 
from the array length. A negative or zero 
result indicates either that the item was a 
single element or that the last element in 
the array has been processed? the routine 
returns to the caller. If the result is 
positive, the storage location of the list 
item and the location in the buffer are 
each incremented by the item length and 
transfer is made to the beginning of the 
loop to process the next element of the 
array. If, after incrementing the buffer 
location, the end of the buffer has been 
reached, further processing depends on 
whether the operation is for input or 
output. 

For output, the current buffer is writ- 
ten and flagged to indicate that this log- 
ical record continues on the next physical 
record. A new output buffer is then 
initialized. 

For input, a check is made to see if the 
current physical record is flagged in this 
manner, and if it is, the next physical 
record is read. If the current physical 
record is the last one written as part of 
this logical record, an error message is 
transmitted to the user and the task is 
terminated. The reading and writing of 
additional physical records as part of this 
logical record is accomplished by a call to 
I/O control (CHCIC). 

CHCIF — Format Processor 



Routines Called : 

• Format Processor (CHCIF) 

* I/O Control CCHCIC) 

* Exit CCHCIW) 

• PRMPT CCZATJ1) 



This routine scans the FORMAT string, 
interacts with CHCIC to control the I/O for 
each FORMAT-referenced record, and 
interacts with the appropriate data conver- 
sion routines to effect the item-by-item 
conversion specified by the referencing 
FORMAT statement. CHCIF is entered once 
for each list item in the I/O request. 
(See Chart IF.) 



36 



Entry : The entry point is CHCIF1. Before 
the first entry to CHCIF to process a 
reference to a FORMAT statement , CHCIA (I/O 
Initialization) stores the address of the 
FORMAT string in CHCRWw. 



Immediate input or output of logical 
records 

Initialization of return points to be 
used when closing parentheses are 
reached 



Routines Called: 



• I/O Control (CHCIC) 



Immediate conversion of input or output 
data in accordance with the FORMAT con- 
version code 



• Exit (CHCIW) 

• One of the eleven conversion routines 
(CHCIH through CHCIT) 

• The FORTRAN compiler routine for trans- 
lating FORMAT statements (CEKBF), at 
entry point SYSPFMT 

• PRMPT (CZATJ1) 

Error Checks : Since FORMAT statements may 
be dynamically modified, certain error con- 
ditions may arise due to the syntax of the 
FORMAT string. If there are no syntax 
errors, errors could arise due to conver- 
sion of the data. In such cases the con- 
version routines issue messages describing 
the errors before returning. All syntax 
error checks produce messages describing 
the error. 



In the last case, if an item is known to 
be available, the appropriate conversion 
routine is called and return is made to the 
calling routine. If no item is available, 
the scan continues. 

On entries for subsequent list items in 
the I/O request, CHCIF keeps track of its 
position in the FORMAT table. 

The scan ends when a closing parenthesis 
is reached. 



CHCIH — Integer Output Conversion 

This routine converts a two-byte or 
four-byte binary list item to an integer 
field in the output buffer, according to 
the format In, where n is the integer 
field's size. (See Chart IH.) 



Processing is terminated upon encounter- 
ing invalid control characters in the 
string, strings that exceed the maximum, or 
too many levels of parentheses. When it is 
possible to assume values other than those 
specified (as in the case of invalid size 
of w or d fields after a control charac- 
ter) , processing continues on the current 
item after the error message is issued. 
Otherwise, the erroneous FORMAT item is 
skipped, and processing continues with the 
next control character. 

Operation : At the first entry to CHCIF for 
a given I/O request, CHCIF tests whether 
the FORMAT statement has been translated. 
If not, CHCIF calls CEKBF at entry point 
SYSPFMT. CEKBF enters translations of FOR- 
MAT codes into a FORMAT table, as shown in 
Table 11. 

CHCIF scans the translated FORMAT 
string, tests each entry for validity, and 
performs these actions: 

• Initialization of repetition factors 
both inside and outside the FORMAT 
parentheses 

• Immediate input or output of character 
strings or spaces (wH or w or Tw or 

• Initialization of scale factors before 
FORMAT control units 



Entry : The entry point is CHCIH1. The pa- 
rameter list is described under "Data Con- 
version Routine Parameter Lists," in this 
section. 

Routine Called : PRMPT (CZATJ1) 

Error Checks : If the output buffer area is 
too small to contain the integer field, the 
field is filled with asterisks and a mes- 
sage is issued by PRMPT. 

Operation : The contents of the list item 
are converted in a work area to packed 
decimal, then into zoned decimal. The 
sign, if negative, is set in the conven- 
tional FORTRAN position. The work area is 
moved into the output buffer field from 
right to left, to check whether sufficient 
space is supplied by the field width. 
Blanks are inserted as padding if the buff- 
er size is larger than the converted field 
size. 

CHCII — Real and Integer Input Conversion 

This routine converts a data field in an 
input buffer to the appropriate type of 
list item. An integer field is converted 
to a binary list item. A real field is 
converted to a single- or double- precis ion, 
floating-point list item. The integer 
field has the format In, where n is the 
field width. The real field has the format 
Fw.d, Ew.d, or Dw.d, where w is the field 



Section 5: I/O Routine Descriptions 37 



Table 11 . Translation of FORMAT codes 



FORMAT 
CODE 


FORMAT TABLE ENTRY 




SIZE 
(BYTES) 


BYTE 




BYTE 
1 


BYTE BYTE BYTE 

2 3 4 


BYTE 

5 


H 


STRING 
LENGTH-2 


X'O' 


LENGTH 


CHARACTER STRING 
AS MANY BYTES AS NEEDED (MAX 255) 


/ 


1 


XT 






X 


2 


X'2« 


REPEAT 
COUNT 


T 


2 


X'3' 


W 


P 


2 


X r 4* 


SCALE 
FACTOR 


) 


2 


X'5' 


NEST 
LEVEL 






( 


3 


X»6' 


NEST 

LEVEL 


REPEAT 

COUNT 




A 


3 


X'7' 


REPEAT 
COUNT 


W-l 




Z 


3 


X'S' 


REPEAT 

COUNT 


W-l 




L 


3 i 


X'9» 


REPEAT 
COUNT 


W-l 




I 


3 


X'A» 


REPEAT 
COUNT 


W-l 






G 


4 


X'B' 


REPEAT 
COUNT 


W-l 1 D 




F 


4 ; 


X'O 


REPEAT 
COUNT 


W-l 


D 


D 


4 


X'D' 


REPEAT 
COUNT 


W-l 


D 


E 


4 


X'E' 


REPEAT 
COUNT 


W-l ID 

1 


SPECIAL 
H 


6 


X'F' 




LENGTH 

.... 


ADDRESS OF CHARACTER 
STRING 



width and d is the width of the decimal 
fraction* (See Chart II.) 

Entry ; There are three entry points: 
CHCII, CHCIK, and CHCIG. 

Routine Called: PRMPT CCZATJ1) 



Error Checks s If the FORMAT specification 
CF ff E, D f or I> is improperly specified or 
the data field is greater than the permis- 
sible range, PRMPT is called. 



Operation ; The input data field is scanned 
from left to right to determine: 

1. The value of the sign, if any. 



2. Position of the base number's first 
digit. 

3. Number of digits before the decimal 
point, if real. 

4. Position of first digit after decimal 
point, if real, 

5. Number of digits after decimal point, 
if real. 

6. The letter E or D f if present. 

7. Sign preceding exponent, if any. 

8. Position of exponent's first digit. 

9. Number of exponent digits. 



38 



During the scan a test is made for in- 
valid characters in the numeric fields. In 
addition, a test is made to determine if 
the integer or real data exceeds the per- 
missible maximum. If such errors are 
encountered, the scan is terminated and 
control is passed to PRMPT to issue an 
error message. Otherwise, conversion con- 
tinues and a normal return is made. 



CHCIJ — Real Output Conversion 

This routine converts a single- or 
double-precision floating-point list item 
to a real field in the output buffer. The 
real field has a format of either Ew.d, 
Dw.d, or Fw.d, where w is the field width 
and d is the size, in digit positions, of 
the fractional position. (See Chart IJ.) 



Entry : There are two entry points: 
and CHCIL1. 



CHCU1 



sing parenthesis or central comma, CHCIM 
issues an error message via PRMPT. No 
further action is taken and the list items 
remain unchanged. If either or both real 
fields contain invalid characters or exceed 
the permissible magnitude, CHCII issues an 
error message. 



Operation : The input buffer is scanned to 
find the size of each real data field. 
Once it is determined that the user proper- 
ly specified these data fields and included 
the correct delimiters (parentheses and 
central comma) , the first real data field 
is passed as a parameter to CHCII for con- 
version to a single- or double- precis ion 
floating-point list item. When CHCII 
returns control to CHCIM, CHCIM passes the 
second real data field to CHCII for conver- 
sion, completing the complex input 
conversion. 



Routines Called : Return is made to the 
calling routine. 

Error Checks : If the output buffer is too 
small to contain the real field, the real 
field is filled with asterisks. 

Operation : A test is made against a table 
of powers of ten to determine the required 
output exponent, if any, and the item is 
divided by the appropriate power of ten. 
If there is an exponent, it is moved into 
the output buffer from right to left, fol- 
lowed by its sign and the letter E or D. 
If there is no exponent, the data field, 
after processing is complete, is moved into 
the output buffer and control is passed to 
the calling routine. 



CHCIM — Complex Input Conversion 

This routine converts a complex data 
field in the input buffer to a complex list 
item consisting of two real data fields. 
Each real field is converted to a single- 
or double- precis ion floating-point list 
item according to the format Fw.d, Ew.d, or 
Dw.d, where w is the real field width and d 
is the width of the decimal fraction. (See 
Chart IM. > 

Entry : The entry point is CHCIM1. 

Routines Called : 

• Real and Integer Input Conversion 
(CHCII) 

• PRMPT (CZATJ1) 

Error Checks : If the complex data field in 
the input buffer contains no real field or 
only one real field, or if there is a mis- 



CHCIN — Complex Output Conversion 

This routine converts a complex list 
item consisting of two single- or double- 
precision floating-point items to a complex 
data field in an output buffer. Each 
floating-point list item is converted to a 
real data field according to the format 
code Fw.d, Ew.d, Dw.d, or Gw.s, where w is 
the real field width, d is the width of the 
decimal fraction, and s is the number of 
significant digits. (See Chart IN.) 

Entry : The entry point is CHCIN1. 

Routine Called : General Output Conversion 
(CHCIT) 

Error Check : If the FORMAT specification 
(F, E, D, or G) is improperly given or the 
real data field is greater than the permis- 
sible range, CHCIT issues an error message. 

Operation : CHCIN passes the first list 
item as a parameter to CHCIT for conversion 
to a real data field. When CHCIT completes 
the conversion process and returns to 
CHCIN, CHCIN passes the second list item to 
CHCIT for conversion, completing the com- 
plex output conversion. 



CHCIO — Alphameric and Hexadecimal Input 
Conversion 

This routine transfers a specified num- 
ber of bytes (alphameric or hexadecimal 
characters) from an input buffer area to a 
list item. The format is Aw (alphameric) 
or Zw (hexadecimal) , where w, field width, 
is the number of characters being trans- 
ferred. (See Chart IO.) 



Section 5: I/O Routine Descriptions 39 



Entry ; The entry points are CHCIOl 
(alphameric data) and CHCI02 (hexadecimal 
data) . 

Operation : When the conversion format is 
alphameric, this occurs: 

* If the byte size of the list item 
equals the number of alphameric charac- 
ters in the buffer, a simple move is 
executed, with no data test made* 

* If the byte size of the list item is 
less than the number of alphameric 
characters in the buffer, the excess, 
left-most characters are truncated in 
the list item field, 

* If the byte size of the list item is 
larger than the number of alphameric 
characters in the buffer, the charac- 
ters are transferred into the list item 
field, left™ justified. 

When the conversion format is hexadeci- 
mal, the field is scanned for valid hexa- 
decimal characters. If invalid, a call is 
made to PRMPT. If valid, the characters 
are converted to binary and moved to the 
input item. If the input field was pre- 
ceded by a minus sign, the result is com- 
plemented. In either case, a return is 
made to the calling routine, 

CHCIP — Alphameric and Hexadecimal Output 
Conversion 

This routine transfers a list item con- 
taining a specified number of bytes 
(alphameric or hexadecimal characters) to 
an output buffer area. The format is Aw 
(alphameric) or Zw (hexadecimal) , where w, 
field width, is the number of characters 
being transferred. (See Chart IP.) 

Entry : The entry points are CHCIP1 
(alphameric data) and CHCIP2 (hexadecimal 
data) • 



When the list item contains hexadecimal 
data, it is unpacked and translated to hex- 
adecimal digits in the output buffer. 



C HCIQ — Logical Input (.:■ •aversion 

This routine converts a logical field in 
the input buffer area. The field has the 
format Lw, where w is the field width. 
(See Chart IQ. ) 

Entry : The entry point is CHCIQ1. 

Operation : The list item is set to an 
internal value of .FALSE. (binary zero). 
The logical data field is then scanned 
until either an F or a T is encountered. 
In the first case, immediate return occurs. 
In the second case, the list item is set to 
an internal value of .TRUE. (binary one) 
before returning. 



CHCIR — Logical Output Conversion 

This routine converts a list item to a 
logical field in the output buffer area. 
The field has the format Lw, where w is the 
field width. (See Chart IR.) 

Entry : The entry point is CHCIR1. 

Operation : The output buffer area is first 
filled with blanks. If the list item con- 
tains a value of zero, the letter F is 
placed in the last buffer area position; 
otherwise, the letter T is inserted. 



CHCIS — General Input C aversion 

This routine converts a data field in 
the input buffer to a li.t item according 
to the format Gw.s, where w is the field 
width and s is an optional specification of 
the number of significant digits. (See 
Chart IS.) 



Operation : When the list item contains 
alphameric data, this occurs: 

• If the byte size of the list item 
equals the size of the buffer area, a 
simple move is executed, with no data 
test made. 

» If the byte size of the list item is 
less than the size of the buffer area, 
the list item is entered right- 
justified and padded to the left with 
blanks . 

• If the byte size of the list item is 
greater than the size of the buffer, 
the list item is transferred to the 
buffer area left- justified with excess 
characters truncated. 



Entry : The entry point is CHCIS1. 
Routines Called : 

• Real and Integer Input Conversion 

(CHCII) 

• Logical Input Conversion (CHCIQ) 

• Alphameric and Hexadecimal Input Con- 
version (CHCIO) 

Error Checks : CHCIS does no error check- 
ing. Error checks, if any, are made by the 
called data conversion routines. 

O peration : If the conversion type is *N' f 
indicating a call from the NAMELIST Proces- 
sor (CHCID) , this happens; 



HO 



Type of Data 


J 


Integer 


CHCII 


Real 


CHCII 


Logical 


CHCIQ 


Alphameric 


CHCIO 


Hexadecimal 


CHCIO 



• If the data field begins with a quote, 
a literal character string is moved to 
the list item, 

• If the data field begins with a • Z' , 
hexadecimal conversion is performed. 

If the conversion type is not f N' , the 
list item is checked to determine which 
conversion routine should be called: 

Routine Called 
(Entry point CHCIG) 
(Entry point CHCIK) 
(Entry point CHCIQ1) 
(Entry point CHCI01) 
(Entry point CHCI02) 



CHCIT — General Output Conversion 

This routine converts a list item to a 
data field in the output buffer, according 
to the format Gw.s; where w is the field 
width and s is an optional specification of 
the number of significant digits. (See 
Chart IT.) 

Entry ; The entry point is CHCIT1. 

Routines Called ; 

• Integer Output Conversion (CHCIH) 

• Real Output Conversion (CHCIJ) 

• Logical Output Conversion (CHCIR) 

Error Checks ; CHCIT performs no error 
checks. Discrepancies between the size and 
type specification of the list item and the 
data field are detected by the called con- 
version routine. 

Operation ; CHCIT examines the list item 
type. If logical, a call is made to CHCIR. 
If integer, a call is made to CHCIH. If 
real, the magnitude of the item is tested. 
Should it fall in the range 0.1 to 10**s, a 
call is made to CHCIJ using F format speci- 
fication. If real, and outside this range, 
a call is made to CHCIJ using E or D format 
specification. 



CHCIU — List Termination 

This routine terminates list processing 
for a READ, WRITE, PRINT, or PUNCH state- 
ment, and completes any I/O operation that 
is pending. (See Chart IU.) 

Entry : The entry point is CHCIU1. 

Routines Called: 



• Format Processor (CHCIF) 

• I/O Control (CHCIO 

The final return is made with registers 
unchanged, except that register 13 is set 
to the address of the calling module's 
PSECT and register 15 is set to zero. 



Operation : If the previous list processing 
was an unformatted READ, no further action 
is necessary, and control returns to the 
caller. If the previous action was a for- 
matted READ, CHCIF is entered with a zero 
list item to indicate termination of the 
FORMAT scan. This permits scanning for 
Hollerith format controls that have still 
not been processed, or skipping records 
until the end of the format character 
string. 

If the previous action was an unfor- 
matted WRITE, a final call is made to CHCIC 
to write the complete logical record. 

If, the previous action was a formatted 
WRITE, CHCIF is entered as above, followed 
by CHCIC. 



CHCIW 



Exit 



CHCIW is described in "Section 4: Ser- 
vice Subprogram Descriptions." 



CHCBD — I/O Interruption and Machine 
Indicator Routine 

At the beginning of all FORTRAN main 
programs, the compiler generates code that 
calls this routine at entry point CHCBD1 . 

Entry : The entry point is CHCBD1. 



Operation : This routine sets bits in the 
PSW such that the fixed-point overflow and 
significance exceptions will be ignored, 
and directs the system interruption handler 
as to where to pass control if any of the 
following exceptions occur: 



Exception 
Specification 
Exponent Overflow 
Exponent Underflow 
Divide Check 



Subprogram 
CHCBE2 
CHCBE3 
CHCBE4 
CHCBE5 



In addition, this routine initializes the 
machine indicator flags and the sense light 
simulators, and clears any pointers to 
entries in the DCB table. It then returns 
control to the calling program. 



Section 5: I/O Routine Descriptions 41 



SECTION 6: FLOWCHARTS 



The flowcharts in this manual have been produced by an IBM program, using ANSI sym- 
bols. The symbols are defined in the left column below, and examples of their use are 
shown at the right. 



DEFINITION 



TERMINAL B 



LOCK J 



PROCESS BLOCK 



INDICATES AN ENTRY OR 
TERMINAL. POINT IN A FLOW- 
CHART; SHOWS START, STOP, 
HALT, DELAY, OP INTERRUP- 
TI >N . MAY' AIS<, ' NL>I< AT! 
RETURN TO THE CALLING 



INDICATES A PROCESSING 
FUNCTION OR A DEFINED OP- 
ERATION CAUSING CHANGE IN 
VALUE, FORM OR LOCATION 

OF INFORMATION. 



DT \ 


INDD'ATF'-' A 


DM' IS ION OP 




"~<a r"> H \ 




DECISION ^V 


THAT DI-OI-OM 


■ > ', a'h :, 'i 


BLOCK ~y 


> A NUMBFT -if 


A. " 1 t\AT: 




PATHS SP< l.L 


- M Im;i *l 



INDICATES A SUBROUTINE i 
MODULE THAT IS DESCRIBE!" 

IN THIS manua; 



I . ; -VNAME J 




MODNAME IS THE LcjAD 
NAME OF THE ROUTINE 
FLOWCHART. 



uTHERMuD 
'" 'NTRuL 'P 
''HARTS . 



OF THE FIRST 



oGRAM EXECUTION 
-OU O L-l : r. • ■ ! 

OCK E3 WHEN THE 



LABEL2 IS THE LABEL • ■¥ 
CODE IN THIS ROUTINE- I- 
IS PASSED To THE SUBPo 
RETURNS TO THE NEXT IN 
INC THE SUBROUTINE OAI 

EN'IRYPT IS THE ENTRY P 



VIA: PAHSMEOH 



/INPUT OUTPUT 



PREPARATION 



ARATION \ 



MODULE 
IN THE 
OTHER M 



INDICATES A 


PROCESS THAT 


CHANGES SYS* 


LM OPERATION 


FOB EXAMPLE 


SETS A SWI1 


MODIFIES AN 


incfo regis: 


OR INITIAI t. 


FS A ROUT INF 



INDICATES ENTRY TO C 
FROM ANOTHER BLOCK C 
SAME FLOWCHART PAGE . 



INDICATES ENTRY TO OP EX! 
FROM A BLOCK ON ANOTHER 
PAGE OF THE SAKE SET t >F 
FLOWCHARTS . 




PP=ENTPYPT 
CHART AC 

VIA: PASSMECH 



LABEL3 IS THE LABEL T 
CODE IROM WHICH *<•>,". b> 
'PREDEFINED PROCESS PLY 
DOCUMENTED IN ANOTHER 
(-PDPNM- MAY ALSO BE U 
ING BLOCK) . 



i xt< u'l ion < ntimje' - .-. . : , J 

THE DECISION IS YES. up 
PAGE 2 OF THIS SET 6F FI 
THE DECISION IS NO. 

THE t 'FFPAOl U^NNF.-'I.-R *'/■ 
»'ATES THAT EXECUTE N N 
H3 FROM ANOTHER PAGE ' T 
'"PARTS . 1 -ilS C'CCr 
WITH THE ON PAGE CONNF- |-. 



42 



Program Logic Manual 

GY28-2020-2 

FORTRAN IV Library Subprograms 



Flowcharts on pages 43-88 were not scanned. 



APPENDIX A; FORTRAN DATA MANAGEMENT 



This appendix describes the assumptions 
that the FORTRAN I/O library makes in 
initializing DCBs with information concern- 
ing record format (RECFM) and data set 
organization (DSORG) . These asumptions are 
described in this appendix to help reduce a 
frequent source of error encountered by the 
user when performing I/O. 

Introductory material is presented on 
the DCB describing its general use, con- 
tents, and sources of initialization, 
before discussing the permissible record 
formats and data set organizations, (For a 
description of the DCB in terms of its 
size, format, and use by the rest of TSS/ 
360, see System Control Blocks PLM . ) 



DCB Use 

The Data Control Block CDCB) is created 
by DCB Management (CHCIB) and is used by 
certain data management routines which are 
invoked by macro instruction references in 
I/O Control (CHCIC) . The DCB is required 
for all I/O performed using either BSAM or 
VAM. However, the DCB is not required for 
I/O when using the GATE macro instructions, 
even though CECIB reserves space for one. 
In this case, the DD^AME field is used to 
save the name that the data set would have 
had if GATE were not used„ The principal 
reason for constructing this dummy DCB for 
GATE is to retain consistency for various 
routines when handling data set reference 
numbers with no corresponding DDEF 
commands • 

DCB Content 

The DCB contains information such as the 
DDNAME, type of data set organization, the 
type and size of records, block size for 
blocked data sets, number of buffer areas, 
exits for SYNAD and EODAD, and various con- 
trol flags used by data management, 

DCB Initialization 

The FORTRAN I/O routines, when proces- 
sing an input data set, take advantage of 
information in the DCB to adapt to the 
characteristics of the data set and read it 
correctly* Characteristics are based on 
the parameters for a DCB that can be sup- 
plied from: 

• The user program — type of I/O used 
and associated data format, 

• User-supplied DDEF commands — some of 
the information in the DCB can be 
changed in this manner; however, the 
extent of change is limited. 



• Input data set labels — these override 
both of tha above sources of informa- 
tion, within limits set by data 
management. 

Combinations of DSORG and RECFM 

Table 12 gives the permissible combina- 
tions of record formats and data set 
organizations that may be specified when 
using the FORTRAN I/O library. 



Table 12. 



Combinations of DSORG and RECFM 
values 



A 

N 

i n 

I A 

I N 

I N 

I N 

| N 

| N 

| N 

| N 

I L 

Codes mean: 

A - Acceptable 

L - Limited acceptable 

N - Not acceptable 

DSORG abbreviations mean: 

VS - 



RECFM (- r 



V 
VB 
VT 
F 

FB 

FS 

FT 

FBS 

FBT 

FBST 

FST 

U 



| VS 

-+ 

1 



DSORG VALUES 

PS I VSP 1 VI | VIP 



JL- 



A 

N 

N 
A 
N 
N 
N 
N 
N 
N 
N 
N 



1 A 1 


A I 


A | 


1 A 1 


N 


N | 


1 A 


| N 


N | 


1 A 1 


A 


A | 


1 A 


N 


N | 


t A 


N 


N [ 


1 A 


| N 


1 N | 


I A 


N 


N I 


1 A 


| N 


N | 


1 A 


| N 


N | 


1 A 


1 N 


1 N 1 


1 A 


i L 


| N | 



H 



Virtual sequential (direct access 
only) 

Physical sequential (any device 
except terminals) 
Virtual sequential partitioned 
(direct access only) 
Virtual index sequential 
(direct access only) 
Virtual index sequential partition- 
ed (direct access only) 
RECFM abbreviations mean: 

Variable-length unblocked records 
Variable-length blocked records 
Variable- length unblocked with 
track overflow 

Fixed- length unblocked records 
Fixed-length blocked records 
Same as F, no truncated blocks or 
unfilled tracks 
Same as F, track overflow 
Same as FB, no truncated blocks 
or unfilled tracks 
Same as FB, track overflow 
FBST- Same as FBS, track overflow 
FST - Same as F, no truncated blocks, 
track overflow 
Undefined record length 



PS - 



VSP - 



VI - 



VIP - 



V 

VB 

VT 

F 

FB 

FS 

FT 
FBS 

FBT 



U 
I 



Appendix A: FORTRAN Data Management 89 



Any of the RECFM codes shown can be fol- 
lowed by the letter A or the letter M. A 
indicates that the first character of every 
logical record is a FORTRAN carriage or 
punch control character, M indicates that 
the first character of every record is a 
TSS/360 machine control byte. In general, 
the M option cannot be used by FORTRAN out- 
put data sets, since the control codes are 
unprintable and do not conform to FORTRAN 
conventions* 



records may span over data management phys- 
ical records. In the management of unfor- 
matted FORTRAN data, the first two bits of 
every VS physical record or the third byte 
of every PS physical record is a control 
byte defined as follows; 

X^O 1 A FORTRAN logical record does 
not span into or out of the 
data management physical 
record. 



Unformatted FORTRAN Logical Records 

Under any of the organization techniques 
used, an unformatted WRITE statement may 
lead to a logical record that exceeds the 
length of the maximum record supported by 
the access method. Furthermore, it is not 
possible to enter the byte size of the 
entire FORTRAN logical record into the 
beginning of the I/O physical record 
without the possibility of tying up an 
indefinite amount of virtual storage. 
Therefore, unformatted FORTRAN logical 



X'Ol* This data management physical 
record is the first of a span. 

X'0 2 1 This data management physical 
record is the last of a span. 

X*03 f This data management physical 

record is within the range of a 
span. 

No data management logical record will 
be written containing more than one unfor- 
matted FORTRAN logical record. 



90 



APPENDIX B: EXTERNAL NAMES SUMMARY 



All FORTRAN library routines have five-letter names beginning with the letters 'CHC. 
The names of mathematical library routines begin with ' CHCA 1 or , CHCB I f and the names of 
I/O library routines begin with • CHCI' except one — CHCBD. All other external names 
consist of the routine names with suffixes. 

Table 13. External names of FORTRAN IV library subprograms 



j Mathematical 
I Subprograms j 



Service Subprograms 






h 



Entry | See Tables 2 9 3 f |See Tables 7 and 9, and 
Name (and 7. (Section 4, 



I/O Subprograms 



See Section 5. 



Routine [See Tables 2 f 3, [See Tables 7 and 9, and 
Name (and 7. (Section **. 

CSECT (Routine name (CHCBE: Routine name suffixed 
Name (suffixed by ^".(by 'W. CHCIV and CHCIW: 

j (Routine name suffixed by f C f . 



See Section 5, 






Routine name suffixed by ' C. 



H 



H- 



-H 



PSECT (Routine name (CHCBE: Routine name suffixed 
Name (suffixed by ' R'.(by , R f . CHCIV and CHCIW; 

| (Routine name suffixed by 'W. 

A-_. . X . . 



Routine name suffixed by ' W 



Appendix B: External Names Summary 91 



INDEX 



Where more than one page reference is 
given* the major reference is first* 



.FALSE logical constant 41 
.TRUE logical constant 41 



A conversion code 40 

Absolute value subprograms 19,4 

Access methods 

basic sequential CBSAM) 34 r 35 
virtual CVAM) 34,35 
Access qualifier 34 
Accuracy figures , mathematical 

subprograms 15-24 
ALGAMA subprogram 19,5 

Algorithms of mathematical subprograms 14 
ALOG subprogram 15,4 
ALOG10 subprogram 15,4 

Alphameric and Hexadecimal Input Conversion 
CCHCIO) 40,41 

calls from other routines 
CHCIF 37,38 
CECIS 41 

Csee also I/O library, overview) 
flowchart 80 
Alphameric and Hexadecimal Output 
Conversion CCHCIP) 41 

calls from other routines 
CHCIF 37, 38 
CHCIS 41 

Csee also I/O library, overview) 
Arccosine and arcsine subprograms 15,4 
ARCOS subprogram 15,4 

Arcsine and arccosine subprograms 15,4 
Arctangent subprograms 15,4 
Argument ranges, mathematical 

subprograms 15-23 
Arguments, mathematical subprograms 14-23 
Arrays 

dimensions 36 
elements 35-37 
length 36 
names 35, 36 
size 36 

subdivision, levels of 3 6 
subscripting 36 
ARSIN subprogram 15,4 
Asterisks 40,41 
ATAN subprogram 15,4 
ATAN2 subprogram 15,4 
Attributes 

I/O routines 30 
mathematical subprograms 14 
service subprograms 26 



BACKSPACE operation 13,1 
CHCIA 31,32 
CHCIC 33-35 
Csee also I/O library, overview) 



Basic Sequential Access Method 

CBSAM) 32,34,35 
Binary list item 39 
Blanks 39 

Blocked records 34,35 

BSAM Csee Basic Sequential Access Method) 
BSP macro instruction 3 5 
Buffering 34-42 



CABS subprogram 19, 4 
CALL statement 1 
Calling relationships 

I/O library 3-13 

mathematical library 4 , 5 
Carriage control 90 
CCOS subprogram 17,5 
CDABS subprogram 19,4 
CDCOS subprogram 15,5 
CDEXP subprogram 15,5 
CDLOG subprogram 15,4 
CDSIN subprogram 15,5 
CDSQRT subprogram 15,4 
CEKBF routine 38,39 

CEKT1 ... CEKT6 macro instructions 25 
CEKZA macro instruction 25 
CEKZD macro instruction 25 
CEXP subprogram 15,5 
Character string 38-42 
CHCAA routine 15, 4 
CHCAB routine 15,4 
CHCAC routine 15,5 
CHCAD routine 15,5 
CHCAE routine 15,4 
CHCAF routine 15,4 
CHCAI routine 17,5 
CHCAJ routine 17,5 
CHCAK routine 19,5 
CHCAL routine 19,5 
CHCAM routine 15,5 
CHCAN routine 15,5 
CHCAO routine 15,4 
CHCAP routine 15,4 
CHCAQ routine 15,17,5 
CHCAR routine 15,5 
CHCAS routine 15,4 
CHCAT routine 15,4 
CHCAU routine 19,4 
CHCAV routine 19,4 
CHCAW routine 15,4 
CHCAX routine 15, 4 
CHCAY routine 17,4 
CHCAZ routine 17,4 
CHCBA routine 17,5 
CHCBB routine 17,5 
CHCBC routine 21,25 

mathematical library overview 5 
CHCBD Csee I/O Interruption and Machine 

Indicator Routine) 
CHCBE Csee Interrupt and Machine 

Indicator Routine) 
CHCBG routine 21,25,5 



92 



CHCBH routine 21,25,5 

CHCBI routine 21,25,5 

CHCBJ routine 21,25,5 

CHCBK routine 21,25,5 

CHCBM routine 21,25,5 

CHCBQ routine 15, 4 

CHCBR routine 15, 4 

CHCBT routine 19,5 

CHCBU routine 19,5 

CHCBV routine 19,5 

CHCBW routine 19,5 

CHCBZ (see Error Processor) 

CHCIA (see I/O Initialization) 

CHCIB (see DCB Maintenance) 

CHCIC (see I/O Control 

CHCID (see NAMELIST Processor) 

CHCIE (see List Item Processor) 

CHCIF (see FORMAT Processor) 

CHCIG entry point 42 

CHCIH (see Integer Output Conversion) 

CHCII (see Real and Integer Input 

Conversion) 
CHCIJ (see Real Output Conversion) 
CHCIK entry point 42 
CHCIL1 entry point 40 
CHCIM (see Complex Input Conversion) 
CHCIN (see Complex Output Conversion) 
CHCIO (see Alphameric and Hexadecimal 

Input Conversion) 
CHCIP (see Alphameric and Hexadecimal 

Output Conversion) 
CHCIQ (see Logical Input Conversion) 
CHCIR (see Logical Output Conversion) 
CHCIS (see General Input Conversion) 
CHCIT (see General Output Conversion) 
CHCIU (see List Termination) 
CHCIV (see Dump Routine) 
CHCIW (see Exit Routine) 
Class (see also Type) 

of variable 36 
CLOG subprogram 15,4 
CLOSE macro instruction 35 
Closing parenthesis 39 
Combinations of DSORG and RECFM 89 
Common and natural logarithm 

s ubpr o grams 15,4 
Compiler 31,35 

Compiler- generated entry names 25,2 
Complemented error function 

subprograms 19 , 5 
Complex Input Conversion (CHCIM) 40 

calls from other routines 
CHCID 35 
CHCIF 37,38 
(see also I/O library, overview) 

flowchart 78 
Complex list item 40 
Complex Output Conversion (CHCIN) 4 

calls from other routines 
CHCID 35 
CHCIF 37,38 
(see also I/O library, overview) 

flowchart 76 
Complex result, how passed 14 
Computations of mathematical 

subprograms 15-23 
Control Initialization 

(see I/O Initialization) 



Conversion codes 39,3 

data conversion routines, use by 39-4 2 
Conversion routines 

(see Data conversion routines) 
COS subprogram 17,5 
COSH subprogram 17,5 
COTAN subprogram 17,4 
CSECTs 89,23,25 
CSIN subprogram 15,5 
CSQRT subprogram 15,4 
CZAEB routine 32,33 
CZAFQ1 routines 30 
CZCGA routine 32 



d Field 38-40 

D conversion code 39,40 

DARCOS subprogram 15,4 

DARSIN subprogram 15, 4 

Data Control Block (DCB) 32,33,3 

CHCIA 31 

CHCIC 33-35 

CHCIW 29,30 

contents 89 

initialization 89 

prefix 32,34 

table used by CHCIC 35,43 

use 89 
Data conversion routines 35,37 

parameter lists 30,31 

(see also I/O library, overview; CHCIH; 
CHCII; CHCIJ; CHCIM; CHCIN; CHCIO; 
CHCIP; CHCIQ; CHCIR; CHCIS; CHCIT) 
Data event control block (DECB) 32 
Data field, I/O 38-42 
Data management routines 32,33,3,6 
Data set 

access qualifier 34 

label 89 

read-only 34 

reference number 31-35 
DATAN subprogram 15,4 
DATAN2 subprogram 15,4 
DCB (see Data Control Block; DCB 

Maintenance) 
DCB Maintenance (CHCIB) 32-34 

calls from other routines 
CHCIA 31 
CHCIC 33, 34 
CHCIW 30 
(see also I/O library, overview) 

flowchart 49 
DCOS subprogram 17, 5 
DCOSH subprogram 17,5 
DCOTAN subprogram 17,4 
DDEF command 32-34,3 
DDNAME 89 

DECB (Data Event Control Block) 32 
Decimal conversion 39 
Definitions of subprogram 

computations 15-23 
DERF subprogram 19,5 
DERFC subprogram 19,5 
DEXP subprogram 15,4 
DGAMMA subprogram 19, 5 
Digit 39-42 
Dimension 36 
Dimension product 36 



Index 93 



Direct -reference mathematical 

subprograms 11-25,1,2 
Direct-reference service subprograms 

11-25,1,2 
Divide Check Handier 26-28 
Divide Check Tester 26-28 
DLGAMMA subprogram 19,5 
DLOG subprogram 15 , 1 
DLOG10 subprogram 15,4 
Double buffering 35 
Doubl e- preci s ion 

argument (notation) 2 3 

complex argument (notation) 23 

list item 39,10 
DSIN subprogram 17 f 5 
DSINH subprogram 17,5 
DSORG values 32,89 
DSQRT subprogram 15, 1 
DTAN subprogram 17,4 
DTANH subprogram 19,5 
Dummy DCB 33 
Dump Routine (CHCIV) 28-29,26 

flowchart 87 

(see also I/O library, overview) 
DUMP subprogram 28,29 

(see also Dump Routine) 



CHCIA 31 

CHCIB 3 2 
CHCIC 33,34 
CHCID 35 
CHCIE 37 
CHCIF 37 

FORTRAN compiler (user program) 3 
(see also I/O library, overview) 
1. lowchait 8 
EXIT subprogram 29 f 3Q 

(see also I/O library, overview) 
EXP subprogram 15,4 
Exponent, I/O involving 39, 40 
Exponent Overflow Handler 26-28 
Exponent Overflow and Underflow 

Tester 26-28 
Exponent Underflow Handler CCHCBD1) 26-28. 
Exponentiation subprograms 21 
ent ry par amet er s 11 
(see also CDEXP subprogram? CEXP 
subprogram; DEXP subprogram; EXP 
subprogram; Indirect-reference 
mathematical subprograms; Mathematical 
1 i b r u r y , o v e r v i e w ) 
External entry name (definition) 2 
External names 91 



E conversion code 39-41 
Elements, array 35,37 
END exit 30-33 

control flag in DCB prefix 3 2 
End file lockout indicator 31,35 
END FILE operation l r 13 

CHCIA 31 r 32 

CHCIC 33-35 

Csee also I/O library, overview) 
Entry names 

I/O subprograms 91 

mathematical subprograms 15-25 

service subprograms 26-30 , 2 
EODAD exit 33 f 89 
Equal sign 35 
Equations showing subprogram 

computations 15-23 
ERF subprogram 19 , 5 
ERFC subprogram 19 , 5 
ERR exit 30-33 

control flag in DCB prefix 32 
Error checks 

mathematical subprograms 11-23 

service subprograms 26-29 
Error conditions (see Error checks) 
Error function subprograms 19 , 5 
Error Processor CCIiCBZ, math 
library) 25 r 23 

calls from other routines 11,2 
CHCBE 28 

Csee also Mathematical library, 
overview) 

flowchart 47 
Error routines 

CHCBZ 25,23 
Exceptions 26,28 
Exception Processing Enabler 

CCHCBD1) 26-28 
Exit Routine CCHCIW) 29-35,26,27 

calls from other routines 30 



F conversion code 39-11 

FCDXI entry name 2 5 

FCDXJ entry name 2 5 

FCXPI entry name 2 5 

FCXPJ entry name l", 

FDXPD entry name 2 5 

FDXPI entry name 25 

FDXPJ entry name 25 

Field width, I/O 38-42 

Fill characters 34 

FIXPD entry name 25 

FIXPI entry name 25 

FIXPJ entry name 2 5 

FIXPR entry name 25 

FJXPD entry name 2 5 

FJ X P I e n t r y na me 2 5 

FJXPJ entry name 25 

FJXPR entry name 2 5 

Floating-- point, list item 39,10 

Flowcharts 12-88 

Format 

controls, Hollerith 12 
of FORTRAN logical records 8 8 
of NAM EL 1ST output 36 
FORMAT 

(set also FORMAT Processor) 
clo.-;in<-; paieiiUiCwiS 3 C J 
cedes 38-12 
control 37-12,1 

37,38 

31,32 

32 

36, 37 

37-39 

10 I/O library, overview; Data 



CEKBF 

CHCIA 

CHCIB 
CHCIE 

CHCIF 

(see a Is 
Conversion routines) 
conversion code 39-12 
parenthesis 38 r 39 
repetition factor 38 
scale factor 3 9 



91 



statement, operations involving 

(see FORMAT control) 
string 37,38 
table 38 f 39 
FORMAT Processor (CHCIF) 37-39 
calls from other routines 
CHCIA 31 f 32 
CHCIE 36 f 37 
CHCIU 42 
(see also I/O library, overview) 
flowchart 69 
Format-V records 34 
Formatted READ 37-42,8 
Formatted WRITE 37-42 
with list 10 
without list 11 
FORTRAN 

compiler 31, 35 

CEKBF routine 37,38 

SYSPFMT entry point to CEKBF 37,38 
data management 87,88 

combinations of DSORG and 

RECFM 87,88 
logical records 88 
unformatted logical records 88 
(see also Data Control Block) 
source statements 14 
Fraction- I/O involving 39,42 
FRXPD entry name 25 
FRXPI entry name 25 
FRXPJ entry name 25 
FRXPR entry name 25 
Functional flow 

I/O library routines 7 
mathematical library subprograms 4,5 
Function values of mathematical 

subprograms 14-23 
Functions 

mathematical subprograms 14-21 
service subprograms 26-29 

G conversion code 40-42 
GAMMA subprogram 19,5 
GATE 

DCB 33 
I/O 29,33,34 

macro instruction facility 29,33,34 
GATRD macro instruction 3 4 
GATWR macro instruction 33,34 
General Input Conversion (CHCIS) 41 
calls from other routines 
CHCID 35 
CHCIF 37,38 

(see also I/O library, overview) 
flowchart 81 
General Output Conversion (CHCIT) 4 2 
calls from other routines 
CHCID 35,36 
CHCIF 37,38 
CHCIN 40 

(see also I/O library, overview) 
flowchart 82 
GET macro instruction 34 
GTWRC macro instruction 34 



H conversion code 38 

Header and trailer records in NAMELIST 



output 36 
Hexadecimal input conversion (see 

Alphameric and Hexadecimal Input 

Conversion) 
Hexadecimal output conversion (see 

Alphameric and Hexadecimal Output 

Conversion) 
Hollerith format controls 42 
Housekeeping functions, I/O 43 
Hyperbolic sine and cosine 

subprograms 17,5 
Hyperbolic tangent subprograms 19,5 



I conversion code 38, 39 
I/O Control (CHCIC) 33-35 

calls by other routines 30 
CHCIA 31,32 
CHCID 35 
CHCIE 37 
CHCIF 37 
CHCIU 42 
CECIW 30 

(see also I/O library, overview) 
flowcharts 50-67 
I/O Initialization (CHCIA) 30-32 
called by FORTRAN compiler 35,66 
flowchart 50 

(see also I/O library, overview) 
I/O Interruption and Machine Indicator 

Routine (CHCBD) 41 
I/O library 30-42,2-13 

calling relationships 6,7 
housekeeping functions 42 
internal relationships 3-13 
overview 2,3-13 
subdivisions 3 
(see also I/O routines) 
I/O list control routines 3,7 
I/O operation control routines 3,7 
I/O operations (see BACKSPACE operation; 
END FILE operation; PRINT operation? PUNCH 
operation; READ operation; REWIND 
operation; WRITE operation; WRITE 
Initialize operation) 
I/O PSECT 42 
I/O routines 30-42,2-13 
attributes 30 
names 30,89 
P SECTS 30 
save areas 30 
work areas 30 

(see also Data Conversion routines) 
I/O services control routines 3,7 
I/O statement (see I/O operations) 
Indirect-reference mathematical 

subprograms 25 ,1 , 2,14 
Indirect-reference service subprograms 2 
INOUT (OPEN option) 34 
INPUT (OPEN option) 34 
Integer input conversion (see Real and 

Integer Input Conversion) 
Integer Output Conversion (CHCIH) 39 
calls from other routines 
CHCIF 37,38 
CHCIT 42 

(see also I/O library, overview) 
flowchart 71 



Index 95 



Integer result, how passed 14 
Interrupt and Machine Indicator Routine 
CCHCBE) 26-28,4 
flowcharts 44-46 
Item length 37 
Item type 15-23,36-41 



JFCB (Job File Control Block) 33 



KEYLEN values 32 



L conversion code '41 
Label, data set 89 
Left parenthesis 35 
Linkage 

I/O routines 30 

(see also I/O Communication) 
mathematical subprograms 14 
service subprograms 26 
(see also Calling relationships) 
List control 2,3 

flag in DCB prefix 32 
(see also I/O library, overview; List 
Item Processor) 
List item 36-42 
binary 39 
complex 40 

double- precis ion 39 f 4 
floating-point 39,40 
single-precision 39 
List Item Processor CCHCIE) 30,36-37 
called by FORTRAN compiler 31 

Csee also I/O library, overview) 
flowchart 70 
List processing Csee List control) 
List Termination CCHCIU) 30,42 
called by FORTRAN compiler 31 
flowchart 86 

Csee also I/O library* overview) 
Literal" character string 42 
Log-gamma and gamma subprograms 19,5 
Logical constats 41 
Logical Input Conversion (CHCIG) 41 
calls from other routines 
CHCIF 37,38 
CHCIS 41,42 

(see also I/O library, overview) 
flowchart 82 
Logical Output Conversion CCHCIR) 41 
calls from other routines 
CHCIF 37,38 
CHCIT 42 

(see also I/O library, overview) 
flowchart 83 
Logical record 90 
CHCIC 34 
CHCID 35 
CHCIE 37 
CHCIF 39 



Macro instructions 
BSP 33,35 
CEKT1. . .CEKT6 25 



CEKZA 25 
CEKZD 25 

CLOSE 35 

GATK facility 
(JATWR 33,34 
GATRD 33,34 
GTWRC 3 4 

GET 33,34 

in I/O library 3 3 

in mathematical library 25 

NOTE 33,35 

OPEN 34,35 

POINT 33,35 

PUT 33,34 

READ 33 

SAVE 25 

SETL 33-35 

STOW 33 

WRITE 33,34 
Mathematical library 14-25,2-5 

ca 1 1 i ng rela t i uns h I. us 4 , 5 

i n 1 1 .• i na 1 re 1 at i on sh i p s 2-5 

overview 2-5 

s u b divisions 2 
Ma t heiua tica 1 sub pr 09 ra ma 14-2 5 , 1 

a ecu racy f igur es 1 5-19, 23, 2 4 

arguments 15-23 

attributes 14 

computations l\>--23 

definitions ( descript ive 
eq ua t i on s ) 1 L ) - 2 3 

d i r e ct -referenc <= 15-2 b 

e n t r y name s 15-25,91 

e nt 1 y paramete r s 1 4 

equations 15-23 

error action 14 

exit parameters 14 

functions 14-21 

i nd i r ect-refere nee 2 3-25 

int i'-r relationships 4 , 5 

overview 3-5 

pui p-^ses 15-23 

storage estimates 15-23 

tables 4,5,15-21 
Minus sign, I/O involving 39- m 



n field' 39 

N conversion code u2 

NAM EL I ST 

control* 1,3 

CHCIA 31,32 

CIIC IB 32 

CHCIC 3 4 

CHCID 35 # 36 

CilCIS- 32 

(see also I/O library, overview) 
d im ension prod u c t 3 6 
format for our put 3 6 
•header and trailer records 36 
input 36 
name 35, 36 
notation 36 
out put 3 6 
record 35 

s tat ement ( s et< NAMKL1S T con tro 1 ; 
t a b i e 3 5 f 3 6 
• 1 1 a tier and heu d ex records 3 1 



96 



variable 36 

(see also NAMELIST Processor) 
NAMELIST Processor (CHCID) 35,36 

called by CHCIA 31,32 

Csee also I/O library, overview) 

flowcharts 68-69 
Names 

I/O routines 30 # 91 

mathematical subprograms 14-23,91 

service subprograms 27,91 
Natural and common logarithm 

subprograms 15,4 
Non-format -V records 34 i 
Notation, NAMELIST 36 
NOTE macro instruction 35 



OPEN macro instruction 
Output buffer 34 
Overview 2-13 



34,35 



Packed decimal conversion 39 

Padding 34,39 

Parameter lists (general information) 

I/O routines 30 

mathematical subprograms 14 

service subprograms 26,28-30 
Parenthesis 35,38,39 
PAUSE subprogram 29-30 

(see also Exit Routine; I/O library, 
overview) 
PDUMP subprogram 29 

(see also Dump Routine; I/O library, 
overview) 
Physical record 37,90 
POINT macro instruction 35 
Powers of ten, table 39 
PRINT operation 7 

CHCIA 31 

CHCIE 36 

CHCIU 42 

(see also I/O library, overview) 
Program interruptions 26 
PSECTs 

I/O routines 30,91 

(see also I/O Communications) 

mathematical routines 23,91 
label generation 1 

locations passed in register 13 25 
PUNCH operation 7 

CHCIA 31 

CHCIE 36 

CHCIU 42 

(see also I/O library, overview) 
PUT macro instruction 34 



Quote 42 



Range of data field 39, 40 
READ macro instruction 33 
Read-only data set 34 
READ operation 31-42 

formatted 8 

with list 8,9 

with NAMELIST 9 






without list 8,10 
unformatted 9,10 
(see also I/O library, overview) 
Real argument (notation) 23 
Real and Integer Input Conversion 
(CHCII) 39 

calls from other routines 

CHCIF 37,38 - ^ 

CHCIM 4 
CHCIS 41, 42 

(see also I/O library, overview) 
flowchart 75 
Real Output Conversion (CHCIJ) 40 
calls from other routines 
CHCIF 37,38 4 

CHCIT 42 r . ;j 

(see also I/O library ^ overview) 
flowcharts 73,74 
Real result, how passed 14 
RECFM (see Record format) 
Record format (RECFM) ^ r 

DSORG considerations 8^^0,32 
format- V 34 t \ 

non-format-V 34 
Records 

blocked 34,35 
logical (see Logical record) 
physical 90,37 
unblocked 35 
Register save areas (I/O routines) 30, % 
Repeat constant 35 
Repetition factor, FORMAT 38 
Repetition notation for NAMELIST J/O 36 
Return parameters (see Exit parameters) 
REWIND operation 13 c , 

CHCIA 31,32 r 

CHCIC 33-35 

(see also I/O library, overview) 
Right parenthesis 38,39 
Routine names 
I/O 91,30 

(for list, see Table of Consents) 
mathematical 91,14-21 > n£ & 

for indirect-referent : , lco 
subprograms 21,25 i- 

service subprograms 26-29* t * 

s field 40-42 u 

Save areas for I/O routines 30 

(see also I/O Coram#ni cation) 
SAVE macro instruction 25 
Scale factor, FORMAT 39 
Sense light subprograms (SLITE, 

SLITET) 26-28 
Service subprograms 26-29,2 ^; 

attributes 27 

entry names 26,27 

entry parameters 26 

error checks 26-27 

parameters 26 
SETL macro instruction 35 
Sign of number, I/O involving 39-41 
Significant digits 42 
Simple variable 36 
SIN subprogram 17,5 
Sine and cosine subprograms 

hyperbolic 17,5 

trigonometric 17,5,16 



Index 97 



Single-precision 

a rgument ( not at i on > 2 3 

list item 39 
SINH subprogram 17 f 5 
Size of data field 39,40 
SLITE and SX»IT£T subprograms 26-28 
Source program (see User program) 
Spaces, in FORMAT I/O 3 8 

(see also Blanks) 
Spanning 34,90 

Specification Exception Handler 26-28 
Square root subprograms (CSQRT, CDSQRT, 

DSQRT, SQRT) 15 f 4 
STOP subprogram 29 f 30 

(see also Exit Routine? I/O library, 
overview) 
Storage estimates 

mathematical subprograms 15-23 

service subprograms 27 
STOW macro instruction 33 
Subdivision, array 36 
Subscripted variable 36 
Subscripts 35,36 
Supervisor 6 
SVC instruction 30 
SYNAD exit 33 f 89 
Syntax of FORMAT string 37,38 
SlfSIN 33 
S3TSLIB 1 
SYSOUT l t 3 

CHCIB 33 

CHCIW 29 

CHCIX *2 
SYSPFffT entry point to CEKBF 37 f 38 
System entry na»e 21,23,25 
Syste» interruption handler 2 8 



T conversion code 38,41 
Table of powers ten 40 
TUN subprogram 17 f U 
Tangent subprograms 

hyperbolic 1 9 f 5 

trigonometric 17, t* 
TANH subprogram l i *,5 
Task Supervisor 3*) 
Ten, powers of* <-) 
Seminal entry to HftMBLIST table 36 



Trailer and header records in NAME LI ST 

output 36 
Trigonometric sine and cosine 

subprograms 15-17,5 
Trigonometric tangent subprograms 17,4 
Truncation, in I/O 41 
Type ( r ea 1 , intege r , e t c « ) 3 t - i l 2 t l *j -23 

Unblocked records 35 

Unformatted FORTRAN logical records 90 
Unformatted READ 9,10,33 

with list 9 

without list 10 
Unformatted WRITE 12 
UPDATE (OPEN option) 3 4 
User entry name 2 4 
User program 30,36,37 

diagram showing interface with I/O 
library 6 



VAM 34,35 
Variable 

class 15-23,36 

location 36 

name 35 f 36 

NAMELIST 36 
■simple 36 

subscripted 36 

type IS- 21, 36 
Virtual Access Method (VAM) 34,35 
VPAM data set 34 



w field 39-43 

width of data field 38-42 

Work areas (see PSECTs) 

WRITE Initialize operation 34,35 

WRITE macro instruction 34 

WRITE operation 31-42 

•formatted 10, 11, 3 4 

with list 10-12,36 

with NAMELIST 11,34,36 

without list 11,12 

u n f o nna tt ed 12 

Csee also I/O library, overview) 

Z conversion code 41,42 
Zoned decimal conversion 39 



m