You are on page 1of 359

Application Programmer’s Library

Reference Manual, Volume 1


004–2165–002
    "! #%$&'  !()+* #+! ,.-/ 102 )(&0234(534"623478,9 (+:;' #.<='>='? )(@ +34A34>B:;' C#+>>D3
A3E=A>7F<=!347G #%'#;B)> :H<#+ 3?(I(=34":;")J3?7KD>L! #)'!>MD>ONP"))3E#C=34 :L (5(I"#Q>BF" ! #L$&'  !()=* #!,
R > )"#+(SB2 + (2:;' #.<='M'A3D'(5347P#T:L')34 'A3E=A>7F<=!347L>'7' =)347GB)A :U*WV8V8VPF)7G?XX Y,  ? Z2! " +2[W!\+? ZD>Q +3
* #+(5)  <=)3]>BV8 34! )"!'8' #+7PV 3?!)A #+ ! (&VF#+> #+3434 ()2* #+! ,.98+3^*)V8V8VP)'_>34(2#+`A34()=#(I D  LBW' #7aNP 1'(5()<:;3#+` ' D"  GBW78' :;'>3?(
A34()<="J #+OB)A :U 3^A34'7834 b (+:; (5 #)34 =A3?)'?)"#cB2(I' 7d #+BW":;') #%A34()<= ) #eB)A :U 3== '! 3E:;3E#M' #7T! #+)3?fF #Q  (<D" !')  #+,
* #+BW> :;')  #L (&A3E=A>7<!347gNP  h +3=34 :L (5(5 #Q>B +3*)V8V8V8,

i * jc* 9V8kL-mlTkn02V8I902*W89Vko02*W$&pq9 i V8$&VFlTk


r 5( 3E+7F<= ! '?)"#2>78 (5! >()<=A3D>L 3^$& 6234 #:;3E#+"(q()<D>sW34!2)/A34(5) !)  #+(m'(&(I3?BW  Q #% +3^0+ )(& #%k&')'K! ' <=(I3'+t-/0
Z, ZZu e'#78v #%(5 :; "'?q>()<=!!3?(I(5>! ' <=(534(S #% +3t-/0w2q #; 3^kmxmk+k&x]Ve8lK-/I-Ht-/0LI<8= 3:;3E#)(I, r #.<D ()347T y+)(
A34(534"62347K<#+7834@ +3=  + i ' NP(&B2 +3 r #+ )3?7P)')34(5,2#)'!)>vF:;' #.<=BW'! <=A34S (& "! #L$&' + ! ()=* #+! , +zXX-m:/  +34')A3
R _yNaF, j{<#)' #T|& 3ENS2-H X ?Yu Y?,

-m<=)>)'(I_w #+y2=t> == 'I=' C-/7' +' 2F>B) =' `}2uWj R += ' >u5 02* #+BW":/+02*Wv~4w€A‚ƒq 62' pa5„2 i D! j RR -m=A3E#) !3k2
 r/R V802 ir 59V80w r lT*Wxm5„2u)j R V-m=' #+7 r lT*W=x]v:L_O'A3aB)347834 ' LA3?> (5)34A347G) '73E:L'_>(S' #+7G834!' <=(53#]NT>_w(I)')  #% (&' #
(5 ' #7=* ==8jP9>=t>X ==t 9>2t 98Z2t 9 #+8<=E3E#+j{'? #+)3E#'#!391> ()2=x]5' `-m# :;')  #e98+3?'?)3? += ' `- RR +' G=X 
' G?Xk+= ' L††P:/= " #+CI2(5)3E:/+= '2k&>!W== 'GV i +' C‡5X ' O‡X(I32= ' i #+_ ' OlPˆm52' 2v02V8V i D'"' #.
' G5u)j R +' Lk+u)9X ' L5|a 2' O9X = '`98Yk++' O98YVF' >9<=)> 2' C„2u)j R == '`„+jc5== ' >u)Z* jP8|9>
km34 623? #/ +3=NP34q,.,w, =k&$&' <=(5()+k&>!W62 3N@+VFjckm5=$& w'02 #+y+paVF„2-/0w+*Wxm5.lPk‰34 34(lT3? NT>_Okm (5_&-/ 'y
lT3? NT>_`ˆ<=3E<= #OVF#.6+ A#:;3E# lT34 NT>_`ˆ<=3E<= #+^98>"(J=x i lTVF9>02ˆ]5+V8$ i km0w5jd-/09VF r/R V0 i * lPƒ8
5(5)3E:Šjc' #)3E#+' #!3]' #+7G023:;>J3=9134(5) #OVF#.62"A#.:L3E#+ .91 <=(5)347 r lT*Wxm5'#7 r lP*)x]&jP-m„‹'?E3K) '73:;'_w(@>B' L023?(I3?'?E!W.
i , i , , 2'SNa+> L Na#347T()<D(5 78 ' ;>B+ " ! #L$&' +"!()=* #+! ,

$&*M (q'g)'783E:;'_g>B "! #L$&' + ! ()+* #!,*W02* „n' #+7P ! #L$& '  !(@'?E3A34w (5)34A347T) '73:;'_w(@' #+7P +3F" ! #L$&'  !(& >>` (q'
) '73E:L'_/>B "! #%$&'  !()+* #+! ,

k&%"(S'g)'783E:;'_OB2= #+)A>km')'^5(5)3E:L(J=* #+! ,+kmV8 r/i 902* „2.|-m„2=' #+7K|j{g'A3a)'783E:;'_w(@>Bk& w )'V8Œ <= :L3E#+
"= '?)"#,2V802XK (&')'783E:L'? _C>BVFjP-OF5* #+! ,+VF9>-"(S'g)'783E:;'_OB2V9>-ŽI2(5)3E:;()=* #!,*Wj"(S'g)'783E:;'_OB2* #)34 #') #'
F<=(5 #+3?(I(Mj{'!W+ #+34(S"= '?)"#,jc* R g (&')'783E:L'? _C>B>j{* R g= :/<=)34@I2(5)3E:;(5, r lT* „n (&'KA34w (5)34A347G)'783E:L'? _/ #% +3 r #+ )3?7
)')34(@'#7T> +34q! <#+)"34()M "!3E#(I3?7d34fF! <(I 6234 d A<=yT„&v8x+=3E#Q= :/=' #. i :;")3478,„&vx=3E#L"(q'A34>"(I)3?A347G)'783E:;'_OBw„&vx=3E#
:O='# i )78,.„hc #+78N‘I2(5)3E:’' #7G +3=„n73E6+ !3^'A3) '73:;'_w(&>B>983x=3E#Q$&A<=,

98+3 r lT*W=x]`=34 ') #+O()(5)3E:“ (&734 62347dB)A : r lP* „=”e52(I)3:Ž|=,498+3 r lT*W=x]a =34') #+e()(5)3E:• (&' (5]D'(5347P #e='? 2 #Q +3
tw<=  ;834 _>34 3EQBW NT'A3km (5) D><=) #c[)8k&\.<#7834= ! 3E#+(53aBWA :Š98+3^0234>3#+)(&B2 +3 r #+ 6234(5  G>B=' "B)> #+"',
New Features

Application Programmer’s Library Reference Manual, Volume 1 004–2165–002

–&—q˜A™Pšn›1œqS›1žmŸS™¡w¢?˜A£™P¤I—qQ¥G¦S¦SžA˜A¡>›1¤ ˜A§œ©¨&˜A£¢›1¢?ª‰«I§+¢T¬/¢›8ª=¨&˜A£™T­q® ­q®&–&—q%¡>—q›1œq¯™P¤I§‹¤I—qhšn›1œqS›1ž&›1¢y%Ÿ&¤ ›1˜AžAŸ


£žA§+°%®
±c°²¡>§œq³=¢?™˜A§œ´¢y§S¤ ˜Aœq™P›1¢y%›1³=›1˜AžA›1£žAh«I§+¢eµ5¶KµI·¸™ª=™¤Išn™1®m¹2 ­8»=¼K›1œqŸ ­1»¼®
IEG2MIPSº VAX2MIPSº
±c°²»»=µI½¾žA›1ª¢?™d›1¢y%›1³›8˜AžA›1£žAQ«I§+¢eµ5¶KµI·¸™ª=™¤Išn™1®m¹2 ­1»¼g«I§¢eŸ&¤ ›1˜AžA™1®&µ5œ©›1ŸSŸ&˜A¤I˜A§+œq¿q›%œq°
¢y§+¢Tšn™™›1¯Q™º ¤I¢?˜Aœq¯^®m¹
¢y§S¤ ˜AœqQ°c›1™P›1Ÿ&ŸÀ°c—q˜A¡w—Àšn›8¦S™d›1œ‰¢?¢y§¢eœqSšn£=¢e¤ §n›1œ´¢INTRO_FFIO ­8¬O¼K«I§¢/Ÿ&¤ ›1˜AžA™M®
ffstrerrorº
Record of Revision

ÁqÂ8ÃÄ8Å>Æ2Ç ÈÉÂ8ÄÊ8ÃÅyË`ÌÅ>Æ2Ç

Íq® Î ½L¡>¤ §£¢CÍ1Ï1Ï1Ð


½L¢?˜A¯˜Aœq›1žmÑS¢˜Aœq¤ ˜Aœq¯]®&–&—q˜A™Pšn›1œqS›8žm™S¦S¦S§+¢¤ ™G¤ —qQÑS¢y§¯¢?›1šnšn˜Aœq¯‰Ò&œq³=˜A¢y§œqšnœq¤gÍ® Î{¢yžA›1™=®
Ó›1œqª‰§+«a¤ —qQ¢y§+S¤I˜Aœq™G˜Aœ©¤ —q˜A™Pšn›1œqS›1žm°c¢yh§¢?˜A¯˜Aœq›1žAžAªn¦S¢?˜Aœq¤IŸŽ˜Aœ©¤I—qnÔ`Õ;ÖI×aØ;ÙnÚÛ>Ü?ÝIÜ?Þ>ß
à=Þ>ßáqâÞyáãOäaã å>ã?Ü ã?ßæFã^çèÞ>ß=âÞ>éê¿q¦SS£žA˜A¡w›8¤I˜A§+œÀ¹¶aë1Î1ì1í1Ïq®

Îq® ì ±c§+³šn£¢CÍ1Ï1Ï1î
¶K¦S¢˜Aœq¤^¤ §n™S¦S¦S§+¢¤a¤ —qQÑS¢y§¯¢?›1šnšn˜Aœq¯©Ò&œq³˜A¢ §œqšnœq¤^Îq® ì{¢yžA›1™=®

­q® ì ïISœqQÍ8Ï1Ï1í
¶K¦S¢˜Aœq¤^¤ §n™S¦S¦S§+¢¤a¤ —qQÑS¢y§¯¢?›1šnšn˜Aœq¯©Ò&œq³˜A¢ §œqšnœq¤^­q® ì{¢yžA›1™=®S–&—qc¹—q›1¢yŸÀӍšn§¢?ª
¨&˜A£¢›8¢ªð¢y§S¤ ˜Aœq™ ¹2ñcÓÒ&Ó¼K›1¢y%Ÿ&«I¢¢yŸSœq¤I˜AžS›{žA›1¤ ¢T¢yžA›1™Q§œ´µI¶KµI·ò™ª™¤Išn™1®
º
­q® Í ¥;S¯S™¤Í1Ï1Ï1ó
¶K¦S¢˜Aœq¤^¤ §n™S¦S¦S§+¢¤a¤ —qQÑS¢y§¯¢?›1šnšn˜Aœq¯©Ò&œq³˜A¢ §œqšnœq¤^­q® Í{¢yžA›1™=®S–&—qc¦S¢?˜Aœq¤IŸ¤ ô¤§+«
¤I—q˜A™Pšn›8œqS›1žm°c›1™dšn›8Ÿ&Q›1³=›1˜AžA›1£žAh˜Aœ©¦@§™¤I™¡>¢?˜A¦S¤ ® ¦S™¼a«I§+¢š‹›1¤K§+œqžAª‹«I§+¢T¤ —q˜A™P¢yžA›1™=®
º
­q® ­ ïISžAª‹Í1Ï1Ï8Ï
¶K¦S¢˜Aœq¤^¤ §n™S¦S¦S§+¢¤a¤ —qQÑS¢y§¯¢?›1šnšn˜Aœq¯©Ò&œq³˜A¢ §œqšnœq¤^­q® ­{¢yžA›1™=®S–&—qc¦S¢?˜Aœq¤IŸ¤ ô¤§+«
¤I—q˜A™Pšn›8œqS›1žm°c›1™dšn›8Ÿ&Q›1³=›1˜AžA›1£žAh˜Aœ©¦@§™¤I™¡>¢?˜A¦S¤ ® ¦S™¼a«I§+¢š‹›1¤K§+œqžAª‹«I§+¢T¤ —q˜A™P¢yžA›1™=®
º

004–2165–002 i
About This Guide

–&—q˜A™G¦SS£žA˜A¡w›8¤I˜A§+œoŸ&§+¡wSšnœq¤I™P»§¢?¤I¢?›1œqõI¡>›1žAžA›1£žAh™S£¦S¢y§+¯=¢?›1šn™P›1œqŸ¢y§+S¤I˜Aœq™
›1³=›1˜AžA›1£žA%¤I§‹S™¢™G§+«a¤ —qQ¬O¢?›1ª¨&˜A£™G¦S¢y§+Ÿ&S¡>¤I¿@°c—q˜A¡>—©˜A™T˜Aœq¡>žASŸ&ŸŽ˜Aœ©¤ —q
ÑS¢y§+¯=¢?›1šnšn˜Aœq¯©Ò&œq³=˜A¢y§œqšnœq¤ Ñ&ÒS¼K­q® ­c¢yžA›1™=®
º
–&—qh¬O¢?›1ª=¨S˜A£=™T¦S¢y§+Ÿ&S¡>¤g¡>§+œq¤I›1˜Aœq™P™³=¢?›1žmžA˜A£¢›8¢˜A™ö¤ —qcžA˜A£¢?›1¢?ª‹¢y§S¤ ˜Aœq™G¡w›8œ©£
¡>›1žAžAŸ«I¢y§š÷™§S¢y¡>%¡w§+Ÿ&Q°c¢˜A¤ ¤Iœ©˜Aœ©›{œqSšn£¢O§+«g¦S¢y§+¯=¢?›1šnšn˜Aœq¯‰žA›1œq¯S›1¯=™¿
˜Aœq¡>žASŸ&˜Aœq¯o»=§+¢?¤I¢?›1œq¿q¬/¿@ÑS›1™¡w›8žA¿@›1œqŸÀ›1™™šn£žAªnžA›1œq¯S›1¯=®m–&—qQ˜Aœq«5§+¢?šn›1¤I˜A§+œ´˜Aœ©¤ —q˜A™
Ÿ&§+¡>Sšnœq¤K™S¦S¦SžAšnœq¤I™P˜Aœq«I§+¢šn›8¤I˜A§+œ´¡>§œq¤ ›1˜AœqŸ˜Aœ©§+¤I—q¢Ošn›1œqS›1žA™P§«g¤ —q
ÑS¢y§+¯=¢?›1šnšn˜Aœq¯©Ò&œq³=˜A¢y§œqšnœq¤Ÿ&§+¡wSšnœq¤I›1¤ ˜A§œ©™¤F®
–&—q˜A™G˜A™P›{¢y«I¢yœq¡>hšn›1œqS›1ž&«I§¢e›1¦S¦SžA˜A¡>›1¤ ˜A§+œ©›1œqŸ™ª™¤Išø¦S¢y§¯¢?›1šnšn¢?™1®]¶K›8Ÿ&¢?™
™—q§+SžAŸ›1žA™§n—q›1³=%›{°c§+¢ù˜Aœq¯‰ùœq§°cžAŸ&¯=L§+«g˜A¤I—q¢e¤I—qQúG±cµ5¬/½L¹¿qú;±cµI¬O½;¹&ûšnù¿@§+¢
úG±cµ5·‘§+¦S¢?›1¤I˜Aœq¯‹™ª™¤Išü›1œqŸ›{°c§+¢ù˜Aœq¯‰ùœq§°cžAŸ&¯=%§«¤I—qQ»§¢?¤ ¢›1œ©§¢C¬
¦S¢y§+¯¢›1šnšn˜Aœ¯ožA›1œq¯S›1¯=®
ÑS§+¢¤ ˜A§œq™G§«¤I—q˜A™Pšn›1œqS›8žm›1¢y%£›1™Ÿ§œ‰šn›1¤I¢˜A›1žA™d¢y¦S¢y§+Ÿ&S¡>ŸŽ§+¢e›1Ÿ&›8¦S¤IŸÀ«I¢y§+š
µIÒ&Ò&Ò¹2¤ ŸÍ1ì1ì1­q® Ï8ë1Í1Ï1Ï1Î8¿q¡>§¦Sª¢?˜A¯=—q¤ ¡>¼KÍ1Ï1Ï8Î{£ª‰¤ —qQµ5œq™¤ ˜A¤IS¤ c§«Ò&žA¡>¤I¢?˜A¡>›1ž]›8œqŸ
Ò&žA¡w¤ ¢y§+œq˜A¡w™dÒ&œq¯=˜Aœq¢?™¿qµ5œq¡®S–&—qcµIÒ&º Ò&Ò¤I›1ù™Tœq§n¢y™¦S§+œq™˜A£˜AžA˜A¤Iª‰«I§+¢e›1œqŸ°c˜AžAž]›1™™Sšn
œq§nžA˜A›1£˜AžA˜A¤Iª‰«I§¢OŸS›1šn›1¯™d¢y™SžA¤ ˜Aœq¯o«I¢y§+šý¤ —qQ¦SžA›1¡>šnœq¤K›1œqŸ¡>§+œq¤IôM¤˜Aœ©¤ —q˜A™
¦SS£žA˜A¡>›1¤ ˜A§œa®mµ5œq«I§+¢?šn›1¤I˜A§+œ´˜A™T¢y¦S¢y§+Ÿ&S¡>ŸŽ°c˜A¤I—o¤I—qh¦S¢?šn˜A™™˜A§œ©§«¤I—qQµIÒ&Ò&Ò`®

Documentation Organization
–&—qh¦S¢˜Aœq¤ ŸÀ³¢™˜A§+œq™G§+«a¤ —qQ›1¦S¦SžA˜A¡>›1¤ ˜A§+œÀžA˜A£¢›1¢?ª‹šn›1œÀ¦@›1¯=™d›8¦S¦S›1¢O˜Aœ©Î{³=§žASšn™
›1œqŸŽ›1¢y%¯¢y§S¦@Ÿ›1¡>¡>§+¢yŸ&˜Aœq¯©¤ §n¤ §¦S˜A¡>™1®&¹Q¤ —q ­1»¼ašn›1œo¦S›1¯
«I§+¢TŸS¤I›8˜AžA™d›8£=§+S¤a¤I—qh¡>§œq¤ œq¤ ™T§+«g›1¡>—©³=§žASšn® INTRO_APPLIBSº
Ò&›8¡w—´¤ §¦S˜A¡;™¡w¤ ˜A§+œ©›1žA™§n—q›1™T›1œ´˜Aœq¤ ¢y§Ÿ&S¡>¤ §¢?ªnšn›1œÀ¦S›8¯=Q°c—q˜A¡>—oô¦@žA›1˜Aœq™d¤I—q
¡>§+œq¤Iœq¤ ™d§+«g¤I—qQ™¡>¤ ˜A§œ©›8œqŸ¦S¢y§+³˜AŸ&™;§+¤ —q¢C˜Aœq«I§+¢?šn›1¤I˜A§+œ´›1£§+S¤a¤I—qQS™›1¯%§+«g¤I—q§+™
¢y§+S¤I˜Aœq™M®]–&—qQ«I§žAžA§+°c˜Aœq¯n˜Aœq¤I¢y§+Ÿ&S¡>¤I§+¢ªošn›1œo¦S›1¯™P›1¢y%›1³=›1˜AžA›1£žA=þ
­1»=¼ ­1»¼
INTRO_CONVERSIONº INTRO_PROGAIDSº
­1»¼ ­1»¼
INTRO_FFIOº INTRO_PXFº
­1»¼ ­8»=¼
INTRO_HEAPº INTRO_SORTSEARCHº
­8»=¼ ­1¼
INTRO_INTERFACEº INTRO_STREAMSº
­1»¼ ­1»¼
INTRO_IOº INTRO_SYNCº

004–2165–002 iii
Application Programmer’s Library Reference Manual, Volume 1

Related Publications
–&—qh«5§+žAžA§+°c˜Aœq¯‰Ÿ&§+¡>Sšnœq¤I™P¡>§+œq¤I›1˜êœÀ›8Ÿ&Ÿ&˜A¤I˜A§+œq›1žS˜Aœq«5§+¢?šn›1¤I˜A§+œ´¤ —q›1¤ašn›1ªn£%—qžA¦S«ISžyþ
ÿ ÙãáGã?ß=ÝaàÛ>Þ1ã?Ü5Ù Cà;ä KÞ>ßcé häKã åã?Ü ã?ß=æãçèÞ>ßâ=Þ>é
ÿ Ô/ÕGÖI×KØGَÔ4ã?Üe×aÛ;Þ>ßCäKã å>ã?Ü ã?ßæFã^çèÞwßâÞwé
ÿ Câ 1ãOÝIÛ&ÞwÜ4Þ>éêéêã?é+ã?æÝIÛwÜ1é WæFÞ>ÝêÛ>ß
ÿ Þ1ãTÙâ "!#?ÝIã" Ô?ã?Ü $ %Câ&1ã
ÿ Ô/ÕGÖI×KØGÙnÙ!?ÝIã"à&Ü4ÞwÜ'êã"OäKã å>ã?Ü ã?ßæFã^çèÞwßâÞwé
ÿ Ô/ÕGÖI×KØGÙnÙ!?ÝIã"×KÞ>éêé&Cäaã å>ã?Ü ã?ßæFã^çèÞ>ß=âÞ>é
ÿ 1é&êæÞwÝêÛ>ß(&Ü Û áqÜ?Þ)Gã?Ü*$ eÖ,+4Ø-Câ&1ã
ÿ Ø)8Ý )&.Wßá/1é&êæÞwÝêÛ>ߋ×aÛ8ãeÛ>ߎÔ`Õ;ÖI×aØ;ÙoÙ!#?ÝIã")
–&—qh«5§+žAžA§+°c˜Aœq¯ðšn›1œqS›1žA™dŸ&§+¡>Sšnœq¤^¤I—qQ¬/¢›1ª¨&˜A£™T¦S¢y§+Ÿ&S¡w¤®]¥;žAž&šn›1œo¦S›1¯™P˜Aœ‰¤ —q™
šn›1œqS›8žA™d¡>›1œÀ›1žA™§ð£h³=˜A°cŸ§œqžA˜Aœq%£ª‰S™˜Aœq¯‰¤I—q ¡>§šnšn›1œqŸgþ
man
ÿ Ùæ0êã4ß=Ý 1gæPà .Ü?Þ>Ü"!häKã å>ã?Ü ã?ßæFã^çèÞwßâÞwé
ÿ ÖIß=ÝIÜ'êß'êæ2&Ü Û>æFã"1âÜ ã"Cäaã å>ã4Üyã?ßæFã^çèÞ>ß=âÞ>é
ÿ Ùæ0êã4ß=Ý 1gæPà .Ü?Þ>Ü"Wã"OäKã?Þ!%äKã å>ã?Ü ã?ßæFã
ÿ 1é&êæÞwÝêÛ>ß(&Ü Û áqÜ?Þ)Gã?Ü*$ eà&.Ü?Þ>Ü"!cäaã?Þ!{äaã å>ã?Ü ã?ßæFã
µIœ´›8Ÿ&Ÿ&˜A¤I˜A§+œ´¤ §n¤ —q™%Ÿ&§+¡wSšnœq¤I™¿@™³¢›1žmŸ&§+¡wSšnœq¤I™P›1¢y%›1³=›1˜AžA›1£žA%¤I—q›1¤]Ÿ&™¡>¢˜A£
¤ —qc¡>§+šn¦S˜AžA¢C™ª™¤Išn™d›1³›8˜AžA›1£žAQ§+œ´ú;±hµ5¬O½;¹{›1œqŸŽú;±hµ5¬O½;¹Sû2šnù]®S¹2§+šn%§«¤I—q™
šn›1œqS›8žA™d›1¢y=þ
ÿ ×aÚ34häKã?Þ!%äKã å>ã?Ü ã?ßæFã
ÿ ×aÚ34h×KÛ)GÞ>ßCÞ>ß/)WÜyã4æFÝ 51ã'Cäaã å>ã4Üyã4ß=æãKçèÞ>ß=âÞ>é
ÿ ÚÛwÜ4Ý5Ü4Þwßnà=Þ>ßáqâÞyáãOäaã å>ã?Ü ã?ßæFã^çèÞ>ß=âÞ>é 6 Û>éêâ;ã27
ÿ ÚÛwÜ4Ý5Ü4Þwßnà=Þ>ßáqâÞyáãOäaã å>ã?Ü ã?ßæFã^çèÞ>ß=âÞ>é 6 Û>éêâ;ã28
ÿ ÚÛwÜ4Ý5Ü4Þwßnà=Þ>ßáqâÞyáãOäaã å>ã?Ü ã?ßæFã^çèÞ>ß=âÞ>é 6 Û>éêâ;ã29
ÿ ×aÜ?Þ!{×+4× : :©äKã å>ã?Ü ã?ßæFã^çèÞwßâÞwé

iv 004–2165–002
About This Guide

–&—qh«5§+žAžA§+°c˜Aœq¯‰šn›1œqS›8žA™dŸ&§+¡wSšnœq¤¤ —qc¡>§+šn¦S˜AžA¢?™T¤I—q›8¤K›8¢yh›8³›1˜Ažê›1£žAh§œ´µI¶KµI·
™ª™¤ šn™1þ
ÿ çèÖ&Ù&ÜyÛ;{ÚÛ>Ü?ÝIÜ?Þ>ß<34h×aÛ);Þ>ßCÞ>ß=)êÜ ã?æÝ 51ã"eäKã åã?Ü ã?ß=æãçèÞ>ßâ=Þ>é
ÿ çèÖ&Ù1ÜyÛ"4ã").é !hà=Þ>ßáqâ=Þ áqã&Ü ÛyáÜ?Þ)Gã?Ü*$ Câ&1ã
ÿ çèÖ&Ù1ÜyÛ;ÚÛwÜ4Ý5Ü4Þwß>;;hà=Þ>ßáqâÞyáãeäKã åã?Ü ã?ß=æãçèÞ>ßâ=Þ>é
ÿ çèÖ&Ù1ÜyÛ;ÚÛwÜ4Ý5Ü4Þwß>;;=&Ü ÛyáÜ?Þ)Gã?Ü*$ Câ&1ã
ÿ çèÖ&Ù1ÜyÛ)?@AB WÝC&Û>Ü?Ýêßá©Þ>ß  Ü4Þwß"WÝDWÛwß>Câ 1ã

Obtaining Publications
¹FEdµ`šn›8˜Aœq¤I›1˜Aœq™T˜Aœq«I§+¢?šn›1¤I˜A§+œ´›1£§+S¤a›1³›8˜AžA›1£žAh¦SS£žA˜A¡>›1¤I˜A§+œq™P›1¤¤I—qQ«I§+žAžA§°c˜Aœq¯nú;¶a¨`þ

http://techpubs.sgi.com/library
–&—q˜A™HG‰£ð™˜A¤I%¡>§œq¤ ›1˜Aœq™C˜Aœq«5§+¢?šn›1¤I˜A§+œ‰¤I—q›8¤^›1žAžA§+°c™Tª=§+´¤ §ð£¢y§+°c™%Ÿ&§¡>Sšnœq¤ ™e§+œqžA˜Aœq¿
§+¢yŸ&¢eŸ&§¡>Sšnœq¤ ™¿S›8œqŸ™œqŸ«IŸ&£›1¡>ù‰¤ §n¹FEdµ®JIq§+¡>›1œo›1žA™§n§¢yŸS¢T›%¦S¢˜Aœq¤ ŸŽ¹FEdµ
Ÿ&§+¡>Sšnœq¤K£ª‰¡>›1žAžA˜Aœq¯‹Í{ó1ì1ì/K8Î1ícÏ1­1ì8íq®
–&—qoÔ?ã4Ü%&â.é êæÞwÝWÛwßC×KÞ>ÝIÞ>éêÛ á©Ÿ&™¡>¢˜A£™P¤ —qc›1³=›1˜AžA›1£˜AžA˜A¤ ª‹›1œqŸ¡>§œq¤ œq¤K§«›1žAž]¬O¢?›1ª
—q›1¢yŸS°{›8¢yc›1œqŸ™§+«5¤ °c›1¢ycŸ&§+¡wSšnœq¤I™P¤ —q›1¤a›1¢y%›1³=›1˜AžA›1£žAL¤I§‹¡wS™¤ §šn¢?™1®m¬OS™¤I§+šn¢?™
°c—q§‰™&£™¡>¢?˜A£=%¤ §n¤ —qQ¬O¢?›1ªnµIœq«I§¢?š ¬/¶KµIœq«I§¢?šn¼a¦S¢y§+¯¢›1šü¡w›8œ›8¡w¡>™™T¤ —q˜A™
˜Aœq«I§+¢šn›8¤I˜A§+œ´§+œ´¤I—qQ¬/¶Kµ5œq«I§+¢?š÷™ª™¤Išº Ž®
¹FEdµ`šn›8˜Aœq¤I›1˜Aœq™T˜Aœq«I§+¢?šn›1¤I˜A§+œ´§+œ´¦SS£žA˜A¡>žAªn›1³=›1˜AžA›1£žA%¬O¢?›1ªoŸ&§+¡wSšnœq¤I™P›1¤¤ —q
«I§+žAžA§°c˜Aœq¯©úG¶K¨`þ

http://www.cray.com/swpubs/
–&—q˜A™G‰£‰™˜A¤I%¡>§+œq¤I›1˜Aœq™P˜Aœq«I§+¢?šn›1¤I˜A§+œ´¤ —q›1¤a›1žAžA§+°c™Tª=§+¤I§‹£¢y§°c™%Ÿ&§+¡wSšnœq¤I™P§+œqžA˜Aœq
›1œqŸŽ™œqŸ´«IŸ&£›1¡>ù‰¤ §o¹LEdµF®8–2§ð§+¢yŸ&¢T›{¦@¢˜Aœq¤ Ÿ¬/¢›8ªnŸ&§+¡>Sšnœq¤I¿q˜A¤ —q¢e¡>›1žAž
M ÍNK1î8Í/K1ó1­cî8Ï1ì1íc§¢e™œqŸ›{«I›1¡>™˜Ašn˜AžA%§+«aª§S¢C¢yJO=S™¤K¤ §n«I›1ôɜqSšn£¢
M ÍNK1î8Í/K1ó1­c­8ó1Ð1ìq®&¹LEdµgšn¦SžA§+ª=™Tšn›1ªn›1žA™§n§+¢yŸ&¢e¦S¢?˜Aœq¤IŸÀ¬O¢?›1ªoŸ&§+¡>Sšnœq¤I™P£ª
™œqŸ&˜Aœq¯o¤I—q˜A¢e§¢yŸS¢?™d³=˜A›cžA¡>¤I¢y§+œq˜A¡Lšn›1˜Až&¤ § ®
orderdsk
¬/&™¤ §šn¢™d§+S¤I™˜AŸ&%§+«a¤ —qcúGœq˜A¤IŸ¹2¤ ›1¤ ™d›8œqŸ¬O›1œq›8Ÿ&›c™—q§SžAŸ¡>§+œq¤I›1¡>¤¤ —q˜A¢ežA§+¡>›1ž
™¢?³=˜A¡wh§+¢y¯›1œq˜QP1›1¤ ˜A§œ©«I§¢e§+¢yŸ&¢?˜Aœq¯‰˜Aœq«I§¢?šn›1¤ ˜A§œ©›1œqŸŸ&§+¡>Sšnœq¤I›8¤I˜A§+œ´˜Aœq«I§¢?šn›1¤ ˜A§œa®

Conventions
–&—qh«5§+žAžA§+°c˜Aœq¯‰¡>§+œq³œq¤I˜A§+œq™G›8¢yhS™Ÿ´¤ —q¢y§S¯—q§S¤g¤ —q˜A™PŸ&§+¡wSšnœq¤Fþ

004–2165–002 v
Application Programmer’s Library Reference Manual, Volume 1

¬ § œ ³ œ ¤˜§ œ Ó › œ ˜œ ¯
–&—q˜A™HRSôŸSõ5™¦S›1¡>%«I§+œq¤aŸ&œq§¤ ™džA˜A¤ ¢?›1ž]˜A¤ šn™T™&¡>—©›1™
command ¡>§šnšn›8œqŸ&™¿SR&žA™¿q¢y§+S¤I˜Aœq™¿@¦S›1¤ —©œq›1šn™¿@™˜A¯œq›1žA™¿
šn™™›1¯™¿q›1œqŸÀ¦S¢y§¯¢?›1šnšn˜Aœq¯‰žA›1œq¯=S›8¯=h™¤ ¢S¡>¤ &¢ ™1®
51Þ>Ü"WÞ.éWã µ5¤ ›1žA˜A¡;¤ ª=¦S«5›8¡wQŸ&œq§+¤I™d³=›1¢?˜A›1£žA%œq¤ ¢?˜A™P›8œqŸ°c§¢yŸ&™
§+¢e¡>§œq¡>¦S¤ ™T£˜Aœq¯‰Ÿ&*R&œqŸ`®
–&—q˜A™P£§žAŸ&¿SRSôŸ&õI™¦S›8¡wQ«5§+œq¤aŸSœq§¤ ™PžA˜A¤I¢?›1ž]˜A¤ šn™
user input
¤ —q›1¤a¤I—qQS™¢eœq¤ ¢?™P˜Aœ©˜Aœq¤ ¢›8¡w¤ ˜A³=%™™™˜A§+œq™1®
½;S¤I¦SS¤K˜A™T™—q§+°{œ©˜Aœ©œq§+œq£§+žAŸ&¿RSôMŸ&õI™¦S›1¡>%«I§œq¤®
µIœ´›8Ÿ&Ÿ&˜A¤I˜A§+œ´¤ §n¤ —q™%«I§¢?šn›1¤ ¤I˜Aœq¯o¡>§+œq³œq¤I˜A§+œq™¿q™³¢›1žmœq›1šn˜Aœq¯‹¡>§+œq³œq¤I˜A§+œq™d›1¢y
S™Ÿ¤ —q¢y§+S¯=—q§+S¤g¤I—qQŸS§¡>Sšnœq¤ ›1¤I˜A§+œa®UT1¬/¢›8ªnÑ VCÑÀ™ª=™¤ šn™XWhŸ&œq§+¤ ™d›1žAž
¡>§+œR&¯S¢›8¤I˜A§+œq™G§+«a¬/¢›1ª‰¦S›1¢?›1žAžAž]³=¡>¤ §¢C¦S¢y§+¡>™™˜Aœq¯ ÑYVCÑS¼™ª=™¤Išn™d¤I—q›8¤K¢?Sœo¤I—q
úG±cµ5¬/½L¹ð§¦S¢›1¤ ˜Aœq¯n™ª™¤ šŽ® T8¬O¢?›1ª©ÓÑSÑÀ™ª™¤ šn™XW{º Ÿ&œq§+¤I™T›8žAž]¡>§œRS¯&¢?›1¤ ˜A§œq™d§«
¤ —qc¬/¢›8ªn–&­1ҍ™¢˜A™P¤ —q›1¤a¢Sœo¤ —qQú;±cµI¬O½;¹&ûšnùo§+¦S¢?›1¤I˜Aœq¯‹™ª™¤IšŽ® T1µ5¶aµ5·
™ª™¤ šn™XW{Ÿ&œq§+¤I™d¹FEdµa¦SžA›1¤I«I§+¢?šn™;°c—q˜A¡>—o¢Sœo¤ —qQµ5¶KµI·è§+¦S¢?›1¤ ˜Aœq¯n™ª=™¤ šŽ®
–&—qhŸ&«I›1SžA¤™—qžAž]˜Aœ©¤ —qQú;±cµI¬O½;¹‹›1œqŸúG±cµI¬O½;¹&ûšnùn§+¦S¢?›1¤ ˜Aœq¯©™ª™¤Išn™¿q¢y«I¢¢ Ÿ
¤ §o›1™P¤ —q?ÝIÞwß1Þ>Ü"N"Z1ã?éWé꿘A™T›{³¢™˜A§+œ©§«¤I—q=[e§+¢?œ©™—qžAž]¤ —q›1¤^¡>§œq«I§+¢šn™G¤ §n¤ —q
«I§+žAžA§°c˜Aœq¯©™¤ ›1œqŸ&›1¢yŸ&™1þ
ÿ µ5œq™¤ ˜A¤IS¤ %§+«aÒ&žA¡w¤ ¢?˜A¡w›8ž]›1œqŸÒSžA¡>¤I¢y§+œq˜A¡>™GÒ&œq¯˜Aœq¢?™ µIÒ&Ò&Ò&¼KÑ&§+¢?¤I›1£žAQ½L¦@¢?›1¤I˜Aœq¯
¹ª=™¤ šøµ5œq¤ ¢«I›8¡w ÑS½;¹µ5·a¼¹2¤ ›1œqŸ&›8¢yŸŠÍ1ì1ì8­q® Î1ë1Í1Ï8Ï1Î º
º
ÿ ·Tû2½;¦SœoÑS§¢?¤I›8£=˜êžA˜A¤Iª>EdS˜AŸ&¿qµI™™S%Ð º ·aÑ EdÐ8¼
–&—qQú;±hµ5¬O½;¹{›1œqŸ©ú;±cµI¬O½;¹&ûšnùn§+¦S¢?›1¤ ˜Aœq¯n™ª=™¤ šn™T›8žA™§É™S¦S¦S§+¢¤]¤I—qQ§+¦S¤ ˜A§œq›1žSS™
§+«g¤I—qQ¬U™—qžAžy®

Man page sections


–&—qhœq¤I¢?˜A™T˜Aœ©¤I—q˜A™PŸS§¡>Sšnœq¤K›8¢yh£›1™ŸŽ§+œo›{¡>§šnšn§+œ©«I§¢?šn›1¤®m–&—qQ«5§+žAžA§+°c˜Aœq¯‰žA˜A™¤
™—q§+°{™d¤I—qQ§+¢yŸ&¢e§«g™¡>¤ ˜A§œq™e˜Aœ©›1œ´œq¤ ¢?ª‰›1œqŸŸ&™¡>¢?˜A£™P›1¡>—©™¡>¤I˜A§+œa®&Ó§™¤aœq¤ ¢?˜A™
¡>§+œq¤I›1˜Aœ´§+œqžAª‰›{™&£™¤^§«¤I—q™%™¡>¤ ˜A§œq™1®

¹ ¡ ¤˜§ œ — › Ÿ ˜œ ¯ \ ™ ¡ ¢ ˜¦ ¤˜§ œ
±c¥GÓÒ ¹¦S¡>˜QRS™G¤ —qQœq›1šnQ§+«g¤I—qQœq¤ ¢?ª‰›1œqŸ£¢?˜AJ]&ª‹™¤I›1¤ ™
˜A¤ ™d«ISœq¡>¤I˜A§+œa®
¹FIK±h½LÑS¹µ5¹ ÑS¢y™œq¤ ™d¤ —qc™ªœq¤I›1ôc§«¤I—qhœq¤ ¢ªM®
µIӍÑS¨&Ò&ÓÒ&±h–+¥O–&µI½L± µ5ŸSœq¤I˜QRS™T¤ —qc™ª™¤ šn™d¤ §n°c—q˜A¡>—©¤ —qQœq¤ ¢ªn›1¦S¦SžA˜A™1®

vi 004–2165–002
About This Guide

¹–+¥G±/\G¥;¶ \;¹ ÑS¢y§³=˜AŸ&™G˜Aœq«5§+¢?šn›1¤I˜A§+œ‰›1£§S¤a¤ —qc¦@§¢?¤I›1£˜AžA˜A¤ ª‰§+«a›


S¤I˜AžA˜A¤ ªn§+¢e¢y§S¤ ˜Aœq=®
\GÒ&¹¬O¶aµ5ÑS–&µ5½;± \G˜A™¡wS™™™d¤ —qQœq¤ ¢ª‰˜Aœ©ŸS¤I›8˜Ažy®
±c½;–&Ò&¹ ÑS¢y™œq¤ ™d˜A¤ šn™d§«¦S›1¢?¤I˜A¡>SžA›1¢C˜Ašn¦S§+¢¤ ›1œq¡>=®
¬/¥;úG–mµI½;±c¹ \G™¡>¢˜A£™d›1¡>¤I˜A§+œq™d¤ —q›1¤a¡>›1œ©Ÿ&™¤ ¢y§+ªnŸ&›1¤ ›É§¢
¦S¢y§+Ÿ&S¡>hSœqŸ&™˜A¢yŸ¢y™SžA¤ ™M®
G©¥;¶a±cµI±/Ed¹ \G™¡>¢˜A£™d›1¡>¤I˜A§+œq™d¤ —q›1¤a¡>›1œ©—q›1¢?š÷¦@§¦@žA¿
JO=S˜A¦@šnœq¤I¿@§+¢e™ª™¤ šü™§+«I¤I°c›1¢y®
Ò&±=VCµ5¶K½;±cÓÒ&±c– \G™¡>¢˜A£™d¦S¢yŸ&JRSœqŸ™—qžAž]³=›1¢?˜A›1£žA™T¤ —q›1¤
VS¥G¶KµI¥)^&¨&Ò&¹ Ÿ&¤ ¢?šn˜Aœqh™§+šnQ¡>—q›1¢?›1¡>¤I¢˜A™¤ ˜A¡w™P§«g¤ —qQ™—qžAž]§¢/¤ —q›1¤
›1««I¡w¤¤I—qh£—q›1³=˜A§+¢C§«™§+šnh¦S¢y§+¯¢›1šn™¿@¡>§+šnšn›1œqŸ&™¿
§+¢eS¤I˜AžA˜A¤ ˜A™1®
¶aÒ&–&ú;¶a±_VS¥G¨&úGÒ&¹ \G™¡>¢˜A£™d¦S§™™˜A£žAQ¢y¤IS¢?œÀ³=›1žAS™d¤I—q›1¤]˜AœqŸ&˜A¡>›1¤Ic›
žA˜A£¢?›1¢ª‰§¢/™ª=™¤ šý¡>›1žAžmôM¡>S¤IŸ™S¡>¡w™™«ISžAžAª>¿q§+¢
˜AŸ&œq¤ ˜QRS™G¤ —qQ¢?¢y§+¢T¡>§œqŸS˜A¤I˜A§+œ´SœqŸ&¢O°c—q˜A¡>—À˜A¤
«I›1˜AžAŸ`®
Ò&·aµ5–Ž¹–+¥/–&ú;¹ \G™¡>¢˜A£™d¦S§™™˜A£žAQô˜A¤a™¤I›1¤ S™d³=›1žAS™d¤ —q›1¤a˜AœqŸ&˜A¡>›1¤I
°c—q¤ —q¢O¤I—qh¡>§šnšn›1œqŸ´§¢eS¤ ˜AžA˜A¤IªoôM¡>S¤IŸ
™S¡w¡>™™«ISžAžAª®
ÓÒ&¹¹2¥EdÒ&¹ \G™¡>¢˜A£™d˜Aœq«5§+¢?šn›1¤I˜A§+œq›1žA¿qŸ&˜A›8¯=œq§+™¤I˜A¡>¿q›1œqŸ¢?¢y§+¢
šn™™›1¯™d¤ —q›1¤ašn›1ªn›1¦@¦S›1¢®S¹žA«IõIôM¦SžA›1œq›1¤ §¢?ª
šn™™›1¯™d›1¢y%œq§+¤žA˜A™¤ Ÿ`®
Ò&¶a¶K½;¶K¹ \G§¡>Sšnœ¤I™d¢¢y§+¢T¡>§+Ÿ&™1®m¥G¦S¦SžA˜A™T§+œqžAª‰¤ §n™ª=™¤ š
¡>›1žAžA™1®
»½;¶m–&¶K¥G± \G™¡>¢˜A£™d—q§° ¤I§‹¡w›8žAžm›{™ª=™¤Išü¡>›1žAžm«I¢y§+šý»§¢?¤I¢?›1œa®
Ò&·a–&Ò&±c¹µ5½;±c¹ ¥;¦@¦SžA˜A™d§œqžAªð¤I§o™ª™¤Išø¡w›8žAžA™M®
^&úEd¹ µ5œqŸS˜A¡w›8¤I™dùœq§°cœo£S¯™G›1œqŸŸSJRS¡w˜Aœq¡w˜A™M®
Ò&·a¥;ÓÑS¨&Ò&¹ ¹—q§°c™dôM›1šn¦SžA™d§+«aS™›1¯=®
»µ5¨&Ò&¹ ¨&˜A™¤I™HRSžA™G¤ —q›1¤^›8¢yh˜A¤I—q¢T¦@›1¢¤K§+«a¤ —qQœq¤ ¢ªn§¢e›8¢y
¢yžA›8¤IŸ¤I§‹˜A¤F®

004–2165–002 vii
Application Programmer’s Library Reference Manual, Volume 1

¹Ò&Ҏ¥G¨&¹½ ¨&˜A™¤I™Pœq¤ ¢˜A™P›1œqŸÀ¦SS£žA˜A¡w›8¤I˜A§+œq™;¤ —q›1¤^¡>§+œq¤I›1˜Aœ´¢yžA›1¤IŸ


˜Aœq«I§¢?šn›1¤ ˜A§œa®

Reader Comments
µI«gª§+—q›8³Q¡w§+šnšnœq¤ ™P›8£=§+S¤a¤I—qQ¤ ¡>—qœq˜A¡>›1ž^›1¡>¡>S¢›8¡wª¿S¡>§œq¤ œq¤ ¿§¢C§¢y¯›1œq˜QP1›1¤ ˜A§+œ´§+«
¤ —q˜A™;ŸS§¡>Sšnœq¤ ¿@¦@žA›1™%¤IžAžmS™1®Y^&c™S¢yh¤ §n˜Aœq¡>žASŸ&L¤ —qc¤ ˜A¤IžA%›8œqŸ¦S›1¢?¤œqSšn£¢C§«
¤ —qcŸS§¡>Sšnœq¤^°c˜A¤I—Àª§S¢C¡>§šnšnœq¤I™1®
I§¡>›1œ©¡>§œq¤ ›1¡>¤S™G˜Aœ©›1œqª‰§+«a¤ —qh«5§+žAžA§+°c˜Aœq¯‰°c›1ª™1þ
ÿ ¹œqŸõIšn›1˜Ažm¤ §n¤ —qQ«I§žAžA§+°c˜Aœq¯n›1Ÿ&Ÿ&¢y™™1þ

techpubs@sgi.com
ÿ ¹œqŸ›h«I›1ôɤ §n¤ —qh›1¤I¤ œq¤ ˜A§œ©§+« T8–M¡>—qœq˜A¡w›8ž]ÑSS£žA˜A¡w›8¤I˜A§+œq™XWc›1¤Fþ M ÍNK8î1ìcÏ1­1Îhì1ó1ì1Íq®
ÿ ú;™L¤I—qh»Ÿ&£›1¡>ùn§+¦S¤I˜A§+œ©§œ´¤ —qQ–M¡w—qœq˜A¡>›1žmÑSS£=žA˜A¡>›1¤ ˜A§+œq™;¨S˜A£=¢?›1¢?ª<G‰§+¢žAŸ`G˜AŸ&
G‰£‰¦@›1¯=þ

http://techpubs.sgi.com
ÿ ¬O›8žAžm¤I—qQ–¡>—qœq˜A¡w›8ž]ÑSS£žA˜A¡w›8¤I˜A§+œq™HEd¢y§+S¦S¿@¤ —q¢y§+S¯=—©¤I—qh–M¡w—qœq˜A¡>›1žm¥;™™˜A™¤I›1œq¡>
¬Oœq¤I¢ ¿S™˜Aœq¯‰§+œqh§«¤I—qQ«I§+žAžA§°c˜Aœq¯nœqSšn£¢?™Mþ
»§¢C¹LEdµaµI¶KµI·ò£›1™ŸŽ§+¦S¢?›1¤I˜Aœq¯‹™ª™¤Išn™Mþ&Íhó1ì1ìhó1ì1ìÉÐ1¹FEdµ
»§¢Cú;±cµI¬O½;¹É§+¢eúG±cµ5¬/½L¹Sûšnùn£›1™Ÿ§¦S¢›1¤ ˜Aœq¯n™ª™¤ šn™d§+¢e¬O¢?›1ª‹½L¢?˜A¯˜AœÀÎ1ì1ì1ì
™ª=™¤ šn™1þmÍhó8ì1ìcÏ1î1ìhÎ1í1Î1Ï ¤I§+žAžm«5¢yh«I¢y§+šý¤ —qQú;œq˜A¤ Ÿ¹¤ ›1¤I™d›1œqŸŽ¬O›8œq›1Ÿ&›1¼^§¢
º
M ÍNK1î1Í=K1ó1­cîK8ì1ì
ÿ ¹œqŸšn›1˜Až&¤ §n¤ —qc«I§+žAžA§°c˜Aœq¯n›1Ÿ&Ÿ&¢y™™1þ
–1¡>—qœq˜A¡w›8ž]ÑSS£žA˜A¡w›8¤I˜A§+œq™
¹FEdµ
ÍK1ì8ì{¥Gšn¦S—q˜A¤I—q›1¤I¢yQÑSù=°cª®
Ó§Sœq¤ ›1˜AœaVK˜A°T¿q¬O›8žA˜A«5§+¢?œq˜A›cÏ1Ð1ì1Ð8­1ë1Í1­1î1Í
G©h³=›1žAS%ª§+S¢e¡>§šnšnœq¤I™T›1œqŸ°c˜AžAž]¢y™¦S§+œqŸ¤I§‹¤I—qšü¦@¢y§šn¦S¤ žAª2®

viii 004–2165–002
CONTENTS

Introductory page

intro_applibs, INTRO_APPLIBS ..................... Introduction to CrayLibs Application Libraries ............................................ 1

Calling Sequence
callseq .................................................................... Details the calling sequence for UNICOS systems ....................................... 3

I/O routines
intro_io, INTRO_IO ............................................. Introduction to Fortran-callable I/O routines ................................................ 9
acptbad, ACPTBAD .................................................. Makes bad data available ............................................................................ 19
aqclose, AQCLOSE .................................................. Closes an asynchronous queued I/O file ..................................................... 22
aqopen, AQOPEN, AQOPENM .................................... Opens a file for asynchronous queued I/O .................................................. 23
aqread, AQREAD, AQREADC .................................... Queues a simple or compound asynchronous I/O read request .................. 25
aqrecall, AQRECALL ............................................. Waits for completion of asynchronous queued I/O request ........................ 27
aqstat, AQSTAT ...................................................... Checks the status of asynchronous queued I/O requests ............................ 29
aqwait, AQWAIT ...................................................... Waits for completion of asynchronous queued I/O requests ...................... 31
aqwrite, AQWRITE, AQWRITEC ............................ Queues a simple or compound asynchronous I/O write request ................. 32
asnctl, ASNCTL ...................................................... Controls function of ASSIGN, ASNFILE, ASNUNIT, and ASNRM
routines ........................................................................................................ 34
asnqfile, ASNQFILE, ASNQUNIT ........................ Returns the assign options currently in effect for a file name or
unit number ................................................................................................. 36
assign, ASSIGN, ASNUNIT, ASNFILE, ASNRM ... Provides library interface to assign processing ....................................... 38
asyncms, ASYNCMS, ASYNCDR ............................... Sets I/O mode for random-access routines to asynchronous ...................... 40
checkms, CHECKMS, CHECKDR ............................... Checks status of asynchronous random-access I/O operation ..................... 42
checktp, CHECKTP .................................................. Checks tape position .................................................................................... 44
closev, CLOSEV ...................................................... Closes volume and mounts next volume in Volume Identifier list ............ 45
closms, CLOSMS, CLOSDR ...................................... Writes master index and closes random-access file .................................... 46
endsp, ENDSP ........................................................... Disables special tape processing ................................................................. 48
findms, FINDMS ...................................................... Reads record into data buffers used by random-access routines ................ 49
flush, FLUSH ........................................................... Writes data buffered by Fortran output statements to a file ....................... 51
fsup, FSUP, ISUP .................................................... Suppress values in Fortran edit-directed output .......................................... 53
gettp, GETTP ........................................................... Gets information about an opened tape file ................................................ 54
getwa, GETWA, SEEK ............................................... Synchronously and asynchronously reads data from the
word-addressable, random-access file ......................................................... 57
gtstdptr, GTSTDPTR ............................................. Returns pointer to standard file ................................................................... 59
numblks, NUMBLKS .................................................. Returns the current size of a file in 4096-byte blocks ................................ 60
openms, OPENMS, OPENDR ...................................... Opens a local file as a random-access file that can be accessed or
changed by the record-addressable, random-access file I/O routines ......... 61
putwa, PUTWA, APUTWA ........................................... Writes to a word-addressable, random-access file ...................................... 64
read, READ, READP .................................................. Reads words, full or partial record modes .................................................. 66
readc, READC, READCP ........................................... Reads characters, full or partial record mode ............................................. 68
readibm, READIBM .................................................. Reads two IBM 32-bit floating-point words from each Cray Research
64-bit word .................................................................................................. 70
readms, READMS, READDR ...................................... Reads a record from a random-access file to memory ............................... 71
rnl, RNLFLAG, RNLDELM, RNLSEP, RNLREP,
RNLCOMM .................................................................... Manipulates characters recognized by NAMELIST ..................................... 73
rnlecho, RNLECHO .................................................. Specifies output unit for NAMELIST error messages and echo lines ......... 75

004– 2165– 002 ix


rnlskip, RNLSKIP .................................................. Takes appropriate action when an undesired NAMELIST group is
encountered .................................................................................................. 76
rnltype, RNLTYPE .................................................. Determines action if type mismatch occurs across equal sign on
NAMELIST input record ............................................................................. 77
setsp, SETSP ........................................................... Enables and disables EOV processing ........................................................ 78
settp, SETTP ........................................................... Positions a tape file at a tape block and/or a tape volume ......................... 79
skipbad, SKIPBAD .................................................. Skips bad data ............................................................................................. 81
skipf, SKIPF ........................................................... Skips files .................................................................................................... 83
startsp, STARTSP .................................................. Enables special tape processing .................................................................. 85
stindx, STINDX, STINDR ...................................... Allows an index to be used as the current index by creating a
subindex ....................................................................................................... 86
syncms, SYNCMS, SYNCDR ...................................... Sets I/O mode for random-access routines to synchronous ........................ 88
tsync, TSYNC ........................................................... Requests tape synchronization ..................................................................... 90
waitms, WAITMS, WAITDR ...................................... Waits for completion of an asynchronous I/O operation ............................ 91
wclose, WCLOSE ...................................................... Finalizes changes and closes word-addressable, random-access file .......... 93
wnl, WNLFLAG, WNLDELM, WNLSEP, WNLREP ....... Provides user control of NAMELIST output format ................................... 94
wnlline, WNLLINE .................................................. Allows each NAMELIST variable to begin on a new line ......................... 96
wnllong, WNLLONG .................................................. Selects NAMELIST output line length ........................................................ 97
wopen, WOPEN ........................................................... Opens a word-addressable, random-access file ........................................... 98
write, WRITE, WRITEP ........................................... Writes words, full or partial record mode ................................................. 100
writec, WRITEC, WRITECP .................................... Writes characters, full or partial record mode .......................................... 102
writibm, WRITIBM .................................................. Writes two IBM 32-bit floating-point words from each Cray 64-bit
word ........................................................................................................... 104
writms, WRITMS, WRITDR ...................................... Writes to a random-access file on disk ..................................................... 105

FFIO routines
intro_ffio, INTRO_FFIO ................................... Describes performance options available with the FFIO layers ............... 113
ffassign .................................................................. Provides library interface to assign processing ......................................... 127
fffcntl .................................................................... Performs functions on files opened using flexible file I/O ....................... 128
ffiolock, ffiounlock ........................................ Provide locking for FFIO functions .......................................................... 136
fflistio .................................................................. Initiates a list of I/O requests using flexible file I/O ................................ 137
ffopen, ffopens, ffclose, ffopenf,
ffclosef .................................................................. Opens or closes a file using flexible file I/O ............................................ 141
ffpos ......................................................................... Positions files opened using flexible file I/O ............................................ 145
ffread, ffwrite, ffweof, ffweod,
ffreadf, ffwritef, ffweodf, ffweoff,
ffflush .................................................................... Provides flexible file I/O ........................................................................... 149
ffreada .................................................................... Provides asynchronous read using flexible file I/O ................................... 152
ffseek, ffbksp, ffseekf, ffbkspf ................. Repositions a flexible file I/O file ............................................................. 156
ffsetsp .................................................................... Initiates EOV processing for files opened using flexible file I/O ............. 159
ffstrerror, FFSTRERROR ................................... Get FFIO error message string .................................................................. 160
ffwritea .................................................................. Provides asynchronous write using flexible file I/O ................................. 161
glio_group, glio_group_mpi,
glio_group_shmem ............................................... Defines a group of processes to be associated with a global file. ............ 163

PXF library routines


intro_pxf, INTRO_PXF ........................................ Introduction to PXF POSIX library .......................................................... 165
ipxfargc, IPXFARGC ............................................. Returns the number of command-line arguments excluding the
command name .......................................................................................... 170
ipxfwexitstatus, IPXFWEXITSTATUS ............ Returns the lower bits of exit argument ................................................ 171

x 004– 2165– 002


ipxfwstopsig, IPXFWSTOPSIG .......................... Returns part of the lower bits of signal number that terminates child
process ....................................................................................................... 174
ipxfwtermsig, IPXFWTERMSIG .......................... Returns lower bit of signal that terminates a child process ...................... 177
pxfaccess, PXFACCESS ........................................ Checks the accessibility of a named file ................................................... 180
pxfalarm, PXFALARM ............................................. Schedule alarm signal ................................................................................ 182
pxfchdir, PXFCHDIR ............................................. Changes the current directory to a specified directory ............................. 184
pxfchmod, PXFCHMOD ............................................. Sets file modes for a named file ................................................................ 186
pxfchown, PXFCHOWN ............................................. Changes the owner and group of a file ..................................................... 189
pxfchroot, PXFCHROOT ........................................ Changes the root directory to a specified directory .................................. 191
pxfclearenv, PXFCLEARENV ............................... Clears all environment variables ............................................................... 193
pxfconst, PXFCONST, PXFISCONST,
IPXFCONST ................................................................ Returns the value associated with symbolic constants .............................. 195
pxfcreat, PXFCREAT ............................................. Creates a new file or rewrites an existing file .......................................... 199
pxfctermid, PXFCTERMID ................................... Generates terminal pathname .................................................................... 202
pxfdirectory, PXFOPENDIR, PXFREADDIR,
PXFREWINDDIR, PXFCLOSEDIR, .......................... Performs directory operations ................................................................... 204
pxfestrget, PXFESTRGET ................................... Accesses a single string element of a structure component that is an
array ........................................................................................................... 207
pxfexecv, PXFEXECV, PXFEXECVE,
PXFEXECVP ................................................................ Executes a new process image file ............................................................ 209
pxffcntl, PXFFCNTL ............................................. Provides a subset of fcntl(2) functionality, except the third
argument is always an integer ................................................................... 216
pxffileno, PXFFILENO ........................................ Returns the file descriptor for a specified unit .......................................... 218
pxffork, PXFFORK .................................................. Creates a process ....................................................................................... 219
pxfgetarg, PXFGETARG ........................................ Returns a command-line argument ............................................................ 222
pxfgetcwd, PXFGETCWD ........................................ Gets the pathname of the working directory ............................................. 223
pxfgetegid, PXFGETEGID ................................... Gets the effective group ID ....................................................................... 225
pxfgetenv, PXFGETENV ........................................ Returns a value for the environment name ............................................... 226
pxfgeteuid, PXFGETEUID ................................... Gets effective user ID ............................................................................... 229
pxfgetgid, PXFGETGID ........................................ Gets the real group ID ............................................................................... 230
pxfgetgrgid, PXFGETGRGID ............................... Gets group information using the group ID .............................................. 231
pxfgetgrnam, PXFGETGRNAM ............................... Gets group information using the group name ......................................... 233
pxfgetgroups, PXFGETGROUPS .......................... Gets supplementary group IDs .................................................................. 235
pxfgetlogin, PXFGETLOGIN ............................... Gets user name .......................................................................................... 237
pxfgetpgrp, PXFGETPGRP ................................... Gets the process group ID ......................................................................... 239
pxfgetpid, PXFGETPID ........................................ Gets the process ID ................................................................................... 241
pxfgetppid, PXFGETPPID ................................... Gets the parent process ID ........................................................................ 243
pxfgetpwnam, PXFGETPWNAM ............................... Gets password information about login name ........................................... 245
pxfgetpwuid, PXFGETPWUID ............................... Gets password information by using user ID ............................................ 247
pxfgetuid, PXFGETUID ........................................ Gets the real user ID ................................................................................. 249
pxfintget, PXFINTGET ........................................ Allows values stored in individual components of a structure to be
extracted and used ..................................................................................... 250
pxfintset, PXFINTSET ........................................ Allows components of a structure to be set or modified .......................... 251
pxfisatty, PXFISATTY ........................................ Determines if file descriptor corresponds to a valid file descriptor .......... 252
pxfisblk, PXFISBLK ............................................. Tests for block special file ........................................................................ 254
pxfischr, PXFISCHR ............................................. Tests for character special file ................................................................... 256
pxfisdir, PXFISDIR ............................................. Tests for directory file ............................................................................... 258
pxfisfifo, PXFISFIFO ........................................ Tests for pipe or a FIFO special file ......................................................... 260
pxfisreg, PXFISREG ............................................. Tests for regular file .................................................................................. 262
pxflink, PXFLINK .................................................. Creates a link to a file ............................................................................... 264
pxflocaltime, PXFLOCALTIME .......................... Converts to local time ............................................................................... 266

004– 2165– 002 xi


pxfopen, PXFOPEN .................................................. Provides a Fortran interface to the open(2) system call ......................... 268
pxfrename, PXFRENAME ........................................ Renames a file ........................................................................................... 271
pxfrmdir, PXFRMDIR ............................................. Removes a directory entry ........................................................................ 273
pxfsetenv, PXFSETENV ........................................ Sets environment variable pair .................................................................. 275
pxfsetgid, PXFSETGID ........................................ Sets group ID ............................................................................................ 277
pxfsetpgid, PXFSETPGID ................................... Set process group ID ................................................................................. 279
pxfsetsid, PXFSETSID ........................................ Creates a new session for a calling process .............................................. 281
pxfsetuid, PXFSETUID ........................................ Sets user ID ............................................................................................... 283
pxfsleep, PXFSLEEP ............................................. Delays process execution .......................................................................... 285
pxfstat, PXFSTAT .................................................. Retrieves the file status ............................................................................. 287
pxfstrget, PXFSTRGET ........................................ Allows values stored in individual components of a structure to be
extracted and used ..................................................................................... 289
pxfstrset, PXFSTRSET ........................................ Allows values stored in individual components of a structure to be
set ............................................................................................................... 291
pxfstructcopy, PXFSTRUCTCOPY ..................... Copies structure ......................................................................................... 293
pxfstructcreate, PXFSTRUCTCREATE ............ Creates an instance of the desired structure and returns a nonzero
handle in the argument jhandle ................................................................. 295
pxfstructfree, PXFSTRUCTFREE ..................... Deletes the instance of the structure referenced by jhandle ..................... 297
pxfsysconf, PXFSYSCONF ................................... Retrieves the value of configurable system variables ............................... 299
pxftime, PXFTIME .................................................. Gets system time ....................................................................................... 301
pxftimes, PXFTIMES ............................................. Gets process times ..................................................................................... 303
pxfucompare, PXFUCOMPARE ............................... Compares unsigned integers ...................................................................... 305
pxfumask, PXFUMASK ............................................. Sets the file creation mask ........................................................................ 307
pxfuname, PXFUNAME ............................................. Retrieves the operating system name ........................................................ 309
pxfunlink, PXFUNLINK ........................................ Removes a directory entry ........................................................................ 311
pxfwait, PXFWAIT, PXFWAITPID ........................ Obtains information about a calling process’ child process ..................... 313
pxfwifexited, PXFWIFEXITED .......................... Determines if child process exited with exit ......................................... 317
pxfwifsignaled, PXFWIFSIGNALED ................. Determines if the child process terminated because of a signal ............... 319
pxfwifstopped, PXFWIFSTOPPED ..................... Determines if a child process has stopped ................................................ 322
pxfutime, PXFUTIME ............................................. Sets access and modification times of a file ............................................. 325

xii 004– 2165– 002


INTRO_APPLIBS ( 3F ) INTRO_APPLIBS ( 3F )

NAME
INTRO_APPLIBS – Introduction to CrayLibs Application Libraries

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
This manual describes different routines provided in the CrayLibs Application Libraries, which includes
libsma, libf, and libu. A library is a collection of subroutines usually organized around a specific
subject such as I/O. Intrinsic procedures and subprograms are documented in the Intrinsic Procedures
Reference Manual.
The printed versions of the routines appear in two volumes and are grouped according to topics.
Volume 1 contains the following topic sections:
• Calling Sequence: Calling sequences for UNICOS systems.
• I/O Routines: File positioning, auxiliary NAMELIST, logical record, random-access file, asynchronous
queued I/O, output suppression, and BOV/EOV tape processing.
• FFIO Routines: File opening, closing, read, and write for files using flexible file I/O (FFIO).
• Specialized Libraries: POSIX interface routines.
Volume 2 contains the following topic sections:
• Conversion Routines: Foreign file conversion (IBM, CDC, and VAX), numeric conversion, ASCII
conversion, IEEE conversion, and other conversion routines.
• System Interface Routines: Job control, floating-point interrupt, and special purpose interface routines.
• Heap, Table, and SDS Management Routines: Routines for manipulating and managing memory within
heaps, tables, and secondary data segments (SDS).
• Programming Aid Routines: Flowtrace, traceback, dump, exchange package processing, and signal
routines.
• Streams: Hardware streaming routines
• Synchronization Routines: Task, lock, event, and barrier routines.
• Search Routines: Search options to find maximum and minimum elements in vectors.
• Appendix A: C Library Interface Routines: C routines and system calls that provide a C interface to
Fortran programmers.

004– 2165– 002 1


INTRO_APPLIBS ( 3F ) INTRO_APPLIBS ( 3F )

SUBPROGRAM CLASSIFICATION
Unless otherwise noted, all routines in this manual are described as Fortran or C subroutines or functions. In
some cases (for example, SECOND), the routine may be called as either a subroutine or a function. Programs
written in C can call library functions intended for use by Fortran programs. C programmers are responsible
for passing arguments by address and not by value, which is the normal case in C.
C programs can also be written to accommodate Fortran users. Such programs must be written to accept
arguments passed by address rather than by value, which is the normal case in C. The program names must
be in uppercase.
Pascal programs can call library functions intended for use by Fortran programs. Similarly, Fortran codes
can invoke subroutines and functions written in Pascal. Unlike C, the Pascal compiler passes all arguments
by address, and it supports several predefined conversion functions to facilitate communication with Fortran
routines.
For more information on interlanguage calls, see Interlanguage Programming Conventions.

LIBRARY USAGE AND LOADERS


If you created a routine with the same name as a default routine (one described in this manual or in your
Fortran reference manual), your routine will be loaded if you specify it on your loader’s command line. See
the loader reference material for your compiler for more information.

NOTES
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX, all
arguments must be of default kind unless documented otherwise. On UNICOS and UNICOS/mk, default
kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default kind is KIND=4.

SEE ALSO
INTRO_CONVERSION(3F), INTRO_FFIO(3F), INTRO_HEAP(3F), INTRO_INTERFACE(3F),
INTRO_IO(3F), INTRO_PROGAIDS(3F), INTRO_PXF(3F), INTRO_SHMEM(3),
INTRO_SORTSEARCH(3F), INTRO_STREAMS(3), INTRO_SYNC(3F)

2 004– 2165– 002


CALLSEQ ( 3F ) CALLSEQ ( 3F )

NAME
callseq – Details the calling sequence for UNICOS systems

IMPLEMENTATION
UNICOS systems

DESCRIPTION
This section details how subprograms are interlinked while running on UNICOS systems. A subprogram
corresponds to a function in C, a PROGRAM, SUBROUTINE or FUNCTION in Fortran, or a set of
ENTER/EXIT macros in CAL.
Frame
A frame is a contiguous region of memory associated with a subprogram. At a minimum, a frame contains a
pointer to the Traceback Name Block (TNB), the address of the caller (the return address, register B00), the
address of the argument list (register B01), and the address of the caller’s frame (register B02).
All subprograms have a frame except certain low-level (BASELVL) routines (see following).
In a stack environment (the default) the frame is allocated on the stack when the subprogram is invoked and
the memory is released for re-use when the subprogram exits. A stack frame (see figure 1) will also contain
storage for local variables and argument lists. For subprograms that are compiled with a static option, the
frame is allocated at compile-time and is never released. Local variables and argument lists are also
allocated at compile-time, though not as part of the frame.
Static and stack subprograms may call each other, but a static routine should not be called recursively nor
should it be used in a multitasking environment.
Stack
The stack is created prior to entering the main program. The stack is implemented as one or more blocks
(called stack segments) of memory in the user heap. The B66 register points to the current top of the stack;
the B67 register points to the end of the current stack segment. As subprograms are invoked, their stack
frame is created by incrementing the top of the stack by the size of the stack frame. When a stack frame
cannot fit in the current segment this is called a stack overflow, and the stack manager is called to extend the
segment, if possible, or to allocate a new segment from the heap. A link is established between the old and
new segments and processing continues. When exiting subprograms, the top of the stack is decremented by
the size of the stack frame. When a stack segment is empty, it may be returned to the heap.
The stack manager maintains a 128-word pad area beyond the end of the stack within the current stack
segment. This is done so that subprograms can save B and T registers prior to checking for a segment
overflow. If the stack manager must allocate a new segment, the saved B and T registers will be copied to
the new segment. If the stack manager cannot extend a segment nor allocate a new segment to contain a
stack frame, the program terminates with a stack allocation failure.

004– 2165– 002 3


CALLSEQ ( 3F ) CALLSEQ ( 3F )

Traceback
The traceback information is a statically allocated block called the Traceback Name Block (TNB) which is
generated at compile-time. The TNB contains information about each subprogram including its name, the
address of its entry point, and information about the contents of the frame. The subprogram entry sequence
puts the address of the TNB into the first word of the frame (non-BASELVL routines only). The TNB
information can be used by run-time debuggers or to print out a traceback in the event of an abnormal
program termination.
Subprogram Arguments
Most subprograms pass their arguments (both call-by-address and call-by-value arguments) in consecutive
memory locations called an argument list. A one-word Argument List Header (ALH) is added to the
beginning of the argument list. The ALH contains the number of words of arguments (for use by
subprograms which accept a variable number of arguments) and the line number of the caller (for use by
traceback and run-time debugging).
Certain intrinsic functions and VFUNCTIONS do not use an argument list. Instead, they pass arguments
(usually call-by-value) through registers. These subprograms can accept only a limited number of arguments
and do not have access to an ALH. By convention, these subprograms have a percent (%) as the last
character of their name. The arguments are passed through consecutive S registers starting with S1. Note
that each multi-word call-by-value argument requires the corresponding number of registers (for example, a
complex value requires two registers). Vectorized versions of these functions are usually available. By
convention, these vectorized subprograms have a percent (%) has the first and last character of their name.
The arguments to vectorized functions are passed through the V registers in a manner analogous to the scalar
functions. In addition, the VL register contains the vector length.
Function Results
Subprograms expect one-word function results (integers, pointers, floating-point numbers, and so forth) to be
in the S1 register; two-word function results (complex or double-precision) to be in S1 and S2; and a
double-precision complex result is returned in S1 through S4.
Languages which support functions that return aggregates (arrays, structures, and so forth) will pass an
"extra" argument to the function containing the address of the aggregate.
Register Conventions
All registers are considered saved, scratch, or reserved, as follows:
• Saved registers must be saved and restored if used by the subprogram.
• Scratch registers may be used by the subprogram without saving and restoring them.
• Reserved registers must not be used by the subprogram except as outlined below.
The A, S, V, VL, and VM registers are scratch registers. The VL register is also an argument register for
vectorized subprograms where it contains the vector length, but in those subprograms it can otherwise be
treated as a scratch register.

4 004– 2165– 002


CALLSEQ ( 3F ) CALLSEQ ( 3F )

Most of the B and T registers are saved registers. Subprogram linkage information is passed through B
registers (B00 through B02) which are also saved registers. The stack pointers (B66 through B67) are
reserved registers and are altered only during subprogram entry/exit.

Register Status Purpose

B00 saved Return address (parcel form)


B01 saved Pointer to the argument list
B02 saved Pointer to the caller’s frame
B03 through B65 saved Saved B registers
B66 reserved Pointer to the top of the stack
B67 reserved Stack segment limit pointer
B70 through B77 scratch Scratch B registers
T00 through T67 saved Saved T registers
T70 through T77 scratch Scratch T registers

It is important that the saved registers be stored in the proper place in the frame so that traceback, longjump,
and so forth can locate the necessary information.
All of the shared B and T registers are considered scratch registers in non-multitasked programs. In
multitasked programs, SB0 through SB3 and ST0 through ST3 are reserved for use by the multitasking
library and should not be altered; the remaining shared B and T registers are available to the user.
Semaphores SM0 through SM15 are reserved for the multitasking and other run-time libraries and should not
be altered. The remaining semaphores are available to the user.
The matrix in the Bit Matrix Multiply (BMM) functional unit (when present) is considered a scratch register.
BASELVL subprograms
Certain subprograms may utilize a light-weight entry/exit sequence (called BASELVL) to obtain better
performance. However, these subprograms must operate under certain constraints:
• They must be leaf routines; that is, they cannot call other subprograms.
• They must not declare any local (stack) variables.
• They do not have a frame, thus certain traceback/debugging information must be kept in specific registers.
These registers are considered reserved while executing a BASELVL subprogram.

Register Purpose

B00 Return address (parcel form)


B01 -1 (indicates a BASELVL routine)
B77 TNB pointer
A1 Callers argument list pointer

004– 2165– 002 5


CALLSEQ ( 3F ) CALLSEQ ( 3F )

Because BASELVL subprograms do not have a frame, they can execute their entry/exit sequence without
memory references.
Argument List Header
The following table describes the Argument List Header

Field Word Bits Description

ARFLAG 0 0 Nonstandard calling sequence flag (unused)


ARVAL 0 1 0 ≥ call-by-address, 1 ≥ call-by-value
ARCHR 0 2 0 ≥ non-character function; 1 ≥ char. function
ARCHK 0 3 Runtime argument checking flag (1 = on)

TRACEBACK Name Block


The following table describes the Traceback Name Block.
The following table describes the traceback information added before the entry point.

Field Word Bits Description

TNBNN -1 0-63 Last (or only) 8 characters of name.


TNBO 0 0-31 Mandatory zero.
TNBL 0 32-47 Number of following words (excluding this one).
TNBLN 0 48-63 Number of characters in the name. The first character of the name is
contained in the -1 word -ICEIL(TNBLN,8) word of the table.
TNBPA 1 0-63 Parcel address of entry point.
TNBBL 2 0 Base level flag; set if this subprogram makes no calls.
TNBLT 2 1-7 Language type:
0 = cft or cft2
1 = PCC 2.0
2 = Pascal
3 = cft77
4 = CAL
5 = CFT 90
6 = C++
7 = Reserved
8 = SCC (ANSI C)
9 = Ada
10 = Lisp
11 = PCC
TNBCR 2 8-19 Maximum size of parameter list built by this subprogram.
TNBTVS 2 32-63 Size of stack temporary variable store.
TNBSCS 3 0-31 Size of static constant space.

6 004– 2165– 002


CALLSEQ ( 3F ) CALLSEQ ( 3F )

Field Word Bits Description

TNBSVS 3 32-63 Size of static variable space.


TNBNT 4 50-56 Number of T registers.
TNBNB 4 57-63 Number of B registers.
TNBPS 5 0-63 Language-specific information; otherwise unspecified.

SEE ALSO
Cray Assembler for MPP (CAM) Reference Manual, for information about calling sequences on UNICOS/mk
systems.

004– 2165– 002 7


8 004– 2165– 002
INTRO_IO ( 3F ) INTRO_IO ( 3F )

NAME
INTRO_IO – Introduction to Fortran-callable I/O routines

IMPLEMENTATION
See individual man pages for implementation details

DESCRIPTION
The I/O routines include the following:
• Assign processing routines
• File positioning routines
• Auxiliary NAMELIST routines
• Logical record I/O routines
• Random-access file I/O routines
• Asynchronous queued I/O routines
• Fortran-callable tape processing routines involving beginning- and end-of-volume processing
• Miscellaneous I/O routines
• Fortran I/O units

ASSIGN PROCESSING ROUTINES


Assign processing routines provide a library interface to assign processing. See the assign(1) man page
for details about assign processing.
The following routines are available for assign processing.
• ASNCTL(3F): controls functioning of ASSIGN, ASUNIT, ASNFILE, and ASNRM
• ASSIGN(3F): provides interface to assign processing from Fortran
• ASNUNIT(3F): assigns attributes to units (documented on the ASSIGN(3F) man page)
• ASNFILE(3F): assigns attributes to files (documented on the ASSIGN(3F) man page)
• ASNRM(3F): removes all entries in the assign environment (documented on the ASSIGN(3F) man page)
• ASNQFILE(3F): returns attributes for a file
• ASNQUNIT(3F): returns attributes for a unit (documented on the ASNQFILE(3F) man page)

004– 2165– 002 9


INTRO_IO ( 3F ) INTRO_IO ( 3F )

FILE POSITIONING ROUTINES


These routines are not available on IRIX systems.
File positioning routines change or indicate the position of the current file. These routines set the current
positioning direction to input (read). If the previous processing direction is output (write), end-of-data is
written on a blocked sequential file, and the buffer may be flushed. On a random file, the buffer is flushed.
The following routines are used for positioning:
• GETPOS(3I): returns current position of tape or mass storage file (this routine is documented in the
Fortran Language Reference Manual, Volume 3.)
• SETPOS(3I): returns to the position retained from the GETPOS request (documented on the GETPOS(3I)
man page in the Fortran Language Reference Manual, Volume 3.)
• GETTP(3F): receives position information about an opened tape file
• SETTP(3F): positions a specified tape file at a tape block
• SKIPF(3F): skips files
AUXILIARY NAMELIST ROUTINES
NAMELIST routines let you control input and output defaults. No arguments are returned. For a more
complete description of the NAMELIST feature, see the CF90 Commands and Directives Reference Manual.
The following routines are used for auxiliary NAMELIST routines:
• RNLCOMM(3F): deletes or adds a trailing comment indicator (documented on the rnl(3F) man page)
• RNLDELM(3F): deletes or adds a delimiting character (documented on the rnl(3F) man page)
• RNLFLAG(3F): deletes or adds an echo character (documented on the rnl(3F) man page)
• RNLREP(3F): deletes or adds a replacement character (documented on the rnl(3F) man page)
• RNLSEP(3F): deletes or adds a separator character (documented on the rnl(3F) man page)
• RNLECHO(3F): specifies the output unit for error messages and echo lines
• RNLSKIP(3F): takes action when an undesired NAMELIST group is encountered
• RNLTYPE(3F): determines the action if a type mismatch occurs across the equal sign on an input record
• WNLDELM(3F): defines an ASCII NAMELIST delimiter (documented on the wnl(3F) man page)
• WNLFLAG(3F): indicates the first ASCII character of the first line (documented on the wnl(3F) man
page)
• WNLREP(3F): defines an ASCII NAMELIST separator (documented on the wnl(3F) man page)
• WNLLINE(3F): allows each NAMELIST variable to begin on a new line
• WNLLONG(3F): indicates output line length

10 004– 2165– 002


INTRO_IO ( 3F ) INTRO_IO ( 3F )

LOGICAL RECORD I/O ROUTINES


Not available on IRIX systems.
The logical record I/O routines are divided into read routines, write routines, and bad data error recovery
routines. The following routines are used for logical record I/O:
• ACPTBAD(3F): makes bad data available
• READ(3F): reads words, full record mode
• READP(3F): reads words, partial record mode (documented on the READ(3F) man page)
• READC(3F): reads characters, full record mode
• READCP(3F): reads characters, partial record mode (documented on the READC(3F) man page)
• READIBM(3F): reads two IBM 32-bit real number words from each Cray 64-bit word
• SKIPBAD(3F): skips bad data
• WRITE(3F): writes words, full record mode
• WRITEP(3F): writes words, partial record mode (documented on the WRITE(3F) man page)
• WRITEC(3F): writes characters, full record mode
• WRITECP(3F): writes characters, partial record mode (documented on the WRITEC(3F) man page)
• WRITIBM(3F): writes two IBM 32-bit real number words from each Cray 64-bit number word
READIBM(3F), and WRITIBM(3F) are not supported on UNICOS/mk systems.
Read Routines
Read routines transfer partial or full records of data from the external device to the user data area.
Depending on the read request issued, the data is placed in the user data area either 1 character per word or
in full words. In partial mode, the file maintains its position after the read is executed. In record mode, the
file position is maintained after the end-of-record (EOR) that terminates the current record. Operation of
these routines depends on the -F and -s options on the assign(1) command.
Write Routines
Write routines transfer partial or full records of data from the user data area to the external device.
Depending on the write operation requested, data is either taken from the user data area 1 character per word
and packed 8 characters per word or is transferred in full words. In partial mode, no end-of-record (EOR) is
inserted in the external device in the word following the data that terminates the record. Operation of these
routines depends on the -F and -s options on the assign(1) command.

004– 2165– 002 11


INTRO_IO ( 3F ) INTRO_IO ( 3F )

Bad Data Error Recovery Routines


Bad data error recovery routines enable a user program to continue processing a file when bad data is
encountered. Bad data refers to an unrecovered error encountered while the file was being read. Skipping
the data forces the file to a position past the bad data, so that no data is transferred to the user-specified
buffer. Accepting the data causes the bad data to be transferred to a user-specified buffer. The file is then
positioned immediately following the bad data.
When an unrecovered data error is encountered, continue processing by calling either the SKIPBAD or the
ACPTBAD routine.
These routines do not work with foreign data conversion.

RANDOM-ACCESS FILE I/O ROUTINES


These routines are not available on IRIX systems.
Sequentially accessed files are used for applications that read input only once during a process and write
output only once during a process. However, when large numbers of intermediate results are used randomly
as input at various stages of programs, a random-access file capability is more efficient than sequential
access. A random-access file consists of records that are accessed and changed. Random access of data
eliminates the slow processing and inconvenience of sequential access when the order of reading and writing
records differs in various applications.
Random-access file I/O routines let you specify how records of a file are to be changed, without the usual
limitations of sequential access. Choose specific routines based on performance requirements and the type of
access needed.
Random-access files can be created and accessed by the record-addressable, random-access file routines
(READMS/WRITMS and READDR/WRITDR) or the word-addressable, random-access file routines
(GETWA/PUTWA).
Note: Files created by this method are distinct from Fortran direct-access I/O files. Also, random-access file
I/O routines used in a program with segmented programs should reside in the root segment. However, if all
I/O is done within one segment, the routines can reside in that segment.
Record-addressable, Random-access File I/O Routines
These routines are not available on IRIX systems.
Record-addressable, random-access file I/O routines let you generate files containing variable-length,
individually addressable records. These records can be read and rewritten at your discretion. The library
routines update indexes and pointers. The random-access file information is stored in two places: in an
array in user memory and at the end of the random-access file.
When a random-access file is opened, the OPEN routine initializes an array in user memory to contain the
master index to the records of the file. This master index contains the pointers to and, optionally, the names
of the records within the file. Although you provide this storage area, it must be modified only by the
random-access file I/O routines.

12 004– 2165– 002


INTRO_IO ( 3F ) INTRO_IO ( 3F )

When a random-access file is closed and optionally saved, the storage area containing the master index is
rewritten at the end of the random-access file, thus recording changes to the contents of the file.
The following Fortran-callable routines can change or access a record-addressable, random-access file:
OPENMS, WRITMS, READMS, CLOSMS, FINDMS, CHECKMS, WAITMS, ASYNCMS, SYNCMS, OPENDR,
WRITDR, READDR, CLOSDR, STINDR, CHECKDR, WAITDR, ASYNCDR, SYNCDR, and STINDX.
The READDR/WRITDR random-access I/O routines are direct-to-disk versions of READMS/WRITMS. All
input or output goes directly between the user data area and the mass storage file without passing through a
system-maintained buffer. Because mass storage can be addressed only in 512-word blocks, all record
lengths are rounded up to the next multiple of 512 words.
You can intermix READMS/WRITMS and READDR/WRITDR files in the same program, but you must not
use the same file in both packages simultaneously.
OPENMS/OPENDR opens a file and specifies the file as a random-access file that can be accessed or changed
by the record-addressable, random-access file I/O routines. If the file does not exist, the master index
contains zeros; if the file does exist, the master index is read from the file. The master index contains the
current index to the file. The current index is updated when the file is closed using CLOSMS/CLOSDR.
A single program can use up to 40 active READMS/WRITMS files and 20 READDR/WRITDR files.
The following routines are used for record-addressable, random-access I/O:
• ASYNCMS(3F), ASYNCDR(3F): sets the I/O mode to be asynchronous
• CHECKMS(3F), CHECKDR(3F): checks the status of an asynchronous I/O operation
• CLOSMS(3F), CLOSDR(3F): closes a random-access file and writes the master index
• FINDMS(3F): reads records into data buffers used by random-access file routines
• OPENMS(3F), OPENDR(3F): opens a local file as a random-access file
• READMS(3F), READDR(3F): reads a record from a random-access file to memory
• STINDX(3F), STINDR(3F): allows an index to be used as the current index by creating a subindex
• SYNCMS(3F), SYNCDR(3F): sets the I/O mode to be synchronous
• WAITMS(3F), WAITDR(3F): waits for completion of an asynchronous I/O operation
• WRITMS(3F), WRITDR(3F): writes data from user memory to a random-access file and updates the index
Word-addressable, Random-access File I/O Routines
These routines are not available on IRIX systems.

004– 2165– 002 13


INTRO_IO ( 3F ) INTRO_IO ( 3F )

A word-addressable, random-access file consists of an adjustable number of contiguous words. You can
access any word or contiguous sequence of words from a word-addressable, random-access file by using the
associated routines. These files and their I/O routines are similar to the record-addressable, random-access
files and their routines, except that an index is not meaningful. The Fortran-callable, word-addressable
random-access I/O routines are WOPEN, WCLOSE, PUTWA, APUTWA, GETWA, and SEEK. WOPEN opens a
file and specifies it as a word-addressable, random-access file that can be accessed or changed with the
word-addressable routines. The WOPEN call is optional. If a call to GETWA or PUTWA is executed first, the
file is opened for you with the default number of blocks (16), and istats is turned on.
The following routines are used for word-addressable, random-access file I/O:
• GETWA(3F): synchronously reads words from the file into user memory
• SEEK(3F): asynchronously reads data into file buffers (documented on the GETWA(3F) man page)
• PUTWA(3F): synchronously writes words from memory to the file
• APUTWA(3F): asynchronously writes words from memory to the file (documented on the PUTWA(3F)
man page)
• WCLOSE(3F): finalizes additions and changes and closes the file
• WOPEN(3F): opens a file and specifies it as a word-addressable, random-access file
ASYNCHRONOUS QUEUED I/O ROUTINES
These routines are not available on IRIX systems.
Asynchronous queued I/O routines initiate a transfer of data and allow the subsequent execution sequence to
proceed concurrently with the actual transfer.
The following routines are used for asynchronous queued I/O:
• AQCLOSE(3F): closes an asynchronous queued I/O file
• AQOPEN(3F): opens a file for asynchronous queued I/O
• AQOPENM(3F): opens a file for asynchronous queued I/O using specified status flag (documented on the
AQOPEN(3F) man page)
• AQREAD(3F): queues a simple asynchronous I/O read request
• AQREADC(3F): queues a compound asynchronous I/O read request (documented on the AQREAD(3F)
man page)
• AQRECALL(3F): waits for completion of a particular set of asynchronous queued I/O requests
• AQSTAT(3F): checks the status of asynchronous queued I/O requests
• AQWAIT(3F): waits for completion of all asynchronous queued I/O requests
• AQWRITE(3F): queues a simple asynchronous I/O write request
• AQWRITEC(3F): queues a compound asynchronous I/O write request (documented on the AQWRITE(3F)
man page)

14 004– 2165– 002


INTRO_IO ( 3F ) INTRO_IO ( 3F )

FORTRAN-CALLABLE TAPE PROCESSING ROUTINES


See individual man pages for implementation details.
Fortran-callable routines perform special functions on a tape file.
• CHECKTP(3F): checks tape position
• CLOSEV(3F): closes volume and mounts next volume in Volume Identifier list
• ENDSP(3F): disables special tape processing
• SETSP(3F): enables and disables EOV processing
• STARTSP(3F): enables special tape processing

MISCELLANEOUS I/O ROUTINES


FLUSH(3F) writes to a file any buffered data previously written by Fortran output statements.
GTSTDPTR(3F) maps a standard file descriptor into the corresponding address of the FILE structure (stream
pointer) for subsequent use in the Fortran-callable fread(3C) and fwrite(3C) routines.
The LENGTH(3I) and UNIT(3I) routines allow a Fortran program to issue a wait until a BUFFER IN or
BUFFER OUT operation has completed. This type of wait is crucial if the program must synchronize a data
transfer with further use of the information being transferred.
The NUMBLKS(3F) function returns the current file size of a specified unit or file.

FORTRAN I/O UNITS


The SGI Fortran implementation allows I/O units to be connected to files, and they serve as a means of
referring to that file. This subsection describes the characteristics of those unit identifiers.
A Fortran unit identifier is one of the following:
• An integer variable or expression with a 0 or positive value. Each integer unit identifier (i) is associated
with the file fort.i, which may exist. For example, unit 10 is associated with the file fort.10 in the
current working directory.
• An asterisk, identifying a particular file that is connected for formatted, sequential access (allowed only
on READ and WRITE statements). On READ statements, an asterisk refers to unit 100 (standard input).
On WRITE statements, an asterisk refers to unit 101 (standard output).
• UNICOS and UNICOS/mk systems only: A Hollerith (integer) variable consisting of 1 to 7 left-justified,
zero-filled ASCII characters. Each Hollerith unit identifier is associated with the file of the same name,
which may or may not exist. For example, unit ’red’L is associated with the file red in the current
working directory.
Certain Fortran I/O statements have an implied unit number. The PRINT statement always refers to unit
101 (standard output).

004– 2165– 002 15


INTRO_IO ( 3F ) INTRO_IO ( 3F )

Fortran INQUIRE and CLOSE statements may refer to any valid or invalid unit number. All other Fortran
I/O statements may refer only to valid unit numbers. For the purposes of an executing Fortran program, all
unit numbers in use or available for use by that program are valid (that is, they exist). All unit numbers that
are not available for use are invalid (that is, they do not exist).
A valid unit number is any positive integer. Unit numbers 100 through 102 are reserved. Unit numbers 0,
5, and 6 are normally associated with the standard error, standard input, and standard output files,
respectively, although that association can be overridden. All other valid unit numbers are associated with
the file fort.i, as previously indicated. You can use the INQUIRE statement to check the validity
(existence) of any unit number prior to using it. Example:
LOGICA L UNI TOK, UNITOP
...
INQUIR E (UN IT = I, EXI ST = UNITOK , OPE NED = UNI TOP)
IF (UN ITO K .AN D. .NO T. UNI TOP) THEN
OPEN (UNIT = I, ... )
ENDIF

Initially, all valid units are closed. A unit is connected to a file as the result of one of three types
of opens:
• An implicit open occurs when the first reference to a unit number is an I/O statement other than OPEN,
CLOSE, INQUIRE, BACKSPACE, ENDFILE, or REWIND. Example:
WRI TE (4) I, J, K

If unit number 4 is not open, the WRITE statement will cause it to be connected to the associated file
(fort.4), unless overridden by an assign(1) command referencing unit 4.
• An explicit unnamed open occurs when the first reference to a unit number is an OPEN statement without
a FILE specifier. Example:
OPE N (7, FORM=’ UNF ORM ATT ED’ )

If unit number 7 is not open, the OPEN statement will cause it to be connected to the associated file
(fort.7), unless overridden by an assign command referencing unit 7.
• An explicit named open occurs when the first reference to a unit number is an OPEN statement with a
FILE specifier. Example:
OPEN (9, FIL E=’blu e’)

If unit number 9 is not open, the OPEN statement will cause it to be connected to the file blue, unless
overridden by an assign command referencing unit 9 or the file blue.
The BACKSPACE, ENDFILE, and REWIND statements will not do an implicit open. If the unit is not
connected to a file, the requested operation is disregarded.

16 004– 2165– 002


INTRO_IO ( 3F ) INTRO_IO ( 3F )

Unit numbers 100 through 102 are permanently associated with the standard input, standard output, and
standard error files, respectively. They may be referenced on READ and WRITE statements. A CLOSE
statement on these unit numbers has no effect. An INQUIRE statement on these unit numbers will indicate
they are nonexistent (invalid). These unit numbers exist to allow guaranteed access to the standard input,
standard output, and standard error files, without regard to any unit actions taken by an executing program.
Thus, a READ or WRITE I/O statement with an asterisk unit identifier (or a PRINT statement) will always
work. Nonstandard I/O operations on these units (for example, BUFFER IN, BUFFER OUT, READMS,
WRITEMS, and so on) are not supported.
Fortran application or library subroutines that want to access the standard error file, standard input file, or
standard output file can use unit numbers 100 through 102, even if the user program closes or reuses unit
numbers 0, 5, and 6.
Special Files
For all unit numbers associated with the standard input, standard output, and standard error files, the nature
of that association is sequential and formatted. That is, unformatted and/or direct-access statements are not
allowed on those files. Furthermore, the standard input file is read-only. ENDFILE, PRINT, and WRITE
statements are not allowed, and the standard error and standard output files are write-only (READ statements
are not allowed).
REWIND and BACKSPACE statements are permitted on terminal files, but with no effect.
ENDFILE is permitted on terminal files, unless they are read-only (standard input); it writes a logical endfile
record.
For all unit numbers associated with pipes, the REWIND statement is invalid. If the file logically has to be
repositioned, the BACKSPACE statement is invalid. A situation in which the file may not have to be
positioned is a BACKSPACE over an endfile record for a file that has only a logical representation of an
endfile record (for example, text files).
Inquire-by-Unit Processing
The INQUIRE statement can be used to retrieve the name of a file connected to a specified unit, if the file
has a name. The Fortran standard allows for unnamed files.
The standard input, standard output, and standard error files are unnamed, and an INQUIRE on a unit
connected to any of these files indicates that it is unnamed (the NAMED parameter is set to .FALSE.).
An INQUIRE on any unit connected using an explicit named open will indicate that the file is named and
will return as the name, the name that was given on the FILE specifier on the OPEN statement.
An INQUIRE on any unit connected using an explicit unnamed open or an implicit open, may or may not
indicate that the file is named. A name will be returned only if the Fortran run-time library can ensure that a
subsequent open, with the FILE specified as the name, will connect to the same file. For scratch files (files
opened with STATUS=’SCRATCH’), a name is returned so the same assign(1) options associated with
the file name are used.

004– 2165– 002 17


INTRO_IO ( 3F ) INTRO_IO ( 3F )

CAUTIONS
The property of unit numbers 100 through 102, whereby they appear nonexistent or invalid on an INQUIRE
or OPEN and yet I/O is permitted, is an extension to the Fortran standard.
It is possible that the special files (standard input, standard output, and standard error) can have two different
units connected to them simultaneously (units 0/102, 5/100, and 6/101). This is an SGI extension to the
Fortran standard.

SEE ALSO
assign(1)
For more information about I/O for Fortran programmers, see the Application Programmer’s I/O Guide.
This guide describes the type of I/O available and provides insight into the efficiencies and inefficiencies of
each. It demonstrates how to speed up various forms of I/O and describes tools that extract statistics from
the execution of a Fortran program.

18 004– 2165– 002


ACPTBAD ( 3F ) ACPTBAD ( 3F )

NAME
ACPTBAD – Makes bad data available

SYNOPSIS
CALL ACPTBAD(unit, uda, wrdcnt, termcnd, ubcnt [,acptcnt])

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
ACPTBAD makes bad data available to you by transferring it to the user-specified buffer.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
unit Unit number.
uda User data area to receive bad data.
wrdcnt On exit, number of words transferred.
termcnd On exit, address of termination condition:
=0 Positioned at end-of-block
=1 Positioned at end-of-file
=2 Positioned at end-of-data
<0 Not positioned at end-of-block
ubcnt On exit, unused bit count. Defined only if termcnd is 0, and wrdcnt is nonzero.
acptcnt Optional integer parameter. On input, it specifies the maximum number of words of bad data
that you want to accept. If the number of words of bad data in the block exceeds this value, the
excess is discarded.

004– 2165– 002 19


ACPTBAD ( 3F ) ACPTBAD ( 3F )

EXAMPLES
Example 1 demonstrates the use of ACPTBAD when used with the READ library routine.
PRO GRAM EXA MPL E1
IMP LICIT INT EGE R(A -Z)
PAR AMETER (NB YTE S=4 000 0,N DIM =NB YTE S/8 ,DN =99 )
DIM ENSION BUF FER (1: NDI M)
DIM ENSION UDA (1: 2*N DIM )

200 0 CON TINUE


NWORDS = NDI M
CAL L REA D(D N,B UFF ER, NWO RDS ,ST ATU S)
IF( (STATU S.E Q.2 ) .OR . (ST ATU S.E Q.3 )) THE N ! EOF or EOD
STOP ’CO MPL ETE ’
ELS E IF (ST ATU S .EQ . 4) THE N ! Par ity err or
NWORDS = 2*N DIM
CALL ACP TBA D(D N, UDA , WC, TER MCN D, UBC NT, NWO RDS )
IF (TE RMC ND .LT . 0) THE N
PRI NT *,’ ERR OR WHE N ACC EPT ING BAD DAT A = ’,T ERM CND
STO P ’ER ROR ’
ENDIF
NWORDS = WC
END IF
C ...
C Pro cess dat a
C ...
GOT O 200 0 ! Con tin ue rea din g
END
Example 2 shows how ACPTBAD works with the Fortran READ statement.

20 004– 2165– 002


ACPTBAD ( 3F ) ACPTBAD ( 3F )

PRO GRA M EXAMPL E1


IMP LIC IT INT EGER(A -Z)
PAR AME TER(NB YTES=4 000 0,NDIM =NB YTE S/8 ,DN=99 )
DIM ENSION BUF FER (1:NDI M)
DIMENS ION UDA(1: 2*N DIM )
PARAMETER (BA DDATA=135 6)

200 0 CON TIN UE


REA D(D N,ERR= 3000,I OST AT=IST AT, END =50 00)BUF FER
C ...
C Pro cess data
C ...
GOT O 200 0 ! Con tinue readin g
300 0 CON TIN UE
IF (IS TAT .EQ. BAD DAT A) THEN ! Par ity err or
NWO RDS = 2*N DIM
CALL ACPTBA D(DN, UDA , WC, TERMCN D, UBC NT, NWORDS )
IF (TERMC ND .LT . 0) THEN
PRINT *,’ ERR OR WHE N ACC EPT ING BAD DAT A = ’,T ERM CND
STOP ’ERROR ’
END IF
ELSE
PRINT *,’ ERR OR ’,ISTA T,’ FROM READ’
STOP ’ER ROR’
END IF
C ...
C Process bad data
C ...
GOT O 200 0
500 0 CON TIN UE
STO P ’CO MPL ETE ’
END

SEE ALSO
SKIPBAD(3F)

004– 2165– 002 21


AQCLOSE ( 3F ) AQCLOSE ( 3F )

NAME
AQCLOSE – Closes an asynchronous queued I/O file

SYNOPSIS
CALL AQCLOSE(aqp, status [,reply])

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
AQCLOSE closes a file opened by using AQOPEN(3F). AQCLOSE starts all queued AQIO requests, waits for
their completion, and then closes the file. If any queued or busy requests have pending error conditions, an
error status is returned, and reply (if present) is set to the request ID of the failed request.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
aqp Integer variable or array element. The name of the array in the user’s program that contains the
asynchronous queued I/O file handle. This must be the same variable specified in the AQOPEN
request.
status Integer variable. Status code status returns any errors or status information to the user. On
output from AQCLOSE, status has one of the following values:
=0 No error detected.
<0 Error detected. The absolute value of status indicates the cause of the error. See
intro(2) and the Fortran library error messages. The conditions that may cause
AQCLOSE to return an error status include the close(2) of the file failed; the aqp
argument was invalid; a previously asynchronous I/O request to this file failed, and the
resulting error status had not previously been returned to the program.
reply Optional integer variable. If present, and if an error is due to a failed I/O request, it returns the
request ID of the most recent failed request.

SEE ALSO
AQOPEN(3F), AQREAD(3F), AQREADC (see AQREAD(3F)), AQRECALL(3F), AQSTAT(3F), AQWAIT(3F),
AQWRITE(3F), AQWRITEC (see AQWRITE(3F))
Application Programmer’s I/O Guide

22 004– 2165– 002


AQOPEN ( 3F ) AQOPEN ( 3F )

NAME
AQOPEN, AQOPENM – Opens a file for asynchronous queued I/O

SYNOPSIS
CALL AQOPEN(aqp, aqpsize, dn, status)
CALL AQOPENM(aqp, aqpsize, name, oflag, status)

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
AQOPEN opens a file to be used in subsequent AQIO requests, such as AQREAD(3F) or AQWRITE(3F).
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
aqp Integer variable or array element that will be assigned the asynchronous queued I/O file handle.
aqpsize Integer variable, expression, or constant. Maximum number of queued I/O requests.
dn A Fortran character constant or variable containing the name of the file. An integer variable,
expression, or constant. dn can be a unit number or the name of the file as an L-type Hollerith
constant.
name A Fortran character constant or variable containing the name of the file.
oflag An integer input variable. oflag contains the status flags that AQOPENM passes to the open(2)
system call when opening the specified file. The value for oflag may be obtained from
IPXFCONST. For more information about the possible values, see the open(2) man page.
AQOPENM does not verify the validity of the oflag specified. For the default file type, the status
flag that AQOPEN uses includes the O_RAW bit; if you use AQOPENM, you must explicitly
specify this if it is desired.
Some assign(1) options may cause the oflag to be modified. These are: -l, -w, -p, -q, and
-n:st.

004– 2165– 002 23


AQOPEN ( 3F ) AQOPEN ( 3F )

status Integer variable. Status code status returns any errors or status information to the user. On
output from AQOPEN, status has one of the following values:
=0 No errors detected.
<0 Error detected. If the absolute value of status is ≥ 1000, it is a library error, and you can
type explain lib-x to view an explanation. If the absolute value of status is < 1000,
it is probably a system error; type explain sys-x to view an explanation.
Asynchronous queued I/O provides a method of random access to or from mass storage into buffers in user
memory.

NOTES
A file opened using AQOPEN must be closed by AQCLOSE(3F). Failure to close the file in this way will
cause unpredictable behavior.
It is not valid to mix calls to AQIO routines with standard Fortran I/O statements that use the same unit
number.

SEE ALSO
AQCLOSE(3F), AQREAD(3F), AQRECALL(3F), AQSTAT(3F), AQWAIT(3F), AQWRITE(3F)
Application Programmer’s I/O Guide

24 004– 2165– 002


AQREAD ( 3F ) AQREAD ( 3F )

NAME
AQREAD, AQREADC – Queues a simple or compound asynchronous I/O read request

SYNOPSIS
CALL AQREAD(aqp, cpuadd, blknum, blocks, reqid, queue, status)
CALL AQREADC(aqp, cpuadd, mstride, blknum, blocks, dstride, incs, reqid, queue, status)

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
AQREAD and AQREADC transfer data between the data buffer and the device on which the file resides.
Requests can be simple (AQREAD) or compound (AQREADC). A simple request is one in which data from
consecutive sectors on the disk is read into one buffer. A compound request is one in which several simple
requests are separated by a constant number of sectors on disk, a constant number of memory words for
buffers, or both.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
aqp Integer array. The name of the array in the user’s program that contains the asynchronous
queued I/O file handle. Must be the same array as specified in the AQOPEN(3F) request.
cpuadd Type determined by the user; this may not be a Fortran character variable. Starting memory
address; the location where the first word of data is placed.
blknum Integer variable, expression, or constant. Starting block number. The block number of the first
block to be read on this request. Block numbering starts at 0.
blocks Integer variable, expression, or constant. The number of 4096-byte blocks to be read.
reqid Integer variable, expression, or constant. A user-supplied value for identifying a particular
request.
queue Integer variable, expression, or constant. Queue flag. If 0, I/O is initiated provided that I/O on
the file is not already active. If the queue flag is set to nonzero, the request is added to the
queue but no attempt is made to start I/O.
status Integer variable. Status code status returns any errors to the user. On output from these
routines, status has one of the following values:
=0 No error detected.

004– 2165– 002 25


AQREAD ( 3F ) AQREAD ( 3F )

<0 Error detected. The absolute value of status indicates the cause of the error. See
intro(2) for more information. AQREAD and AQREADC may return an error status if a
previous asynchronous I/O request to this file failed, and the resulting error status had not
been returned to the program.
dstride Integer variable, expression, or constant. Disk stride; the number of disk blocks to skip between
the base addresses of consecutive transfers. The stride value may be positive (to skip forward),
negative (to skip backward), or 0. This parameter is valid only for compound requests.
incs Integer variable, expression, or constant. The number of simple requests minus 1 that comprise
a compound request. Zero (0) implies a simple request. This parameter is valid only for
compound requests.
mstride Integer variable, expression, or constant. Data buffer stride; the number of memory words to
skip between the base addresses of consecutive transfers. The stride value may be positive (to
skip forward), negative (to skip backward), or 0 (implying a contiguous data flow to memory).
This parameter is valid only for compound read requests.

SEE ALSO
AQCLOSE(3F), AQOPEN(3F), AQRECALL(3F), AQSTAT(3F), AQWAIT(3F), AQWRITE(3F)
intro(2) in the UNICOS System Calls Reference Manual
Application Programmer’s I/O Guide

26 004– 2165– 002


AQRECALL ( 3F ) AQRECALL ( 3F )

NAME
AQRECALL – Waits for completion of asynchronous queued I/O request

SYNOPSIS
CALL AQRECALL(aqp, status, reqid, reply)

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
AQRECALL leaves the program suspended until a particular asynchronous queued I/O request (and all the
asynchronous I/O requests made with the same aqp that preceded it) is complete, or until an error is
encountered.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
aqp Integer array. The name of the array in the user’s program that contains the asynchronous
queued I/O file handle. This must be the same array specified in the AQOPEN(3F) request.
status Integer variable. This status code returns one of the following values on output from
AQRECALL:
0 The requested ID is not found in the list of I/O requests.
+5 I/O has been completed.
<0 A negative value indicates that the I/O request indicated by reply has failed. Control is
returned immediately. The absolute value of the status returned indicates the reason. See
intro(2) for more details.
reqid If nonzero, AQRECALL waits until the I/O identified by this value (and all that preceded it) are
complete, or until an error is encountered.
If zero, AQRECALL waits until all outstanding I/O is complete, or until an error is encountered.
AQRECALL searches the queue of requests until it finds the first match for reqid. If more than
one entry in the request queue has the same reqid, results are unpredictable. To effectively use
AQRECALL, ensure that each entry in the queue has a unique request ID. Entries may remain in
the queue after AQWAIT or AQRECALL.
reply Integer variable. If an error occurred, reply is set to the request ID of the entry that incurred the
error. Control is returned immediately. If more than one outstanding request has a pending
error, AQRECALL must be called repeatedly until the return status is 0 to call all error returns.

004– 2165– 002 27


AQRECALL ( 3F ) AQRECALL ( 3F )

SEE ALSO
AQOPEN(3F), AQREAD(3F), AQSTAT(3F), AQWAIT(3F), AQWRITE(3F)
intro(2) in the UNICOS System Calls Reference Manual
Application Programmer’s I/O Guide

28 004– 2165– 002


AQSTAT ( 3F ) AQSTAT ( 3F )

NAME
AQSTAT – Checks the status of asynchronous queued I/O requests

SYNOPSIS
CALL AQSTAT(aqp, reply, reqid, status [,wait])

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
AQSTAT returns the status of a particular queued request. If the optional wait argument is specified, return
is delayed until that request is complete.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
aqp Integer array. The name of the array in the user’s program that contains the asynchronous
queued I/O file handle. This must be the same array specified in the AQOPEN(3F) request.
reply Integer variable. Specify a dummy integer in this position because the routine expects four
arguments in a particular order.
reqid Integer variable, expression, or constant. Specifies the request ID for which status information
will be returned.
status Integer variable. This status code returns one of the following values on output from AQSTAT:
0 The requested ID is not found in the list of I/O requests. This can occur if the requested
ID does not correspond to an actual request, or if the requested ID has completed and the
entry has been overwritten.
+2 The requested ID is in the library queue, but the system request to start this I/O has not
been made.
+4 The asynchronous request is queued for I/O in the operating system.
+5 I/O has been completed.
<0 A negative value indicates that this I/O request failed. The absolute value of the status
returned indicates the reason. See intro(2) for more details.
wait Optional argument. If present and nonzero, return is delayed until the specified request is
complete.

004– 2165– 002 29


AQSTAT ( 3F ) AQSTAT ( 3F )

SEE ALSO
AQCLOSE(3F), AQOPEN(3F), AQREAD(3F), AQRECALL(3F), AQWAIT(3F), AQWRITE(3F)
intro(2) in the UNICOS System Calls Reference Manual
Application Programmer’s I/O Guide

30 004– 2165– 002


AQWAIT ( 3F ) AQWAIT ( 3F )

NAME
AQWAIT – Waits for completion of asynchronous queued I/O requests

SYNOPSIS
CALL AQWAIT(aqp, status [,reply])

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
AQWAIT delays program execution until all pending requests have completed or until an error is
encountered. If necessary, requests that are queued but not started are started.
If any of the pending requests encounters an error, control is returned immediately, and the variable reply, if
specified, is set to the request ID of the request that encountered the error.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
aqp Integer array. The name of the array in the user’s program that contains the asynchronous
queued I/O parameter block. This must be the same array specified in the AQOPEN(3F) request.
status Integer variable that returns any errors or status information to the user. On output from
AQWAIT, status has one of the following values:
2 No I/O is active or queued.
=0 No errors detected.
<0 Error detected. The absolute value of the status indicates the cause of the error. See
intro(2) for more information.
reply Optional argument. Request ID of request in error.

SEE ALSO
AQCLOSE(3F), AQOPEN(3F), AQREAD(3F), AQRECALL(3F), AQSTAT(3F), AQWRITE(3F)
intro(2) in the UNICOS System Calls Reference Manual
Application Programmer’s I/O Guide

004– 2165– 002 31


AQWRITE ( 3F ) AQWRITE ( 3F )

NAME
AQWRITE, AQWRITEC – Queues a simple or compound asynchronous I/O write request

SYNOPSIS
CALL AQWRITE(aqp, cpuadd, blknum, blocks, reqid, queue, status)
CALL AQWRITEC(aqp, cpuadd, mstride, blknum, blocks, dstride, incs, reqid, queue, status)

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
AQWRITE and AQWRITEC transfer data between the device on which the file resides and the data buffer.
Requests can be simple (AQWRITE) or compound (AQWRITEC). A simple request is one in which data
from one buffer is written to consecutive sectors on disk. A compound request is one in which several
simple requests are separated by a constant number of sectors on disk, a constant number of memory words
for buffers, or both.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
aqp Integer array. The name of the array in the user’s program that contains the asynchronous
queued I/O file handle. Must be the same array specified in the AQOPEN request.
cpuadd Type determined by user; this may not be a Fortran character variable. Starting memory
address; the location of the first word in the user’s program to be written.
blknum Integer variable, expression, or constant. The block number of the first block to be written on
this request. Block numbering starts at 0.
blocks Integer variable, expression, or constant. The number of 4096-byte blocks to be written.
reqid Integer variable, expression, or constant. A user-supplied value for identifying a particular
request.
queue Integer variable, expression, or constant. Queue flag. If 0, I/O is initiated when I/O on the file
is not already active. If the queue flag is set to nonzero, the request is added to the queue but
no attempt is made to start I/O.
status Integer variable. Status code status returns any errors to the user. On output from these
routines, status has one of the following values:
=0 No error detected.

32 004– 2165– 002


AQWRITE ( 3F ) AQWRITE ( 3F )

<0 Error detected. The absolute value of status indicates the cause of the error. See
intro(2) for more information. AQREAD and AQREADC may return an error status if a
previous asynchronous I/O request to this file failed, and the resulting error status had not
been returned to the program.
mstride Integer variable, expression, or constant. Data buffer stride; the number of memory words to
skip between the base addresses of consecutive transfers. The stride value may be positive (to
skip forward), negative (to skip backward), or 0 (implying contiguous data flow from memory).
This parameter is valid only for compound write requests.
dstride Integer variable, expression, or constant. Disk stride; the number of disk blocks to skip between
the base addresses of consecutive transfers. The stride value may be positive (to skip forward),
negative (to skip backward), or 0. This parameter is valid only for compound requests.
incs Integer variable, expression, or constant. The number of simple requests minus 1 that compose a
compound request. Zero (0) implies a simple request. This parameter is valid only for
compound requests.

SEE ALSO
AQCLOSE(3F), AQOPEN(3F), AQREAD(3F), AQRECALL(3F), AQSTAT(3F), AQWAIT(3F)
intro(2) in the UNICOS System Calls Reference Manual
Application Programmer’s I/O Guide

004– 2165– 002 33


ASNCTL ( 3F ) ASNCTL ( 3F )

NAME
ASNCTL – Controls function of ASSIGN, ASNFILE, ASNUNIT, and ASNRM routines

SYNOPSIS
CALL ASNCTL(option, value, ier)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION

This routine is supported on IRIX systems for programs compiled with the MIPSpro 7 Fortran 90 compiler
or compiled with the -craylibs option to the MIPSpro F77 compiler.
The ’LOCAL’ and ’NEWLOCAL’ modes are useful for any utility written in Fortran when you want to use
ASSIGN(3F) but do not want to access the assign environment file set up by the user.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX, all
arguments must be of default kind unless documented otherwise. On UNICOS and UNICOS/mk, default
kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default kind is KIND=4.
The following is a list of valid arguments for this routine.
option A Fortran character variable containing either of the following values:
’LOCAL’ Causes ASNCTL to establish a local assign environment. The old assign
environment is copied into the newly created local assign environment.
Subsequent calls to ASSIGN, ASNUNIT, ASNFILE, and ASNRM (see
ASSIGN(3F)) affect only the newly created local assign environment. Any
future Fortran OPEN requests will also read from the local assign environment
initiated by this call to ASNCTL. The user must set value to 1 when calling
ASNCTL with option=’LOCAL’.
’NEWLOCAL’ Causes ASNCTL to establish an empty local assign environment. Subsequent
calls to ASSIGN, ASNUNIT, ASNFILE, and ASNRM (see ASSIGN(3F)) affect
the newly created local assign environment. Any future Fortran OPEN
requests will also read from the local assign environment initiated by this call
to ASNCTL. The user must set value to 1 when calling ASNCTL with
option=’NEWLOCAL’.
’RESTORE’ Restores the assign environment that was active before the preceding
’LOCAL’ or ’NEWLOCAL’ request. Sets value to 1 when calling ASNCTL with
option=’RESTORE’.
value Integer variable, constant, or array element containing the option value.

34 004– 2165– 002


ASNCTL ( 3F ) ASNCTL ( 3F )

ier Integer variable or array element that is assigned the error status on return. Zero (0) is usually
returned, indicating no errors were encountered; otherwise, a positive error status is returned.

EXAMPLES
The writer of the following Fortran program wants to disregard any assign information provided by the
user. However, the program requires sequential unformatted I/O on unit 11 with an unblocked file structure.
This is accomplished by the following:
CAL L ASN CTL (’N EWL OCA L’, 1,i er) ! sta rt loc al ass ign env iro nme nt
CAL L ASN UNI T(1 1,’ -s unb loc ked ’,i er) ! ass ign the "un blo cke d" fil e str uct ure
OPE N(1 1,f orm =’u nfo rma tte d’) ! ope n uni t 11

SEE ALSO
ASSIGN(3F)

004– 2165– 002 35


ASNQFILE ( 3F ) ASNQFILE ( 3F )

NAME
ASNQFILE, ASNQUNIT – Returns the assign options currently in effect for a file name or unit number

SYNOPSIS
CALL ASNQFILE(file, attr, istat)
CALL ASNQUNIT(iun, attr, istat)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION

This routine is supported on IRIX systems for programs compiled with the MIPSpro 7 Fortran 90 compiler
or compiled with the -craylibs option to the MIPSpro F77 compiler.
ASNQFILE queries the assign environment for any assign options currently in effect for a file name.
ASNQUNIT queries the assign environment for any assign options currently in effect for a unit number.
The assign options may have been established earlier by the assign(1) command or the ASSIGN,
ASNUNIT, or ASNFILE (see ASSIGN(3F)) library routines.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX, all
arguments must be of default kind unless documented otherwise. On UNICOS and UNICOS/mk, default
kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default kind is KIND=4.
The following is a list of valid arguments for this routine.
file A character variable or array element containing the file name.
attr A character variable or array element that receives the option’s value in the form of a character
string. If the options exceed the length of attr, istat is set to a positive error code. If no
assign options are found for the specified unit or file, ’ ’ is returned in attr.
istat An integer variable or array element that receives one of the following return statuses:
0 Options were found for the specified file or iun
-1 No options were found for the specified file or iun.
>0 An error condition was encountered. Use the explain(1) command to obtain
information about a particular error code.
iun An integer variable or array element containing the unit number.

36 004– 2165– 002


ASNQFILE ( 3F ) ASNQFILE ( 3F )

SEE ALSO
ASNCTL(3F), ASSIGN(3F)
assign(1) in the Application Programmer’s I/O Guide
explain(1) in the UNICOS User Commands Reference Manual

004– 2165– 002 37


ASSIGN ( 3F ) ASSIGN ( 3F )

NAME
ASSIGN, ASNUNIT, ASNFILE, ASNRM – Provides library interface to assign processing

SYNOPSIS
All systems:
CALL ASNUNIT(iunit, astring, ier)
CALL ASNFILE(fname, astring, ier)
CALL ASNRM(ier)
CALL ASSIGN(cmd ,ier)
UNICOS and UNICOS/mk systems only:
CALL ASSIGN(cmd)

IMPLEMENTATION
UNICOS, UNICOS/mk and IRIX systems

DESCRIPTION

This routine is supported on IRIX systems for programs compiled with the MIPSpro 7 Fortran 90 compiler
or compiled with the -craylibs option to the MIPSpro F77 compiler.
ASSIGN provides an interface to assign processing from Fortran.
ASNUNIT and ASNFILE assign attributes to units and files, respectively.
ASNRM removes all entries currently in the assign environment.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX, all
arguments must be of default kind unless documented otherwise. On UNICOS and UNICOS/mk, default
kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default kind is KIND=4.
These routines have the following arguments:
cmd A Fortran character variable containing a complete assign(1) command in the format also
acceptable to ISHELL(3F). The -V option cannot be processed by the ASSIGN routine.
ier An integer variable that is assigned the exit status on return. A 0 indicates normal return; >0
indicates a specific error status
iunit An integer variable or constant containing the unit number to which attributes are assigned.
astring A Fortran character variable containing any attribute options and option values that could be
passed to assign(1). Control options -I, -O, and -R can also be passed.
fname A character variable or constant containing the file name to which attributes are assigned.

38 004– 2165– 002


ASSIGN ( 3F ) ASSIGN ( 3F )

NOTES
Users are encouraged to use the ASSIGN library routines rather than ISHELL(’assign’), because
ISHELL(3F) causes vfork(2), an exec(2) of sh(1), another fork(2), and another exec(2) of
assign(1).
EXAMPLES
Example 1: The following is equivalent to assign -s unblocked f:file
CALL ASSIGN (’a ssi gn -s unb loc ked f:f ile ’ ,ie r)

Example 2: The following has the same effect as assign -I -n 2 u:99


INT EGER IUN
IUN = 99
CALL ASNUNI T(I UN, ’-I -n 2’, IER )

Example 3: The following is equivalent to executing assign -s tape u:1


CALL ASNUNI T(1 ,’ -s tap e’, IER )

SEE ALSO
ASNCTL(3F), ASNQFILE(3F), ASNQUNIT(3F), ISHELL(3F)
assign(1)

004– 2165– 002 39


ASYNCMS ( 3F ) ASYNCMS ( 3F )

NAME
ASYNCMS, ASYNCDR – Sets I/O mode for random-access routines to asynchronous

SYNOPSIS
CALL ASYNCMS(dn [,ierr])
CALL ASYNCDR(dn [,ierr])

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
As the ASYNCMS or ASYNCDR routine sets the I/O mode for the random-access routines to be asynchronous,
I/O operations can be initiated, and subsequent execution can proceed simultaneously with the actual data
transfer. If using READMS(3F), precede asynchronous reads with calls to FINDMS(3F).
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
dn An integer variable, expression, or constant with a maximum of 8 characters. dn can be a unit
number or the name of the file as a Hollerith constant.
ierr Error control and code. Specify an integer variable. If you specified ierr on the call to
ASYNCMS/ASYNCDR, ierr returns any error codes to you. If ierr>0, no error messages are put
into the stderr file; otherwise, an error code is returned, and the message is added to the
program’s stderr file. On output from ASYNCMS/ASYNCDR, ierr has one of the following
values:
=0 No errors detected.
≤ 0 Error detected. ierr contains one of the following error codes:
–1 The file name or unit number is not valid.
-15 OPENMS/OPENDR was not called on this file.

NOTES
The random-access I/O routines cannot be used in multitasking unless you provide your own locks. If you
are Autotasking or if you are not multitasking at all, you will not be affected. You will need locks only if
you are doing your own macrotasking or microtasking and if you are multitasking your I/O calls.

40 004– 2165– 002


ASYNCMS ( 3F ) ASYNCMS ( 3F )

It is not valid to mix calls to MS/DR routines with standard Fortran I/O statements that use the same unit
number.

SEE ALSO
CHECKMS(3F), CLOSMS(3F), FINDMS(3F), OPENMS(3F), READMS(3F), STINDX(3F), SYNCMS(3F),
WAITMS(3F), WRITMS(3F)

004– 2165– 002 41


CHECKMS ( 3F ) CHECKMS ( 3F )

NAME
CHECKMS, CHECKDR – Checks status of asynchronous random-access I/O operation

SYNOPSIS
CALL CHECKMS(dn, istat [,ierr])
CALL CHECKDR(dn, istat [,ierr])

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
CHECKMS and CHECKDR routines check the status of an asynchronous random-access I/O operation.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
dn Integer variable, expression, or constant with a maximum of 8 characters. dn can be a unit
number or the name of the file as a Hollerith constant.
istat File I/O activity flag. Specify an integer variable.
= 0 No I/O activity on the specified file
= 1 I/O activity on the specified file
ierr Error control and code. Specify an integer variable. If you specify ierr on the call to CHECKMS
or CHECKDR, ierr returns any error codes to you. If ierr>0, no error messages are put into the
stderr file. Otherwise, an error code is returned, and the message is added to the program’s
stderr file. On output from CHECKMS or CHECKDR, ierr contains one of the following error
codes:
=0 No error detected.
<0 Error detected. ierr contains one of the following error codes:
–1 The file name or unit number is not valid.
-15 OPENMS/OPENDR was not called on this file.

NOTES
The random-access I/O routines cannot be used in multitasking unless you provide your own locks. If you
are Autotasking or if you are not multitasking at all, you will not be affected. You will need locks only if
you are doing your own macrotasking or microtasking, and if you are multitasking your I/O calls.

42 004– 2165– 002


CHECKMS ( 3F ) CHECKMS ( 3F )

It is not valid to mix calls to MS/DR routines with standard Fortran I/O statements that use the same unit
number.

SEE ALSO
ASYNCMS(3F), CLOSMS(3F), FINDMS(3F), OPENMS(3F), READMS(3F), STINDX(3F), SYNCMS(3F),
WAITMS(3F), WRITMS(3F)

004– 2165– 002 43


CHECKTP ( 3F ) CHECKTP ( 3F )

NAME
CHECKTP – Checks tape position

SYNOPSIS
CALL CHECKTP(unit, istat, icbuf)

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
CHECKTP checks the tape position.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
unit An integer variable or array element containing the Fortran unit number or Hollerith data of not
more than 7 characters.
istat Result of CHECKTP:
-1 No status
0 At EOV
1 Tape off reel
2 Tape mark detected
3 Blank tape detected
icbuf Number of blocks in circular buffer. Always 0 under the UNICOS operating system (included
for COS compatibility).

NOTES
The file must be an opened tape or ER90 file and must use the FFIO tape layer.

SEE ALSO
CLOSEV(3F), ENDSP(3F), SETSP(3F), STARTSP(3F)

44 004– 2165– 002


CLOSEV ( 3F ) CLOSEV ( 3F )

NAME
CLOSEV – Closes volume and mounts next volume in Volume Identifier list

SYNOPSIS
CALL CLOSEV(unit, istat)

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
CLOSEV closes a volume and mounts the next volume.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
unit An integer variable or array element containing the Fortran unit number or Hollerith data of not
more than 7 characters.
istat Result of CLOSEV:
=0 No error occurred
≠0 Error or warning occurred

NOTES
The file must be an opened tape file.

SEE ALSO
CHECKTP(3F), ENDSP(3F), SETSP(3F), STARTSP(3F)

004– 2165– 002 45


CLOSMS ( 3F ) CLOSMS ( 3F )

NAME
CLOSMS, CLOSDR – Writes master index and closes random-access file

SYNOPSIS
CALL CLOSMS(dn [,ierr])
CALL CLOSDR(dn [,ierr])

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
CLOSMS/CLOSDR writes the master index specified in OPENMS/OPENDR from the user program area to the
random-access file and then closes the file.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
dn An integer variable, expression, or constant with a maximum of 8 characters. dn can be a unit
number or the name of the file as a Hollerith constant.
ierr Error control and code. Specify an integer variable. If you specify ierr on the call to
CLOSMS/CLOSDR, ierr returns any error codes to you. If ierr>0, no error messages are put into
the stderr file; otherwise, an error code is returned and the message is added to the program’s
stderr file. On output from CLOSMS/CLOSDR, ierr has one of the following values:
=0 No error detected.
<0 Error detected. ierr contains one of the following error codes:
–1 The file name or unit number is not legal.
-15 OPENMS/OPENDR was not called on this file.
Statistics on the activity of the random-access file are written to the stderr file (see the following table).
CLOSMS/CLOSDR writes a message to stderr on closing the file.

46 004– 2165– 002


CLOSMS ( 3F ) CLOSMS ( 3F )

Message Description

TOTAL ACCESSES = number of accesses


READS = number of reads
WRITES = number of writes
SEQUENTIAL READS = number of sequential reads
SEQUENTIAL WRITES = number of sequential writes
REWRITES IN PLACE = number of rewrites in place
WRITES TO EOI = number of writes to EOI
TOTAL WORDS MOVED = number of words moved
MINIMUM RECORD = minimum record size
MAXIMUM RECORD = maximum record size
TOTAL ACCESS TIME = total access time
AVERAGE ACCESS TIME = average access time

NOTES
The random-access I/O routines cannot be used in multitasking unless you provide your own locks. If you
are Autotasking or if you are not multitasking at all, you will not be affected. You will need locks only if
you are doing your own macrotasking or microtasking, and if you are multitasking your I/O calls.
It is not valid to mix calls to MS/DR routines with standard Fortran I/O statements that use the same unit
number.

CAUTIONS
If a program terminates without closing the random-access file with CLOSMS/CLOSDR, file integrity is
questionable.

SEE ALSO
OPENMS(3F)

004– 2165– 002 47


ENDSP ( 3F ) ENDSP ( 3F )

NAME
ENDSP – Disables special tape processing

SYNOPSIS
CALL ENDSP(unit, istat)

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
This routine disables special tape processing.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
unit An integer variable or array element containing the Fortran unit number or Hollerith data of not
more than 7 characters.
istat Result of ENDSP:
=0 Special processing was successfully disabled.
≠0 Error occurred when disabling special processing.

NOTES
The following preconditions must exist:
• The file must be an opened tape file.
• EOV processing must be enabled.
• Special processing must be disabled before you can enable it and it must be enabled before you can
disable it.
ENDSP removes an alternate path to or from a tape. Tape blocks that were held aside are written to tape.

SEE ALSO
CHECKTP(3F), CLOSEV(3F), SETSP(3F), STARTSP(3F)

48 004– 2165– 002


FINDMS ( 3F ) FINDMS ( 3F )

NAME
FINDMS – Reads record into data buffers used by random-access routines

SYNOPSIS
CALL FINDMS(dn, n, irec [,ierr])

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
FINDMS asynchronously reads the desired record into the data buffers used by the random-access file
routines for the specified file. The next READMS(3F) or WRITMS(3F) call waits for this read to complete
and transfers data appropriately.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
dn An integer variable, expression, or constant with a maximum of 8 characters. dn can be a unit
number or the name of the file as a Hollerith constant.
n The number of words to be read, as in READMS or WRITMS. Type integer variable, expression,
or constant.
irec As in READMS or WRITMS, the record name or number to be read into the data buffers. Specify
an integer variable, expression, or constant.
ierr Error control and code. Specify a type integer variable. If you specify ierr on the call to
FINDMS, ierr returns any error codes to you. If ierr>0, no error messages are put in the
stderr file; otherwise, an error code is returned, and the message is added to the stderr file.
On output from FINDMS, ierr has one of the following values:
=0 No errors or warnings detected.
<0 Error or warning condition detected. ierr contains one of the following error or
warning codes:
-6 The user-supplied named index is not valid.
-8 The index number is greater than the maximum on the file.
-10 The named record was not found in the index array.
-15 OPENMS/OPENDR was not called on this file.
-17 The index entry is less than or equal to 0 in the user’s index array.

004– 2165– 002 49


FINDMS ( 3F ) FINDMS ( 3F )

-18 The user-supplied word count is less than or equal to 0.


-19 The user-supplied index number is less than or equal to 0.
-22 The record does not fit in the buffer. (warning)

NOTES
The random-access I/O routines cannot be used in multitasking unless you provide your own locks. If you
are Autotasking or if you are not multitasking at all, you will not be affected. You will need locks only if
you are doing your own macrotasking or if microtasking and you are multitasking your I/O calls.
It is not valid to mix calls to MS/DR routines with standard Fortran I/O statements that use the same unit
number.

SEE ALSO
ASYNCMS(3F), CHECKMS(3F), CLOSMS(3F), OPENMS(3F), READMS(3F), STINDX(3F), SYNCMS(3F),
WAITMS(3F), WRITMS(3F)

50 004– 2165– 002


FLUSH ( 3F ) FLUSH ( 3F )

NAME
FLUSH – Writes data buffered by Fortran output statements to a file

SYNOPSIS
UNICOS and UNICOS/mk systems:
CALL FLUSH(iunit)
CALL FLUSH(iunit,[istat])
IRIX systems:
CALL FLUSH(iunit, istat)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
FLUSH writes to a file any buffered data previously written by Fortran output statements. FLUSH may be
called after reading or writing. The current file position is not changed.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX, all
arguments must be of default kind unless documented otherwise. On UNICOS and UNICOS/mk, default
kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default kind is KIND=4.
This routine has the following arguments:
iunit Integer variable, expression, or constant containing a Fortran unit number. If this value is 101, it
flushes the unit which is connected to standard output. If this value is 102, it flushes the unit
which is connected to standard error.
istat Integer variable or array element that receives the return status as follows:
=0 Indicates that all buffered data, if any, was flushed. A file that was immediately read, or a
file with a buffer that has not changed since the last flush, might return a 0 status even
though no new data would be written to the file.
-1 Indicates that the Fortran unit does not support FLUSH, and no data was written to the file.
>0 Indicates that an error condition was encountered. The specific error number is returned.
Use the explain(1) command for a description of the error code.
The istat argument is optional on UNICOS systems; the user program is aborted if FLUSH is called without
istat and an error condition is encountered.

004– 2165– 002 51


FLUSH ( 3F ) FLUSH ( 3F )

NOTES
If FLUSH is called with an unconnected unit, an error condition results (except for units 101 and 102).
Calling FLUSH for a file for which the program does not have write permission returns a 0 status if no data
was written to that file previously with Fortran I/O statements.
A WRITE I/O statement with an asterisk unit identifier (or a PRINT statement) uses unit 101. See "Fortran
I/O Units" in INTRO_IO(3F) on UNICOS and UNICOS/mk systems for more information (INTRO_IO is
not available on IRIX systems).

SEE ALSO
explain(1) in the UNICOS User Commands Reference Manual to see a description of the error code.

52 004– 2165– 002


FSUP ( 3F ) FSUP ( 3F )

NAME
FSUP, ISUP – Suppress values in Fortran edit-directed output

SYNOPSIS
CALL FSUP(fvalue)
CALL ISUP(ivalue)
CALL FSUPC
CALL ISUPC

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
fvalue and ivalue are real and integer arguments of default KIND. When FSUP is called, all REAL values
equal to fvalue are suppressed (are output as blanks) when they are encountered in a Fortran edit-directed
formatted I/O operation. FSUP may be recalled to redefine itself.
FSUPC undoes the call to FSUP, and all types are output as ordinary Fortran I/O.
FSUPC and ISUPC invalidate the function obtained by calling FSUP or ISUP, returning to ordinary Fortran
I/O.
ISUP and ISUPC are the integer equivalents of FSUP and FSUPC.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.

004– 2165– 002 53


GETTP ( 3F ) GETTP ( 3F )

NAME
GETTP – Gets information about an opened tape file

SYNOPSIS
CALL GETTP(unit, len, ipa, synch, istat)

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION

GETTP retrieves information about an opened tape file, including its current status.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
unit An integer variable or array element containing the Fortran unit number or Hollerith data of not
more than 7 characters.
len Integer length (in Cray words) of information array ipa. GETTP uses this parameter to
determine the maximum number of information words to return. This parameter also allows for
the addition of more fields in an upward-compatible manner. Currently, 48 words are defined.
ipa Integer information array. On exit, this array contains tape information, as follows:
ipa(1) Current volume identifier (left-justified, zero-filled).
ipa(2)– ipa(7)
Characters 1 through 48 of the path name of the file opened to this tape
(left-justified, zero-filled).
ipa(8) Integer file section number.
ipa(9) Integer file sequence number.
ipa(10) Integer block number relative to tape mark number specified in ipa(23).
ipa(11) Integer number of blocks in the tape layer library buffer. If additional processing
layers have been specified with assign(1) or asgcmd(1), those layers may also
hold buffered data, but they will not be included in this field.
ipa(12) Integer number of blocks in the IOP buffer.
ipa(13) Device ID or unit number in integers.
ipa(14) Device identifier or name (left-justified, zero-filled).
ipa(15) Generic device name (left-justified, zero-filled).

54 004– 2165– 002


GETTP ( 3F ) GETTP ( 3F )

ipa(16) Last device function as an integer.


ipa(17) Last device status as an integer.
ipa(18) Data transfer count in bytes as an integer.
ipa(19) Buffer memory sector count as an integer.
ipa(20) Partial block bytes in buffer memory as an integer.
ipa(21) Outstanding sector count as an integer.
ipa(22) Outstanding block count as an integer.
ipa(23) User tape mark number as an integer, including tape marks embedded in the data.
ipa(24) Direction from tape mark in previous word: 0= after tape mark and 1= before tape
mark.
ipa(25) Today’s year modulus 100 as an integer.
ipa(26) Today’s Julian day as an integer.
ipa(27) File identifier, up to the first 8 characters (left-justified, zero-filled).
ipa(28) Record format name (left-justified, zero-filled).
ipa(29) Tape density as an integer: 1=1600 b/i, 2= 6250 b/i.
ipa(30) Maximum block size as an integer.
ipa(31) Record length as an integer.
ipa(32) File status as an integer: 1= new, 2= old, 3= append.
ipa(33) Label type as an integer: 1= no label, 2= ANSI label, 3= IBM standard label, 4=
bypass label.
ipa(34) Integer file sequence number of first file on volume.
ipa(35) Ring status as an integer: 0= ring out, 1= ring in.
ipa(36) Expiration year modulus 100 as an integer.
ipa(37) Expiration Julian day as an integer.
ipa(38) First volume identifier of file as an integer.
ipa(39) User end-of-volume processing status as an integer: 0= EOV processing off,
1= EOV processing on.
ipa(40) User end-of-volume processing status as an integer: 0= EOV processing is not
currently active, 1= EOV processing is currently active.
ipa(41) User read/write tape mark status as an integer: 0= user read/write tape mark is not
allowed, 1= user read/write tape mark allowed.

004– 2165– 002 55


GETTP ( 3F ) GETTP ( 3F )

ipa(42) Block attribute (left-justified, zero-filled).


’B’L= blocked records
’S’L= spanned records if the record format is ’V’, or standard records if
the record format is ’F’
’R’L= blocked and spanned records if the record format is ’V’
’R’L= blocked and standard records if the record format is ’F’
’ ’L (blank)= none of the above
ipa(43)– ipa(48)
File identifier (left-justified, zero-filled).
synch This parameter is ignored if the last I/O operation was a read. If the last operation was a write,
this parameter is meaningful. In this case, the following values apply:
=0 Do not synchronize dataset.
=1 Synchronize dataset before obtaining position information. It is invalid to specify this
value in the following circumstance: end-of-volume (EOV) processing is enabled, and the
user has reached the EOV but has not started special processing. This parameter has no
effect on data buffered in library layers other than the tape layer.
istat Integer return status. On exit, this parameter contains a value indicating the status of the
information request:
=0 Indicates that the file was successfully queried, and ipa array is defined.
≠0 Indicates that an error was encountered during an attempt to query the tape file, or an
invalid argument was passed to GETTP (for example, len≤0). The ipa array is undefined.

NOTES
The er90 layer is not available on Cray T3E systems. See the assign(1) man page and the Tape
Subsystem User’s Guide, for more information about the er90 FFIO layer.

SEE ALSO
SETTP(3F)

56 004– 2165– 002


GETWA ( 3F ) GETWA ( 3F )

NAME
GETWA, SEEK – Synchronously and asynchronously reads data from the word-addressable, random-access
file

SYNOPSIS
CALL GETWA(dn, result, addr, count [,ierr])
CALL SEEK(dn, addr, count [,ierr])

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
Use the SEEK and GETWA calls together when possible to improve efficiency; SEEK calls are never
functionally required. The SEEK call reads the data asynchronously; the GETWA call waits for I/O to
complete and then transfers the data. The SEEK call moves the last write operation pages from memory to
disk, loading the user-requested word addresses to the front of the I/O buffers. You can load as much data
as fits into the file buffers. Subsequent GETWA and PUTWA calls that reference word addresses in the same
range do not cause any disk I/O.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
dn An integer variable, expression, or constant with a maximum of 8 characters. dn can be a unit
number or the name of the file as a Hollerith constant.
result Variable or array of any type. The location in the user program at which the first word is placed.
addr For GETWA, the word location of the file from which the first word is transferred. For SEEK, the
word address of the next read. Specify a type integer variable, expression, or constant.
count For GETWA, the number of words written from the file into user memory. For SEEK, the number
of words of the next read. Specify a type integer variable, expression, or constant.
ierr Error control and code. Specify a type integer variable. If you specify ierr on the call to GETWA
or SEEK, ierr returns any error codes to you. If ierr is not specified, an error aborts the program.
On output from GETWA, ierr has one of the following values:
=0 No errors detected.
<0 Error detected. ierr contains one of the following error codes:
+1 Request for a seek is outside page buffers.
-1 Invalid unit number.

004– 2165– 002 57


GETWA ( 3F ) GETWA ( 3F )

-2 The number of files has exceeded memory or size availability.


-3 User attempt to read past end-of-data (EOD).
-4 User-supplied word address less than or equal to 0.
-5 User-requested word count greater than maximum allowed.
-6 Illegal file name.
-7 User word count less than or equal to 0.

NOTES
Most of the routines in the run-time libraries are reentrant or have internal locks to ensure that they are
single threaded. Some library routines, however, must be locked at the user level if they are used by more
than one task. GETWA is not internally locked. You must lock each call to GETWA if it is called from more
than one task.
You cannot use the word-addressable I/O package on tape. An attempt to use a tape file causes an error
message to be written to the stderr file.
It is not valid to mix calls to word-addressable routines with standard Fortran I/O statements that use the
same unit number.

EXAMPLES
Assume that you want to use a routine that reads word addresses 1,000,000 to 1,051,200. A file is opened
with 101 blocks of buffer space, and the following call is used before calling the routine:
CALL SEE K(filename,10 00000,512 00, ierr)

Subsequent GETWA or PUTWA calls with word addresses in the range of 1,000,000 to 1,051,200 do not
trigger any disk I/O.

SEE ALSO
PUTWA(3F), WCLOSE(3F), WOPEN(3F)

58 004– 2165– 002


GTSTDPTR ( 3F ) GTSTDPTR ( 3F )

NAME
GTSTDPTR – Returns pointer to standard file

SYNOPSIS
INTEGER fd, stream, GTSTDPTR
stream = GTSTDPTR(fd)

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
GTSTDPTR maps a standard file descriptor (0, 1, or 2) into the corresponding address of the FILE structure
(stream pointer) for use in the Fortran-callable fread(3C) and fwrite(3C) routines.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
This routine has the following arguments:
fd Integer file descriptor. The following values are available:
0 Return address of standard input (stdin)
1 Return address of standard output (stdout)
2 Return address of standard error (stderr)
stream
Address of the FILE structure (stream pointer). Null (0) if the file descriptor is not valid (that is, if it
is not 0, 1, or 2).

SEE ALSO
fread(3C), fwrite(3C) in the UNICOS System Libraries Reference Manual

004– 2165– 002 59


NUMBLKS ( 3F ) NUMBLKS ( 3F )

NAME
NUMBLKS – Returns the current size of a file in 4096-byte blocks

SYNOPSIS
INTEGER NUMBLKS
val = NUMBLKS(unit)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION

This routine is supported on IRIX systems for programs compiled with the MIPSpro 7 Fortran 90 compiler
or compiled with the -craylibs option to the MIPSpro F77 compiler.
NUMBLKS returns the current size of a file.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX, the
argument must be type integer with default KIND, and the function must be type integer with KIND=8.
The following is a list of arguments for this routine.
val File size in 4096-byte blocks. This returned value reflects only the data actually written to disk
and does not take into account data still in the buffers. A value of 0 is returned if the file is a
pipe or character special device. A negative value indicates that unit is not connected or a
system operation failed unexpectedly.
unit An integer variable, expression, or constant containing a Fortran unit number.

60 004– 2165– 002


OPENMS ( 3F ) OPENMS ( 3F )

NAME
OPENMS, OPENDR – Opens a local file as a random-access file that can be accessed or changed by the
record-addressable, random-access file I/O routines

SYNOPSIS
CALL OPENMS(dn, index, length, it [,ierr])
CALL OPENDR(dn, index, length, it [,ierr])

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
OPENMS/OPENDR opens a file and specifies it as a random-access file that can be modified by the
random-access I/O routines. If the file does not exist, the master index contains zeros; if it does exist, the
master index is read from the file. The master index contains the current index to the file that is updated
when the file is closed by using CLOSMS/CLOSDR.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The default number of open files is 20 for OPENDR and 40 for OPENMS.
The following is a list of valid arguments for this routine.
dn An integer variable, expression, or constant with a maximum of 8 characters. dn can be a unit
number or the name of the file as a Hollerith constant.
index The name of the array in the user program that is going to contain the master index to the
records of the file. Specify a type integer array. This array must be changed only by the
random-access file I/O routines. index should be a multiple of 512 words.
length The length of the index array. Specify a type integer variable, expression, or constant. The
length of index depends on the number of records on, or to be written to, the file, using the
master index and on the type of master index. The length specification must be at least 2(nrec)
if it=1 or 3, or nrec if it=0 or 2. nrec is the number of records in, or to be written to, the file,
using the master index.
it Flag indicating the type of master index. Specify a type integer variable, expression, or constant.
it can have one of the following values:
0 Records synchronously referenced with a number between 1 and length
1 Records synchronously referenced with an alphanumeric name of 8 or fewer characters
2 Records asynchronously referenced with a number between 1 and length
3 Records asynchronously referenced with an alphanumeric name of 8 or fewer characters

004– 2165– 002 61


OPENMS ( 3F ) OPENMS ( 3F )

For a named index, odd-numbered elements of the index array contain the record name, and
even-numbered elements of the index array contain the pointers to the location of the record
within the file. For a numbered index, a given index array element contains the pointers to the
location of the corresponding record within the file.
ierr Error control and code. Specify a type integer variable. If you specify ierr on the call to
OPENMS/OPENDR, ierr returns any error codes to you. If ierr is not specified, an error aborts
the program. If you set ierr>0 on input to OPENMS/OPENDR, error messages are not placed in
the stderr file; otherwise, an error code is returned, and the error message is added to the
stderr file. OPENMS/OPENDR writes an open message to the stderr file whether or not the
value of ierr selects messages. On output from OPENMS/OPENDR ierr has the following
values:
=0 No errors detected.
<0 Error detected. ierr contains one of the following error codes:
-1 The file name or unit number is not valid.
-2 The user-supplied index length is less than or equal to 0.
-3 The number of files has exceeded memory or size availability.
-4 The file index length read from the file is greater than the user-supplied index length
(nonfatal message).
-5 The user-supplied index length is greater than the index length read from the file
(nonfatal message).
-11 The index word address read from the file is less than or equal to 0.
-12 The index length read from the file is less than 0.
-13 The file has a checksum error.
-14 OPENMS has already opened the file.
-20 File created by WRITDR/WRITMS.
-21 Memory limit exceeded while allocating internal tables.
-22 Could not open an unsupported DRIO file version.

NOTES
A file opened with OPENMS should be closed only by CLOSMS(3F). If you close the file in some other way,
the future behavior of the program is unpredictable.
The random-access I/O routines cannot be used in multitasking unless you provide your own locks. If you
are Autotasking or if you are not multitasking at all, you will not be affected. You will need locks only if
you are doing your own macrotasking or microtasking, and if you are multitasking your I/O calls.

62 004– 2165– 002


OPENMS ( 3F ) OPENMS ( 3F )

It is not valid to mix calls to MS/DR routines with standard Fortran I/O statements that use the same unit
number.

SEE ALSO
ASYNCMS(3F), CHECKMS(3F), CLOSMS(3F), FINDMS(3F), READMS(3F), STINDX(3F), SYNCMS(3F),
WAITMS(3F), WRITMS(3F)

004– 2165– 002 63


PUTWA ( 3F ) PUTWA ( 3F )

NAME
PUTWA, APUTWA – Writes to a word-addressable, random-access file

SYNOPSIS
CALL PUTWA(dn, source, addr, count [,ierr])
CALL APUTWA(dn, source, addr, count [,ierr])

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
PUTWA synchronously writes a number of words from memory to a word-addressable, random-access file.
APUTWA asynchronously writes a number of words from memory to a word-addressable, random-access file.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
dn An integer variable, expression, or constant with a maximum of 8 characters. dn can be a unit
number or the name of the file as a Hollerith constant.
source Variable or array of any noncharacter type. The location of the first word in the user program to
be written to the file.
addr The word location of the file that is to receive the first word from the user program. addr=1
indicates beginning of file. Specify a type integer variable, expression, or constant.
count The number of words from source to be written. Specify a type integer variable, expression, or
constant.
ierr Error control and code. Specify a type integer variable. If you supply ierr on the call to
PUTWA/APUTWA, ierr returns any error codes to you. If ierr is not supplied, an error causes the
program to abort. On return from PUTWA/APUTWA, ierr has one of the following values:
0 No errors detected.
+1 Request did not fit in the page table (buffer cache) in one pass; therefore, request was not
truly asynchronous.
-1 Invalid unit number.
-2 Number of files has exceeded memory size availability.
-4 User-supplied word address less than or equal to 0.
-5 User-requested word count greater than maximum allowed.

64 004– 2165– 002


PUTWA ( 3F ) PUTWA ( 3F )

-6 Invalid file name.


-7 User word count less than or equal to 0.

NOTES
Most of the routines in the run-time libraries are reentrant or have internal locks to ensure that they are
single-threaded. Some library routines, however, must be locked at the user level if they are used by more
than one task.
PUTWA is not internally locked. You must lock each call to PUTWA if it is called from more than one task.
You cannot use the word-addressable I/O package on tape. An attempt to use a tape file causes an error
message to be written to stderr.
It is not valid to mix calls to word-addressable routines with standard Fortran I/O statements that use the
same unit number.

SEE ALSO
GETWA(3F), WCLOSE(3F), WOPEN(3F)

004– 2165– 002 65


READ ( 3F ) READ ( 3F )

NAME
READ, READP – Reads words, full or partial record modes

SYNOPSIS
CALL READ(unit, word, count, status, [ubc])
CALL READP(unit, word, count, status, [ubc])

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
The READ and READP routines move words of data from disk or tape to a variable or array. After reading
less than a full record from disk or tape, READ leaves the file positioned at the beginning of the next record,
while READP leaves the file positioned at the next item in the record just read.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
unit An integer variable, expression, or constant. unit can be a unit number or name of the file as a
Hollerith constant of 7 characters or less (’MYFILE’L).
word Word-receiving data area, such as a variable or array.
count Integer variable. On entry, the number of words requested. (Do not specify a constant.) On
exit, the number of words actually transferred.
status Integer variable. On exit, status has one of the following values:
=-1 Words remain in record
= 0 End-of-record (EOR)
= 1 Null record
= 2 End-of-file (EOF)
= 3 End-of-data (EOD)
= 4 Hardware error
≥5 Error. The value may represent a Fortran library error or a system error. If it is a system
error, a definition may be found in <errno.h>. See the explain(1) command for
further details. See intro(2) in the UNICOS System Calls Reference Manual, for a
description of the system error names and numbers.

66 004– 2165– 002


READ ( 3F ) READ ( 3F )

ubc Integer variable. Optional unused bit count. Number of unused bits contained in the last word of
the record.

NOTES
If foreign record translation is enabled for the specified unit, the bits from the foreign logical records are
delivered to the user data area without data conversion.

EXAMPLES
The following example reads the first 2 words of the next record on unit 15. It also checks for success by
examining the returned value of status and writing a message containing the number of words read.
INTEGE R REC (10 )
IUNIT = 15
NUM = 2
CALL READ(I UNI T, REC , NUM, ISTAT)
IF (IS TAT .GT . 1) THE N
C handle except ion al con dition s (EO F, EOD , err or)
CAL L ABO RT(’unexp ect ed sta tus enc ounter ed’)
ENDIF
WRITE( *,* )’ Read ’ ,NU M,’ act ual words’
END

SEE ALSO
ACPTBAD(3F), READC(3F), READIBM(3F), SKIPBAD(3F), WRITE(3F), WRITEC(3F), WRITIBM(3F)

004– 2165– 002 67


READC ( 3F ) READC ( 3F )

NAME
READC, READCP – Reads characters, full or partial record mode

SYNOPSIS
CALL READC(unit, char, count, status)
CALL READCP(unit, char, count, status)

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
READC and READCP routines unpack characters from the I/O buffer and insert them in the user data area
beginning at the first word address. Characters are placed into the data area, 1 character per word,
right-justified. This process continues until the count is satisfied or an end-of-record (EOR) is encountered.
If an EOR is encountered first, the remainder of the field specified by the character count is filled with
blanks.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
unit An integer variable, expression, or constant. unit can be a unit number or file name as a
Hollerith constant of 7 characters or less (’MYFILE’L).
char Character-receiving data area.
count Integer variable. On entry, the number of characters requested. On exit, the number of
characters actually transferred.
status Integer variable. On exit, status has one of the following values:
=-1 Characters remain in record
= 0 End-of-record (EOR)
= 1 Null record
= 2 End-of-file (EOF)
= 3 End-of-data (EOD)
= 4 Hardware error
≥5 Error. If it is a system error, a definition may be found in <errno.h>. See
explain(1) for complete details. See intro(2) in the UNICOS System Calls Reference
Manual, for a description of the system error names and numbers.

68 004– 2165– 002


READC ( 3F ) READC ( 3F )

NOTES
If foreign record translation is enabled for the specified unit, the bits from the foreign logical records are
delivered after character conversion as specified with the assign(1) command.

SEE ALSO
ACPTBAD(3F), READ(3F), READIBM(3F), SKIPBAD(3F), WRITE(3F), WRITEC(3F), WRITIBM(3F)
explain(1) in UNICOS User Commands Reference Manual

004– 2165– 002 69


READIBM ( 3F ) READIBM ( 3F )

NAME
READIBM – Reads two IBM 32-bit floating-point words from each Cray Research 64-bit word

SYNOPSIS
CALL READIBM(unit, fwa, word, increment)

IMPLEMENTATION
UNICOS systems (except Cray T90 systems that support IEEE arithmetic)

DESCRIPTION
READIBM reads two IBM 32-bit floating-point words from each Cray Research 64-bit word.
When using the CF90 compiler on UNICOS systems, all arguments must be of default kind unless
documented otherwise. On UNICOS systems the default kind is KIND=8 for integer, real, complex, and
logical arguments.
The following is a list of valid arguments for this routine.
unit An integer variable, expression, or constant. unit can be a unit number or file name as a
Hollerith constant of 7 characters or less.
fwa First word address (FWA) of the user data area.
word Number of words needed.
increment Increment of the IBM words read.
On exit, the IBM 32-bit format is converted to the equivalent Cray Research 64-bit value. The Cray
Research 64-bit words are stored in the user data area.

NOTES
IBM2CRAY(3F) is the recommended routine for performing the same conversion.

SEE ALSO
ACPTBAD(3F), READ(3F), READC(3F), SKIPBAD(3F), WRITE(3F), WRITEC(3F), WRITIBM(3F)

70 004– 2165– 002


READMS ( 3F ) READMS ( 3F )

NAME
READMS, READDR – Reads a record from a random-access file to memory

SYNOPSIS
CALL READMS(dn, ubuff, n, irec [,ierr])
CALL READDR(dn, ubuff, n, irec [,ierr])

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
READMS and READDR read records from a random-access file to a contiguous memory area in the user’s
program.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
dn An integer variable, expression, or constant with a maximum of 8 characters. dn can be a unit
number or the name of the file as a Hollerith constant.
ubuff The location in your program where the first word of the record is placed. User-specified type;
do not use type character.
n The number of words to be read. Specify a type integer variable, expression, or constant. n
words are read from the random-access record irec and placed contiguously in memory,
beginning at ubuff. If necessary, READDR rounds n up to the next multiple of 512 words. If the
file is in synchronous mode, the data is saved and restored after the read. The maximum record
size is limited to 4,194,303 words.
irec The record number or record name of the record to be read. Specify a type integer variable,
expression, or constant. A record name is limited to a maximum of 8 characters. For a
numbered index, irec must be between 1 and the length of the index declared in the
OPENMS/OPENDR(3) call, inclusive. For a named index, irec is any 64-bit entity you specify.
ierr Error control and code. Specify a type integer variable. If you supply ierr on the call to
READMS/READDR, ierr returns any error codes to you. If ierr>0, no error messages are put into
the stderr file; otherwise, an error code is returned, and the message is added to the stderr
file.
On output from READMS/READDR, ierr has one of the following values:
=0 No errors detected.
<0 Error detected. ierr contains one of the following error codes:

004– 2165– 002 71


READMS ( 3F ) READMS ( 3F )

-1 The file name or unit number is invalid.


-6 The user-supplied named index is invalid.
-8 The index number is greater than the maximum on the file.
-10 The named record was not found in the index array.
-15 OPENMS/OPENDR was not called on this file.
-17 The index entry is less than or equal to 0 in the user’s index array.
-18 The user-supplied word count is less than or equal to 0.
-19 The user-supplied index number is less than or equal to 0.

NOTES
Most of the routines in the run-time libraries are reentrant or have internal locks to ensure that they are
single threaded. Some library routines, however, must be locked at the user level if they are used by more
than one task.
READMS and READDR are not internally locked. You must lock each call to these routines if they are called
from more than one task.
You cannot use the word-addressable I/O package on tape. An attempt to use a tape file causes an error
message to be written to stderr.
The random-access I/O routines cannot be used in multitasking unless you provide your own locks. If you
are Autotasking or if you are not multitasking at all, you will not be affected. You will need locks only if
you are doing your own macrotasking or microtasking and if you are multitasking your I/O calls.
It is not valid to mix calls to word-addressable routines with standard Fortran I/O statements that use the
same unit number.

CAUTIONS
If you are using READDR in asynchronous mode, and the record size is not a multiple of 512 words, user
data can be overwritten and not restored. With SYNCDR(3F), the file can be switched to read synchronously,
causing data to be copied out and restored after the read has completed.

SEE ALSO
ASYNCMS(3F), CHECKMS(3F), CLOSMS(3F), FINDMS(3F), OPENMS(3F), STINDX(3F), SYNCMS(3F),
WAITMS(3F), WRITMS(3F)

72 004– 2165– 002


RNL ( 3F ) RNL ( 3F )

NAME
RNLFLAG, RNLDELM, RNLSEP, RNLREP, RNLCOMM – Manipulates characters recognized by NAMELIST

SYNOPSIS
CALL RNLFLAG(char, mode)
CALL RNLDELM(char, mode)
CALL RNLSEP(char, mode)
CALL RNLREP(char, mode)
CALL RNLCOMM(char, mode)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
On IRIX systems, this routine is valid only when compiling programs with the MIPSpro 7 Fortran 90
compiler or when compiling programs with the -craylibs option to the MIPSpro F77 compiler. See the
"BUGS" subsection for further details.
These routines perform character manipulation.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS or IRIX, all arguments must
be of default kind unless documented otherwise. On UNICOS the default kind is KIND=8 for integer, real,
complex, and logical arguments; on IRIX, the default kind is KIND=4.
The following is a list of valid arguments for this routine.
char For RNLFLAG, an echo character. Default is E.
For RNLDELM, a delimiting character. The defaults are $ and &.
For RNLSEP, a separator character. Default is a comma (,).
For RNLREP, a replacement character. Default is =.
For RNLCOMM, a trailing comment indicator. Defaults are a colon (:) and a semicolon (;).
mode mode can have the following values:
=0 Delete character
≠0 Add character
In each of these user-control subroutine argument lists, char is a character variable that contains any ASCII
character. Except on the Cray T90 series, char may also be a Hollerith character, specified by 1Lx or 1Rx.
These routines support the Cray Fortran 77 (CF77) namelist extension. The ANSI Fortran 90 standard
introduced a standardized version of namelist I/O. The facilities provided by these routines are not used by
namelist I/O in a Fortran program compiled with Cray Fortran 90 (CF90) unless the -f77 option is supplied
on the assign command for a file or unit.

004– 2165– 002 73


RNL ( 3F ) RNL ( 3F )

RNLFLAG adds or removes char from the set of characters that, if found in column 1, initiates echoing of
the input lines to stdout.
RNLDELM adds or removes char from the set of characters that precede the NAMELIST group name and
signal end-of-input.
RNLSEP adds or removes char from the set of characters that must follow each constant to act as a
separator.
RNLREP adds or removes char from the set of characters that occur between the variable name and the
value.
RNLCOMM adds or removes char from the set of characters that initiate trailing comments on a line.
No checks are made to determine the reasonableness, usefulness, or consistency of these changes.

BUGS
On IRIX systems, the implementation of these routines has not been thoroughly tested.

SEE ALSO
RNLECHO(3F), RNLSKIP(3F), RNLTYPE(3F), WNL(3), WNLLINE(3F), WNLLONG(3F)

74 004– 2165– 002


RNLECHO ( 3F ) RNLECHO ( 3F )

NAME
RNLECHO – Specifies output unit for NAMELIST error messages and echo lines

SYNOPSIS
CALL RNLECHO(unit)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
On IRIX systems, this routine is valid only when compiling programs with the MIPSpro 7 Fortran 90
compiler or when compiling programs with the -craylibs option to the MIPSpro F77 compiler. See the
"BUGS" subsection for further details.
RNLECHO specifies the output unit for NAMELIST error messages and echo lines.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS or IRIX, all arguments must
be of default kind unless documented otherwise. On UNICOS the default kind is KIND=8 for integer, real,
complex, and logical arguments; on IRIX, the default kind is KIND=4.
unit Output unit to which error messages and echo lines are sent. If unit= – 1, error messages and
lines echoed because of an E in column 1 go to standard output (stdout).
If unit ≤ 0, error messages and input lines are echoed to unit, regardless of any echo flags
present. If unit=6 or unit=101, stdout is implied.

BUGS
On IRIX systems, the implementation of these routines has not been thoroughly tested.

SEE ALSO
RNL(3), RNLSKIP(3F), RNLTYPE(3F) WNL(3), WNLLINE(3F), WNLLONG(3F)

004– 2165– 002 75


RNLSKIP ( 3F ) RNLSKIP ( 3F )

NAME
RNLSKIP – Takes appropriate action when an undesired NAMELIST group is encountered

SYNOPSIS
CALL RNLSKIP(mode)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
On IRIX systems, this routine is valid only when compiling programs with the MIPSpro 7 Fortran 90
compiler or when compiling programs with the -craylibs option to the MIPSpro F77 compiler. See the
"BUGS" subsection for further details.
RNLSKIP determines an appropriate action if the NAMELIST group encountered is not the desired group.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS or IRIX, all arguments must
be of default kind unless documented otherwise. On UNICOS the default kind is KIND=8 for integer, real,
complex, and logical arguments; on IRIX, the default kind is KIND=4.
mode mode can have one of the following values:
>0 Skips the record and issues a message (default)
=0 Skips the record
<0 Aborts the job or goes to the optional ERR= branch

BUGS
On IRIX systems, the implementation of these routines has not been thoroughly tested.

SEE ALSO
RNL(3), RNLECHO(3F), RNLTYPE(3F), WNL(3), WNLLINE(3F), WNLLONG(3F)

76 004– 2165– 002


RNLTYPE ( 3F ) RNLTYPE ( 3F )

NAME
RNLTYPE – Determines action if type mismatch occurs across equal sign on NAMELIST input record

SYNOPSIS
CALL RNLTYPE(mode)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
On IRIX systems, this routine is valid only when compiling programs with the MIPSpro 7 Fortran 90
compiler or when compiling programs with the -craylibs option to the MIPSpro F77 compiler. See the
"BUGS" subsection for further details.
RNLTYPE determines an action if a type mismatch occurs.
mode If mode is not equal to 0, converts the constant to the type of the variable (default). If mode=0,
aborts the job or goes to the optional ERR= branch.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS or IRIX, all arguments must
be of default kind unless documented otherwise. On UNICOS the default kind is KIND=8 for integer, real,
complex, and logical arguments; on IRIX, the default kind is KIND=4.

BUGS
On IRIX systems, the implementation of these routines has not been thoroughly tested.

SEE ALSO
RNL(3), RNLECHO(3F), RNLSKIP(3F), WNL(3F), WNLLINE(3F), WNLLONG(3F)

004– 2165– 002 77


SETSP ( 3F ) SETSP ( 3F )

NAME
SETSP – Enables and disables EOV processing

SYNOPSIS
CALL SETSP(unit, iflag, istat)

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
SETSP enables and disables end-of-volume (EOV) processing.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
unit An integer variable or array element containing the Fortran unit number or Hollerith data of not
more than 7 characters.
iflag Enable or disable flag; iflag has the following arguments:
=0 Disables EOV processing
≠0 Enables EOV processing
istat Result of SETSP; istat can have one of the following values:
=0 No error
≠0 Error occurred

NOTES
The following preconditions must exist:
• The file must be an opened tape or ER90 file and must use the FFIO tape layer. ER90 files are not
supported on Cray T3E systems.
• EOV processing must be disabled for you to enable it.
• EOV processing must be enabled for you to disable it.
SEE ALSO
CHECKTP(3F), CLOSEV(3F), ENDSP(3F), STARTSP(3F)
Tape Subsystem User’s Guide

78 004– 2165– 002


SETTP ( 3F ) SETTP ( 3F )

NAME
SETTP – Positions a tape file at a tape block and/or a tape volume

SYNOPSIS
CALL SETTP(unit, nbs, nb, nvs, nv, ivi, synch, istat)

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
SETTP lets a program position a tape file at a particular tape block and/or tape volume. Tape volumes and
blocks are numbered sequentially, starting at 1. Volume positioning, if selected, occurs prior to any block
positioning. Volumes can be selected either by number or by volume identifier.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
unit An integer variable or array element containing the Fortran unit number or Hollerith data of not
more than 7 characters.
nbs Block number request sign. This parameter must be set to one of the following Hollerith values:
1H+ Indicates that the nb parameter is the number of blocks to skip forward, relative to the
current position.
1H- Indicates that the nb parameter is the number of blocks to skip backward relative to the
current position.
1H Indicates that the nb parameter is an absolute block number, relative to the last tape
mark or beginning-of-volume. If a nonzero value is specified for the nv parameter,
positioning is absolute with respect to that tape volume. If nv is 0, and the -T
parameter was not present on the tpmnt(1) command, the positioning is absolute with
respect to the current tape volume. If nv is 0, and the -T parameter was present on the
tpmnt command, then positioning is absolute with respect to the last tape mark read or
written. One blank space must follow 1H.
nb Integer block number. Specifies the relative or absolute block number to which the tape file is
to be positioned. A block number of 0 indicates no block positioning should be performed. A
negative block number is not valid.
nvs Volume number request sign. This parameter must be set to one of the following Hollerith
values:

004– 2165– 002 79


SETTP ( 3F ) SETTP ( 3F )

1H+ Indicates that the nv parameter is the number of volumes to skip forward, relative to the
current position.
1H– Indicates that the nv parameter is the number of volumes to skip backward relative to
the current position.
1H Indicates that the nv parameter is an absolute volume number, relative to the beginning
of the volume identifier list (specified on the tpmnt(1) command). One blank space
must follow 1H.
nv Integer volume number. Specifies the relative or absolute volume to which the tape file is to be
positioned. A volume number of 0 indicates no volume positioning is to be performed. A
negative volume number is invalid.
ivi Name of volume identifier to be mounted. The name must be left-justified and zero-filled. A
nonzero ivi parameter is not valid if nbs is 1H+ or 1H-, or if nvs is 1H+ or 1H-, or if nv is
nonzero. Specifying the volume identifier currently mounted causes it to be rewound.
synch Parameter to allow compatibility with the COS operating system; not supported under the
UNICOS operating system. The tape file is always synchronized (that is, all pending I/O is
allowed to complete) before any positioning.
istat Integer return status. On exit, this parameter contains a value indicating the status of the
positioning request.
=0 Indicates that the file was successfully positioned.
≠0 Indicates that an error was encountered trying to position the tape file, or an argument that
was not valid was passed to SETTP (for example, nb<0).

NOTES
The file must be a tape or ER90 file and must use the FFIO tape layer. ER90 files are not supported on
Cray T3E systems.
The er90 layer is not available on Cray T3E systems. See the assign(1) man page and the Tape
Subsystem User’s Guide for more information about the er90 FFIO layer.

SEE ALSO
GETTP(3F)
tpmnt(1) in the UNICOS User Commands Reference Manual

80 004– 2165– 002


SKIPBAD ( 3F ) SKIPBAD ( 3F )

NAME
SKIPBAD – Skips bad data

SYNOPSIS
CALL SKIPBAD(unit, blocks, termcnd)

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
SKIPBAD lets you skip bad data so that bad data is not sent to the user-specified buffer.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of arguments for this routine.
unit An integer variable or array element containing the Fortran unit number; unit may contain
Hollerith data of not more than 7 characters.
blocks On exit, this is the number of physical tape blocks skipped.
termcnd On exit, termcnd can have one of the following values:
<0 Not positioned at end-of-block
=0 Positioned at end-of-block
=1 Positioned at end-of-file

004– 2165– 002 81


SKIPBAD ( 3F ) SKIPBAD ( 3F )

EXAMPLES

PRO GRAM EXA MPL E1


IMP LICIT INT EGE R(A -Z)
PAR AMETER (NB YTE S=4 000 0,N DIM =NB YTE S/8 ,DN =99 )
DIM ENSION BUF FER (1: NDI M)
DIM ENSION UDA (1: 2*N DIM )

200 0 CON TINUE


NWORDS = NDI M
CALL READ(D N,B UFF ER, NWO RDS ,ST ATU S)
IF( (STATU S.E Q.2 ) .OR . (ST ATU S.E Q.3 )) THE N ! EOF or EOD
STOP ’CO MPL ETE ’
ELSE IF (ST ATU S .EQ . 4) THE N ! Par ity err or
CALL SKI PBA D(D N, BLO CKS , TER MCN D)
IF (TE RMC ND .LT . 0) THE N
PRI NT *,’ ERR OR WHE N SKI PPI NG BAD DAT A = ’,T ERM CND
STO P ’ER ROR ’

ELSEIF (TE RMC ND. EQ. 0)T HEN


PRI NT *,’ SKI PPE D ’,B LOC KS, ’ BAD BLO CKS ’
ELSE ! EOF
PRI NT *,’ SKI PPE D ’,B LOC KS, ’ BAD BLO CKS ’
STO P ’CO MPL ETE ’
ENDIF
GOTO 200 0
END IF
C ...
C Proces s dat a
C ...
GOTO 2000 ! Con tin ue rea din g
END

SEE ALSO
ACPTBAD(3F)

82 004– 2165– 002


SKIPF ( 3F ) SKIPF ( 3F )

NAME
SKIPF – Skips files

SYNOPSIS
CALL SKIPF(iunit, [ifile, istat, [retstat]])

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
SKIPF directs the system to skip a specified number of files from the current position.
When using the CF90 compiler on UNICOS and UNICOS/mk systems, all arguments must be of default
kind unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer,
real, complex, and logical arguments.
The following is a list of valid arguments for this routine.
iunit An integer variable or array element containing the Fortran unit number. Name of the file or
unit number to be positioned.
ifile Integer number. This parameter specifies the number of files to be skipped. If ifile is negative,
SKIPF positions backwards. If iunit is positioned midfile, the partial file skipped counts as one
file.
istat A 2-element integer array that returns the number of files skipped in the second element. istat is
an optional argument.
retstat Integer number. retstat is an optional argument. If present, retstat contains a value indicating
the status of the SKIPF request on return from the SKIPF subroutine. If this argument is not
present and a fatal error occurs while positioning, the program is aborted. retstat can have one
of the following values:
=0 Indicates that positioning was successful
≠0 Indicates that an error occurred

NOTES
SKIPF does not skip past end-of-data (EOD) or beginning-of-data (BOD). If BOD is encountered before
ifile files have been skipped when skipping backward, the file is positioned after the BOD. When skipping
forward, the file is positioned before the EOD of the current file. SKIPF is currently supported only for
online tape or ER90 files that use the FFIO tape layer.

004– 2165– 002 83


SKIPF ( 3F ) SKIPF ( 3F )

SKIPF can be used for positioning by user tape mark for tapes (see the -T option on the tpmnt(1)
command). SKIPF may not be used to position to different files within a multifile volume (see the -q
option of the tpmnt(1) command).

SEE ALSO
tpmnt(1) in the UNICOS User Commands Reference Manual

84 004– 2165– 002


STARTSP ( 3F ) STARTSP ( 3F )

NAME
STARTSP – Enables special tape processing

SYNOPSIS
CALL STARTSP(unit, istat)

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
STARTSP enables special end of volume (EOV) tape processing.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
unit An integer variable or array element containing the Fortran unit number or Hollerith data of not
more than 7 characters.
istat Result of STARTSP; istat can have one of the following values:
=0 Special processing initiated
≠0 Special processing not initiated

NOTES
The following preconditions must exist:
• The file must be an opened tape or ER90 file and must use the FFIO tape layer. ER90 files are not
supported on Cray T3E systems.
• EOV processing must be enabled.
• Special processing must be disabled.
STARTSP creates an alternative path to or from a tape. Tape blocks in the pipeline are held aside.
Subsequent write operations will go directly to tape; subsequent read operations will come directly from tape
(if data is available) or from the blocks in the pipeline. Both read and write operations are performed in
first-in-first-out (FIFO) order. After you have read from the blocks in the pipeline, they are unavailable for
writing after the ENDSP(3F) routine.

SEE ALSO
CHECKTP(3F), CLOSEV(3F), ENDSP(3F), SETSP(3F)
Tape Subsystem User’s Guide

004– 2165– 002 85


STINDX ( 3F ) STINDX ( 3F )

NAME
STINDX, STINDR – Allows an index to be used as the current index by creating a subindex

SYNOPSIS
CALL STINDX(filename, index, length, it [,ierr])
CALL STINDR(filename, index, length, it [,ierr])

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
STINDX/STINDR reduces the amount of memory needed by a file containing a large number of records. It
also maintains a file containing records logically related to each other. Records in the file, rather than
records in the master index area, hold secondary pointers to records in the file.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
filename An integer variable, expression, or constant that has a maximum of 8 characters. The name of
the file as a Hollerith constant. Alternatively, filename can be a positive integer that identifies
the file as fort.n, where n = filename. If an integer value is passed in filename, it must be in
the range 0 < n < 100.
index The user-supplied array used for the subindex or new current index. Specify a type integer
array. If index is a subindex, it must be a storage area that does not overlap the area used in
OPENMS/OPENDR(3) to store the master index.
length The length of the index array. Specify a type integer variable, expression, or constant. The
length of index depends on the number of records in the file or to be written to the file using the
master index and on the type of master index. If it=1, length must be at least twice the number
of records in the file or to be written to the file using index. If it=0, length must be at least the
number of records on or to be written to the file using index.
it A flag to indicate the type of index. Specify a type integer variable, expression, or constant.
When it=0, the records are referenced with a number between 1 and length. When it=1, the
records are referenced with an alphanumeric name of 8 or fewer characters. For a named index,
odd-numbered elements of the index array contain the record name and even-numbered elements
of the index array contain pointers to the location of the record within the file. For a numbered
index, a given index array element contains pointers to the location of the corresponding record
within the file. The index type defined by STINDX/STINDR must be the same as that used by
OPENMS/OPENDR.

86 004– 2165– 002


STINDX ( 3F ) STINDX ( 3F )

ierr Error control and code. Specify a type integer variable. If you supply ierr on the call to
STINDX/STINDR, ierr returns any error codes to you. If ierr>0, no error messages are put into
the stderr file; otherwise, an error code is returned, and the message is added to the stderr
file.
On return from STINDX/STINDR, ierr has one of the following values:
=0 No errors detected.
<0 Error detected. ierr contains one of the error codes described in the following table:
-1 The file name or unit number is not valid.
-15 OPENMS/OPENDR was not called on this file.
-16 A STINDX/STINDR call cannot change the index type.
STINDX/STINDR allows more than one index to manipulate the file. Generally, STINDX/STINDR toggle
the index between the master index (maintained by OPENMS/OPENDR and CLOSMS/CLOSDR(3)) and a
subindex (supplied and maintained by you).
You must maintain and update subindex records stored in the file. You can access and change records in the
file only by using the current index.
After a STINDX/STINDR call, subsequent calls to READMS/READDR(3) and WRITMS/WRITDR(3) use and
alter the current index array specified in the STINDX/STINDR call. You can save the subindex by calling
STINDX/STINDR with the master index array, then writing the subindex array to the file using
WRITMS/WRITDR. Retrieve the subindex by calling READMS/READDR on the record containing the
subindex information. Thus, STINDX/STINDR allows logically infinite index trees into the file and reduces
the amount of memory needed for a random-access file containing many records.

CAUTIONS
When generating a new subindex (for example, building a database), set the array or memory area used for
the subindex to 0. If the subindex storage is not set to 0, unpredictable results occur.

SEE ALSO
ASYNCMS(3F), CHECKMS(3F), CLOSMS(3F), FINDMS(3F), OPENMS(3F), READMS(3F), SYNCMS(3F),
WAITMS(3F), WRITMS(3F)

004– 2165– 002 87


SYNCMS ( 3F ) SYNCMS ( 3F )

NAME
SYNCMS, SYNCDR – Sets I/O mode for random-access routines to synchronous

SYNOPSIS
CALL SYNCMS(dn [,ierr])
CALL SYNCDR(dn [,ierr])

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
SYNCMS and SYNCDR set the I/O mode for random-access routines.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
dn An integer variable, expression, or constant with a maximum of 8 characters. dn can be a unit
number or the name of the file as a Hollerith constant.
ierr Error control and code. Specifies an integer variable. If you supply ierr on the call to
SYNCMS/SYNCDR, ierr returns any error codes to you. If ierr>0, no error messages are put into
the stderr file; otherwise, an error code is returned, and the message is added to the stderr
file.
On return from SYNCMS/SYNCDR, ierr has one of the following values:
=0 No errors detected.
<0 Error detected. ierr contains one of the following error codes:
-1 The file name or unit number is invalid.
-15 OPENMS/OPENDR was not called on this file.
All I/O operations wait for completion.

NOTES
The random-access I/O routines cannot be used in multitasking unless you provide your own locks. If you
are Autotasking or if you are not multitasking at all, you will not be affected. You will need locks only if
you are doing your own macrotasking or microtasking and if you are multitasking your I/O calls.

88 004– 2165– 002


SYNCMS ( 3F ) SYNCMS ( 3F )

It is not valid to mix calls to MS/DR routines with standard Fortran I/O statements that use the same unit
number.

SEE ALSO
ASYNCMS(3F), CHECKMS(3F), CLOSMS(3F), FINDMS(3F), OPENMS(3F), READMS(3F), STINDX(3F),
WAITMS(3F), WRITMS(3F)

004– 2165– 002 89


TSYNC ( 3F ) TSYNC ( 3F )

NAME
TSYNC – Requests tape synchronization

SYNOPSIS
CALL TYSNC(unit, istat)

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
TSYNC synchronizes a tape or ER90 file. This request is ignored if the last operation was a read. If the last
operation was a write, the tape file is synchronized (that is, buffered data is written to the tape). This routine
will return an error if the user has specified any FFIO layers other than the tape layer, the er90 layer, or
the bufa layer (see assign(1)).
It is not valid to call TSYNC in the following circumstance: when end-of-volume (EOV) processing is
enabled, and when the user has reached the EOV but has not started special processing.
If TSYNC is called when EOV processing is enabled, it may cause the user to reach EOV. In this case,
TSYNC will return without error, but the tape may not be synchronized. When EOV processing is enabled,
the user should check to see if EOV was reached by calling CHECKTP(3F) after calling TSYNC.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine:
unit An integer variable or array element containing the Fortran unit number or Hollerith data of not
more than 7 characters.
istat If istat=0, no error occurred. If istat is nonzero, an error or warning occurred.

NOTES
The file must be a tape or ER90 file. ER90 files and the er90 layer are not supported on Cray T3E
systems.

SEE ALSO
CHECKTP(3F)
assign(1)

90 004– 2165– 002


WAITMS ( 3F ) WAITMS ( 3F )

NAME
WAITMS, WAITDR – Waits for completion of an asynchronous I/O operation

SYNOPSIS
CALL WAITMS(dn, istat [,ierr])
CALL WAITDR(dn, istat [,ierr])

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
WAITMS and WAITDR wait for completion of an asynchronous I/O operation.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
dn Integer variable, expression, or constant with a maximum of 8 characters. dn can be a unit
number or the name of the file as a Hollerith constant.
istat File error flag. Specify a type integer variable; istat can have one of the following values:
0 No error occurred during the asynchronous I/O operation
1 Error occurred during the asynchronous I/O operation
ierr Error control and code. Specify a type integer variable. If you supply ierr on the call to
WAITMS/WAITDR, ierr returns any error codes to you. If ierr>0, no error messages are put into
the stderr file; otherwise, an error code is returned, and the message is added to the stderr
file.
On return from WAITMS/WAITDR, ierr has one of the following values:
=0 No errors detected.
<0 Error detected. ierr contains one of the following error codes:
–1 The file name or unit number if not valid.
-15 OPENMS/OPENDR was not called on this file.

NOTES
The random-access I/O routines cannot be used in multitasking unless you provide your own locks. If you
are Autotasking or if you are not multitasking at all, you will not be affected. You will need locks only if
you are doing your own macrotasking or microtasking and if you are multitasking your I/O calls.

004– 2165– 002 91


WAITMS ( 3F ) WAITMS ( 3F )

It is not valid to mix calls to MS/DR routines with standard Fortran I/O statements that use the same unit
number.

SEE ALSO
ASYNCMS(3F), CHECKMS(3F), CLOSMS(3F), FINDMS(3F), OPENMS(3F), READMS(3F), SYNCMS(3F),
STINDX(3F) WRITMS(3F)

92 004– 2165– 002


WCLOSE ( 3F ) WCLOSE ( 3F )

NAME
WCLOSE – Finalizes changes and closes word-addressable, random-access file

SYNOPSIS
CALL WCLOSE(dn [,ierr])

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
WCLOSE finalizes the additions and changes to the word-addressable, random-access file and closes the file.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
dn An integer variable, expression, or constant with a maximum of 8 characters. dn can be a unit
number or the name of the file as a Hollerith constant.
ierr Error control and code. Specify an integer variable, expression, or constant. If you supply ierr
on the call to WCLOSE, ierr returns any error codes to you. If ierr is not supplied, an error
aborts the program.
On output from WCLOSE, ierr has one of the following values:
0 No errors detected
-1 Invalid unit number
-6 Invalid file name

NOTES
You cannot use the word-addressable I/O package on tape. An attempt to use a tape file causes an error
message to be written to stderr.
It is not valid to mix calls to word-addressable routines with standard Fortran I/O statements that use the
same unit number.

SEE ALSO
GETWA(3F), PUTWA(3F), WOPEN(3F)

004– 2165– 002 93


WNL ( 3F ) WNL ( 3F )

NAME
WNLFLAG, WNLDELM, WNLSEP, WNLREP – Provides user control of NAMELIST output format

SYNOPSIS
CALL WNLFLAG(char)
CALL WNLDELM(char)
CALL WNLSEP(char)
CALL WNLREP(char)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
On IRIX systems, this routine is valid only when compiling programs with the MIPSpro 7 Fortran 90
compiler or when compiling programs with the -craylibs option to the MIPSpro F77 compiler. See the
"BUGS" subsection for further details.
These routines provide user control of output formatting.
char For WNLFLAG, the first ASCII character of the first line. Default is a blank.
For WNLDELM, a NAMELIST delimiter. Default is &.
For WNLSEP, a NAMELIST separator. Default is a comma (,).
For WNLREP, a NAMELIST replacement character. Default is =.
WNLFLAG changes the character written in column 1 of the first line from blank to char. Typically, char is
used for carriage control if the output is to be listed, or for forcing echoing if the output is to be used as
input for NAMELIST reads.
WNLDELM changes the character preceding the group name and END from & to char.
WNLSEP changes the separator character immediately following each value from , to char.
WNLREP changes the replacement operator that comes between name and value from = to char.
In each of these subroutines, char is a character variable that contains any ASCII character. Except on the
Cray T90 series, char may also be a Hollerith character, specified by 1Lx or 1Rx.
These routines support the Cray Research FORTRAN 77 (CF77) namelist extension. The ANSI Fortran 90
standard introduced a standardized version of namelist I/O. The facilities provided by these routines are not
used by namelist I/O in a Fortran program compiled with Cray Research Fortran 90 (CF90) unless the -f77
option is supplied on the assign(1) command for a file or unit.

94 004– 2165– 002


WNL ( 3F ) WNL ( 3F )

BUGS
On IRIX systems, the implementation of these routines has not been thoroughly tested.

SEE ALSO
RNL(3), RNLECHO(3F), RNLSKIP(3F), RNLTYPE(3F), WNLLINE(3F), WNLLONG(3F)

004– 2165– 002 95


WNLLINE ( 3F ) WNLLINE ( 3F )

NAME
WNLLINE – Allows each NAMELIST variable to begin on a new line

SYNOPSIS
CALL WNLLINE(value)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
On IRIX systems, this routine is valid only when compiling programs with the MIPSpro 7 Fortran 90
compiler or when compiling programs with the -craylibs option to the MIPSpro F77 compiler. See the
"BUGS" subsection for further details.
WNLLINE allows each NAMELIST variable to begin on a new line.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS or IRIX, all arguments must
be of default kind unless documented otherwise. On UNICOS the default kind is KIND=8 for integer, real,
complex, and logical arguments; on IRIX, the default kind is KIND=4.
value The following values are possible for the value argument:
0 No new line
1 New line for each variable

BUGS
On IRIX systems, the implementation of these routines has not been thoroughly tested.

SEE ALSO
RNL(3), RNLECHO(3F), RNLSKIP(3F), RNLTYPE(3F), WNL(3), WNLLONG(3F)

96 004– 2165– 002


WNLLONG ( 3F ) WNLLONG ( 3F )

NAME
WNLLONG – Selects NAMELIST output line length

SYNOPSIS
CALL WNLLONG(length)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
On IRIX systems, this routine is valid only when compiling programs with the MIPSpro 7 Fortran 90
compiler or when compiling programs with the -craylibs option to the MIPSpro F77 compiler. See the
"BUGS" subsection for further details.
WNLLONG specifies the output line length of the NAMELIST variable.
length The maximum output line length for NAMELIST writes, in the range 8 < length < 267. A length
of -1 has the effect of setting the output length to the initial, default value (133 for NAMELIST
output).
When using the CF90 compiler on UNICOS systems, all arguments must be of default kind unless
documented otherwise. On UNICOS the default kind is KIND=8 for integer, real, complex, and logical
arguments.

NOTES
WNLLONG is overridden by the RECL parameter on the OPEN statement. Where possible, RECL should be
used in place of WNLLONG to select the NAMELIST output line length.

BUGS
On IRIX systems, the implementation of these routines has not been thoroughly tested.

SEE ALSO
RNL(3), RNLECHO(3F), RNLSKIP(3F), RNLTYPE(3F), WNL(3), WNLLINE(3F)

004– 2165– 002 97


WOPEN ( 3F ) WOPEN ( 3F )

NAME
WOPEN – Opens a word-addressable, random-access file

SYNOPSIS
CALL WOPEN(dn, blocks, istats [,ierr])

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
WOPEN opens a file and specifies it as a word-addressable, random-access file that can be accessed or
changed with the word-addressable I/O routines. The WOPEN call is optional.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
dn An integer variable, expression, or constant with a maximum of 8 characters. dn can be a unit
number or the name of the file as a Hollerith constant.
blocks The maximum number of 512-word blocks that the word-addressable package can use for a
buffer. Specify a type integer variable, expression, or constant.
istats Specify a type integer variable, expression, or constant. If istats is nonzero, statistics about the
changes and accesses to the file filename are collected. (See the following table for information
about the statistics that are collected.) Statistics are written to stderr.
ierr Error control and code. Specify a type integer variable. If you supply ierr on the call to
WOPEN, ierr returns any error codes to you. If ierr is not supplied, an error aborts the job.
On output from WOPEN, ierr has one of the following values:
0 No errors detected
-1 Invalid unit number
-2 Number of files has exceeded memory size availability
-6 Invalid file name

NOTES
A file opened using WOPEN should be closed only by WCLOSE(3F). If you close the file in some other way,
the subsequent behavior of the program and the validity of the file are unpredictable.

98 004– 2165– 002


WOPEN ( 3F ) WOPEN ( 3F )

If you bypass WCLOSE, the internal tables maintained by the word-addressable I/O package are not updated,
leaving dangling pointers in future computation.
You cannot use the word-addressable I/O package on tape. An attempt to use a tape file causes an error
message to be written to stderr.
It is not valid to mix calls to word-addressable routines with standard Fortran I/O statements that use the
same unit number.

MESSAGES

Message Description

BUFFERS USED = Number of 512-word buffers used by this file.


TOTAL ACCESSES = Number of accesses. This is the sum of the GETWA(3F) and
PUTWA(3F) calls.
GETS = Number of times the user called GETWA.
PUTS = Number of times the user called PUTWA.
FINDS = Number of times the user called SEEK(3F).
HITS = Number of times word addresses desired were resident in memory.
MISSES = Number of times no word addresses desired were resident in memory.
PARTIAL HITS = Number of times that some but not all of the word addresses desired
were in memory.
DISK READS = Number of physical disk reads done.
DISK WRITES = Number of times a physical disk was written to.
BUFFER FLUSHES = Number of times buffers were flushed.
WORDS READ = Number of words moved from buffers to user.
WORDS WRITTEN = Number of words moved from user to buffer.
TOTAL WORDS = Sum of WORDS READ and WORDS WRITTEN.
TOTAL ACCESS TIME = Real time spent in disk transfers.
AVER ACCESS TIME = TOTAL ACCESS TIME divided by the sum of DISK READS and
DISK WRITES.
EOD BLOCK NUMBER = Number of the last block of the file.
DISK WORDS READ = Count of number of words moved from disk to buffers.
DISK WDS WRITTEN = Count of number of words moved from buffers to disk.
TOTAL DISK XFERS = Sum of DISK WORDS READ and DISK WORDS WRITTEN.
BUFFER BONUS % = TOTAL WORDS divided by value TOTAL DISK XFERS multiplied
by 100.

SEE ALSO
GETWA(3F), PUTWA(3F), WCLOSE(3F)

004– 2165– 002 99


WRITE ( 3F ) WRITE ( 3F )

NAME
WRITE, WRITEP – Writes words, full or partial record mode

SYNOPSIS
CALL WRITE(unit, word, count, ubc, status)
CALL WRITEP(unit, word, count, ubc, status)

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
WRITE and WRITEP write words in full or partial record mode.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
unit An integer variable, expression, or constant. unit can be a unit number or file name as a
Hollerith in 7 characters or less (’MYFILE’L).
word Data area containing words; this may not be a Fortran character variable.
count An integer variable. Word count. For WRITE, a value of 0 causes an end-of-record (EOR)
record control word to be written.
ubc An integer variable. Optional unused bit count. Number of unused bits contained in the last
word of the record.
status An integer variable. Optional status. If present, status has one of the following values on exit:
=0 No error.
≠0 Error. If it is a system error, a definition may be found in <errno.h>. See the
explain(1) command for complete details. See intro(2) in UNICOS System Calls
Reference Manual, for a description of the system error names and numbers.
In routines in which words are written, the number of words specified by the count are transmitted from the
area beginning at the first word address and are written in the I/O buffer.

NOTES
If foreign record translation is enabled for the specified unit, the bits from the user are delivered to the
foreign logical records without data conversion.

100 004– 2165– 002


WRITE ( 3F ) WRITE ( 3F )

SEE ALSO
ACPTBAD(3F), READ(3F), READC(3F), READIBM(3F), SKIPBAD(3F), WRITEC(3F), WRITIBM(3F)
explain(1) in the UNICOS User Commands Reference Manual

004– 2165– 002 101


WRITEC ( 3F ) WRITEC ( 3F )

NAME
WRITEC, WRITECP – Writes characters, full or partial record mode

SYNOPSIS
CALL WRITEC(unit, char, count, status)
CALL WRITECP(unit, char, count, status)

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
WRITEC and WRITECP write characters in full or partial record mode.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of valid arguments for this routine.
unit An integer variable, expression, or constant. unit can be a unit number or file name as a
Hollerith constant in 7 characters or less (’MYFILE’L).
char Data area containing characters; this may not be a Fortran character variable.
count Type integer variable. Character count.
status Type integer variable. Optional status. If present, status has one of the following values on
exit:
=0 No error.
≠0 Error. If it is a system error, a definition may be found in <errno.h>. See intro(2)
in UNICOS System Calls Reference Manual, for a description of the system error names
and numbers.
WRITEC and WRITECP routines pack characters into the I/O buffer for the file. The count specifies the
number of characters packed. These characters originate from the user area defined at the first word address,
which is 1 character per source word (right-justified).

NOTES
If foreign record translation is enabled for the specified unit, the bits from the user are delivered to the
foreign logical records after character conversion is specified with the assign(1) command.

102 004– 2165– 002


WRITEC ( 3F ) WRITEC ( 3F )

SEE ALSO
ACPTBAD(3F), READ(3F), READC(3F), READIBM(3F), SKIPBAD(3F), WRITE(3F), WRITIBM(3F)
assign(1)

004– 2165– 002 103


WRITIBM ( 3F ) WRITIBM ( 3F )

NAME
WRITIBM – Writes two IBM 32-bit floating-point words from each Cray 64-bit word

SYNOPSIS
CALL WRITIBM(unit, fwa, value, increment)

IMPLEMENTATION
UNICOS systems (except Cray T90 systems that support IEEE arithmetic)

DESCRIPTION

WRITIBM writes two IBM 32-bit floating-point words from each Cray 64-bit word.
When using the CF90 compiler on UNICOS systems, all arguments must be of default kind unless
documented otherwise. On UNICOS systems the default kind is KIND=8 for integer, real, complex, and
logical arguments.
The following is a list of valid arguments for this routine.
unit File name or unit number
fwa First word address (FWA) of the user data area
value Number of values to be written
increment Increment of the source (Cray) words written

NOTES
On exit, IBM 32-bit words are written to the unit.

SEE ALSO
ACPTBAD(3F), READ(3F), READC(3F), READIBM(3F), SKIPBAD(3F), WRITE(3F), WRITEC(3F)

104 004– 2165– 002


WRITMS ( 3F ) WRITMS ( 3F )

NAME
WRITMS, WRITDR – Writes to a random-access file on disk

SYNOPSIS
CALL WRITMS(dn, ubuff, n, irec, rrflag, s [,ierr])
CALL WRITDR(dn, ubuff, n, irec, rrflag, s [,ierr])

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
WRITMS and WRITDR write data from user memory to a record in a random-access file on disk and update
the current index.
When using the CF90 compiler on UNICOS or UNICOS/mk systems, all arguments must be of default kind
unless documented otherwise. On UNICOS and UNICOS/mk, the default kind is KIND=8 for integer, real,
complex, and logical arguments.
The following is a list of arguments for this routine.
dn Type integer variable, expression, or constant with a maximum of 8 characters. dn is a unit
number or the name of the file as a Hollerith constant.
ubuff The location of the first word in the user program to be written to the record. User-specified
type. May not be a Fortran character variable.
n The number of words to be written to the record. Specify a type integer variable, expression, or
constant. n contiguous words from memory, beginning at ubuff, are written to the file record.
Because UNICOS unblocked-file I/O is in multiples of 512 words, it is recommended that n be a
multiple of 512 words when speed is important. However, the random access file I/O routines
support record lengths other than multiples of 512 words. WRITDR rounds n up to the next
multiple of 512 words, if necessary.
64
The maximum record size is 4,194,303 words for WRITMS and 2 /S words for WRITDR, where
S is the size of the DRIO file in words. There are 2 exceptions to this maximum record size for
WRITDR; the maximum record size is 4,193,792 words in the following cases:
• when STINDR has been used to select a non-default index array
• when the datafile being accessed was created by a program linked with CrayLibs releases
prior to CrayLibs 3.0
irec The record number or record name of the record to be written. Specify a type integer variable,
expression, or constant. A record name is limited to a maximum of 8 characters. For a
numbered index, irec must be between 1 and the length of the index declared in the
OPENMS/OPENDR(3) call. For a named index, irec is any 64-bit entity you specify.

004– 2165– 002 105


WRITMS ( 3F ) WRITMS ( 3F )

rrflag A flag indicating record rewrite control. Specify a type integer variable, expression, or constant.
rrflag can be one of the following codes:
0 Write the record at end-of-data (EOD).
1 If the record already exists, and the new record length is less than or equal to the old
record length, rewrite the record over the old record. If the new record length is greater
than the old, abort the program or return the error code in ierr. If the record does not
exist, the program aborts or the error code is returned in ierr.
-1 If the record exists, and its new length does not exceed the old length, write the record
over the old record; otherwise, write the record at EOD.
s A subindex flag. Specify a type integer variable, expression, or constant. (The implementation
of this parameter has been deferred.)
ierr Error control and code. Specify a type integer variable. If you supply ierr on the call to
WRITMS/WRITDR, ierr returns any error codes to you. If ierr>0, no error messages are put into
the stderr file; otherwise, an error code is returned and the message is added to the stderr
file.
On return from WRITMS/WRITDR, ierr has one of the following values:
0 No errors or warnings detected.
<0 Error or warning condition detected. ierr contains one of the following error or warning
codes:
Error codes:
-1 The file name or unit number is not valid.
-6 The user-supplied named index is not valid.
-7 The named record index array is full.
-8 The index number is greater than the maximum on the file.
-9 Rewrite record exceeds the original.
-15 OPENMS/OPENDR was not called on this file.
-17 The index entry is less than or equal to 0 in the user’s index array.
-18 The user-supplied word count is less than or equal to 0.
-19 The user-supplied index number is less than or equal to 0.
-26 The user-requested record length exceeds the maximum allowed.
-27 The user-requested record length exceeds the maximum allowed for a file of this size.
Warning codes:
-21 The record size exceeds the buffer size for an asynchronous WRITMS request. The
WRITMS operation operated synchronously.

106 004– 2165– 002


WRITMS ( 3F ) WRITMS ( 3F )

NOTES
Most routines in the run-time libraries are reentrant or have internal locks to ensure that they are single
threaded. Some library routines, however, must be locked at the user level if they are used by more than
one task.
WRITMS and WRITDR are not internally locked. You must lock each call to these routines if they are called
from more than one task.
You cannot use the word-addressable I/O package on tape. An attempt to use a tape file causes an error
message to be written to stderr.
It is not valid to mix calls to MS/DR routines with standard Fortran I/O statements that use the same unit
number.

EXAMPLES
The following examples show some of the features and uses of random-access file routines.
Example 1: In the SORT program, a sequence of records is read in and then printed out as a sorted sequence
of records.
PROGRA M SOR T
INTEGE R IAR RAY (512)
INTEGE R IND EX (51 2), KEY S (10 0)
CALL OPE NMS (’S ORT ’L, IND EX, 255 ,1)
N=50
C READ IN RAN DOM ACC ESS REC ORD S FRO M UNI T "SO RT"
DO 21 I=1 ,N
REA D(5 ,10 00) (IA RRA Y(J ),J =1, 512 )
NAM E=I ARR AY( 1)
KEY S(I )=I ARR AY(1)
CAL L WRI TMS (’S ORT’L, IAR RAY ,51 2,N AME ,0)
21 CONTIN UE
C SORT KEYS ALP HAB ETI CALLY IN ASC END ING ORD ER USI NG
C EXC HANGE SOR T
DO 23 I=1 ,N- 1
MIN =I
J=I +1
DO 22 K=J ,N
IF (KE YS( K).LT. KEY S(M IN) ) MIN =K
22 CON TIN UE
IB= KEY S(I )
KEY S(I )=K EYS (MIN)
KEY S(M IN) =IB
23 CONTIN UE
C WRITE OUT RAN DOM ACC ESS REC ORD S IN ASC END ING
C ALP HABETI CAL ORD ER

004– 2165– 002 107


WRITMS ( 3F ) WRITMS ( 3F )

DO 24 I=1 ,N
NAM E=KEYS (I)
CALL READMS (’S ORT’L, IAR RAY ,51 2,NAME )
WRI TE( 6,5 120) (IARRA Y(J ),J =1, 512)
24 CON TINUE
1000 FOR MAT (". ....." )
5120 FOR MAT (1X,". ... ..")
CALL CLO SMS (’S ORT’L)
STOP
END

In this example, the random-access file is initialized as shown in line 4. Lines 6 through 11 show that a
record is read from unit 5 into array IARRAY and then written as a record to the random-access file SORT.
The first word of each record is assumed to contain an 8-character name to be used as the name of the
record.
Lines 12 through 21 sort the names of the records in array KEYS. Lines 22 through 26 read in and then
print the records in alphabetical order.
Example 2: Programs INITIAL and UPDATE show how the random-access file might be updated without
the usual search and positioning of a sequential access file.
Program INITIAL:
PRO GRAM INITIA L
INT EGER IARRAY (512)
INT EGER INDEX (512)
C
C OPE N RAN DOM ACCESS DATASE T
C THI S INI TIA LIZES THE RECORD KEY "IN DEX "
C
CALL OPENMS (’M ASTER’ L,I NDEX,1 01, 1)
C
C READ IN RECORD S FRO M UNI T 6 AND
C WRITE THE M TO THE DATASE T "MA STE R"
C
DO 10 I=1 ,50
READ(6 ,600) (IA RRA Y(J),J =1, 512)
NAME=I ARRAY( 1)
CALL WRITMS (’M ASTER’ L,I ARR AY, 512,NA ME,0,0 )
CON TINUE
C
C CLO SE "MASTE R" AND SAV E REC ORD S FOR UPD ATING
C
10 CAL L CLO SMS (’MAST ER’ L)
600 FOR MAT (1X ,’.... .’)

108 004– 2165– 002


WRITMS ( 3F ) WRITMS ( 3F )

STO P
END

Program UPDATE:
PRO GRAM UPDATE
INT EGE R INE WRCD(5 12)
INT EGE R IND X (51 2)
C
C OPE N RANDOM ACC ESS DATASE T CRE ATED IN THE
C PRE VIO US PRO GRAM "IN ITI AL"
C
C IND X WIL L BE WRITTEN OVE R THE OLD RECORD KEY
C
CALL OPENMS (’M AST ER’L,I NDX ,10 1,1 )
C
C READ IN NUM BER OF REC ORD S TO BE UPD ATE D
C
5 REA D (6, 610) N
C
C REA D IN NEW RECORD S FRO M UNI T 6 AND
C WRITE THEM IN PLA CE OF THE OLD RECORD THA T HAS
C THAT NAM E
C
DO 10 I=1 ,N
REA D(6,60 0) (INEWR CD( J), J=1 ,51 2)
NAME=I NEWRCD (1)
CAL L WRI TMS (’M ASTER’ L,I NEW RCD ,51 2,N AME ,1, 0)
10 CON TINUE
C
C CLOSE "MASTE R" AND SAV E NEW LY UPD ATE D REC ORD S
C FOR FUR THE R UPD ATING
C
CAL L CLO SMS (’M AST ER’ L)
600 FOR MAT (1X,". ... ..")
610 FOR MAT (1X ,".... .." )
STOP
END

In the preceding example, program INITIAL creates a random-access file on unit MASTER; program
UPDATE then replaces particular records of this file without changing the remainder of the records.

004– 2165– 002 109


WRITMS ( 3F ) WRITMS ( 3F )

Line 10 shows that the call to CLOSMS(3F) at the end of INITIAL caused the contents of INDEX to be
written to the random-access file.
Line 4 shows that the call to OPENMS(3F) at the beginning of UPDATE has caused the record key of the
random-access file to be written to INDX. The random-access file and INDX are now the same as the
random-access file and INDEX at the end of INITIAL.
Lines 6 through 10 show that certain records are replaced.
Example 3: The program SNDYMS is an example of the use of the secondary index capability, using
STINDX(3F). In this example, dummy information is written to the random-access file.
PROGRAM SNDYMS
IMPLIC IT INT EGE R (A- Y)
DIMENSION PIN DEX(20 ),S IND EX(30) ,ZB UFF R(5 0)
DAT A PLE N,SLEN ,RLEN /20 ,30 ,50/
C OPE N THE FIL E.
CALL OPENMS (1, PINDEX ,PL EN, 0,E RR)
IF (ERR.N E.0) THEN
PRINT* ,’ Err or on OPENMS , err =’, ERR
STOP 1
END IF
C LOO P OVE R THE 20 PRI MAR Y IND ICES. EAC H TIM E
C A SECOND ARY INDEX IS FUL L, WRI TE THE
C SEC OND ARY IND EX ARR AY TO THE DATASE T.
DO 40 K=1 ,PLEN
C ZERO OUT THE SEC OND ARY IND EX ARRAY.
DO 10 I=1,SL EN
10 SIN DEX (I)=0
C CALL STINDX TO CHANGE IND EX TO SIN DEX .
CALL STINDX (1, SINDEX,SL EN, 0,ERR)
IF (ER R.NE.0 ) THE N
PRINT* ,’ Err or on STI NDX , err =’, ERR
STOP 2
END IF
C WRI TE SLEN RECORD S.
DO 30 J=1 ,SLEN
C GEN ERATE A REC ORD LENGTH BET WEE N 1 AND RLE N.
TRLEN= MAX 0(IFIX (RANF( 0)* FLO AT(RLE N)) ,1)
C FIL L THE "DA TA" ARR AY WIT H RAN DOM FLOATI NG POI NT
C NUM BER S.
DO 20 I=1 ,TRLEN
20 ZBU FFR(I) =(J+SI N(F LOA T(I))) **( 1.+RAN F(0))
CALL WRI TMS (1, ZBUFFR ,TR LEN,J, -1, DUM MY, ERR )
IF (ER R.N E.0 ) THE N
PRI NT* ,’ Err or on WRI TMS, err=’, ERR

110 004– 2165– 002


WRITMS ( 3F ) WRITMS ( 3F )

STO P 3
END IF
30 CON TIN UE
C "TO GGL E" THE IND EX BACK TO THE MAS TER AND
C WRITE THE SECOND ARY IND EX TO THE DATASE T.
CAL L STI NDX (1, PINDEX ,PL EN,0)
C NOT E THE ABO VE STINDX CALL DOES NOT USE THE
C OPTION AL ERROR PARAME TER , AND WIL L ABO RT
C IF STI NDX DETECT S AN ERR OR.
CAL L WRI TMS (1,SIN DEX ,SLEN, K,- 1,D UMM Y,E RR)
IF (ER R.N E.0) THE N
PRI NT*,’ Err or on STI NDX , err =’, ERR
STO P 4
ENDIF
40 CONTIN UE
C CLO SE THE DATASE T.
CAL L CLO SMS (1, ERR )
IF (ERR.N E.0 ) THE N
PRI NT*,’ Err or on CLO SMS , err =’, ERR
STO P 5
ENDIF
STO P ’No rmal’
END

SEE ALSO
CLOSMS(3F), OPENMS(3F), STINDX(3F)

004– 2165– 002 111


112 004– 2165– 002
INTRO_FFIO ( 3F ) INTRO_FFIO ( 3F )

NAME
INTRO_FFIO – Describes performance options available with the FFIO layers

IMPLEMENTATION
See individual man pages for implementation details.

DESCRIPTION
The Flexible File I/O (FFIO) system lets the user specify a comma-separated list of layers through which I/O
data is to be passed. This is done by providing a value for the spec argument to the -F option on the
assign(1) command. This specifies a class of processing to be done on the data.
The following C routines are used with FFIO:
• fffcntl(3C): performs functions on files opened using FFIO
• fflistio(3C): initiates a list of I/O requests using FFIO
• ffiolock(3C): locks and unlocks function calls
• ffopen(3C): opens or closes a file using FFIO
• ffpos(3C): positions files opened using FFIO
• ffread(3C): reads from a file using FFIO
• ffreada(3C): provides asynchronous read using FFIO
• ffseek(3C): repositions a FFIO file
• ffwritea(3C): provides asynchronous write using FFIO
• ffsetsp(3C): initiates EOV processing for files opened using FFIO
• ffwrite(3C): writes to a file using FFIO
FFIO on IRIX systems
The default layer for direct access on IRIX systems is the cache layer and it does not have the coherency
to handle multiple processes doing I/O to the same file. The user must assign the direct access file to either
the system or global layer for programs to work as expected with more than one process.
On IRIX systems, the FFIO library calls aio_sgi_init the first time it issues an asynchronous I/O call.
It passes the following parameters to aio_sgi_init:
aio_nu musers =MA X(6 4,s ysc onf (_S C_N PRO C_C ONF ))
aio_th reads= 5
aio _locks =3

If a program is using multiple threads and asychronous I/O, it is important that the value of
aio_numusers be at least as large as the number of sprocs and pthreads that the application contains. For
more information, see the aio_sgi_init man page on IRIX systems.

004– 2165– 002 113


INTRO_FFIO ( 3F ) INTRO_FFIO ( 3F )

Users can change these values by setting the following environment variables to the desired value:
• change FF_IO_AIO_THREADS to modify aio_threads
• change FF_IO_AIO_LOCKS to modify aio_locks
• change FF_IO_AIO_NUMUSERS to modify aio_numusers
The following example causes aio_threads to be set to 8 when the FFIO routines call aio_sgi_init:
set env FF_ IO_ AIO _THREA DS 8

Users can also supersede the FFIO library’s call to aio_sgi_init by calling it themselves, before the first
I/O statement in their program.
The following layers can issue asynchronous I/O calls on IRIX systems:
• cos: see the later description on this man page for a description of how the cos layer uses asynchronous
I/O.
• cachea and bufa: users should assume that these layers may issue asynchronous I/O calls.
• system or syscall: these layers may issue asynchronous I/O calls if called from a BUFFER IN or
BUFFER OUT statement, or from the cos or cachea layer. The system and syscall layer may
also issue asynchronous I/O calls if called via ffreada(3C), ffwritea(3C), or fflistio(3C) (all
deferred on IRIX systems).
Specifying FFIO Layers
The spec argument of the -F option of the assign(1) command comprises a list of layers or filters that are
used to manipulate the data file as it is being read or written. The available layers include performance
options (such as memory-resident and SDS-resident files) and the capability to read and write files in a
variety of different vendors’ blocking formats. Each layer spec is of the general form:
class[.type[.subtype]][:num1]:[num2]:[num3]]
Many of the layers also allow you to specify the numeric parameters with a keyword. On UNICOS and
UNICOS/mk systems, this requires that your application be linked with Cray Research’s CrayLibs 3.0 or
later releases. The format for these specifications is given in the description of each layer where the
specification is available.
Selected layers are available on IRIX systems. The available platforms are detailed in each layer’s
description.
For more information about FFIO, see the Application Programmer’s I/O Guide.
The spec argument can have the following values:
Class Explanation
blankx or blx
Blank compression filter. This layer is used as a filter to compress or decompress blanks in
character data.
Not available on IRIX systems.

114 004– 2165– 002


INTRO_FFIO ( 3F ) INTRO_FFIO ( 3F )

type can be one of the following:


cos COS-style blank compression (blxchr=27 or Ox10)
ctss CTSS-style blank compression (blxchr=48 or 0x30)
c205 CYBER 205-style blank compression (blxchr=48 or 0x30)
num1 is the decimal value of the ASCII character used as the escape code to control the
blank compression (usually ESC or 27). num2 is the decimal value of the ASCII character
that is the object of the compression (usually BLANK or 32).
You can specify the numeric parameters with this alternate keyword syntax:
blx[.type][.blxchr=num1][.blnk=num2]
blankx[.type][.blxchr=num1][.blnk=num2]
bmx Tape I/O. Each logical record requested is a physical tape block.
Deferred implementation on IRIX systems.
The num1 field represents the size of each buffer, in 4096-byte blocks. The num2 field
represents the number of buffers.
On UNICOS systems, files on ER90 volumes that have been mounted in blocked mode may
use this layer (see the Tape Subsystem User’s Guide, for information about restrictions on
record sizes when using ER90 block mode).
You can specify the numeric parameters with this alternate keyword syntax:
bmx[.bufsize=num1][.num_buffers=num2]
bufa Asynchronous buffering layer.
Available on IRIX systems.
The bufa layer provides asynchronous buffering. It allows efficient sequential-access I/O.
The num1 field represents the size in 4096-byte blocks of each buffer. The maximum value
for num1 on IRIX systems is 32,767. The maximum allowed value on UNICOS and
UNICOS/mk systems is 1,073,741,823 (you may not be able to use a value of this size
because that amount of memory may not be available).
The num2 field selects the number of buffers to be used.
You can specify the numeric parameters with this alternate keyword syntax:
bufa[.bufsize=num1][.num_buffers=num2]
c205 CDC CYBER 205/ETA records.
Not available on IRIX systems.

004– 2165– 002 115


INTRO_FFIO ( 3F ) INTRO_FFIO ( 3F )

The CYBER 205-type W record can be selected by specifying c205.w. The num1 field is
not permitted. The num2 field represents the size of the working buffer, in bytes, used in
record blocking. If any logical records written exceed this size, a major performance
penalty can result.
The type field should be specified as w. The best performance is currently obtained when
num2 is greater than the largest record to be processed plus 16 bytes.
You can specify the numeric parameters with this alternate keyword syntax:
c205[.w][.bufsize=num2]
cache Cached file. The cache layer allows efficient random-access I/O, even when file access is
clustered in several regions of a file.
Available on IRIX systems.
During reads and writes to the layer, cache buffers frequently must be preempted. The
buffer chosen for preemption is always the least recently accessed buffer at the time of
preemption.
The options available are .mem, which specifies that buffers reside in memory or .sds,
which specifies that buffers reside in the SDS. (.sds is not supported on Cray T3E
systems or IRIX systems). Memory-resident buffers are the default.
The numeric fields are as follows:
• num1 is the size in 4096-byte blocks of each cache page. The maximum value for num1
on IRIX systems is 32,767. The maximum allowed value on UNICOS and UNICOS/mk
systems is 1,073,741,823 (you may not be able to use a value of this size because that
amount of memory may not be available).
• num2 selects the number of cache pages to be used.
• num3 is the size in 4096-byte blocks at which the cache layer attempts to bypass
cache layer buffering. If a user’s I/O request is larger than num3, the request might
not be copied to a cache page. The default on IRIX systems is num3=num1. The
default on UNICOS and UNICOS/mk systems is num3=num1*num2.
You can specify the numeric parameters with this alternate keyword syntax:
cache[.type][.page_size=num1][.num_pages=num2]
[.bypass_size=num3]
cachea Asynchronously cached file.
Available on IRIX systems.
This type of processing usually performs well whenever the cache layer might be used.
In addition, any sequential forward and sequential backward access through the file is
detected. When sequential access patterns are detected while reading, asynchronous
read-ahead is performed provided that the numbers of pages to read ahead has been
specified. When writing, selective asynchronous write-behind is performed.

116 004– 2165– 002


INTRO_FFIO ( 3F ) INTRO_FFIO ( 3F )

The values for type are .mem, which specifies that buffers reside in memory, or .sds,
which specifies that buffers reside in the SDS (.sds is not supported on Cray T3E systems
or on IRIX systems). Memory-resident buffers are the default.
The numeric fields are as follows:
• num1 is the size in 4096-byte blocks of each cache page. The maximum value for num1
on IRIX systems is 32,767. The maximum allowed value on UNICOS and UNICOS/mk
systems is 1,073,741,823 (you may not be able to use a value of this size because that
amount of memory may not be available).
• num2 selects the number of cache pages to be used.
• num3 selects the number of pages to read ahead asynchronously. The default is 0.
• num4 selects a shared cache number in the range of 1 to 15. If num4 is 0, a private
cache is indicated.
You can specify the numeric parameters with this alternate keyword syntax:
cachea[.type][.page_size=num1][.num_pages=num2]
[.max_lead=num3][.shared_cache=num4]
On IRIX systems, stacked shared cachea layers are not supported.
On UNICOS and UNICOS/mk systems, stacked shared cachea layers are supported, but
in multitasked programs, different files must not mix the order of the shared caches.
Examples:
The following specifications cannot both be used by a multitasked program:
• assign -F cachea::::1,cachea::::2 u:1
• assign -F cachea::::2,cachea::::1 u:2
The following specifications can both be used by a multitasked program on a UNICOS
system:
• assign -F cachea::::1,cachea::::2 u:1
• assign -F cachea::::1,cachea::::2 u:2
cdc CDC 60-bit format type.
Not available on IRIX systems.
No numeric fields are accepted.
The supported values for type are as follows:
type Format
iw I-type blocks, W-type records
cw C-type blocks, W-type records

004– 2165– 002 117


INTRO_FFIO ( 3F ) INTRO_FFIO ( 3F )

cs C-type blocks, S-type records


cz C-type blocks, Z-type records
The subtype field accepts one of the following values that indicate the presence of block
trailers and other low-level characteristics:
subtype Value
disk Disk type structure, for use with station transfers of CYBER datasets
i NOS internal tape format
si System internal or SCOPE internal tape format
cos or blocked
COS blocking.
Available on IRIX systems.
If specified, type must be one of the following:
type Action
sync Uses a single buffer in the blocking and deblocking process. I/O is done
strictly synchronously.
async Divides the buffer into two parts and uses asynchronous I/O to transfer the
blocked data between the buffer(s) and the logical device. When reading,
asynchronous read-ahead is performed, and when writing, asynchronous
write-behind is performed. To effectively use async, the buffer size should
be at least twice the record length.
auto Default (if type is not specified). Chooses either synchronous or asynchronous
behavior depending on the buffer size. If the buffer size is less than 64
blocks, synchronous behavior is selected. If it is greater than or equal to 64
blocks, asynchronous behavior is selected.
For num1, enter the desired buffer size in 4096-byte blocks (for example, -F cos:42
requests COS blocking and a 42-block buffer). The num1 value also determines the record
size for underlying layers which perform record blocking. The underlying record size is
num1 blocks if in synchronous mode and num1/2 or num1/2+1 blocks if in asynchronous
mode. For an underlying tape layer, the record size is the tape block size.
MIPSpro 7.3/PE 3.3 release: If not specified, the default buffer size is the larger of the
following: the large I/O size (UNICOS and UNICOS/mk systems only), the preferred I/O
block size (see the stat(2) man page), or 48 blocks. Furthermore, if type is auto (the
default), then the default buffer size is doubled if asynchronous mode is used (the cos
layer automatically switches to asynchronous mode).
You can specify the numeric parameters with this alternate keyword syntax:
cos[.type][.bufsize=num1]

118 004– 2165– 002


INTRO_FFIO ( 3F ) INTRO_FFIO ( 3F )

er90 ER90 I/O.


Not available on IRIX systems or on Cray T3E systems.
Each I/O operation results in a corresponding system call. Adjacent records are not
delimited from one another. No subfields are accepted. The byte-stream mode of the
device must be used. See tpmnt(1).
event I/O layer monitoring.
Available on IRIX systems.
The event layer monitors I/O occurring between two layers on a per-file basis. This layer
generates statistics in an ASCII log file; users can specify what type of report is generated.
The event layer is enabled by default. Users do not have to relink their programs to
study I/O performance. To generate information, rerun the program with the event layer
specified on the assign command.
Statistics are reported to stderr by default. The FF_IO_LOGFILE environment variable
can be used to name a file to which statistics are written by the event layer. The default
action is to overwrite the existing file. To append information to an existing file, specify a
plus sign (+) before the file name.
The event layer reports counts for read, read, write, and writea. These counts
represent the number of calls made to to an FFIO layer entry point. In some cases, the
system layer may actually use a different I/O system call, or multiple system calls. For
example, the reada system call does not exist on IRIX systems, and the system layer
reada entry point will use aio_read().
On IRIX systems, the report that is generated may include mention of the "lock" layer, even
though the lock layer may not have been specified by the user.
On Cray T3E systems, if more than one process is using the event layer, and you set the
FF_IO_LOGFILE environment variable, you must use the plus sign (+) before the file
name to prevent process a from overwriting the information written by process b. Using
the plus sign also means that the information will be appended to an existing file.
On Cray T3E systems you can also use the FF_IO_LOGFILEPE environment variable to
name a file to which statistics are written. The file name will be x.n, where x is the name
specified by the environment variable and n is the number of the PE which wrote the file.
The default action is to overwrite the existing file. To append information to the existing
file, specify a plus sign (+) before the file name.
Enter one of the following for type:
value Information reported
nostat No statistical information is reported.
summary Information on event types that occur at least once are reported.
brief A one-line summary for layer activities is reported.

004– 2165– 002 119


INTRO_FFIO ( 3F ) INTRO_FFIO ( 3F )

f77 FORTRAN 77/UNIX Fortran record blocking. This is the common blocking format used
by most FORTRAN 77 compilers on UNIX systems.
Available on IRIX systems.
Enter one of the following for type:
type Format
nonvax Default. Control words in a format common to machines such as the
MC68000.
vax VAX format (byte-swapped) control words. Not available on IRIX systems.
The specification of vax or nonvax is not relevant to data conversion.
For num1, enter the maximum record size in bytes. For num2, enter the working buffer
size, in bytes.
You can specify the numeric parameters with this alternate keyword syntax:
f77[.type][.recsize=num1][.bufsize=num2]
fd Connect to a specific file descriptor.
Available on IRIX systems.
Field num1 is the decimal value of the file descriptor. Classes named stdin, stdout,
and stderr exist as alternate names for fd:0, fd:1, and fd:2.
You can specify the numeric parameters with this alternate keyword syntax:
fd[.file_descriptor=num1]
global File global to all processes.
Available on IRIX systems.
This is a caching layer which distributes the cache across multiple SHMEM or MPI
processes. Open and close operations are collective (require participation by all processes
which access the file). All other operations are independently performed by one or more
processes. The library allows multiple processes to concurrently access the file while
maintaining coherency of buffered data.
Specify one of the following options for type:
type Description
privpos Default. The file position is private to a process. All processes may seek
to independent locations in the file.
globpos (Deferred). The file position is global to all processes. A seek or I/O
operation by any process will affect the position for all processes.
The numeric fields are as follows:
num1 The size in 4096-byte blocks of each cache page.

120 004– 2165– 002


INTRO_FFIO ( 3F ) INTRO_FFIO ( 3F )

num2 Selects the number of cache pages to be used on each process. If there are n
processes, then n . num2 cache pages are used.
num2 buffer pages are allocated on every process which shares access to a global file. File
pages are direct-mapped onto processes such that page n of the file will always be cached
on process (n mod NPES), where NPES is the total number of processes sharing access to
the global file. Once the process is identified where caching of the file page will occur, a
least-recently-used method is used to assign the file page to a cache page within the caching
process.
You can specify the numeric parameters with this alternate keyword syntax:
global[.type][.page_size=num1][.num_pages=num2]
ibm Record blocking for common record types on IBM operating systems.
Deferred implementation on IRIX systems.
Specify one of the following record formats for type:
type Format
f Fixed-length record format. For num1, enter the logical record size in 8-bit bytes.
For num2, enter the maximum physical block size in 8-bit bytes; if specified, num2
must be equal to num1.
fb Fixed-length, blocked record format. For num1, enter the logical record size in
8-bit bytes. For num2, enter the maximum physical block size in 8-bit bytes; num2
must be an exact multiple of num1.
u Undefined record format. For num1, enter the maximum record size, in 8-bit bytes.
v Variable length record format. For num1, enter the maximum logical record size in
8-bit bytes. For num2, enter the maximum physical block size in 8-bit bytes.
vb Variable length blocked record format. For num1, enter the maximum logical
record size in 8-bit bytes. For num2, enter the maximum physical block size in
8-bit bytes.
vbs Variable length blocked, spanned record format. For num1, enter the maximum
logical record size in 8-bit bytes. For num2, enter the maximum physical block
size in 8-bit bytes.
No subtype is accepted for the ibm class record formats. num1 does not need to be smaller
than num2.
You can specify the numeric parameters with this alternate keyword syntax:
ibm[.type][.recsize=num1][.mbs=num2]
mr or sds Memory-resident and SDS-resident files. mr is a deferred implementation on IRIX systems.
sds is not available on Cray T3E systems or on IRIX systems.

004– 2165– 002 121


INTRO_FFIO ( 3F ) INTRO_FFIO ( 3F )

The mr and sds layers let you declare a byte-stream file, but the given file should reside in
the specified medium as much as possible; this can improve performance.
Enter one of the following for type:
type Load Specification
save Default. Loads the file into the specified medium when the file is opened and
writes the data back out when closed.
scr Scratch file. Does not attempt to load at open and discards data on close.
Enter one of the following for subtype:
subtype Overflow Specification
ovfl Default. Writes excess data that does not fit in the specified medium to the
next lower layer.
novfl If data does not fit in the specified medium, subsequent write(1) operations
fail.
The mr and sds layers accept numeric fields. Generally, the numeric field specification
represents best-efforts values. They are used for tuning purposes and usually do not cause
errors if they are not satisfied precisely as specified. The fields are as follows:
Field Value
num1 Initial size of the memory or SDS allocation. Specified in 4096-byte blocks.
Default is 0.
num2 Maximum size of the memory or SDS allocation. Specified in 4096-byte blocks.
46
Default is s -1.
num3 Increment size of the memory or SDS allocation. Specified in 4096-byte blocks.
This value is used when allocating additional memory or SDS space. The
default is 256 for SDS files and 32 for memory resident files.
For example, if the SDS limit for a process is 1000 blocks, and sds.scr:1500 is
specified, an initial SDS allocation of 1000 blocks is used.
Similarly, if sds:500:10000:1000 was specified, the first request for SDS space would
result in the allocation of 500 blocks. If possible, this is allocated contiguously, but it is
not guaranteed. If a file size exceeds 500 blocks, an attempt is made to increase the file by
an increment of 1000 blocks. If this attempt fails, whatever can be allocated is given to the
file. Assuming no other SDS use, this is 500 blocks. At this point, the file assumes an
overflow status.

122 004– 2165– 002


INTRO_FFIO ( 3F ) INTRO_FFIO ( 3F )

When using memory-resident files, you must ensure that not too much data is written to the
file without limiting its size. Unrestrained and unmanaged growth of such a file can cause
heap fragmentation and program abort. If this growth has used all available memory, the
error message processor may be unable to issue a message. Therefore, such an abort may
be difficult to diagnose and correct. It is recommended that the maximum memory size
field be specified in all cases. (For example, mr.scr::10000 would limit such a file to
approximately 5 Mwords of main memory.)
You can specify the numeric parameters with this alternate keyword syntax:
mr[.type[.subtype]][.start_size=num1] [.max_size=num2]
[.inc_size=num3]
sds[.type[.subtype]][.start_size=num1] [.max_size=num2]
[.inc_size=num3]
null Syntactic no-op.
Available on IRIX systems.
No optional fields are accepted. null may be specified where syntax demands a value, but
no function is desired. This does not perform the same function as /dev/null.
nosve CDC NOS/VE record formats.
Not available on IRIX systems.
The following values are allowed for the type and num fields:
type Value
d ANSI D format (variable-length) records. For num1, enter the maximum logical
record size in 8-bit bytes. For num2, enter the maximum physical block size in
8-bit bytes.
f ANSI F fixed-length records. For num1, enter the logical record size in 8-bit
bytes. For num2, enter the maximum physical block size in 8-bit bytes; num2
must be an exact multiple of num1.
s ANSI S format (segmented) records. For num1, enter the maximum logical
record size. For num2, enter the maximum physical block size used in the
lower-level layers.
u Undefined records. For num1, enter the maximum logical record size, in 8-bit
bytes. For num2, enter the maximum physical block size in 8-bit bytes.
v NOS/VE V format records. The num1 field is not permitted. For num2, specify
the size of the working buffer used in record blocking; if any logical records that
are written exceed this size, a major performance penalty can result.
You can specify the numeric parameters with this alternate keyword syntax (as noted
previously, .recsize may not be permitted for some types):

004– 2165– 002 123


INTRO_FFIO ( 3F ) INTRO_FFIO ( 3F )

nosve[.type][.recsize=num1][.mbs=num2]
site Site layer. This option lets a site add custom I/O handlers for specific needs at load time.
See the Application Programmer’s I/O Guide, for details.
Available on IRIX systems.
stdin, stdout, or stderr
Connects to specific file descriptors 0, 1, and 2, respectively. (See the fd class.)
system Generic system I/O layer. Selects bmx, er90, or syscall as appropriate.
Available on IRIX systems.
syscall System I/O call. Each I/O operation results in a corresponding system call.
Available on IRIX systems.
This layer does not accept any options on UNICOS or UNICOS/mk systems. On IRIX
systems, it has one optional parameter as follows:
syscall[.cboption]
The cbption can be one of the following values:
aiocb The syscall layer is notified, via a signal, when the asynchronous I/O
completes.
noaiocb The syscall layer polls the completion status word to determine
asynchronous I/O completion. This is the default value.
tape Tape I/O. Each logical record requested is a physical tape block. This is the same as bmx.
Deferred implementation on IRIX systems. For information about the tmf layer on IRIX
systems, see the IRIX TMF User’s Guide, 007-3969-001.
The num1 field represents the size of each buffer, in 4096-byte blocks. The num2 field
represents the number of buffers.
You can specify the numeric parameters with this alternate keyword syntax:
tape[.bufsize=num1][.num_buffers=num2]
text Special character terminated records.
Available on IRIX systems.
Enter one of the following for type:
type Format
nl Newline-separated records
eof Newline-separated records and the special character sequence ~e on a line by
itself delimiting EOF
205 CYBER 205-style text file

124 004– 2165– 002


INTRO_FFIO ( 3F ) INTRO_FFIO ( 3F )

ctss CTSS-style text format


This class accepts num specifications. If specified, num1 represents the decimal value of the
ASCII character to use to delimit records; the default varies depending on the type. For
num2, enter the requested working buffer size in bytes.
You can specify the numeric parameters with this alternate keyword syntax:
text[.type][.newline=num1][.bufsize=num2]
user User layer. This option allows a user to add custom I/O handlers for specific needs at load
time. See the Application Programmer’s I/O Guide, for details.
Available on IRIX systems.
vms Provides record blocking for common record types on VMS/MS operating systems.
For type, enter one of the following record formats:
type Format
f Fixed-length records
v Variable length records
s Segmented variable records
Each type accepts the following subtypes to specify the blocking format within the record
type:
subtype Format
tape ANSI standard record format. This subtype should be used with labeled
VAX/VMS tapes.
bb Binary blocked format. This subtype should be used with files that are to be
fetched or disposed with a BB or TB format, or with unlabeled magnetic tapes.
This subtype requires an enclosing blocking; for example, vms.s.bb,bmx or
vms.s.bb,cos.
tr Transparent format. This subtype should be used with files that are transferred
between the VAX/VMS system by using fetch or dispose
(UNICOS/UNICOS/mk commands) and the TR format. Any other method that
precisely transfers the disk image, including all VMS control words, will also
work. Note that ftp does not correctly transfer nontext, variable-length record
files.
This class accepts num1 and num2 fields; they have a similar meaning to ibm class. For
type s, num1 is ignored. For type f, num2 need not be a multiple of num1.
You can specify the numeric parameters with this alternate keyword syntax:
vms[.type][.subtype][.recsize=num1][.mbs=num2]

004– 2165– 002 125


INTRO_FFIO ( 3F ) INTRO_FFIO ( 3F )

EXAMPLES
The following are example FFIO specifications.
Example 1: The following example specifies FORTRAN 77/UNICOS Fortran blocking with a working
buffer of 128,000 bytes to allow efficient creation of logical records up to 127,992 bytes:
f77::1 28000

Example 2: The following example specifies IBM VBS records with a block size of 16,384 bytes:
ibm .vbs:: 16384

Example 3: The following example specifies a memory-resident layer with an initial memory size of 100
4096-byte blocks:
mr:100

Example 4: The following example specifies VMS V records with a maximum record size of 1000 bytes:
vms .v.tr: 1000

Example 5: The following example specifies the SS-resident layer that loads from disk on open and saves to
disk on close, does not allow overflow, has an initial size of 10 4096-byte blocks in SDS, grows to a
maximum size of 559 blocks in minimum increments of 37 blocks:
sds .save. novfl: 10: 559 :37

See the Application Programmer’s I/O Guide, for more detailed information about FFIO specifications.

NOTES
Some FFIO specification requirements are not obvious. For example, CYBER 205 R-type records must be
requested with blx.ctss,text.205.
The Fortran I/O library checks for conflicting attributes when file name and unit attributes are both present
during OPEN processing for a Fortran unit. The existence of an assign attribute for both the file and the unit
results in an error condition.

SEE ALSO
Application Programmer’s I/O Guide
acptbad(3F), assign(3F), ffopen(3C), openms(3F), opendr (see openms(3F)), skipbad(3F)
df(1), ln(1), setf(1), tpmnt(1), write(1)
asgcmd(1), assign(1)
ialloc(2), open(2)
SDSALLOC(3F)

126 004– 2165– 002


FFASSIGN ( 3C ) FFASSIGN ( 3C )

NAME
ffassign – Provides library interface to assign processing

SYNOPSIS
#include <ffio.h>
int ffassign(char *cmd);

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
This routine is supported on IRIX systems for programs compiled with the MIPSpro 7 Fortran 90 compiler
or compiled with the -craylibs option to the MIPSpro F77 compiler.
ffassign provides an interface to assign processing from C.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and UNICOS/mk
systems, the default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX systems, the
default kind is KIND=4.
This routine has one argument:
cmd A string containing a complete assign(1) command in the format also acceptable to system(3C).
The -V option cannot be processed by the ffassign routine.

RETURN VALUES
Zero is returned on success, and -1 is returned when an error is detected. errno is set to the error number
when an error condition occurs.

EXAMPLES
The following is equivalent to assign -s unblocked f:file:
ret = ffassi gn( "as sig n -s unb loc ked f:f ile ");

SEE ALSO
assign(1)
INTRO_FFIO(3F)

004– 2165– 002 127


FFFCNTL ( 3C ) FFFCNTL ( 3C )

NAME
fffcntl – Performs functions on files opened using flexible file I/O

SYNOPSIS
#include <ffio.h>
UNICOS and UNICOS/mk systems:
int fffcntl (int fd, int cmd, [,long *arg, struct ffsw *stat]);
IRIX systems:
int fffcntl (int fd, int cmd, void *arg, struct ffsw *stat);

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
The fffcntl function performs a variety of functions on files opened by ffopen or ffopens, using
flexible file I/O (FFIO). Arguments are as follows:
fd Number returned by function ffopen or ffopens.
cmd Specifies values defined in header file ffio.h. See under the next heading, VALUES FOR cmd
ARGUMENT.
arg The type and value of arg is cmd specific. See preceding descriptions.
stat Pointer to the status return structure.
Values for cmd Argument
The following values can be used for the cmd argument introduced above:
FC_ACPTBAD
Accepts bad data (valid only for online tape files on UNICOS and UNICOS/mk systems and ER90
files on UNICOS systems.) arg is a pointer to structure ffc_baddata_s, defined in header file
ffio.h. This cmd is valid with the tape FFIO layer. The fields of this structure have the
following meaning:
ffc_bytes Number of bytes of bad data transferred is returned in this field.
ffc_maxflag Set this value to 1 if a maximum value is specified in field ffc_maxwords. Set
this value to 0 if no maximum value is specified.
ffc_maxwords Maximum number of words of bad data to transfer to user’s data area. If the
number of words of bad data in the block exceed this value, the excess is
discarded.

128 004– 2165– 002


FFFCNTL ( 3C ) FFFCNTL ( 3C )

ffc_termcnd Position after accepting bad data is shown in this field, as follows: 0 indicates
end of block; 1 indicates EOF; 2 indicates EOD; and a value less than 0 indicates
that an error occurred. The absolute value is the error number.
ffc_uda User data area to receive bad data.
FC_ASPOLL
Checks for completion of an asynchronous FFIO request. Argument arg is a pointer to a structure of
type struct ffsw, which had previously been passed to an asynchronous FFIO request. The
purpose of this call is to pass control to the underlying layers to do intermediate processing or
cleanup on the request. If the request is complete, fields in the status return structure are set as
described under function ffreada(3C).
FC_CHECKTP
Checks tape position. This value is valid only for online tape files on UNICOS and UNICOS/mk
systems and ER90 files on UNICOS systems. arg is a pointer to structure ffc_chktp_s, defined
in header file ffio.h. This command is valid with the tape FFIO layer. The fields of this
structure have the following meaning:
stat The status of the tape, as follows:
– 1 = No status
0 = At EOV
1 = Tape off reel
2 = Tape mark detected
3 = Blank tape detected
The remaining fields are unused.
FC_ENDSP
Ends special processing. This value is valid only for online tape files on UNICOS and UNICOS/mk
systems and ER90 files on UNICOS systems. arg is unused. This function removes the alternate
path to tape created by FC_STARTSP. Tape blocks that were held aside are written to tape. This
cmd is valid with the tape FFIO layer.
FC_CLOSEV
Closes volume and mounts next volume in the Volume Identifier list. arg is unused. This value is
valid only for online tape files on UNICOS and UNICOS/mk systems and ER90 files on UNICOS
systems. The er90 layer is not supported on Cray T3E systems. This cmd is valid with the
following FFIO layers: tape, er90, bufa.
FC_GETTP
Retrieves information about an opened tape file (valid only for online tape files on UNICOS and
UNICOS/mk systems and ER90 files on UNICOS systems. arg is a pointer to structure
ffc_gettp_s, defined in header file ffio.h.
The er90 layer does not guarantee that records correspond to physical tape blocks. See the
assign(1) man page and the Tape Subsystem User’s Guide for more information about the er90
FFIO layer.

004– 2165– 002 129


FFFCNTL ( 3C ) FFFCNTL ( 3C )

The fields of this structure have the following meaning:


ffc_glen Number of words to copy to the array pointed to by field ffc_pa.
ffc_synch Synchronization value, as follows: a value of 1 indicates to synchronize the dataset
before obtaining position information; a value of 0 means do not synchronize the
dataset. This field is ignored if the last operation was a read. It is also invalid to
specify this value if end-of-volume (EOV) processing is enabled, and the user has
reached EOV but has not started special processing.
ffc_pa Address of array that will contain information returned by this function. The values
returned in this array are as follows:
ffc_pa[0] Current volume identifier.
ffc_pa[1] – ffc_pa[6]
Characters 1– 48 of the path name of the file opened to this tape.
ffc_pa[7] Integer file section number.
ffc_pa[8] Integer file sequence number.
ffc_pa[9] Integer block number relative to tape mark specified in ffc_pa[22].
ffc_pa[10] Integer number of blocks in the library buffer. If additional processing layers have
been specified with assign(1) or asgcmd(1), those layers may also hold buffered
data, but they will not be included in this field.
ffc_pa[11] Integer number of blocks in the IOP or system buffer.
ffc_pa[12] Integer device ID or unit number.
ffc_pa[13] Device identifier or name.
ffc_pa[14] Generic device name.
ffc_pa[15] Last device function.
ffc_pa[16] Last device status.
ffc_pa[17] Data transfer count in bytes.
ffc_pa[18] Buffer memory sector count.
ffc_pa[19] Partial block bytes in buffer memory.
ffc_pa[20] Outstanding sector count.
ffc_pa[21] Outstanding block count.
ffc_pa[22] User tape mark number, including tape marks embedded in the data.
ffc_pa[23] Direction from tape mark in previous word: 0 = after tape mark; 1 = before tape
mark.
ffc_pa[24] Today’s year modulus 100.

130 004– 2165– 002


FFFCNTL ( 3C ) FFFCNTL ( 3C )

ffc_pa[25] Today’s Julian day.


ffc_pa[26] File identifier, up to the first 8 characters.
ffc_pa[27] Record format name.
ffc_pa[28] Tape density: 1 = 1600 bpi; 2 = 6250 bpi.
ffc_pa[29] Maximum block size.
ffc_pa[30] Record length.
ffc_pa[31] File status: 1 = new; 2 = old; 3 = append.
ffc_pa[32] Label type: 1 = no label; 2 = ANSI label; 3 = IBM standard label; 4 = bypass label.
ffc_pa[33] Integer file sequence number of first file on volume.
ffc_pa[34] Ring status: 0 = ring out; 1 = ring in.
ffc_pa[35] Expiration year modulus 100.
ffc_pa[36] Expiration Julian day.
ffc_pa[37] First volume identifier of file.
ffc_pa[38] User end-of-volume status: 0 = EOV processing off; 1 = EOV processing on.
ffc_pa[39] User end-of-volume processing status: 0 = not in active EOV processing; 1 = in
active EOV processing.
ffc_pa[40] User read/write tape mark status: 0 = user read/write tape mark not allowed;
1 = user read/write tape mark is allowed.
ffc_pa[41] Block attribute: ’B’ = blocked records; ’S’ = spanned records, if the record format
is ’V’, or standard records, if the record format is ’F’; ’R’ = blocked and spanned
records, if the record format is ’V’, blocked and standard records, if the record
format is ’F’; ’0’ = none of the previous values.
ffc_pa[42] – ffc_pa[47]
File identifier.
FC_GETINFO
Gets information about the layers connected to this open file. arg is a pointer to structure
ffc_info_s. The information returned in this structure is as follows:
ffc_flags
Flag word containing attributes of the file/connection. These bit masks are defined in header
file ffio.h and are set if true, as follows:
FFC_STRM Can handle stream I/O.
FFC_REC Can handle records.
FFC_WEOF Can represent EOF.
FFC_WEOD Can represent EOD (always set).

004– 2165– 002 131


FFFCNTL ( 3C ) FFFCNTL ( 3C )

FFC_BKSP Can handle backspace.


FFC_BKFIL Can handle backfile.
FFC_SEEKA Can seek absolute.
FFC_SEEKR Can seek relative.
FFC_SEEKE Can seek to end.
FFC_POSREC Can position by record number.
FFC_POSFIL Can position by EOF mark.
FFC_RWND Can rewind by seek(x,0,0).
FFC_FIXD Can do fixed-length records.
FFC_VAR Can do variable-length records.
FFC_BINARY Can do binary data.
FFC_CODED Can do formatted (character) data.
FFC_RDM Can do random I/O (no truncation).
FFC_SEQ Can do sequential I/O.
FFC_ASYNC Can do asynchronous I/O. (All layers have asynchronous entry points, but
this bit tells whether the behavior is actually async.)
FFC_WRTRUNC Write implies truncation.
FFC_NOTRN Does no transformation on data; no control words are added or subtracted.
Data is not changed.
ffc_gran
Minimum granularity. This is the smallest size in bits of a valid data transfer. For example,
the system call layer has an ffc_gran of 8, as it can handle a byte as its smallest unit of
data transfer. Some CDC record formats have a granularity of 60.
ffc_reclen
Valid only for fixed length records. This is the record length in bits.
ffc_fd
Lowest level file descriptor for the layer that makes system calls. This is not always
available, or may not be meaningful for some layers or combinations of layers. This is - 1 if
no descriptor is available.
FC_GETLK
Performs an fcntl call with cmd F_GETLK. arg is a pointer to structure flock (defined in
sys/fcntl.h), which is used in the fcntl call. Currently supported only by the syscall and
system layers, and not for tapes or ER90 devices.

132 004– 2165– 002


FFFCNTL ( 3C ) FFFCNTL ( 3C )

FC_GETLKW
Performs an fcntl call with cmd F_GETLKW. arg is a pointer to structure flock (defined in
sys/fcntl.h), which is used in the fcntl call. Currently supported only by the syscall and
system layers, and not for tapes or ER90 devices.
FC_IALLOC
Performs an ialloc system call. Supported only on UNICOS and UNICOS/mk architectures and
only by the syscall and system layers. Not supported for tapes or ER90 devices. arg is a
pointer to structure ff_ialloc_struct, defined in the ffio.h file. The ialloc call is made
using the following parameters:
• The ia_nb element of the structure is the second argument
• The ia_flag element of the structure is the third argument
• The ia_part element of the structure is the fourth argument
• The ia_avl element of the structure is the fifth argument
FC_RECALL
Awaits completion of an asynchronous FFIO request. Argument arg is a pointer to a structure of
type struct ffsw, which is the status return structure of the asynchronous request. Function
fffcntl waits for completion of the asynchronous request, if necessary. Fields in the status return
structure are set as described under function ffreada(3C).
FC_SCRATCH
Specifies that a file is to be deleted at close time. The arg argument is a pointer to int. On exit,
*arg is set to contain zero or more of the following result bits:
SCR_NOFLUSH Set if ffclose processing has been optimized to suppress buffer flushing.
SCR_SINGLELINK Set if the file is not a pipe or a tty, has a link count equal to one, and is not a
symbolicly linked file.
SCR_UNLINKED Set if this fffcntl call has successfully unlinked the file.
FC_SETLK
Performs an fcntl call with cmd F_SETLK. arg is a pointer to structure flock (defined in
sys/fcntl.h), which is used in the fcntl call. Currently supported only by the syscall and
system layers, and not for tapes or ER90 devices.
FC_SKIPBAD
Skips bad data (valid only for online tape files on UNICOS and UNICOS/mk systems and ER90 files
on UNICOS systems. arg is a pointer to structure ffc_baddata_s, defined in header file
ffio.h. This cmd is valid with the tape FFIO layer. The fields of this structure used by
FC_SKIPBAD are as follows; all other fields are unused:
ffc_blocks The number of blocks skipped is returned in this field.

004– 2165– 002 133


FFFCNTL ( 3C ) FFFCNTL ( 3C )

ffc_termcnd Position after skipping bad data is returned in this field, as follows: 0 indicates end
of block; 1 indicates EOF or EOD; and a value less than 0 indicates that an error
occurred. The absolute value is the error number.
FC_STAT
Returns a structure much like the one returned by the fstat (see stat(2)) system call. arg is a
pointer to a ffc_stat_s structure (from ffio.h). Fields in this structure are filled in as
appropriate by the layers. For the system call layer, all fields are simply retrieved by doing an
fstat call. For other layers, such as mr, the size field in the stat structure is modified to reflect
the buffered data. Other layers can make similar changes to the basic information from the system
for similar reasons. The result is a stat structure that can be used in the same way and for the
same purposes as the fstat system call.
FC_SETSP
Disables special EOV processing. This value is valid only for online tape files on UNICOS and
UNICOS/mk systems and ER90 files on UNICOS systems. arg is an integer value that should be set
to 0. See ffsetsp(3C) for a description of how to enable special EOV processing. This cmd is
valid with the tape FFIO layers.
FC_STARTSP
Starts special EOV processing. This value is valid only for online tape files on UNICOS and
UNICOS/mk systems and ER90 files on UNICOS systems. arg is unused. EOV processing must be
enabled prior to starting special EOV processing. This function creates an alternative path to or from
a tape. Tape blocks in the pipeline are held aside. Subsequent write operations will go directly to
tape; subsequent read operations will come directly from tape (if data is available) or from the blocks
in the pipeline. Both read and write operations are performed in FIFO order. After you have read
from the blocks in the pipeline, they are unavailable for writing. This cmd is valid with the
following tape FFIO layer.
FC_TPC_SDBSZ
Changes the data block size on an ER90 device. This is valid only when using the tape layer. arg
is the requested new block size. This cmd has no effect when it is used with an IBM-compatible
tape.
Not supported on IRIX systems.
FC_TSYNC
(Valid only for online tape files on UNICOS and UNICOS/mk systems and ER90 files on UNICOS
systems. It requests that the tape file be synchronized. This command is ignored if the last operation
was a read. It is also invalid to request synchronization if the end-of-volume (EOV) processing is
enabled, and the user has reached EOV but has not started special processing. If the end-of-volume
processing is enabled, the user should check to see if EOV was reached after requesting FC_TSYNC
(see the description for FC_CHECKTP). In this case, the fffcntl returns without error, but the tape
may not be synchronized (that is, data may remain buffered). This cmd is valid with the following
FFIO layers: tape, er90, bufa.
The er90 layer is not supported on Cray T3E systems.

134 004– 2165– 002


FFFCNTL ( 3C ) FFFCNTL ( 3C )

RETURN VALUES
The fffcntl function returns 0 on success. Otherwise, it returns -1 and the sw_error field of the stat
structure contains the error number.

SEE ALSO
fflistio(3C) ffopen(3C), ffreada(3C), ffsetsp(3C), ffwritea(3C)
assign(1), asgcmd(1)
Tape Subsystem User’s Guide, for more information about the er90 FFIO layer

004– 2165– 002 135


FFIOLOCK ( 3C ) FFIOLOCK ( 3C )

NAME
ffiolock, ffiounlock – Provide locking for FFIO functions

SYNOPSIS
#include <ffio.h>
int ffiolock (int fd, struct ffsw *stat);
int ffiounlock (int fd [, struct ffsw *stat]);

IMPLEMENTATION
UNICOS systems

DESCRIPTION
The ffiolock and ffiounlock functions provide a way of locking a group of Flexible File I/O (FFIO)
function calls that use the same fd. The ffiolock function sets a lock; any other task that issues an FFIO
call with the same fd will wait until the lock is released. Function ffiounlock releases the lock.
The following arguments are available for this routine:
fd Integer returned by ffopen or ffopens
stat Status structure

RETURN VALUES
In case of error, both functions return -1 and the ffsw.sw_error field contains the error value.
Otherwise, 0 is returned.

136 004– 2165– 002


FFLISTIO ( 3C ) FFLISTIO ( 3C )

NAME
fflistio – Initiates a list of I/O requests using flexible file I/O

SYNOPSIS
#include <sys/types.h>
#include <sys/iosw.h>
#include <sys/listio.h>
#include <ffio.h>
int fflistio (int cmd, struct fflistreq *list, int nent
[,struct ffstat *stat]);

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
The fflistio function provides a way to initiate a list of distinct I/O requests and, optionally, waits for
all of them to complete. Each I/O request in the list provides for maximum control over the desired I/O
characteristics. As much as possible, the operation of this function is the same as the listio system call.
The purpose of this function is to provide the functionality of listio(2) combined with the facilities
provided by flexible file I/O (FFIO).
The arguments are as follows:
cmd Any of the following commands:
LC_START Initiates the I/O requests and returns control as soon as possible
LC_WAIT Initiates the I/O requests and returns when all requests have completed
list Pointer to an array of fflistreq structures.
nent The number of requests in the list to process.
The fflistreq structure includes the following members:
int li_opcode Operation code for the request: LO_READ for read and LO_WRITE for
write.
unsigned li_drvr:32 Driver dependent; not used.
unsigned li_flags:32 Special request flags: LF_LSEEK to set initial file offset to
li_offset.
long li_offset Initial file byte offset, if LF_LSEEK is set in flags.
int li_fildes fdinfo pointer, obtained from ffopen(3C) or ffopens(3C).
char *li_buf Pointer to an I/O data buffer in memory.

004– 2165– 002 137


FFLISTIO ( 3C ) FFLISTIO ( 3C )

unsigned li_nbyte Number of bytes to read or write for each stride.


struct ffsw *li_status Pointer to an I/O status structure where the FFIO functions will put
completion status for this request. See fffcntl(3C).
int li_signo This value must be zero. Signals are not supported.
int li_nstride Number of strides; defaults to 1.
long li_filstride File stride in bytes; default is for contiguous data flow to/from the file.
long li_memstride Memory stride in bytes; default is for contiguous data flow to/from the
memory buffer.
When reading or writing an n-dimensional array on a disk, the desired data I/O occurs at regular intervals,
but it may not be contiguous. The last three variables in the fflistreq structure can be used to specify a
compound request, causing multiple sections of data to be transferred. The distance from the start of one
section of data on disk to the start of the next section is called the file stride. There is an analogous stride
through memory.
The operation of the stride parameters are the same as listio(2). See listio(2) for more information
on the details of operation.
When a particular request is complete, the associated ffsw structure is filled in whenever an fffcntl
function is given an opportunity with an FC_RECALL or FC_ASPOLL function code. In the ffsw
structure, sw_stat is set to a non-zero value upon completion, sw_error may contain a system or library error
number, and sw_count contains the number of bytes actually moved. For a successful compound request,
sw_count would be li_nstride * li_nbyte.
If one or more of the I/O requests are ill-formed and cannot be started, an LC_WAIT type command returns
immediately.

RETURN VALUES
If fflistio completes successfully, a nonnegative integer is returned, indicating the number of requests
that were successfully started. Otherwise, a value of -1 is returned, and errno is set to indicate the error.

ERRORS
The fflistio system call fails on a variety of conditions including the set of errors returned by
listio(2) and those returned by the FFIO functions.

EXAMPLES
The following example shows how to use the fflistio system call to initiate a list of input requests. The
fflistio request reads every tenth block (that is, blocks 1, 11, 21, 31, and so on) from file datafile.
fffcntl(3C) is used to determine when the request is complete.

138 004– 2165– 002


FFLISTIO ( 3C ) FFLISTIO ( 3C )

The request is initiated asynchronously (LC_START), and the data is stored in the buffer buf contiguously.
Since input is performed asynchronously, the program can complete other work in parallel with the request.
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/types.h>
#include <signal.h>
#include <sys/iosw.h>
#include <sys/listio.h>
#include <ffio>

#define BLK_SIZ 4096


struct blk {
char blk_data[BLK_SIZ];
};

main()
{
struct fflistreq request;
struct ffsw reqstat, dumstat;
struct blk buf[10];
int fd;

if ((fd = ffopen("datafile", O_RDONLY)) == -1) {


perror("open (datafile) failed");
exit(1);
}
memset (&reqstat, 0, sizeof(reqstat));
memset (&request, 0, sizeof (request));

/* Set up the I/O request */


request.li_opcode = LO_READ; /*request read*/
request.li_fildes = fd; /*file descriptor*/
request.li_buf = (char *) buf; /*store input data here*/
request.li_nbyte = BLK_SIZ; /*each stride = 1 block*/
request.li_status = &reqstat; /*status for this request*/
request.li_signo = 0; /*do not send signal upon completion*/
request.li_nstride = 10; /*read 10 strides*/
request.li_memstride = 0; /*default (contiguous) memstride*/
request.li_filstride = 10 * BLK_SIZ; /*file stride=10 blocks*/

if (fflistio(LC_START, &request, 1) != 1) {
perror("fflistio failed");
exit(1);
}

/* other work can be performed here while fflistio request completes */

fffcntl(fd, FC_RECALL, &reqstat, &dumstat); /* waits for I/O completion */

printf("Number of bytes read = %d\n\n", reqstat.sw_count);


}

004– 2165– 002 139


FFLISTIO ( 3C ) FFLISTIO ( 3C )

SEE ALSO
fffcntl(3C), ffopen(3C)
listio(2) in the UNICOS System Calls Reference Manual

140 004– 2165– 002


FFOPEN ( 3C ) FFOPEN ( 3C )

NAME
ffopen, ffopens, ffclose, ffopenf, ffclosef – Opens or closes a file using flexible file I/O

SYNOPSIS
#include <fcntl.h>
#include <ffio.h>
UNICOS and UNICOS/mk systems:
int ffopen (const char *name, int oflag [, int mode
[, long cbits [, struct ffsw *stat]]]);
int ffopens (const char *name, int oflag, int mode,
long cbits, [int cblks,] struct ffsw *stat, const char *str);
ffclose (int fd [, struct ffsw *stat]);
IRIX systems:
int ffopen (const char *name, int oflag [,mode_t mode]);
int ffopens (const char *name, int oflag, mode_t mode,
long cbits, int cblks, struct ffsw *stat, const char *str);
int ffclose (int fd);
All systems:
ffclosef (int fd, struct ffsw *stat);
int ffopenf (const char *name, int oflag , mode_t mode, long cbits, int
cblks, struct ffsw *stat);

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
The ffopen and ffopens functions open a file using flexible file I/O (FFIO). These functions are
modeled after the open(2) system call. The file associated with name is opened, and appropriate structures
are built to do special handling on the file. For ffopen, the processing layers to be used are as requested
with the asgcmd(1) or assign(1) commands. For ffopens, the layers are specified by the string at str.
The ffopen function returns an integer. Although it is not a file descriptor, it is used in much the same
way when passed to the other functions such as ffread, ffwrite, or ffclose.
The oflag, mode, and cbits parameters are exactly as in open(2).

004– 2165– 002 141


FFOPEN ( 3C ) FFOPEN ( 3C )

On IRIX systems, the cbits and cblks parameters are ignored.


The stat parameter is a pointer to a status return structure containing a flag, an error indication, a transfer
count, and an indication of the condition that terminated the request.
The ffclose and ffclosef functions close the file associated with fd. It does any necessary flushing
and termination for that file. Files opened using ffopen(3C) are not guaranteed to be flushed at program
termination; call ffclose or ffclosef to ensure this.

NOTES
On IRIX systems, the FFIO routines are stored in libffio.so, and are available in the N32 and N64
ABIs.

RETURN VALUES
Upon successful completion, a non-negative integer is returned; this integer is currently a pointer to a control
block. Otherwise, -1 is returned, and, if the stat parameter is passed, the error value is found in
stat.sw_error. If the stat parameter is not provided, the error code is found in errno. The stat
parameter is required for ffopens() and ffclosef.

EXAMPLES
To write a C program that will read the records of a COS blocked file named indata and copy the data
from the file (without blocking information) to stdout, compile the following program:

142 004– 2165– 002


FFOPEN ( 3C ) FFOPEN ( 3C )

#inclu de <stdio .h>


#inclu de <fcntl .h>
#inclu de <ffio. h>

#defin e BSZ 100 00

main()
{
int fd, ret ;
cha r buf [BS Z];
str uct ffsw stat;
int ubc = 0;

fd = ffo pen("i nda ta" , O_R DON LY) ;


do
{
ret = ffr ead f(fd, buf , BSZ , &st at, PAR TIAL, &ubc);
fwr ite(bu f, 1, ret , std out );
} while (FFSTA T(s tat) != FFE OD) ;
ret = ffc lose(fd);
}

Use the following commands to compile, link, and run this program on UNICOS and UNICOS/mk systems:
$ cc cpy .c
$ FILENV=\$ EVA R ; export FILENV
$ eval ` assign -F cos ind ata ` # declar e "in dat a" is COS blo cked
$ a.out

Use the following commands to compile, link, and run this program on IRIX systems:
$ cc cpy.c -lffio
$ eva l ` ass ign -F cos ind ata ` # declar e "in dat a" is COS blo cked
$ a.out

The same example program could be written to use the ffopens entry point. The layers to use in decoding
the blocking information are specified in the call, and not in the shell command asgcmd(1), as follows:
#inclu de <stdio .h>
#inclu de <fcntl .h>
#inclu de <ffio. h>

#defin e BSZ 100 00

main()
{

004– 2165– 002 143


FFOPEN ( 3C ) FFOPEN ( 3C )

int fd, ret ;


char buf[BS Z];
char *str;
struct ffs w sta t;
int ubc = 0;

/* Set up to pro ces s COS blo cke d fil e. */


str = "cos";
fd = ffo pen s("ind ata", O_R DONLY, 0, 0L, 0, &stat, str );
do
{
ret = ffr eadf(f d, buf, BSZ, &stat, PAR TIA L, &ub c);
fwr ite(bu f, 1, ret , std out);
} while (FFSTA T(s tat ) != FFEOD) ;
ret = ffc lose(f d);
}

Use the following commands on UNICOS and UNICOS/mk systems to compile, link, and run this program:
$ cc cpy .c
$ a.o ut

Use the following commands on IRIX systems to compile, link, and run this program:
$ cc cpy .c -lffio

SEE ALSO
ffread(3C), ffseek(3C)
asgcmd(1)
open(2) in the UNICOS System Calls Reference Manual
Application Programmer’s I/O Guide

144 004– 2165– 002


FFPOS ( 3C ) FFPOS ( 3C )

NAME
ffpos – Positions files opened using flexible file I/O

SYNOPSIS
#include <ffio.h>
UNICOS and UNICOS/mk systems:
int ffpos (int fd, int cmd, long *arg , int len, struct ffsw *stat);
IRIX systems:
off_t ffpos (int fd, int cmd, void *arg , int len, struct ffsw *stat);

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
The ffpos function provides a way of positioning files opened by ffopen or ffopens (see
ffopen(3C)), using flexible file I/O (FFIO). The arguments are as follows:
fd Value returned by ffopen or ffopens.
cmd Specifies a value defined in header file ffio.h. See the following subsection, VALUES FOR cmd
ARGUMENT.
arg The type and value of this argument is cmd specific. See preceding descriptions.
len If cmd = FP_GETPOS or FP_SETPOS, len specifies the number of Cray words in arg. This
parameter is ignored for other values of cmd.
stat Pointer to the status return structure.
Values for cmd Argument
The following values can be used for the cmd argument introduced above.
FP_BSEEK
Sets the current file position as specified by *arg and *(arg+1). Not supported on IRIX systems.
*arg contains the bit position requested; this must be a byte boundary. *(arg+1) specifies one of
the following values, defined in header file stdio.h:
0 or SEEK_SET
Sets the pointer to the value of *arg, which must be a non-negative integer.
1 or SEEK_CUR
Sets the pointer to the current position, plus or minus *arg. This is supported only in the
following layers that are not record-oriented; these layers are specified to assign -F as follows:
syscall, sds, mr (memory resident), cache, cachea, bufa, er90.

004– 2165– 002 145


FFPOS ( 3C ) FFPOS ( 3C )

2 or SEEK_END
Sets the pointer to the end of the file, minus *arg. *arg must be a non-negative integer. Not all
layers support this option.
FP_GABS
Returns information about the current position in arg, which can later be used by a call to ffpos with
cmd = FP_SABS. arg is a pointer to structure fp_abs (defined in header file ffio.h).
This call is useful only for online tape and ER90 files. It may be used with the tape, er90, or bufa
layers on UNICOS systems. It may be used with the tape layer on Cray T3E systems. ER90 files are
not supported on Cray T3E systems. For some devices, some of the fields in fp_abs may be unused.
When this request is made after a write function, the library and tape driver flush all remaining data
from the write behind to the tape before attempting to get the position. When this request is made after
a read request, an approximate address is returned, since there may be data buffered in the controller,
system buffers, or library buffers. FP_GABS does not return information about the volume serial
number (VSN) currently in use.
FP_GETPOS
Returns information about the current position in arg, which can later be used by a call to ffpos with
cmd 0=FP_SETPOS. For online tape files, 2 Cray words are returned in arg. For files assigned with
assign -F er90, 4 Cray words are returned in arg. For files assigned with -F cos,er90, 6 Cray
words are returned in arg. For all other file types, 1 Cray word is returned in arg. For ER90 files, the
information returned does not include the VSN. When using the information returned in a call to
ffpos with cmd=FP_SETPOS, you must ensure that you are positioned on the correct volume. This
command is unsupported for ER90 files that use the FFIO tape layer. Available on UNICOS and
UNICOS/mk systems. ER90 files and the er90 layer are not supported on Cray T3E systems.
FP_SABS
Sets the position as specified in arg. The information in arg should have been obtained by a previous
call to ffpos with cmd = FP_GABS. arg is a pointer to structure fp_abs. This call is useful only
for online tape and ER90 files. FP_SABS assumes that you are currently positioned on the correct
VSN. You must have permission to set the position to the specified address when using absolute track
address positioning. Tape manager permission is required for IBM-compatible tapes. For ER90 files,
tape manager permission is required to position outside the current partition. Bypass-label permission
or tape manager permission is required to position outside the current file, or past a user tape mark.
Available on UNICOS and UNICOS/mk systems. ER90 files and the er90 layer are not supported on
Cray T3E systems.
FP_SETPOS
Sets the position as specified by the information in arg. The information in arg should have been
obtained by a previous call to ffpos with cmd = FP_GETPOS.
Not available on IRIX systems.

146 004– 2165– 002


FFPOS ( 3C ) FFPOS ( 3C )

FP_SKIPF
This value is valid only for online tape files on UNICOS systems and on Cray T3E systems and for
ER90 files on UNICOS systems. It directs the system to skip a specified number of files from the
current position. The file will not be positioned beyond BOD or EOD. This is used for positioning by
user tapemark (see the -T option on the tpmnt(1) command). It may not be used to position to
different files within a multifile volume (see the -q option of the tpmnt(1) command. arg is a pointer
to structure ffp_skipf_s (also defined in header file ffio.h). This cmd is valid with the following
FFIO layers: tape. The fields of this structure have the following meaning:
ffp_nfil On input, specifies the number of files to skip. If the value is negative, the file is
positioned backward. On output, contains the number of files skipped.
ffp_nrec Currently unused.
FP_SKIPTPMK
This value is valid only for online tape files on UNICOS systems and on Cray T3E systems. It directs
the system to skip a specified number of tape marks from the current position. The file will not be
positioned beyond BOD or EOD. This is used for positioning by user tapemark (see the -T option on
the tpmnt(1) command). arg is a pointer to structure ffp_skiptpmk_s (defined in <ffio.h>).
The fields in this structure have the following meaning:
ffp_ntpmk On input, specifies the number of tape marks to skip. If the value is negative, the file is
positioned backwards. On output, this field contains the number of tape marks left to
position.
unused1 This field is reserved.
The FP_SKIPTPMK cmd functions differently from FP_SKIPF. Except in the case where you request
positioning past EOD, FP_SKIPF will position you at the beginning of a file; that is, FP_SKIPF will
position you either at BOD, immediately after a user tape mark, or at EOD. FP_SKIPTPMK functions
like the ioctl TR_PTMS described in the Tape Subsystem User’s Guide. It skips the specified number of
tape marks. If skipping forward, it will position you directly after a user tape mark or at EOD. If
skipping backwards, it will position you directly before a user tape mark or at BOD. This cmd is valid
with the following FFIO layers: tape.
FP_SETTP
arg is a pointer to structure ffp_settp_s (also defined in header file ffio.h). This cmd is valid
with the following FFIO layers: tape.
The er90 layer is not supported on Cray T3E systems.
On input, the fields of ffp_settp_s have the following meaning:
ffp_nb
Number of blocks to position; should always be a positive number.
ffp_nbs_p
Indicates the direction of block positioning. The following values are defined in header
<ffio.h>:

004– 2165– 002 147


FFPOS ( 3C ) FFPOS ( 3C )

FP_TPOS_BACK
Indicates that the ffp_nb field is the number of blocks to skip backward, relative to the
current position.
FP_TPOS_FORW
Indicates that the ffp_nb field is the number of blocks to skip forward, relative to the
current position.
FP_TPOS_ABS
Indicates that the ffp_nb field is an absolute block number, relative to the last tape mark
number or beginning of the volume. If a nonzero value is specified for the ffp_nv field,
positioning is absolute with respect to that tape volume. If ffp_nv is 0, and the -T option
was not present on the tpmnt(1) command, the position is absolute with respect to the
current tape volume. If ffp_nv is 0, and the -T option was present on the tpmnt
command, then positioning is absolute with respect to the last tape mark read or written.
ffp_nv
Number of volumes to position; should always be a positive number. A volume number of 0
indicates no volume positioning is to be performed.
ffp_nvs_p
Indicates the direction of volume positioning. The following values are defined in header file
ffio.h:
FP_TPOS_FORW The number of volumes to skip forward, relative to the current position.
FP_TPOS_BACK The number of volumes to skip backward, relative to the current position.
FP_TPOS_ABS Specifies an absolute volume number, relative to the beginning of the volume
identifier list (specified on the tpmnt(1) command.)
ffp_vi
Name of volume identifier to be mounted. A nonzero ffp_vi field is invalid if ffp_nbs_p is
FP_TPOS_FORW or FP_TPOS_BACK or if ffp_nvs is FP_TPOS_FORW or FP_TPOS_BACK
and ffp_nv is nonzero.

RETURN VALUES
If cmd is FP_BSEEK, ffpos returns the new bit position of the file on success. For other values of cmd,
the ffpos function returns 0 on success. On failure, it returns -1 and the sw_error field of the stat
structure contains the error number.

SEE ALSO
ffopen(3C)
tpmnt(1) in the UNICOS User Commands Reference Manual
Tape Subsystem User’s Guide

148 004– 2165– 002


FFREAD ( 3C ) FFREAD ( 3C )

NAME
ffread, ffwrite, ffweof, ffweod, ffreadf, ffwritef, ffweodf, ffweoff, ffflush –
Provides flexible file I/O

SYNOPSIS
#include <ffio.h>
UNICOS and UNICOS/mk systems:
int ffread (int fd, void *buf, size_t nb [, struct ffsw *stat [, int
fulp [, int *ubc]]]);
int ffwrite (int fd, const void *buf, size_t nb [, struct ffsw *stat
[, int fulp [, int *ubc]]]);
int ffweof (int fd [, struct ffsw *stat]);
int ffweod (int fd [, struct ffsw *stat]);
int ffflush (int fd [, struct ffsw *stat]);
IRIX systems:
ssize_t ffread (int fd, void *buf, size_t nb);
ssize_t ffwrite (int fd, const void *buf, size_t nb);
int ffweof (int fd);
int ffweod (int fd);
int ffflush (int fd);
All systems:
size_t ffreadf (int fd, void *buf, size_t nb , struct ffsw *stat, int
fulp, int *ubc);
size_t ffwritef (int fd, const void *buf, size_t nb , struct ffsw
*stat, int fulp, int *ubc);
int ffweoff (int fd, struct ffsw *stat);
int ffweodf (int fd, struct ffsw *stat);
int ffflush (int fd, struct ffsw *stat);

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

004– 2165– 002 149


FFREAD ( 3C ) FFREAD ( 3C )

DESCRIPTION
The ffread and ffwrite functions provide flexible file I/O (FFIO) to record-oriented or byte
stream-oriented data in an application-transparent manner.
Function ffweof writes an end-of-file (EOF) if the function is supported for the layer in use.
Function ffweod writes an end-of-data (EOD). If the FFIO specification is stream oriented, this requests
truncation of the file at the current position.
Function ffflush instructs the layer to flush as much data to the file as is convenient. For some layers,
and layers which do no buffering (for example, the syscall layer), this operation does nothing. For record
layers, the ffflush function will not terminate any partially-written records. This function is intended for
use on files which are being written. It is undefined for files which are being read.
The arguments are as follows:
fd Number returned by ffopen(3C).
buf Pointer to the user data buffer.
nb Requested number of bytes to be read or written.
stat Pointer to the returned status structure.
fulp Either FULL or PARTIAL (defined in header file ffio.h); indicates whether I/O should be
performed in full or partial record mode.
ubc Unused bit count. The word pointed to by this pointer is in the range of 0 through 7; it is used to
specify how many bits in the last byte are not valid data.
The nb and ubc arguments are used together to determine an exact number of bits to be transferred. nb
always indicates the number of bytes affected by the data transfer, even if only one bit is transferred in that
byte.
If argument ubc is omitted, it is assumed to be 0.
If ubc is specified, it functions as both an input and output argument. It is passed to ffread or ffwrite
as a request to omit processing the specified number of bits in the last byte of the request. For example, to
read 2 bits from a file, you should set nb to 1, set the word at ubc to 6, and call ffread. On completion of
the ffread request, the word pointed to by ubc is set by ffread to indicate the number of unused bits in
the last byte read. As in the preceding example, if only one bit were available to be read, then the word at
ubc would be set to 7 by ffread.
For ffwrite, ubc is an input argument specifying the number of bits in the last byte transferred that should
not be written to the file. Function ffwrite normally will not change the value of the word at ubc,
because, if the specified number of bits is not written, an error is returned.

150 004– 2165– 002


FFREAD ( 3C ) FFREAD ( 3C )

RETURN VALUES
Upon successful completion, a non-negative value is returned. Otherwise, -1 is returned and, if the stat
argument is passed, the error value is found in stat.sw_error. If the stat parameter is not provided, the
error code is found in errno.
If the stat parameter is passed, the sw_stat field is set to one of the following values, indicating the
condition that terminated the operation:
Value Description
FFERR An error was encountered.
FFEOR An end-of-record (EOR) was encountered.
FFEOF An end-of-file (EOF) was encountered.
FFEOD An end-of-data (EOD) was encountered.
FFCNT For layers without record handling, some data was read before an EOF or EOD was encountered.
For layers with record handling, the count was satisfied before an EOR was encountered. If the
count was satisfied simultaneously with encountering an EOR, the FFEOR status is returned.
The FFSTAT macro, defined in ffio.h, can be used to obtain the value of the sw_stat field.

SEE ALSO
ffopen(3C), ffseek(3C)
asgcmd(1)
Application Programmer’s I/O Guide

004– 2165– 002 151


FFREADA ( 3C ) FFREADA ( 3C )

NAME
ffreada – Provides asynchronous read using flexible file I/O

SYNOPSIS
#include <ffio.h>
int ffreada (int fd, char *buf, unsigned nbyte, struct ffsw *status [, int
fulp [, int *ubc)]];

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
The ffreada function is modeled after the reada system call, and the parameters are the same as
ffread(3C). The difference between ffread and ffreada is that ffreada performs its work
asynchronously whenever possible.
Arguments to ffreada are as follows:
fd Value returned from an ffopen, or ffopens call.
buf Pointer to the buffer in which the data is stored.
nbyte Number of bytes to be written.
status Address of the ffsw status return structure, which is described in the following paragraphs.
fulp Either the value FULL or PARTIAL as defined in header ffio.h. Specifying FULL requests
that the file position should be advanced to a point immediately after the next EOR in the file
after transferring the requested data. Specifying PARTIAL requests that the file position should
be maintained at the bit immediately following the last one transferred. This is an optional
argument. If it is not specified, FULL is assumed.
ubc Number of unused bits in the last byte; for example, a single bit can be read by requesting one
byte and a ubc of 7. This is an optional argument. If it is not specified, 0 is assumed.
The ffreada function tries to read nbyte bytes from the FFIO file associated with fd (opened with ffopens
or ffopen). Data is read into the buffer pointed to by buf (see ffread(3C)). The function returns control to
the user as soon as possible, even when the data cannot be delivered until later. The stat parameter is used
to notify the caller when the request has completed. The status structure has several fields used to determine
the status of a given request. The following is a partial description of the status structure:

152 004– 2165– 002


FFREADA ( 3C ) FFREADA ( 3C )

struct ffsw {
uin t sw_ flag :1,
sw_ err or :31,
sw_ cou nt :32,
sw_ sta t :16;
};

A call to ffreada initiates an asynchronous read of the requested data. You must check for completion of
each asynchronous request by using fffcntl with the command codes FC_RECALL or FC_ASPOLL. If
such a call to fffcntl detects that the request is complete, the status structure is filled in. The sw_flag is
always set on completion, sw_error may contain a system call or library error number and sw_count contains
the number of bytes actually moved. Some FFIO layers with less than byte granularity also return a value in
ubc that contains the number of bits in the last byte returned that are not valid.
The file position for reading or writing is always the file position at the time of the ffreada or
ffwritea(3C) call. The file’s position is incremented at that time by nbyte bytes, or the number of bytes
remaining in the file, whichever is less. In this way, calls to the ffreada, ffwritea, and ffseek(3C)
library functions can be interspersed, and the file position is incremented naturally.
To use asynchronous I/O effectively, all outstanding I/O requests must have their own status structures.
Each request must also be checked with an fffcntl(3C) call with a command code of FC_RECALL or
FC_ASPOLL. Use code FC_RECALL if the caller does not want control returned until the I/O request is
complete. Code FC_ASPOLL returns control immediately, regardless of the status of the request. This
allows the user to check on the completion of a given request without waiting.

RETURN VALUES
If ffreada completes successfully, a nonnegative integer is returned. Otherwise, a value of -1 is returned,
and status.sw_error is set to indicate the error.

ERRORS
The ffreada function fails for a variety of reasons, including library and system errors.

EXAMPLES
The following example illustrates a way to use function ffreada to perform a read operation in parallel
with other work in a user’s process.
#include <st dlib.h >
#include <st dio .h>
#include <fc ntl .h>
#include <ff io. h>

str uct ffs w rds tat , wrs tat, dumsta t;

004– 2165– 002 153


FFREADA ( 3C ) FFREADA ( 3C )

main()
{
cha r buf [40 96*8], buf2[4 096*8] ;
int fd;

if ((fd = ffopen("d ata fil e", O_RDON LY)) == -1) {


per ror ("open (da tafile ) fai led");
exit(1 );
}
/*
* Ass ume the file is large. Rea d in first 8 sec tors, and
* sim ultane ous ly write out the fol low ing 8 sec tors.
*/
ffr eada(f d, buf, 409 6*8, &rdsta t, FUL L);
ffw ritea( fd, buf2, 409 6*8 , &wr sta t, FUL L);

/* perfor m oth er wor k her e in parall el wit h I/O com pletio n */

/*
* See if eit her operat ion is com plete with fffcnt l(FC_A SPOLL) .
* Che ck sw_stat to det erm ine comple tion.
*/
fff cnt l(fd, FC_ ASP OLL, &rdsta t, &du mstat) ; /* don ’t wai t */
fff cnt l(fd, FC_ ASP OLL , &wr stat, &dumst at); /* don’t wait */

if (FF STAT(rdst at) == 0) reada_ is_not _done( );


if (FF STAT(wrst at) == 0) wri tea_is _not_d one();
/*
* wai t for read and wri te to comple te. fffcnt l(3) may have to be
* cal led mor e tha n onc e. Check sw_sta t to ensure com pletio n.
*/
whi le( FFSTAT(rd sta t) == 0)
fffcntl(f d, FC_REC ALL, &rdsta t, &du mstat) ;

if (FF STAT(rdst at) == FFERR)


pri ntf ("Read fai led, errno= %d", rdstat .sw_er ror);

/* wai t for wri te */


whi le( FFSTAT(wr sta t) == 0)
fffcntl(f d, FC_RECALL , &wr stat, &dumst at);

if (FF STAT(wrst at) == FFE RR)


pri ntf ("Read failed , err no=%d" , wrs tat.sw _error );

154 004– 2165– 002


FFREADA ( 3C ) FFREADA ( 3C )

/* inp ut dat a fro m ffr ead a now availa ble in buf fer buf */
}

SEE ALSO
errno.h(3C), fffcntl(3C), ffopen(3C), ffread(3C), ffseek(3C), ffwritea(3C), intro(3C)

004– 2165– 002 155


FFSEEK ( 3C ) FFSEEK ( 3C )

NAME
ffseek, ffbksp, ffseekf, ffbkspf – Repositions a flexible file I/O file

SYNOPSIS
#include <ffio.h>
#include <unistd.h>
UNICOS and UNICOS/mk systems:
int ffseek (int fd, off_t pos, int whence [, struct ffsw *stat]);
int ffbksp (int fd [, struct ffsw *stat]);
IRIX systems:
off_t ffseek (int fd, off_t pos, int whence);
int ffbksp (int fd);
All systems:
off_t ffseekf (int fd, off_t pos, int whence, struct ffsw *stat);
int ffbkspf (int fd, struct ffsw *stat);

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
The ffseek function provides flexible file I/O (FFIO) positioning capability similar to that of lseek(2).
In addition to the functionality of lseek, ffseek provides access to limited positioning on blocked files
and record-oriented files. Specifying ffseek(fd, 0, 0) always rewinds a file to its initial point,
regardless of whether the file is stream, blocked, or tape. When using the syscall layer, this function
cannot be used to position a tape.
This function allows programs to be written so that their I/O can be controlled by the asgcmd(1) or
assign(1) command. Both native and foreign record-oriented I/O, multifile datasets, and
performance-oriented layers (such as SDS resident layers and memory-resident layers) are available with this
mechanism.
Function ffbksp allows you to perform a backspace operation on those FFIO layers that support it.
Currently, this is limited to cos, tape, f77, and text.
Arguments are as follows:
fd Number returned by ffopen(3C).
pos Byte position requested.
whence Specifies one of the following values (defined in header file stdio.h):

156 004– 2165– 002


FFSEEK ( 3C ) FFSEEK ( 3C )

0 or SEEK_SET Sets the pointer to the value of pos. pos must be a non-negative integer.
(Special case: ffseek(fd, 0, 0) = rewind)
1 or SEEK_CUR Sets the pointer to the current position, plus or minus *arg. This is
supported only in layers that are not record-oriented; layers are specified
to assign -F as follows: syscall, sds, mr (memory resident),
cache, cachea, bufa, er90.
2 or SEEK_END Sets the pointer to the end of the file, minus pos. pos must be a
non-negative integer. Not all layers support this option. (Special case:
ffseek(fd, 0, 2) = position just in front of the EOD.)
stat Pointer to the ffsw status return structure.

RETURN VALUES
The return value is the current position in the file after the seek. Upon successful completion, a
non-negative value is returned. Otherwise, -1 is returned, and, if the stat parameter is passed, the error value
is found in stat.sw_error. If the stat parameter is not provided, the error code is found in errno.

EXAMPLES

#in clu de <st dlib.h >


#in clu de <fc ntl.h>
#in clu de <st dio.h>
#in clu de <ff io.h>

mai n()
{
size_t ret;
int fd, i, j;
off _t fret;

fd = ffopen("d ata ", O_R DWR | O_C REA T, 066 6);

for (i = 0 ; i < 100 0 ; i++ )


{
ret = ffwrit e(f d, &i, sizeof (i));
if (ret < 0) abo rt();
}

for (i = 0 ; i < 10 ; i++ )


{
fre t = ffs eek (fd , i * siz eof(j) * 100 , SEE K_S ET) ;
if (fret < 0) abo rt( );
ret = ffr ead (fd , &j, siz eof (j) );

004– 2165– 002 157


FFSEEK ( 3C ) FFSEEK ( 3C )

if (re t < 0) abo rt( );


pri ntf("Valu e is %d at word %d\n", j, i*100) ;
}
}

Output from the previous program is as follows:


Val ue is 0 at wor d 0
Val ue is 100 at word 100
Val ue is 200 at wor d 200
Val ue is 300 at word 300
Val ue is 400 at wor d 400
Val ue is 500 at word 500
Val ue is 600 at wor d 600
Val ue is 700 at word 700
Val ue is 800 at wor d 800
Val ue is 900 at word 900

SEE ALSO
errno.h(3C), ffclose(3C), ffopen(3C), ffread(3C), ffwrite(3C)

158 004– 2165– 002


FFSETSP ( 3C ) FFSETSP ( 3C )

NAME
ffsetsp – Initiates EOV processing for files opened using flexible file I/O

SYNOPSIS
#include <ffio.h>
int ffsetsp (int fd[, struct ffsw *stat]);

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
The ffsetsp function initiates special end-of-volume (EOV) processing for online tape files opened by
ffopen or ffopens (see ffopen(3C)), using flexible file I/O (FFIO). Arguments are as follows:
fd Number returned by ffopen or ffopens.
stat Pointer to the status return structure.
This function is valid only for online tape and ER90 files that use the FFIO tape layer on UNICOS and
UNICOS/mk systems. ER90 files are not supported on Cray T3E systems.

RETURN VALUES
Function ffsetsp returns 0 if successful. Otherwise, a value of -1 is returned, and, if the stat parameter is
passed, the error value is found in stat.sw_error. If the stat parameter is not provided, the error code
is found in errno.

SEE ALSO
fffcntl(3C), ffopen(3C)

004– 2165– 002 159


FFSTRERROR ( 3C ) FFSTRERROR ( 3C )

NAME
FFSTRERROR – Get FFIO error message string

SYNOPSIS
#include <ffio.h>
char *ffstrerror(int errnum);

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
The FFSTRERROR function maps an FFIO error number in errnum to an error message string, and returns a
pointer to that string. The returned string should not be overwritten.

SEE ALSO
strerror(3C)

160 004– 2165– 002


FFWRITEA ( 3C ) FFWRITEA ( 3C )

NAME
ffwritea – Provides asynchronous write using flexible file I/O

SYNOPSIS
#include <ffio.h>
int ffwritea (int fd, char *buf, unsigned nbyte, struct ffsw *status [,int
fulp[, int *ubc]]);

IMPLEMENTATION
UNICOS and UNICOS/mk systems

DESCRIPTION
The ffwritea function is modeled after the writea system call and the parameters are the same as
ffwrite(3C). The difference between ffwrite and ffwritea is that ffwritea performs its work
asynchronously when possible.
Arguments to ffwritea are as follows:
fd Value returned from an ffopen, or ffopens call.
buf Pointer to the buffer in which the data is stored.
nbyte Number of bytes to be written.
status Pointer to the ffsw status return structure, described in detail in ffreada(3C).
fulp Either the value FULL or PARTIAL as defined in header ffio.h. FULL requests that an EOR
mark be written immediately after the requested data. PARTIAL requests that no such mark be
written.
This is an optional argument. If it is not specified, FULL is assumed.
ubc Number of unused bits in the last byte; for example, a single bit can be written by requesting 1
byte and a ubc of 7.
This is an optional argument. If it is not specified, 0 is assumed.
The description of handling asynchronous FFIO is given under ffreada and fflistio.

ERRORS
Function ffwritea fails and the file pointer remains unchanged if any one of a number of conditions
occurs. These include many system errors and library errors that result from the operations performed by the
FFIO layers performing the I/O.

004– 2165– 002 161


FFWRITEA ( 3C ) FFWRITEA ( 3C )

RETURN VALUES
If ffwritea completes successfully, a nonnegative integer is returned. Otherwise, a value of -1 is
returned, and status.sw_error is set to indicate the error.

EXAMPLES
An example program using ffwritea is shown with ffreada(3C).

SEE ALSO
errno.h(3C), fffcntl(3C), fflistio(3C), ffopen(3C), ffreada(3C)
write(2) in the UNICOS System Calls Reference Manual

162 004– 2165– 002


GLIO_GROUP ( 3F ) GLIO_GROUP ( 3F )

NAME
glio_group_mpi, glio_group_shmem – Defines a group of processes to be associated with a global
file.

SYNOPSIS
C or C++:
#include <ffio.h>
#include <mpi.h>
void glio_group_mpi(MPI_Comm comm)
#include <mpp/shmem.h>
void glio_group_shmem(int handle);
Fortran:
include "mpif.h"
INTEGER comm
CALL GLIO_GROUP_MPI(comm)
include "mpp/shmem.fh"
INTEGER handle
CALL GLIO_GROUP_SHMEM(handle);

IMPLEMENTATION
UNICOS/mk and IRIX systems

DESCRIPTION
These subroutines identify the group of processes which will share access to any FFIO files opened with the
global FFIO layer. These files, termed global files, must be opened and closed collectively by all
processes that share access to them.
The following is a list of valid arguments for these routines:
comm An MPI communicator. The group of processes associated with this communicator will access
the global file. This process group must be executing within a single host machine.
handle A SHMEM process group handle returned from the shmem_group_create_strided()
function.
The glio_group_mpi and glio_group_shmem functions are collective across the set of processes
identified by comm or handle.
If glio_group_mpi or glio_group_shmem are not called prior to an open of a global file, all MPI
or SHMEM processes in the application must collectively open and close the file.

004– 2165– 002 163


GLIO_GROUP ( 3F ) GLIO_GROUP ( 3F )

EXAMPLES
The following Fortran program opens global file globfile for access from SHMEM processes (PEs) 0 and
1. PEs 2 and higher will not access the file.
progra m glo bal _su bse t
includ e "mp p/s hme m.f h"
intege r rac om, han dle
common /ra com / rac om( SHM EM_ GRO UP_ COM _SI ZE)

call start_ pes (0)


racom = 0

c Define a SHM EM gro up and the n ope n glo bfi le acr oss thi s gro up

if (my _pe(). le. 1) the n


cal l ass ign ("a ssi gn -F glo bal u:2 0", ier )
handle = shm em_ gro up_ cre ate _st rid ed( 0, 1, 2, rac om, shm em_ null)
cal l gli o_g rou p_s hme m(h and le)
ope n (20 ,fi le= "gl obf ile ",a cce ss= "di rec t", rec l=6 4)
endif

end

SEE ALSO
shmem_group_create_strided(3)

164 004– 2165– 002


INTRO_PXF ( 3F ) INTRO_PXF ( 3F )

NAME
INTRO_PXF – Introduction to PXF POSIX library

IMPLEMENTATION
See individual man pages for implementation details

DESCRIPTION
The POSIX FORTRAN 77 Language Interfaces Standard IEEE Std 1003.9-1992 (POSIX.a) defines a
standardized interface for accessing the system services of IEEE Std 1003.1-1990 (POSIX.1), and supports
routines to access constructs not directly accessible with FORTRAN 77.
Only a subset of the routines described in this standard are currently available on Cray Research systems.
For some routines, only a portion of the functionality described by the standard is currently implemented.
Many of the service interfaces defined in POSIX.1 require the use of aggregate data types (for example,
structures) that do not map to FORTRAN 77 entities. POSIX.9 solves this problem by the use of data
abstraction; by using additional subroutines to access and manipulate the aggregate data, the underlying data
structures are hidden from the user. It is the responsibility of the Fortran programmer to maintain variables
corresponding to the individual components of the actual implementation of the aggregate data, but the
programmer does not need to know the details of the actual implementation of the aggregate. The basic
model of this data abstraction is as follows:
1. The programmer calls the PXFSTRUCTCREATE subroutine to "create" an instance of the desired
aggregate data type; this subroutine returns a handle that the programmer subsequently uses in order to
reference and/or manipulate the data.
2. The programmer uses additional subroutines to load values into, or extract values out of, the aggregate
data. These subroutines are passed the handle of the desired aggregate and the name of the specific
component that is to be accessed. The programmer has direct control over only one component at a
time.
3. If an application passes information to the system, the PXFtypeSET subroutine is called once for each
member before calling the system procedure. Currently, only PXFINTSET and PXFSTRSET are
implemented.
4. If an application needs to get information from the system, the PXFtypeGET subroutine is called once
for each member after calling the system procedure. Currently, only PXFINTGET and PXFINTSET are
implemented.
5. When an instance of an aggregate is no longer required, a subroutine (PXFSTRUCTFREE) can be called
to release it.
6. When calling the actual system procedure, the calling sequence is equivalent to the C binding as shown
in POSIX.1, except that a handle is used in place of the POSIX.1 structure (pointer) argument.

004– 2165– 002 165


INTRO_PXF ( 3F ) INTRO_PXF ( 3F )

Classification of routines
The POSIX routines can be divided into several general groups as described below.
Process primitives
• Routines that create, execute, or terminate a process
1. PXFFORK - Creates a process
2. PXFEXECV, PXFEXECVE, PXFEXECVP - Executes a new process
3. PXFWAIT, PXFWAITPID - Obtains information about a calling process’ child process
4. PXFFASTEXIT - Terminates a Fortran program
5. PXFWIFEXITED - Determines if child process exited with exit
6. PXFWIFSIGNALED - Determines if the child process terminated because of a signal
7. PXFWIFSTOPPED - Determines if a child process has stopped
• Signal routines
8. PXFKILL - Sends a signal to a process or group of processes
9. PXFSIGADDSET - Adds an individual signal to the specified signal set
10. PXFSIGDELSET - Deletes an individual signal in the specified signal set
11. PXFSIGEMPTYSET - Initializes signal set such that all signals defined in POSIX standard are excluded
12. PXFSIGFILLSET - Initializes signal set such that all signals defined in POSIX standard are included
13. PXFSIGISMEMBER - Determines if the specified signal is a member of the specified signal set
14. PXFSIGPENDING - Examines pending signals
15. PXFSIGPROCMASK - Examines and changes blocked signals
16. PXFSIGSUSPEND - Waits for a signal
17. PXFALARM - Schedule alarm signal
18. PXFPAUSE - Suspends process execution until signal
19. PXFSLEEP - Delays process execution
Process environment routines
• Process identification routines
1. PXFGETPID - Gets the process ID
2. PXFGETPPID - Gets the parent process ID
• User identification routines
3. PXFGETEGID - Gets the effective group ID
4. PXFGETEUID - Gets effective user ID

166 004– 2165– 002


INTRO_PXF ( 3F ) INTRO_PXF ( 3F )

5. PXFGETGID - Gets the real group ID


6. PXFGETGROUPS - Gets supplementary group IDs
7. PXFGETLOGIN - Gets user name
8. PXFGETUID - Gets the real user ID
9. PXFSETGID - Sets group ID
10. PXFSETUID - Sets user ID
• Process groups routines
11. PXFSETPGID - Set process group ID
12. PXFSETSID - Creates a new session for a calling process
• System identification routines
13. PXFUNAME - Retrieves the operating system name
• Time routines
14. PXFTIME - Gets system time
15. PXFTIMES - Gets process times
• Environment variable processing routines
16. PXFCLEARENV - Clears all environment variables
17. PXFGETENV - Returns a value for the environment name
18. PXFSETENV - Sets environment variable pair
• Terminal identification routines
19. PXFCTERMID - Generates terminal pathname
20. PXFISATTY - Determines if file descriptor corresponds
• Configurable system values
21. PXFSYSCONF - Retrieves the value of configurable system variables
File and directory routines
1. PXFACCESS - Checks the accessibility of a named file
2. PXFCHDIR - Changes the current directory to a specified directory
3. PXFCHMOD - Sets file modes for a named file
4. PXFCHOWN - Changes the owner and group of a file
5. PXFCHROOT - Changes the root directory to a specified directory
6. PXFCREAT - Creates a new file or rewrites an existing file
7. PXFDIRECTORY - Performs directory operations

004– 2165– 002 167


INTRO_PXF ( 3F ) INTRO_PXF ( 3F )

8. PXFGETCWD - Gets the pathname of the working directory


9. PXFISBLK - Tests for block special file
10. PXFISCHR - Tests for character special file
11. PXFISDIR - Tests for directory file
12. PXFISFIFO - Tests for pipe or a FIFO special file
13. PXFISREG - Tests for regular file
14. PXFLINK - Creates a link to a file
15. PXFOPEN - Provides a Fortran interface to the open(2) system call
16. PXFRENAME - Renames a file
17. PXFRMDIR - Removes a directory entry
18. PXFSTAT - Retrieves the file status
19. PXFUMASK - Sets the file creation mask
20. PXFUNLINK - Removes a directory entry
21. PXFUTIME - Sets access and modification times of a file
Input and output primitives
1. PXFFCNTL - Provides a subset of fcntl(2) functionality, except the third argument is always an
integer
Device and class-specific procedures (not available)
Fortran intrinsics
1. PXFCONST, PXFISCONST, IPXFCONST - Returns the value associated with symbolic constants
2. PXFESTRGET - Accesses a single string element of a structure component that is an array
3. PXFFILENO - Returns the file descriptor for a specified unit
4. PXFGETARG - Returns a command-line argument
5. PXFINTGET - Allows values stored in individual components of a structure to be extracted and used
6. PXFINTSET - Allows components of a structure to be set or modified
7. PXFLOCALTIME - Converts to local time
8. PXFSTRGET - Allows values stored in individual components of a structure to be extracted and used
9. PXFSTRSET - Allows values stored in individual components of a structure to be set
10. PXFSTRUCTCOPY - Copies structure
11. PXFSTRUCTCREATE - Creates an instance of the desired structure and returns a nonzero handle in the
argument jhandle

168 004– 2165– 002


INTRO_PXF ( 3F ) INTRO_PXF ( 3F )

12. PXFSTRUCTFREE - Deletes the instance of the structure referenced by jhandle


13. PXFUCOMPARE - Compares unsigned integers
System Databases
1. PXFGETGRGID - Gets group information using the group ID
2. PXFGETGRNAM - Gets group information using the group name
3. PXFGETPWNAM - Gets password information about login name
4. PXFGETPGRP -Gets the process group ID
5. PXFGETPWUID - Gets password information by using user ID
See the individual man pages for complete details.

004– 2165– 002 169


IPXFARGC ( 3F ) IPXFARGC ( 3F )

NAME
IPXFARGC – Returns the number of command-line arguments excluding the command name

SYNOPSIS
INTEGER FUNCTION IPXFARGC()

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when you compile
programs with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs
option to the MIPSpro F77 compiler.
The IPXFARGC function returns the number of command-line arguments in the command used to invoke the
executing program. The command name is not included in the number returned. A return value of 0
indicates that there are no command-line arguments other than the command name itself.

170 004– 2165– 002


IPXFWEXITSTATUS ( 3F ) IPXFWEXITSTATUS ( 3F )

NAME
IPXFWEXITSTATUS – Returns the lower bits of exit argument

SYNOPSIS
INTEGER FUNCTION IPXFWEXITSTATUS(istat)
INTEGER istat

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
The IPXFWEXITSTATUS integer function returns part of the lower bits from the exit argument x. The
PXFWIFEXITED logical function returns TRUE when exit() was used to return from the child process.
IPXFWEXITSTATUS should only be used when PXFWIFEXITED returns TRUE.
The following is a list of arguments for this routine:
istat An input integer variable with the PXFWAIT or PXFWAITPID output status argument.
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX systems,
the default kind is KIND=4.

EXAMPLES

004– 2165– 002 171


IPXFWEXITSTATUS ( 3F ) IPXFWEXITSTATUS ( 3F )

program pxftes t
integer istat, ire tpid, ipi d, ierror , i, j
integer iwexit status , IPX FWE XIT STATUS
logica l lwi fexite d, PXF WIF EXITED

CALL PXFFOR K(i pid,ie rror)


if (ie rror .ne. 0) the n
print *,’FAI LED : PXF FORK call failed wit h err or = ’,i err or
else
if (ip id .eq . 0) then
j = 0
do i=1 ,10000 0
j = j + i
end do
sto p
else

CALL PXF WAIT(i sta t,iret pid ,ie rro r)


if (ie rror .eq. 0) the n
print *,’PAS SED : PXF WAIT normal tes t’
lwifex ite d = PXF WIF EXITED (is tat )
if (lw ifexit ed .eqv. .TR UE. ) the n ! exi t nor mal ly
iwe xit status = IPX FWE XITSTA TUS(is tat)
if (iw exitst atu s .ne . 0) the n ! exi t(0 ) ret urn ed
print *,’ PXF WIF EXITED ret urn ed TRU E’
pri nt *,’ expect ed IPX FWE XIT STA TUS (is tat ) = 0’
pri nt *,’IPX FWE XIT STA TUS (is tat ) = ’,i wex its tat us
else
print *,’ PXF WIF EXITED tes t PAS SED ’
pri nt *,’ IPX FWEXIT STATUS tes t PAS SED ’
end if
else
print *,’ PXFWIF EXI TED ret urned FALSE’
pri nt *,’ PXF WAI T ist at = ’, ist at
print *,’ IPXFWE XIT STA TUS cannot be cal led .’
endif
els e
print *,’ FAILED : PXF WAI T cal l wit h err or = ’,i err or
endif
endif
endif
end

172 004– 2165– 002


IPXFWEXITSTATUS ( 3F ) IPXFWEXITSTATUS ( 3F )

SEE ALSO
PXFWAIT(3F), PXFWIFEXITED(3F)

004– 2165– 002 173


IPXFWSTOPSIG ( 3F ) IPXFWSTOPSIG ( 3F )

NAME
IPXFWSTOPSIG – Returns part of the lower bits of signal number that terminates child process

SYNOPSIS
INTEGER FUNCTION IPXFWSTOPSIG(istat)
INTEGER istat

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
The IPXFWSTOPSIG integer function returns part of the lower bits of the signal number that caused the
child process to stop. The PXFWIFSTOPPED logical function returns TRUE to indicate that the child
process has stopped. IPXFWSTOPSIG should only be used if PXFWIFSTOPPED returns TRUE.
The following argument is used for this routine:
istat An input integer variable with the PXFWAIT or PXFWAITPID output status argument.
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX systems,
the default kind is KIND=4.

EXAMPLES

pro gram pxftes t


int eger istat, ire tpi d, ipi d, ier ror , i, j
int eger iwstop sig , IPX FWS TOP SIG
log ical lwifst opp ed, PXF WIF STO PPE D
CAL L PXF FORK(i pid ,ie rro r)
if (ierro r .ne . 0) the n
print *,’FAI LED : PXF FOR K cal l fai led wit h err or = ’,i err or
els e

174 004– 2165– 002


IPXFWSTOPSIG ( 3F ) IPXFWSTOPSIG ( 3F )

pri nt *,’ PASSED: PXF FOR K cal l’


if (ip id .eq. 0) the n
j = 0
do i=1 ,100000
j = j + i
end do
cal l PXFGETPID (ic hld id,ier ror )
if (ie rro r .ne . 0) the n
pri nt *, ’PXFGE TPI D FAI LED , ier ror =’, ierror
pri nt *, ’ichld id= ’, ichldi d
else
print *, ’PXFGE TPI D PAS SED ’
end if
cal l PXFCONST( "SI GST OP",is ig, ier ror)

pri nt *, ’PX FCO NST FAI LED , ier ror=’, ier ror
pri nt *, ’is ig= ’, isi g
els e
pri nt *, ’PXFCO NST PAS SED ’
end if
cal l PXF KILL(ichl did ,is ig,ier ror )
if (ie rror .ne. 0) the n
print *, ’PXFKI LL FAI LED ier ror =’, ier ror
print *, ’ichld id= ’, ich ldid
print *, ’isig= ’, isi g
els e
pri nt *, ’PXFKI LL PAS SED ’
end if
sto p "CH ILD"
els e
cal l PXFCON ST( "WU NTRACE D", iop ts, ierror )
if (ie rro r .ne . 0) the n
print *, ’PXFCO NST FAILED , ier ror =’, ier ror
print *, ’iopts =’, iopts
els e
pri nt *, ’PX FCO NST PAS SED ’
end if
CAL L PXFWAITPI D(i pid,is tat ,io pts ,iretp id, ier ror )
if (ie rro r .eq . 0) the n
pri nt *,’PAS SED : PXF WAI T tes t’
lwi fstopped = PXF WIF STO PPED(i sta t)
if (lwifstop ped .eq v. .TR UE.) then
iws top sig = IPX FWS TOP SIG (istat )
if (iw sto psi g .ne . 0) then

004– 2165– 002 175


IPXFWSTOPSIG ( 3F ) IPXFWSTOPSIG ( 3F )

pri nt *,’ PXF WIF STO PPED test PAS SED ’


print *,’IPX FWSTOP SIG test PAS SED ’
cal l PXF CON ST( "SI GCO NT",is ig, ier ror )
if (ie rro r .ne . 0) then
print *,’PXF CON ST FAI LED ,ie rro r=’,ie rro r
pri nt *,’ isi g=’ , isi g
els e
pri nt *, ’PXFCO NST PAS SED ’
end if
! con tin ue the chi ld pro ces s
call PXFKIL L(i pid ,is ig,ier ror )
els e
pri nt *,’ PXF WIF STO PPED test PAS SED ’
print *,’IPX FWSTOP SIG test FAI LED ’
pri nt *,’ PXFWIF STOPPE D ret urn ed TRU E’
pri nt *,’ IPX FWS TOP SIG(is tat ) = ’,i wst opsig
print *,’ist at = ’, ipi d
pri nt *,’ PXFWAI T ist at = ’, ist at
print *,’ire tpid= ’, ire tpi d
end if
els e
pri nt *,’ PXF WIF STO PPE D ret urned FAL SE’
pri nt *,’ ist at = ’, ipi d
pri nt *,’ PXF WAI T ist at = ’, ist at
pri nt *,’ire tpid= ’, ire tpi d
pri nt *,’ IPX FWS TOP SIG can not be cal led.’
end if
els e
pri nt *,’ FAI LED: PXFWAI T cal l wit h err or = ’,i err or
pri nt *,’ ist at = ’, ipi d
pri nt *,’ ist at = ’, ist at
pri nt *,’ ire tpi d = ’, ire tpi d
end if
end if
end if
pri nt *,’ tes t com ple te’
end

SEE ALSO
PXFWAIT(3F), PXFWIFSTOPPED(3F)

176 004– 2165– 002


IPXFWTERMSIG ( 3F ) IPXFWTERMSIG ( 3F )

NAME
IPXFWTERMSIG – Returns lower bit of signal that terminates a child process

SYNOPSIS
INTEGER FUNCTION IPXFWTERMSIG(istat)
INTEGER istat

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
The IPXFWTERMSIG integer function returns the lower bits of the signal number that caused the child
process to terminate. The PXFWIFSIGNALED logical function returns TRUE when the child process has
terminated because of a signal. IPXFWTERMSIG should be used only when PXFWIFSIGNALED returns
TRUE.
The following argument is used for this routine:
istat An input integer variable with the PXFWAIT or PXFWAITPID output status argument.
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX systems,
the default kind is KIND=4.

EXAMPLES

progra m pxf tes t


intege r ist at, ire tpi d, ipi d, ier ror , ich ldi d
intege r iwt erm sig , IPX FWT ERM SIG
logica l lwi fsi gna led , PXF WIF SIG NAL ED

CALL PXFFOR K(i pid ,ie rro r)


if (ie rror .ne . 0) the n
print *,’ FAI LED : PXF FOR K cal l fai led wit h err or = ’,i err or
else

004– 2165– 002 177


IPXFWTERMSIG ( 3F ) IPXFWTERMSIG ( 3F )

pri nt *,’ PASSED: PXF FOR K cal l’


if (ip id .eq. 0) the n
cal l PXFGETPID (ic hld id,ier ror )
if(ier ror .ne. 0) the n
pri nt *, ’PXFGE TPI D FAI LED , ier ror =’, ierror
print *,’ ichldi d=’ ,ic hld id
els e
print *, ’PXFGE TPI D PAS SED ’
end if
cal l PXFCONST( "SI GKI LL",is ig, ier ror)
if(ier ror .ne. 0) the n
pri nt *, ’PX FCO NST FAI LED , ier ror =’, ierror
pri nt *,’isi g=’ ,is ig
els e
pri nt *, ’PXFCO NST PAS SED ’
end if
cal l PXF KILL(ichl did ,is ig,ier ror )
if( ierror .ne . 0) then
pri nt *, ’PX FKI LL FAI LED, ierror =’, ier ror
pri nt *,’ich ldi d=’ ,ic hldid
pri nt *,’isi g=’ ,is ig
els e
print *, ’PX FKI LL PAS SED ’
endif
els e

178 004– 2165– 002


IPXFWTERMSIG ( 3F ) IPXFWTERMSIG ( 3F )

CAL L PXF WAI T(i sta t,i ret pid,ie rro r)


if (ie rro r .eq . 0) the n
pri nt *,’ PAS SED: PXFWAI T tes t’
lwi fsi gnaled = PXF WIF SIG NALED( ist at)
if (lw ifs ignale d .eq v. .TR UE. ) the n ! exi t nor mal ly
iwt erm sig = IPX FWTERM SIG (is tat )
if (iwter msi g .ne . 0) the n ! exi t(0) return ed
print *,’ PXF WIF SIGNAL ED tes t PAS SED ’
pri nt *,’IPX FWT ERM SIG tes t PAS SED’
els e
pri nt *,’PXF WIF SIG NAL ED tes t PAS SED ’
pri nt *,’ IPX FWTERM SIG tes t FAI LED ’
pri nt *,’ PXF WIFSIG NAL ED ret urned FAL SE’
pri nt *,’ IPX FWTERM SIG (is tat ) = ’,i wte rmsig
pri nt *,’ ist at = ’,i sta t
end if
els e
pri nt *,’PXF WIF SIG NAL ED tes t FAI LED ’
pri nt *,’PXF WIF SIG NAL ED ret urn ed FAL SE’
pri nt *,’PXF WAI T ist at = ’, ist at
pri nt *,’ IPX FWE XITSTA TUS cannot be called .’
end if
els e
pri nt *,’FAI LED : PXF WAI T cal l ier ror = ’,i err or
pri nt *,’ist at = ’, istat
pri nt *,’ ire tpi d = ’, ire tpid
end if
end if
end if
pri nt *,’ tes t com ple te’
end

SEE ALSO
PXFWAIT(3F), PXFWIFSIGNALED(3F)

004– 2165– 002 179


PXFACCESS ( 3F ) PXFACCESS ( 3F )

NAME
PXFACCESS – Checks the accessibility of a named file

SYNOPSIS
CHARACTER*n path
INTEGER ilen, iamode, ierror
CALL PXFACCESS(path, ilen, iamode, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFACCESS subroutine uses the access(2) system call to check the accessibility of a named file.
The value of iamode indicates specific file permissions. These file permissions are checked against the
current file permissions specified for the file in path. If the iamode permissions are allowed for the file in
path, PXFACCESS returns a zero in ierror. Otherwise, it returns a nonzero value.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this subroutine:
path An input character variable or array element containing the name of a file.
ilen An input integer variable containing the length of path in characters. If ilen is zero, all trailing
blanks are removed before calling access().
iamode An input integer variable containing the integer value of the symbolic constant for one or more
of the following permissions: R_OK, W_OK, X_OK, or F_OK. An integer value for each of
these symbolic constants is retrieved through the use of PXFCONST or IPXFCONST. The
integer values may be combined through the use of a bitwise inclusive OR function.
ierror An output integer variable that contain zero if the requested access is permitted or nonzero if the
requested access is not permitted.

180 004– 2165– 002


PXFACCESS ( 3F ) PXFACCESS ( 3F )

In addition to the errors returned by the access(2) system call, PXFACCESS may return the following
errors:
EINVAL If ilen is less than 0 or ilen is greater than LEN(path)
ENOMEM If PXFACCESS is unable to obtain memory to copy path.

EXAMPLES

progra m tes t
character *(1 2) path
int eger ilen, iam od, ierr
pat h = ’te stf ile’
iam od = 0
ile n = 0
ier r = 0
cal l pxf con st(’R_ OK’,ia mod ,ierr)
if (ie rr. ne.0) the n
pri nt *,’FAI L: err or fro m pxf con st R_O K = ’,ierr
else
print *,’ PASS: No err or from pxfcon st R_O K = ’
end if
ier r = 0
call pxfacc ess (path, ilen,i amo d,ierr )
if (ierr. ne. 0) then
print *,’ FAIL: err or fro m pxf acc ess = ’,i err
els e
print *,’ PAS S: No err or fro m pxf access = ’
endif
end

SEE ALSO
access(2)

004– 2165– 002 181


PXFALARM ( 3F ) PXFALARM ( 3F )

NAME
PXFALARM – Schedule alarm signal

SYNOPSIS
SUBROUTINE PXFALARM(iseconds, isecleft, ierror)
INTEGER iseconds, isecleft, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
The PXFALARM subroutine uses the alarm (2) system call to wait iseconds before generating the SIGALRM
signal. If a previous PXFALARM has time remaining, isecleft contains the number of seconds until the
SIGALRM would have been generated.
The following is a list of arguments for this routine:
iseconds Default integer input variable containing the number of real-time seconds to wait before sending
the calling process a SIGALRM signal.
isecleft Default integer output variable containing the number of seconds left until a previous request
would have generated a SIGALRM signal.
ierror Default integer output variable containing the status of zero if PXFALARM was successful.
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX systems,
the default kind is KIND=4.

NOTES
Replace the subroutine or function reference to alarm() with a subroutine call to PXFALARM.

EXAMPLES

182 004– 2165– 002


PXFALARM ( 3F ) PXFALARM ( 3F )

program pxftes t
integer isecon ds, isecle ft, ierror

iseconds = 10
isecleft = 0
ierror = 0
CAL L PXF ALARM( ise conds, isecle ft, ier ror )
if (ie rror .ne. 0) the n
pri nt *,’FAI LED : PXF ALA RM cal l fai led wit h err or = ’,i err or
else
pri nt *,’PAS SED : PXFALA RM call return ed no error’
endif
if (isecl eft .ne. 0) the n
print *,’FAI LED : PXF ALARM, ise cleft not zer o, =’, ise cle ft
end if
end

SEE ALSO
alarm(2)

004– 2165– 002 183


PXFCHDIR ( 3F ) PXFCHDIR ( 3F )

NAME
PXFCHDIR – Changes the current directory to a specified directory

SYNOPSIS
CHARACTER*n path
INTEGER ilen, ierror
CALL PXFCHDIR(path, ilen, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFCHDIR subroutine uses the chdir(2) system call to change the current working directory to the
specified directory.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
system, all arguments must be of default kind unless documented otherwise. On UNICOS and UNICOS/mk,
default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default kind is
KIND=4.
The following is a list of valid arguments for this subroutine:
path An input character variable or array element containing the new directory.
ilen An input integer variable containing the length of path in characters. If ilen is zero, all trailing
blanks are removed before calling chdir().
ierror An output integer variable that contains zero if the current working directory was changed or
nonzero if the change of directories was not made.
In addition to the errors returned by the chdir(2) system call, PXFCHDIR may return the following errors:
EINVAL If ilen is less than 0 or if ilen is greater than LEN(path)
ENOMEM If PXFCHDIR is unable to obtain memory to copy path

184 004– 2165– 002


PXFCHDIR ( 3F ) PXFCHDIR ( 3F )

EXAMPLES

progra m tes t
charac ter*(1 2) pat h
intege r ile n, ier r
pat h = ’dir/t est dir ’
ile n = 0
call pxfchd ir( pat h,i len,ie rr)
if (ie rr.ne. 0) the n
pri nt *,’ FAI L: error fro m pxf chd ir = ’,i err
else
pri nt *,’ PAS S: No err or fro m pxf chd ir = ’
endif
end

SEE ALSO
chdir(2)

004– 2165– 002 185


PXFCHMOD ( 3F ) PXFCHMOD ( 3F )

NAME
PXFCHMOD – Sets file modes for a named file

SYNOPSIS
CHARACTER*n path
INTEGER ilen, imode, ierror
CALL PXFCHMOD(path, ilen, imode, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFCHMOD subroutine uses the chmod(2) function to set file modes for the named file.
The value of imode indicates specific file modes. chmod() changes the current file modes for the named file
in path to the file mode specified in imode.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
system, all arguments must be of default kind unless documented otherwise. On UNICOS and UNICOS/mk,
default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default kind is
KIND=4.
The following is a list of valid arguments for this subroutine:
path Input character variable or array element containing the name of a file.
ilen Input integer variable containing the length of path in characters. If ilen is zero, all trailing
blanks are removed before calling chmod().
imode Input integer variable containing the integer value of the symbolic constant for one or more of
the following file modes:
USER READ permissions bit: S_IRUSR
WRITE permissions bit: S_IWUSR
SEARCH/EXECUTE permissions bit: S_IXUSR
Inclusive OR of READ/WRITE/EXECUTE: S_IRWXU

186 004– 2165– 002


PXFCHMOD ( 3F ) PXFCHMOD ( 3F )

GROUP READ permissions bit: S_IRGRP


WRITE permissions bit: S_IWGRP
SEARCH/EXECUTE permissions bit: S_IXGRP
Inclusive OR of READ/WRITE/EXECUTE: S_IRWXG
OTHER READ permissions bit: S_IROTH
WRITE permissions bit: S_IWOTH
SEARCH/EXECUTE permissions bit: S_IXOTH
Inclusive OR of READ/WRITE/EXECUTE: S_IRWXO
SETID Set user ID on execution: S_ISUID
Set group ID on execution: S_ISGID
An integer value for each of these symbolic constants is retrieved through the use of
PXFCONST(3F) or IPXFCONST(3F). The integer values may be combined through
the use of a bitwise inclusive OR function.
ierror Output integer variable that contains zero if the requested file mode bits are set or nonzero if the
requested file mode bits are not set.
In addition to the errors returned by the chmod(2) system call, PXFCHMOD may return the following errors:
EINVAL If ilen < 0 or ilen > LEN(path).
ENOMEM If PXFCHMOD is unable to obtain memory to copy path.

EXAMPLES

progra m tes t
charac ter *(12) path
integer ile n, imo d, ier r, imo dr, imo dw
path = ’testf ile’
imod = 0
imodr = 0
imodw = 0
ilen = 0

004– 2165– 002 187


PXFCHMOD ( 3F ) PXFCHMOD ( 3F )

cal l pxf con st(’S_ IRU SR’,im odr ,ie rr)


if (ie rr. ne. 0) then
pri nt *,’ FAIL: err or fro m pxf const S_I RUS R = ’,i err
sto p
end if
cal l pxf con st( ’S_IROTH’ ,im odw ,ie rr)
if (ie rr. ne.0) the n
pri nt *,’FAI L: error fro m pxf con st S_IWUS R = ’,ierr
sto p
end if
imo d = IOR (im odr,imodw )
cal l pxf chm od(pat h,i len,imod, ier r)
if (ie rr. ne. 0) then
pri nt *,’ FAIL: err or from pxfchm od = ’,i err
els e
pri nt *,’ PAS S: No err or fro m pxf chm od’
end if
end

SEE ALSO
chmod(2)

188 004– 2165– 002


PXFCHOWN ( 3F ) PXFCHOWN ( 3F )

NAME
PXFCHOWN – Changes the owner and group of a file

SYNOPSIS
CHARACTER*n path
INTEGER ilen, iowner, igroup, ierror
CALL PXFCHOWN(path, ilen, iowner, igroup, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFCHOWN subroutine uses the chown(2) function to change the owner and group of a file.
The value of iowner and igroup indicates the new values.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this routine:
path Input character variable or array element containing the name of a file.
ilen Input integer variable containing the length of path in characters. If ilen is zero, all trailing
blanks are removed before calling chown().
iowner Input integer variable containing the integer value for the owner.
igroup Input integer variable containing the integer value for the group.
ierror Output integer variable that contains zero if the group and owner of the file were changed or
nonzero if PXFCHOWN did not change the group and owner.
In addition to the errors returned by the chown(2) system call, PXFCHOWN may return the following errors:
EINVAL If ilen is less than 0 or ilen is greater than LEN(path).
ENOMEM If PXFCHOWN is unable to obtain memory to copy path.

004– 2165– 002 189


PXFCHOWN ( 3F ) PXFCHOWN ( 3F )

EXAMPLES

sub routin e tes t (io wne r,i gro up)


cha racter *(12) pat h
int eger ilen, iow ner , igr oup , ier r
path = ’te stfile ’
ilen = 0
cal l pxf chown( pat h,i len ,io wne r,i gro up, ier r)
if (ierr. ne.0) the n
print *,’FAI L: err or fro m pxf cho wn = ’,i err
els e
print *,’PAS S: No err or fro m pxf cho wn = ’
end if
end

SEE ALSO
chown(2)

190 004– 2165– 002


PXFCHROOT ( 3F ) PXFCHROOT ( 3F )

NAME
PXFCHROOT – Changes the root directory to a specified directory

SYNOPSIS
CHARACTER*n path
INTEGER ilen, ierror
CALL PXFCHROOT(path, ilen, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFCHROOT subroutine uses the chroot(2) system call to change the root directory to the specified
directory.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this subroutine:
path Input character variable or array element containing the name of a file.
ilen Input integer variable containing the length of path in characters. If ilen is zero, all trailing
blanks are removed before calling chroot().
ierror Output integer variable that contains zero if the root directory was changed to the directory
specified by path or nonzero if the root directory was not changed.
In addition to the errors returned by the chroot(2) system call, PXFCHROOT may return the following
errors:
EINVAL If ilen is less than 0 or if ilen is greater than LEN(path)
ENOMEM If PXFCHROOT is unable to obtain memory to copy path

004– 2165– 002 191


PXFCHROOT ( 3F ) PXFCHROOT ( 3F )

EXAMPLES

pro gram test


cha racter *(12) pat h
int eger ilen, ier r
path = ’/d ir/tes t’
ilen = 0
cal l pxf chroot (pa th, ile n,i err )
if (ierr. ne.0) the n
print *,’FAI L: err or fro m pxf chr oot = ’,i err
els e
print *,’PAS S: No err or fro m pxf chr oot ’
end if
end

SEE ALSO
chroot(2)

192 004– 2165– 002


PXFCLEARENV ( 3F ) PXFCLEARENV ( 3F )

NAME
PXFCLEARENV – Clears all environment variables

SYNOPSIS
SUBROUTINE PXFCLEARENV (ierror)
INTEGER ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The subroutine PXFCLEARENV removes all environment variables for the current process.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following argument is used with this subroutine:
ierror An output integer variable that contains a status of zero if all environment variables were cleared.

EXAMPLES
This example shows how to use the PXFCLEARENV routine to clear the environment variable for the current
process.
progra m pxf tes t
intege r ier ror
CALL PXF CLE ARE NV( ier ror )
if (ie rro r .eq . 0) the n
pri nt *,’ PAS SED: pxf cle are nv tes t’
else
pri nt *,’ FAI LED: pxf cle are nv tes t’
endif
end

004– 2165– 002 193


PXFCLEARENV ( 3F ) PXFCLEARENV ( 3F )

This example may display:


PASSED: pxfcle arenv tes t

194 004– 2165– 002


PXFCONST ( 3F ) PXFCONST ( 3F )

NAME
PXFCONST, PXFISCONST, IPXFCONST – Returns the value associated with symbolic constants

SYNOPSIS
CHARACTER*(n) constname
INTEGER ival, ierror
LOGICAL PXFISCONST, 1
i = IPXFCONST (constname)
l = PXFISCONST (constname)
CALL PXFCONST (constnam, ival, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
These functions provide a way for the Fortran programmer to get the value of some symbolic constants
defined in system header files.
IPXFCONST() provides an integer return value but no error checking. If the argument passed corresponds to
one of the defined constants shown below, the return value is the integer value associated with the constant;
if the argument is not a defined constant, the return value is meaningless. PXFISCONST() confirms whether
the argument is a valid constant. PXFISCONST() returns .TRUE only if IPXFCONST() would return a
valid value for the same constname.
Upon successful completion, the subroutine PXFCONST() returns in ival the integer value associated with the
constant described by constname.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of arguments for these subroutines:
constname An input character variable that represents the name of a constant. constname is case-sensitive,
and trailing blanks in the argument are ignored.
The following are valid values for constname. The second column contains the system header
file where the symbolic constant is defined, or the standard where it is defined.
’F_GETLK’ <fcntl.h>

004– 2165– 002 195


PXFCONST ( 3F ) PXFCONST ( 3F )

’F_SETLK’ <fcntl.h>
’F_SETLKW’ <fcntl.h>
’F_RDLCK’ <fcntl.h>
’F_WRLCK’ <fcntl.h>
’F_UNLCK’ <fcntl.h>
’F_DUPFD’ <fcntl.h>
’F_GETFD’ <fcntl.h>
’F_SETFD’ <fcntl.h>
’F_GETFL’ <fcntl.h>
’F_SETFL’ <fcntl.h>
’F_SETSB’* <fcntl.h>
’F_SETALF’* <fcntl.h>
’F_CLRALF’* <fcntl.h>
’O_RDONLY’ <fcntl.h>
’O_WRONLY’ <fcntl.h>
’O_RDWR’ <fcntl.h>
’O_ACCMODE’ <fcntl.h>
’O_NDELAY’ <fcntl.h>
’O_APPEND’ <fcntl.h>
’O_SYNC’ <fcntl.h>
’O_NONBLOCK’ <fcntl.h>
’O_RAW’* <fcntl.h>
’O_SSD’* <fcntl.h>
’O_CREAT’ <fcntl.h>
’O_TRUNC’ <fcntl.h>
’O_EXCL’ <fcntl.h>
’O_NOCTTY’ <fcntl.h>
’0_BIG’* <fcntl.h>
’O_PLACE’* <fcntl.h>
’O_RESTART’* <fcntl.h>
’O_ASYNC’* <fcntl.h>

196 004– 2165– 002


PXFCONST ( 3F ) PXFCONST ( 3F )

’O_PTYIGN’* <fcntl.h>
’O_SFSXOP’* <fcntl.h>
’O_LDRAW’* <fcntl.h>
’O_WELLFORMED’* <fcntl.h>
’O_SFS_DEFER_TM’* <fcntl.h>

’S_ALF_NOGROW’* <sys/stat.h>
’S_ALF_PARTR’* <sys/stat.h>

’SEEK_SET’ <stdio.h>
’SEEK_CUR’ <stdio.h>
’SEEK_END’ <stdio.h>

’STDIN_FILENO’ POSIX.9
’STDOUT_FILENO’ Posix.9
’STDERR_FILENO’ Posix.9
* = UNICOS and UNICOS/mk systems only
Posix.9 specific errors:
’ENONAME’ liberrno.h
’ENOHANDLE’ liberrno.h
Errnos 1– 98 from <errno.h>, for example: ’EPERM’
Cray implementation errors:
EBADID If the idirid argument is an invalid directory ID
EBADHANDLE If the handle is invalid
Additional values for constname are described in descriptions of other PXF routines such as
PXFACCESS, PXFCHMOD, PXFCREAT, PXFOPEN, and so on.
ival An output integer variable. The value associated with the constant.
ierror An output integer variable. It contains the exit status.

EXIT STATUS
Upon successful completion, the argument ierror is set to 0. If any of the following conditions occur,
PXFCONST() sets ierror to the corresponding value.
ENONAME Invalid constant name
ENOMEM PXFCONST() could not allocate the memory required

004– 2165– 002 197


PXFCONST ( 3F ) PXFCONST ( 3F )

SEE ALSO
PXFACCESS(3F), PXFCHMOD(3F), PXFCREAT(3F)

198 004– 2165– 002


PXFCREAT ( 3F ) PXFCREAT ( 3F )

NAME
PXFCREAT – Creates a new file or rewrites an existing file

SYNOPSIS
CHARACTER*n path
INTEGER ilen, imode, ifildes, ierror
CALL PXFCREAT(path, ilen, imode, ifildes, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFCREAT subroutine uses the creat(2) system call to create a new file or rewrite an existing file.
The call is similar to PXFOPEN with an iopenflag argument of O_WRONLY, O_CREAT, and O_TRUNC.
The value of imode indicates specific file modes. If the file exists, imode is ignored. The mode values are
used when path is a new file.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this subroutine:
path An input character variable or array element containing the name of a file.
ilen An input integer variable containing the length of path in characters. If ilen is zero, all trailing
blanks are removed before calling creat().
imode An input integer variable containing the integer value of the symbolic constant for one or more
of the following file modes:
USER READ permissions bit: S_IRUSR
WRITE permissions bit: S_IWUSR
SEARCH/EXECUTE permissions bit: S_IXUSR
Inclusive OR of READ/WRITE/EXECUTE: S_IRWXU

004– 2165– 002 199


PXFCREAT ( 3F ) PXFCREAT ( 3F )

GROUP READ permissions bit: S_IRGRP


WRITE permissions bit: S_IWGRP
SEARCH/EXECUTE permissions bit: S_IXGRP
Inclusive OR of READ/WRITE/EXECUTE: S_IRWXG
OTHER READ permissions bit: S_IROTH
WRITE permissions bit: S_IWOTH
SEARCH/EXECUTE permissions bit: S_IXOTH
Inclusive OR of READ/WRITE/EXECUTE: S_IRWXO
SETID Set user ID on execution: S_ISUID
Set group ID on execution: S_ISGID
An integer value for each of these symbolic constants is retrieved through the use of PXFCONST
or IPXFCONST. The integer values may be combined through the use of a bitwise inclusive OR
function.
ifildes An output integer variable containing the file descriptor returned by creat().
ierror An output integer variable that contains zero if the file is created or rewritten or nonzero if
PXFCREAT is not successful.
In addition to the errors returned by the creat(2) system call, PXFCREAT may return the following errors:
EINVAL If ilen < 0 or ilen > LEN(path)
ENOMEM If PXFCREAT is unable to obtain memory to copy path

EXAMPLES

200 004– 2165– 002


PXFCREAT ( 3F ) PXFCREAT ( 3F )

progra m tes t
charac ter *(12) path
intege r ilen, imo d, ifi lde , ier r
int ege r imo dru , imo dwu , imo dwg, imodrg
int eger ierr1, ier r2, ier r3, ier r4
pat h = ’te stfile ’
imo d = 0
ile n = 0
cal l pxf const( ’S_IRU SR’ ,im odru,i err 1)
cal l pxf const( ’S_IWU SR’ ,im odwu,i err 2)
cal l pxf const( ’S_IRG RP’ ,im odrg,i err 3)
cal l pxf const( ’S_IWG RP’ ,im odwg,i err 4)
imod = IOR ((IOR( imodru ,im odw u)),(I OR( imo drg ,im odw g)) )
cal l pxf creat( path,i len ,imod, ifi lde ,ie rr)
if (ierr. ne.0) the n
print *,’FAI L: error fro m pxf cre at = ’,i err
els e
print *,’PAS S: No err or fro m pxf cre at = ’
end if
end

SEE ALSO
creat(2), PXFCONST(3F)

004– 2165– 002 201


PXFCTERMID ( 3F ) PXFCTERMID ( 3F )

NAME
PXFCTERMID – Generates terminal pathname

SYNOPSIS
SUBROUTINE PXFCTERMID (s, ilen, ierror)
CHARACTER*n s
INTEGER ilen, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFCTERMID subroutine uses the ctermid function to generate a string which is the pathname for the
current process’ controlling terminal. If the pathname for the controlling terminal cannot be determined, the
ilen variable is set to zero.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this subroutine:
s An output character array or character element variable for the pathname for the current process’
controlling terminal. The maximum length of s is defined by the L_ctermid constant found in
<stdio.h>.
ilen An output interger variable for the length of s.
ierror An output integer variable for the completion status of PXFCTERMID. ierror may contain zero if
PXFCTERMID was successful or nonzero if PXFCTERMID was not successful.
PXFCTERMID may return the ETRUNC error value if the output variable s cannot contain the pathname for
the current process’ controlling terminal, causing the pathname to be truncated.

202 004– 2165– 002


PXFCTERMID ( 3F ) PXFCTERMID ( 3F )

EXAMPLES

progra m pxf tes t


intege r ile n, ier ror
cha racter *20 s

CALL PXFCTE RMI D(s ,il en,ier ror )


print *,’con tro lli ng ter min al is ’,s
end

SEE ALSO
ctermid(3S) on IRIX systems
ctermid(3C) on UNICOS and UNICOS/mk systems

004– 2165– 002 203


PXFDIRECTORY ( 3F ) PXFDIRECTORY ( 3F )

NAME
PXFOPENDIR, PXFREADDIR, PXFREWINDDIR, PXFCLOSEDIR, – Performs directory operations

SYNOPSIS
SUBROUTINE PXFOPENDIR (dirname, lendirname, iopendirid, ierror)
CHARACTER*n dirname
INTEGER lendirname, iopendir, ierror
SUBROUTINE PXFREADDIR (idirid, jdirent, ierror)
INTEGER idirid, jdirent, ierror
SUBROUTINE PXFREWINDDIR (idirid, ierror)
INTEGER idirid, ierror
SUBROUTINE PXFCLOSEDIR (idirid, ierror)
INTEGER idirid, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFOPENDIR subroutine uses the opendir(3C) routine to open a directory stream for the directory
dirname and positions the stream at the first directory entry.
The PXFREADDIR subroutine uses the readdir(3C) function to read a directory stream for the next entry
in the directory stream.
The PXFREWINDDIR subroutine uses the rewinddir(3C) function to reset the position in the directory
stream to the first entry of a directory stream while updating the directory stream to the current state of the
directory, as a call to PXFOPENDIR would do.
The PXFCLOSEDIR subroutine uses the closedir(3C) function to close the directory stream referenced
by idirid. Upon sucessful completion, idirid is undefined and the result of subsequent calls to
PXFCLOSEDIR with idirid is not well defined.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.

204 004– 2165– 002


PXFDIRECTORY ( 3F ) PXFDIRECTORY ( 3F )

The following is a list of valid arguments for these subroutines:


dirname An input character array variable containing the path for the directory to be opened.
lendirname An input integer variable containing the length of dirname.
iopendirid An output integer variable for the unique directory ID.
ierror An output integer variable that contains zero if the operation was successful or nonzero if the
operation was not successful.
The iopendirid argument becomes the unique directory ID (idirid) that is used by PXFREADDIR,
PXFREWINDDIR, and PXFCLOSEDIR.
idirid An input integer variable for the unique directory ID generated by PXFOPENDIR.
jdirent An output structure handle created by PXFSTRUCTCREATE(3F) that contains one directory entry.
• The PXFOPENDIR subroutine may return any of the following error values:
EACCES If a component of dirname denies search permission.
ENAMETOOLONG
If the length of the dirname argument exceeds PATH_MAX found in <limits.h> (IRIX
systems only).
ENOENT If the directory in the dirname argument does not exist.
ENOTDIR If a component of dirname is not a directory.
EINVAL If lendirname < 0 or lendirname > LEN(dirname).
ENOMEM If memory needed by PXFOPENDIR could not be allocated.
EMFILE If too many file descriptors are currently open for the process.
ENFILE If too many file descriptors are currently open for the system (IRIX systems only).
• The PXFREADDIR subroutine may return any of the following error values:
EBADF If, when detected, an invalid, unique directory stream ID was used for idirid.
EEND If the end of the directory stream has been reached.
ENOMEM If data structures need for successful completion of PXFREADIR cannot be allocated.
ENOENT If the current file pointer for the directory stream is not located at a valid directory entry.
EDIRCORRUPTED
If the directory on disk is corrupt (IRIX systems only).
EBADID If idirid is an invalid directory identifier (UNICOS and UNICOS/mk systems only).
EBADHANDLE
If jdirent is an invalid handle or has an incorrect handle type (UNICOS and UNICOS/mk
systems only).
• The PXFCLOSEDIR subroutine may return the following error value:

004– 2165– 002 205


PXFDIRECTORY ( 3F ) PXFDIRECTORY ( 3F )

EBADF If, when detected, an invalid, unique directory stream ID was used for idirid.

EXAMPLES
In this example, the /dev/dsk directory is opened, the directory entries are read and printed, the directory
is rewound and the contents are redisplayed, and then the directory is closed.
progra m pxf test
intege r ier ror
intege r (KI ND= 8) jdi ren t,i dirid

CALL PXFSTR UCT CREATE (’d ire nt’,jd irent, ierror )


CALL PXFOPE NDI R(’/de v/d sk’ ,0,idi rid,ie rror)
call pri ntdir(idi rid ,jd ire nt)
CALL PXFREW IND DIR(id iri d,ierr or)
call pri ntdir(idi rid ,jd ire nt)
CALL PXFCLO SED IR(idi rid ,ie rror)
end

subrou tin e pri ntdir( idi rid,jd irent)


intege r ier ror, ilen, EEND
intege r (KI ND= 8) jdi ren t, idirid
character *30 nam e

CALL PXFCON ST( ’EEND’ ,EE ND,ier ror)


do while ((i error .ne . EEND) .and. (ierro r .eq . 0))
CAL L PXF READDI R(i dirid, jdiren t,ierr or)
CAL L PXF STRGET (jd irent, ’d_nam e’,nam e,ilen ,ierro r)
if (ie rror .eq . 0) pri nt *,n ame
enddo
end

SEE ALSO
directory(3C)

206 004– 2165– 002


PXFESTRGET ( 3F ) PXFESTRGET ( 3F )

NAME
PXFESTRGET – Accesses a single string element of a structure component that is an array

SYNOPSIS
SUBROUTINE PXFESTRGET (jhandle, compnam, index, value, ilen, ierror)
INTEGER jhandle, index, ilen, ierror
CHARACTER*n compnam, value

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFESTRGET routine returns a string contained in a single element of a structure component that is an
array.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this subroutine:
jhandle An input handle variable created with PXFSTRUCTCREATE(3F).
compnam An input character variable or array element containing the desired structure component name.
index An input integer variable for the desired index in the array.
value An output character variable or array element that will contain the string referenced by
companm, index, and jhandle.
ilen An output integer variable for the length of the returned character string.
ierror An output integer variable that contains zero if PXFESTRGET was successful or nonzero if
PXFESTRGET was not successful.
The PXFESTRGET subroutine may return any of the following error values:
ENONAME If the component name is not defined for this structure.

004– 2165– 002 207


PXFESTRGET ( 3F ) PXFESTRGET ( 3F )

ETRUNC If the declared length of the character argument is insufficient to contain the string to be
returned.
ENOMEM If there is insufficent memory to create data structures needed by the routine.
EBADHANDLE
If jhandle is an invalid handle or has an incorrect handle type (UNICOS and UNICOS/mk
systems only).

EXAMPLES
In this example, PXFGETGRGID(3F) and PXFGETGID(3F) are used to obtain the first user name in the
current process’ group.
pro gra m pxf tes t
int ege r igi d, ier ror , jgr oup , len , ima x, i
cha rac ter *30 log inn ame
CAL L PXF STR UCT CRE ATE (’g rou p’, jgr oup ,ie rro r)
if (ie rro r .ne . 0) the n
pri nt *,’ FAI LED : PXF STR UCT CRE ATE wit h err or = ’,i err or
els e
CAL L PXF GET GID (ig id, ier ror )
CAL L PXF GET GRG ID( igi d,j gro up, ier ror )
if (ie rro r .ne . 0) the n
pri nt *,’ FAI LED : PXF GET GRG ID wit h err or = ’,i err or
els e
CAL L PXF INT GET (jg rou p,’ gr_ nme m’, ima x,i err or)
if (ie rro r .ne . 0) the n
pri nt *,’ FAI LED : PXF INT GET wit h err or = ’,i err or
els e
if (im ax .gt . 0) the n
do i = 1,i max
CAL L PXF EST RGE T(j gro up, ’gr _me m’, i,l ogi nna me, len ,ie rro r)
pri nt *,l ogi nna me
end do
els e
pri nt *,’ FAI LED : Cou ld not tes t PXF EST RGE T’
end if
end if
end if
end if
end

SEE ALSO
PXFSTRUCTCREATE(3F)

208 004– 2165– 002


PXFEXECV ( 3F ) PXFEXECV ( 3F )

NAME
PXFEXECV, PXFEXECVE, PXFEXECVP – Executes a new process image file

SYNOPSIS
SUBROUTINE PXFEXECV (path, lenpath, argv, lenargv, iargc, ierror)
INTEGER lenpath, lenargv(0:iargc-1), iargc, ierror
CHARACTER*n path, argv(0:iargc-1)
SUBROUTINE PXFEXECVE (path, lenpath, argv, lenargv, iargc, env, lenenv, ienvc, ierror)
INTEGER lenpath, lenargv(0:iargc-1), iargc, lenargv, ienvc, ierror
CHARACTER*n path, argv(0:iargc-1) env(ienvc)
SUBROUTINE PXFEXECVP (file, lenfile, argv, lenargv, iargc, ierror)
INTEGER lenfile, lenargv(0:iargc-1), iargc, ierror
CHARACTER*n file, argv(0:iargc-1)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFEXECV routine uses the execv(2) system call to replace the current process image with a new
process image.
The PXFEXECVE routine uses the execve(2) system call to replace the current process image with a new
process image. The environment variables are not inherited from the calling process image. The
environment variables for the new process image are specified by the env argument.
The PXFEXECVP routine uses the execvp(2) system call to replace the current process image with a new
process image.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of arguments for these routines:
path An input character variable or array element containing the pathname of the new process image
file.
lenpath An input integer variable for the length of path. If lenpath is zero, trailing blanks are removed.

004– 2165– 002 209


PXFEXECV ( 3F ) PXFEXECV ( 3F )

file An input character variable or array element containing the file of the new process image file. If
file contains a slash character, file will be used as the pathname for the new process image file.
Otherwise, the directories listed in the PATH environment variable are searched using each
directory in path as a pathname prefix for file.
lenfile An input integer variable for the length of file. If lenfile is zero, trailing blanks are removed.
argv An input array of character strings. argv contains the arguments to be passed to the new process
image.
lenargv An input array of integers. Each element in lenargv contains the length of the corresponding
character string in argv. If an element in lenargv is zero, the corresponding element in argv has
all trailing blanks stripped.
iargc An input integer variable. iargc contains the number of arguments to pass to the new process
image.
env An input array of character strings. env contains the environment variables for the new process
image.
lenenv An input array of integers. Each element in lenenv contains the length of the corresponding
character string in env. If an element in lenenv is zero, the corresponding element in env will
have all trailing blanks stripped.
ienvc An input integer variable. ienvc contains the number of environment variables for the new
process image.
ierror An output integer variable that contains zero if the routine was successful or nonzero if the
routine was not successful.
The following values may be returned:
EACCES If the new process file is not a regular file, the new process image file mode denies execution
permission, or search permission is denied for a directory listed in the new process image
file’s path prefix.
ENOENT If one or more components of the new process image file’s path name do not exist.
ENOEXEC If the new process image file has the appropriate access permission but an invalid magic
number in its header.
ENOMEM If the memory needed to create structures used by the routine could not be allocated.
EINVAL If lenpath < 0 or lenpath > LEN(path) or any element of lenargv is less than zero or greater
than the length of the corresponding element in argv.

UNICOS and UNICOS/mk only errors:


E2BIG If the number of bytes in argv is greater than the system-imposed limit of ARG_MAX found in
<limits.h>.

210 004– 2165– 002


PXFEXECV ( 3F ) PXFEXECV ( 3F )

EDMOFF If the process image file is offline, and the data migration facility is not configured in the
system.
EFAULT If the new process image file is not as long as indicated by the size values in its header.
ENOMEM If the new process requires more memory than is allowed by the system-imposed maximum
MAXMEM.
EOFFLIN If the process image file is offline, and automatic file retrieval is disabled.
EOFLNDD If the file is offline, and the data management daemon is not currently executing.
EOFLNNR If the file is offline, and it is currently unretrievable.

IRIX 6.2 only errors:


E2BIG If the number of bytes in the new process’s argument list is greater than the system-imposed
limit ARG_MAX (see sysconf(2), intro(2), and limits.h). The argument list limit is
the sum of the size of the argument list plus the size of the environment’s exported shell
variables.
E2BIG If the number of bytes in the first line of an interpreter file is greater than 256 bytes.
EAGAIN If there is not enough memory.
ELIBACC If the required shared library does not have execute permission.
ELIBEXEC If path points to a shared library.
ELIBMAX If the required number of shared libraries exceeds the system imposed maximum SHLIB_MAX
(see intro(2)).
ELOOP If too many symbolic links were encountered in translating path.
ENAMETOOLONG
If the length of path exceeds PATH_MAX found in <limits.h>, or the length of a path
component exceeds NAME_MAX found in <limits.h> while POSIX_NO_TRUNC is in
effect.
ENOEXEC If the executable process image file has badly formed header information or the requested
virtual addresses are not available.
ENOMEM If the new process image requires more virtual space than is allowed either by the system-
imposed maximum or the process imposed maximum PROCSIZE_MAX (see getrlimit(2)
and intro(2)).
EPERM If a non-superuser tries to execute a setuid file that belongs to some other user and the file
system in which the file resides has been mounted with the nosuid option (see fstab(4)),
or if a non-superuser attempts to execute a setuid or setgid shell script with a UID or GID that
is different than the user’s effective UID/GID, and the configured value for
no–suid–shells is non-zero (the default) (see intro(2) and lboot(1M)).

004– 2165– 002 211


PXFEXECV ( 3F ) PXFEXECV ( 3F )

EXAMPLES

PXFEXECV example:
In this example, the program forks and the child calls PXFEXECV to execute the /bin/grep process image
file. The parent process waits for the child to finish executing and then forks again. The child from the
second fork also calls PXFEXECV to execute the /bin/grep process image file. The parent then waits for
the child to finish executing.
pro gram test
int eger ipid, ier ror , len pat h, len arg v(3 ), iar gc, ire tpi d
int eger istat
charac ter*30 pat h, arg v(3 )

path = ’/b in/gre p’


lenpat h = 0
iargc = 3
argv(1 ) = ’grep’
len argv(1 ) = 0
argv(2 ) = ’root’
len argv(2 ) = 0
argv(3 ) = ’/etc/ pas swd ’
len argv(3 ) = 0

CAL L PXF FORK(i pid ,ie rro r)


if (ierro r .ne . 0) the n
print *,’FAI LED : PXF FOR K cal l wit h err or = ’,i err or
els e
if (ip id .eq . 0) the n
pri nt *,’ CHI LD1 : exe cin g gre p’
CAL L PXF EXE CV( pat h, len pat h, arg v, len arg v, iar gc, ier ror )
pri nt *,’ FAI LED : PXF EXE C cal l wit h err or = ’,i err or
sto p
else
pri nt *,’ PAR ENT : wai tin g for CHI LD1 ’
CAL L PXF WAI T(i sta t,i ret pid ,ie rro r)
pri nt *,’ PAR ENT : CHI LD1 fin ish ed. For kin g off CHI LD2 ’
CAL L PXF FOR K(i pid , ier ror )
if (ipid .eq . 0) the n
print *,’ CHI LD2 : exe cin g gre p’
CALL PXF EXE CV( pat h, len pat h, arg v, len arg v, iar gc, ier ror)
print *,’ FAI LED PXF EXE C cal l wit h err or = ’,i err or
stop
els e

212 004– 2165– 002


PXFEXECV ( 3F ) PXFEXECV ( 3F )

pri nt *,’ PAR ENT : wai tin g for CHI LD2 ’


CAL L PXF WAI T(i stat,i ret pid,ie rro r)
pri nt *,’ PAR ENT: CHILD2 fin ish ed. ’
pri nt *,’ PASSED : PXF EXECV nor mal tes t’
end if
end if
end if
end

PXFEXECVE example:
In this example, the program forks and the child calls PXFEXECVE to execute the /bin/grep process
image file. The parent process waits for the child to finish executing and then forks again. The child from the
second fork also calls PXFEXECVE to execute the /bin/grep process image file. The parent then waits for
the child to finish executing.
int eger ipi d, ier ror , len path, len arg v(3), iar gc, ire tpi d
int ege r ist at, err orc ond ition, len env(3) , ien vc
cha racter *30 pat h, arg v(3 )
cha rac ter *30 env (3)

pat h = ’/b in/ gre p’


len pat h = 0
iar gc = 3
arg v(1 ) = ’gr ep’
len arg v(1 ) = 0
arg v(2 ) = ’ro ot’
len arg v(2 ) = 0
arg v(3 ) = ’/e tc/ pas swd ’
len arg v(3 ) = 0
ien vc = 3
env (1) = ’TE RM= vt1 00’
len env(1) = 0
env (2) = ’SH ELL =/b in/ csh’
len env(2) = 0
env (3) = ’DI SPL AY= :0. 0’
len env(3) = 0

CAL L PXF FOR K(i pid ,ie rro r)


if (ie rro r .ne . 0) the n
print *,’ FAI LED : PXFFOR K cal l wit h err or = ’,i err or
els e
if (ip id .eq . 0) the n
pri nt *,’ CHI LD1 : exe cing grep’
CAL L PXF EXE CV( pat h, len path, arg v, len argv, iar gc, ier ror )

004– 2165– 002 213


PXFEXECV ( 3F ) PXFEXECV ( 3F )

pri nt *,’FAI LED : PXF EXEC call with error = ’,i err or
sto p
els e
pri nt *,’ PAR ENT : wai tin g for CHILD1 ’
CAL L PXFWAI T(i sta t,i retpid ,ierro r)
pri nt *,’PAR ENT : CHILD1 fin ish ed. For kin g off CHI LD2 ’
CAL L PXF FOR K(i pid , ier ror )
if (ip id .eq . 0) the n
pri nt *,’ CHI LD2 : execin g gre p’
CAL L PXF EXE CV( path, lenpat h, arg v, len argv, iar gc, ier ror )
pri nt *,’ FAI LED PXFEXE C cal l wit h err or = ’,i err or
sto p
els e
pri nt *,’ PAR ENT : wai tin g for CHILD2 ’
CAL L PXF WAI T(i stat,i retpid ,ierro r)
pri nt *,’ PAR ENT : CHI LD2 fin ished. ’
pri nt *,’ PAS SED : PXF EXE CVP nor mal tes t’
end if
end if
end if
end

PXFEXECVP example:
In this example, the program forks and the child calls PXFEXECVP to execute the grep process image file.
The parent process waits for the child to finish executing and then forks again. The child from the second
fork also calls PXFEXECVP to execute the grep process image file. The parent then waits for the child to
finish executing.
pro gra m tes t
int ege r ipi d, ier ror , len fil e, len arg v(3), iar gc, ire tpi d
int ege r ist at
cha rac ter *30 fil e, arg v(3 )

fil e = ’gr ep’


len fil e = 0
iar gc = 3
arg v(1 ) = ’gr ep’
len arg v(1 ) = 0
arg v(2 ) = ’ro ot’
len arg v(2 ) = 0
arg v(3 ) = ’/e tc/ pas swd ’
len arg v(3 ) = 0

214 004– 2165– 002


PXFEXECV ( 3F ) PXFEXECV ( 3F )

CAL L PXF FOR K(ipid ,ierro r)


if (ierror .ne. 0) the n
print *,’ FAILED : PXFFOR K cal l wit h err or = ’,i err or
els e
if (ipid .eq . 0) then
print *,’ CHILD1 : execin g grep’
CAL L PXF EXECVP(fi le, len fil e, arg v, len arg v, iar gc, ier ror)
pri nt *,’FAI LED: PXF EXE C cal l wit h err or = ’,i err or
sto p
else
print *,’ PAR ENT: wai tin g for CHI LD1’
CALL PXFWAIT(i sta t,i ret pid,ie rro r)
print *,’ PAR ENT: CHI LD1 fin ished. For king off CHI LD2 ’
CALL PXFFORK(i pid , ier ror )
if (ipid .eq . 0) the n
print *,’ CHILD2 : exe cing grep’
CAL L PXF EXE CVP (file, len file, arg v, len argv, iargc, ierror)
print *,’FAI LED PXF EXE C cal l wit h err or = ’,i err or
stop
els e
pri nt *,’ PARENT : wai tin g for CHILD2 ’
CAL L PXF WAIT(i sta t,i ret pid,ie rro r)
print *,’ PARENT : CHILD2 finish ed. ’
print *,’ PASSED : PXF EXECVP nor mal test’
endif
end if
end if
end

SEE ALSO
execv(2)

004– 2165– 002 215


PXFFCNTL ( 3F ) PXFFCNTL ( 3F )

NAME
PXFFCNTL – Provides a subset of fcntl(2) functionality, except the third argument is always an integer

SYNOPSIS
INTEGER ifildes, icmd, iargin, iargout, ierror
CALL PXFFCNTL (ifildes, icmd, iargin, iargout, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFFNCTL() subroutine provides a subset of the functionality of fcntl(2), except that the third
argument is always an integer.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The arguments for PXFFNCTL() are:
ifildes An open file descriptor. ifildes is an input integer variable.
icmd An input integer variable. Specifies the action for fcntl to perform, as described on the
fcntl(2) man page. The constant values for use in specifying icmd are available through calls
to PXFCONST(3F). The following values are currently supported for icmd:
F_CLRA LF*
F_DUPF D
F_GETF D
F_GETF L
F_GETL K
F_SETA LF*
F_SETF D
F_SETF L
F_SETS B*
F_SETL K
F_SETL KW

216 004– 2165– 002


PXFFCNTL ( 3F ) PXFFCNTL ( 3F )

* = UNICOS and UNICOS/mk systems only


iargin An input integer variable. As described below, iargin may also be an output variable. iargin
can be a handle for an instance of the flock structure or an integer, depending on the argument
icmd under the conditions defined in POSIX.1.
If icmd is F_GETLK, F_SETLK, or F_SETLKW, then iargin is a handle for an instance of the
flock structure. This handle should be created by a call to the PXFSTRUCTCREATE()
subroutine, with the string flock given as the STRUCTNAME argument. The components are then
accessed with the subroutines PXFINTSET() and PXFINTGET(), as shown following:
Components for flock structure:

Posix.1 component COMPNAM Structure procedures used to access

l_type l_type PXFINTGET, PXFINTSET


l_whence l_whence PXFINTGET, PXFINTSET
l_start l_start PXFINTGET, PXFINTSET
l_len l_len PXFINTGET, PXFINTSET
l_pid l_pid PXFINTGET, PXFINTSET

If icmd is F_GETLK, the retrieved information overwrites the information described in the
handle used as the iargin argument.
iargout An output integer variable. The value returned in iargout depends on the icmd argument. See
fcntl() for more information.
ierror An output integer variable. It contains the exit status.

EXIT STATUS
Upon successful completion of PXFFCNTL(), the argument ierror is set to 0. If any of the following
conditions occur, ierror is set to the corresponding value:
EINVAL icmd is not valid.
EINVAL icmd is F_GETLK, F_SETLK, or F_SETLKW and iargin is not a valid handle.
errno The fcntl(2) system call failed.
EBADHANDLE iargin, when icmd is F_GETLK, F_SETLK, or F_SETLKW, is an invalid handle or has an
incorrect handle type for this routine.

SEE ALSO
PXFCONST(3F), PXFSTRUCTCREATE(3F), PXFINTGET(3F), PXFINTSET(3F)

004– 2165– 002 217


PXFFILENO ( 3F ) PXFFILENO ( 3F )

NAME
PXFFILENO – Returns the file descriptor for a specified unit

SYNOPSIS
INTEGER IUNIT, IFILDES, IERROR
CALL PXFFILENO (iunit, ifildes, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION

This routine is supported on IRIX systems for programs compiled using the MIPSpro 7 Fortran 90 compiler
or compiled with the -craylibs option to the MIPSpro F77 compiler.
The PXFFILENO() subroutine returns in the ifildes argument the file descriptor to which the unit identified
by iunit is connected.
Processing of some Fortran file types includes library buffering or the addition of control words to the data
written. Users should be aware of this when attempting to make use of the file descriptor associated with a
Fortran unit. Some Fortran units may not be connected to a file descriptor. For example, a file assigned the
attributes -F mr.scr.novfl is not connected to a file descriptor.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of arguments to PXFFILENO:
iunit An input integer variable that contains the Fortran unit number.
ifildes An output integer variable containing the file descriptor of the file identified by iunit.
ierror An output integer variable containing the status.

RETURN VALUES
Upon successful completion of PXFFILENO(), ierror is set to 0. If any of the following conditions occur,
ierror is set to the corresponding value:
EINVAL iunit is not an open unit
EBADF iunit is not connected with a file descriptor

218 004– 2165– 002


PXFFORK ( 3F ) PXFFORK ( 3F )

NAME
PXFFORK – Creates a process

SYNOPSIS
SUBROUTINE PXFFORK (ipid, ierror)
INTEGER ipid, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFFORK routine uses the fork(2) system call to create a new process. The child process is the same
as the parent process except for the following:
• The child process has a unique, currently unused process ID.
• The child process has a different parent process ID. The child process’s process ID is the parent process,
or calling process, ID.
• The child process has its own copy of the parent’s file descriptors. Each of the child’s file descriptors
shares a common file pointer with the corresponding file descriptor of the parent process.
• Process locks are not inherited by the child process (see plock(2)).
• The utime, stime, cutime, and cstime of the child process are set to 0. The time left until an
alarm clock signal is reset to 0.
• All semadj values are cleared (see semop(2)).
• The parent’s set of pending signals are not inherited by the child.
UNICOS and UNICOS/mk systems only:
• Record locks set by the parent process are not inherited by the child process (see fcntl(2) and
lockf(3C)).
• In a multitasking group, only the process that executed the fork system call is copied.
• Each attached shared memory segment is attached and the value of shm_nattch in the data structure
associated with the shared memory segment is incremented by 1.
IRIX systems only:
• File locks previously set by the parent are not inherited by the child (see fcntl(2)).
• Page locks are not inherited (see mpin(2) on IRIX systems).

004– 2165– 002 219


PXFFORK ( 3F ) PXFFORK ( 3F )

• The time left until an itimer signal is reset to 0.


• The child will not inherit the ability to make graphics calls. The child process may receive a
segmentation fault upon attempting to make a graphics call, unless it initializes itself as a graphics
process via winopen() or ginit(). Currently, if the parent is a graphics process, the child’s attempt
to become a graphics process will fail.
• The share mask is set to 0 (see sproc(2)).
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of arguments for this routine:
ipid An output integer variable. ipid will be zero for the child process and the process ID of the child
for the parent process.
ierror An output integer variable that contains zero if PXFFORK was successful or nonzero if PXFFORK
was not successful.
The PXFFORK routine may return any of the following error values:
EAGAIN If the system-imposed limit on the total number of processes under execution in the whole
system (NPROC) is exceeded or if the system-imposed limit on the total number of processes
under execution by one user (CHILD_MAX) is exceeded.
UNICOS and UNICOS/mk systems only:
EBUSY If you attempt to enable accounting when it is already enabled, or if you issue a restart(2)
attempt when another job or process in the system is using the jid or any pid associated with the
job (or process) to be restarted.
EINTR If an asynchronous signal (such as interrupt or quit), which you have elected to catch, occurred
during a fork system call. When execution resumed after processing the signal, the interrupted
system call returned this error condition.
EMEMLIM If more memory space was requested than is allowed for the processes attached to this lnode.
The maximum value is set by the -c option of the shradmin(8) command. This error appears
only on systems running the fair-share scheduler.
ENOEXEC If a request was made to execute a file that, although it has the appropriate permissions, does not
start with a valid magic number (see a.out(5)).
ENOMEM If during an exec(2) or sbreak(2) system call, a program requested more space than the
system could supply. This is not a temporary condition; the maximum space specification is a
system parameter.

220 004– 2165– 002


PXFFORK ( 3F ) PXFFORK ( 3F )

EPROCLIM
If more processes were requested than are allowed for this lnode. The maximum value is set by
the -p option of the shradmin(8) command. This error appears only on systems running the
fair-share scheduler.
IRIX systems only:
EAGAIN If the amount of system memory required is temorarily unavailable.
ENOSPC If the caller is a member of a share group and the total number of share group members plus
child processes exceeds the maximum number of users specified by the usconfig(3P)
command (8 by default). Any changes made with usconfig (3P) must be done Ibeforethe first
sproc is formed.
ENOLCK There are not enough file locks in the system.

EXAMPLES

pro gra m pxf test


intege r ipi d, ierror

CALL PXFFOR K(i pid, ierror )


if (ip id .eq. 0) the n
print *,’ child’
else
print *,’ par ent’
end if
end

SEE ALSO
exec(2), fcntl(2), fork(2), plock(2), restart(2), semop(2), sproc(2), ssbreak(2)
shradmin(8)

004– 2165– 002 221


PXFGETARG ( 3F ) PXFGETARG ( 3F )

NAME
PXFGETARG – Returns a command-line argument

SYNOPSIS
CHARACTER*n buf
INTEGER m, ilen, ierror
CALL PXFGETARG(m, buf, ilen, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFGETARG subroutine examines the command line used to invoke the executing program and returns
the mth command-line argument in buf.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
This routine has the following arguments:
m An input integer variable or array element containing the number of the command-line argument to
return in buf. If m is zero, the command name is returned in buf.
buf An output character variable or array element containing the mth command-line argument.
ilen An output integer variable containing the significant length in characters of the string stored in buf.
If the length of the string is shorter than the length of buf, the shorter length is returned. If the
string is longer, the longer length of the string is returned.
ierror An output integer variable containing 0 if a value is returned in buf or containing the following:
EINVAL If m is out of range
ETRUNC if the declared length of buf is insufficient to contain the string to be returned. The
value of the command-line argument is truncated to fit in buf, and ilen is set to the full
length of the original string.

SEE ALSO
IPXFARGC(3F)

222 004– 2165– 002


PXFGETCWD ( 3F ) PXFGETCWD ( 3F )

NAME
PXFGETCWD – Gets the pathname of the working directory

SYNOPSIS
SUBROUTINE PXFGETCWD (buf, ilen, ierror)
CHARACTER*n buf
INTEGER ilen, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFGETCWD subroutine uses the getcwd() function to get the current working directory.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this subroutine:
buf An output character variable or array element for the current working directory. The longest
pathname cannot be longer than PATH_MAX for the UNICOS operating system, or
MAXPATHLEN for IRIX systems as defined in <sys/param.h>.
ilen An output integer variable containing the character length of buf.
ierror An output integer variable that contains zero if the working directory path was successfully
copied into buf or nonzero if PXFGETCWD was not successful.
The PXFGETCWD subroutine may return any of the following error values:
ETRUNC If the length of buf is less than the complete path length.
EACCESS If read or search permission for any component of the current working directory path was
denied.

004– 2165– 002 223


PXFGETCWD ( 3F ) PXFGETCWD ( 3F )

EXAMPLES
In this example, PXFGETCWD will be called with a large buffer, which should not cause any errors, and then
with a very small buffer, which should cause an error.
pro gram pxftes t
cha racter *1024 pat h
charac ter*10 too sma llb uff
int eger pathle n, ier r

CAL L PXF GETCWD (pa th, pat hle n, ier r)


pri nt *,’ path = ’,p ath ,’ - ier r = ’,i err
CAL L PXF GETCWD (to osm all buf f, pat hle n, ier r)
pri nt *,’ toosma llb uff = ’,t oos mal lbu f,’ - ier r = ’,i err
end

SEE ALSO
getcwd(3C)

224 004– 2165– 002


PXFGETEGID ( 3F ) PXFGETEGID ( 3F )

NAME
PXFGETEGID – Gets the effective group ID

SYNOPSIS
SUBROUTINE PXFGETEGID (iegid, ierror)
INTEGER iegid, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFGETEGID subroutine uses the getegid() function to get the effective group ID.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX, all
arguments must be of default kind unless documented otherwise. On UNICOS and UNICOS/mk, default
kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default kind is KIND=4.
The following is a list of valid arguments for this routine:
iegid An output integer variable for the effective group ID for the current process.
ierror An output integer variable that contains zero if PXFGETEGID was successful.

EXAMPLES
This example calls PXFGETEGID and prints out the current effective group ID and the returned error.
progra m pxf tes t
intege r ieg id, ier r

CALL PXFGET EGI D(i egi d,i err )


print *,’ieg id = ’,i egi d,’ ier r = ’,i err
end

004– 2165– 002 225


PXFGETENV ( 3F ) PXFGETENV ( 3F )

NAME
PXFGETENV – Returns a value for the environment name

SYNOPSIS
SUBROUTINE PXFGETENV (name, lenname, value, lenval, ierror)
CHARACTER*n name, value
INTEGER lenname, lenval, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFGETENV subroutine uses the getenv() function to search the environment list for a name in a
string of the form name=value.
If name matches a name in the list, the character representation of value is stored in the value character
argument and the number of characters in value is stored in lenval. If the length of the value to be placed in
value is larger than the declared length of value, the value string is truncated on the right and stored in
value. The nontruncated length is stored in lenval and ierror is set to etrunc. If the length of the value is
shorter than the declared size of value, the value string is stored with left justification and filled with blanks
on the right. lenval is set to the shorter length of the value string.
If name is found but has no value, blanks are stored in value and lenval is set to zero. If name cannot be
found, EINVAL is returned in ierror.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this routine:
name An input character variable or array element containing the name of an environment variable.
lenname An input integer variable containing the length of name in characters. If lenname is zero, the
trailing blanks are removed. The declared length of the input name is decremented by the
number of blanks removed. If lenname is zero and name is all blanks, the input name is a null
string.
value An output character variable or array element containing the value of the environment variable
name.

226 004– 2165– 002


PXFGETENV ( 3F ) PXFGETENV ( 3F )

lenval An output integer variable containing the length of value in characters. If name is found but has
no value, lenval is zero and value contains all blanks to indicate a null string. If the value
representation is truncated to be stored in value, lenval contains the nontruncated length of value.
If the value representation is shorter than the length of value, lenval contains the shorter length.
ierror An output integer variable containing the status:
EINVAL If name is not in the environment list.
ETRUNC If the declared length of value is insufficient to contain the string to be returned.
The value of name is truncated to fit in value, and lenval contains the original length
of the value of name before truncation.
Zero getenv is successful (if name is found).

EXAMPLES
In this example, PXFGETENV searches for a string containing SHELL=value.
pro gram testpx f
character *24 namea, nam eb
int eger lena, len b, ier
c set input arg uments
ier = 0
len a=0
len b=0
namea= ’SH ELL’
nameb= ’ ’
CALL PXFGET ENV (namea , len a, nam eb, lenb, ier)
print *,’ TEST result s:’
c print inp ut argume nts
pri nt *,’nam ea= -’, nam ea, ’-’
print *,’ lena=’ ,le na
c print out put arg ume nts
pri nt *,’nam eb= -’, nam eb, ’-’
print *,’ lenb=’ ,lenb
print *,’ ier=’, ier
end

If the string is found, it may return:


TEST result s:
namea=-SH ELL
lena=0
nam eb=-/bin/ csh
len b=8
ier =0

004– 2165– 002 227


PXFGETENV ( 3F ) PXFGETENV ( 3F )

SEE ALSO
getenv(3C)

228 004– 2165– 002


PXFGETEUID ( 3F ) PXFGETEUID ( 3F )

NAME
PXFGETEUID – Gets effective user ID

SYNOPSIS
SUBROUTINE PXFGETEUID (ieuid, ierror)
INTEGER ieuid, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFGETEUID subroutine uses the geteuid() system call to get the effective user ID.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX, all
arguments must be of default kind unless documented otherwise. On UNICOS and UNICOS/mk, default
kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default kind is KIND=4.
The following is a list of valid arguments for this routine:
ieuid An output integer variable for the effective user ID for the current process.
ierror An output integer variable that contains zero if PXFGETEUID was successful.

EXAMPLES
This example calls PXFGETEUID and prints out the current effective user ID and the returned error.
progra m pxf tes t
intege r ieu id, ier r

CALL PXFGET EUI D(i eui d,i err )


print *,’ieu id = ’,i eui d,’ ier r = ’,i err
end

004– 2165– 002 229


PXFGETGID ( 3F ) PXFGETGID ( 3F )

NAME
PXFGETGID – Gets the real group ID

SYNOPSIS
SUBROUTINE PXFGETGID (igid, ierror)
INTEGER igid, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFGETGID subroutine uses the getgid() system call to get the real group ID.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX, all
arguments must be of default kind unless documented otherwise. On UNICOS and UNICOS/mk, default
kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default kind is KIND=4.
The following is a list of valid arguments for this routine:
igid An output integer variable for the real group ID for the current process.
ierror An output integer variable that contains zero if PXFGETGID was successful.

EXAMPLES
This example calls PXFGETGID and prints out the current real group ID and the returned error.
pro gram pxftes t
int eger igid, ier r
CAL L PXF GETGID (ig id, ier r)
pri nt *,’ igid = ’,i gid ,’ ier r = ’,i err
end

230 004– 2165– 002


PXFGETGRGID ( 3F ) PXFGETGRGID ( 3F )

NAME
PXFGETGRGID – Gets group information using the group ID

SYNOPSIS
SUBROUTINE PXFGETGRGID (igid, jgroup, ierror)
INTEGER igid, jgroup, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFGETGRGID routine uses the getgrgid(3C) function to obtain group information using a group
ID.
The following are components of the group structure used by PXFGETGRGID and created by calling
PXFSTRUCTCREATE:
• gr_name: Group name
• gr_gid: Group ID
• gr_nmem: Number of group members contained in gr_mem
• gr_mem: Array of group members’ login names
The gr_name component can be accessed by calling PXFSTRGET(3F). gr_gid and gr_nmem can be
accessed by calling PXFINTGET(3F). PXFESTRGET can be used to access the elements of gr_mem.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this routine:
igid An input integer variable containing the group ID, for which group information is requested.
jgroup An output handle of type group created with PXFSTRUCTCREATE(3F).
ierror An output integer variable that contains zero if group information was retrieved or nonzero if
PXFGETGRGID was not successful.

004– 2165– 002 231


PXFGETGRGID ( 3F ) PXFGETGRGID ( 3F )

The PXFGETGRGID routine may also return any of the following error values:
ENOENT If igid contains an non-existant group ID.
ENOMEM If memory needed by PXFGETGRGID could not be allocated.
EBADHANDLE
If jgroup is an invalid handle or has an incorrect handle type (UNICOS and UNICOS/mk
systems only).

EXAMPLES
In this example, PXFGETGRGID is called for information about the group with ID = 0.
program pxftes t
integer jgroup
integer ierror,il en
charac ter*16 name

CALL PXF GETGRGID( 0,j gro up, ier ror )


CALL PXFSTR GET (jgrou p,’ gr_nam e’,nam e,ilen ,ierro r)
print *,’gro up name for the gro up wit h ID= 0 is ’,name

end

232 004– 2165– 002


PXFGETGRNAM ( 3F ) PXFGETGRNAM ( 3F )

NAME
PXFGETGRNAM – Gets group information using the group name

SYNOPSIS
SUBROUTINE PXFGETGRNAM (name, ilen, jgroup, ierror)
CHARACTER*n name
INTEGER ilen, jgroup, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFGETGRNAM routine uses the getgrnam(3C) function to obtain group information using a group
name.
The following are components of the group structure used by PXFGETGRNAM and created by calling
PXFSTRUCTCREATE:
• gr_name: Group name
• gr_gid: Group ID
• gr_nmem: Number of group members contained in gr_mem
• gr_mem: Array of group members’ login names
The gr_name component can be accessed by calling PXFSTRGET(3F). gr_gid and gr_nmem can be
accessed by calling PXFINTGET(3F). PXFESTRGET can be used to access the elements of gr_mem.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this routine:
name An input character character variable or array element containing the group name for which
group information is requested.
ilen An input integer variable containing the length of name. If ilen is zero, trailing blanks are
stripped.

004– 2165– 002 233


PXFGETGRNAM ( 3F ) PXFGETGRNAM ( 3F )

jgroup An output handle of type group created with PXFSTRUCTCREATE(3F).


ierror An output integer variable that contains zero if group information was retrieved or nonzero if
PXFGETGRNAM was not successful.
The PXFGETGRNAM routine may also return any of the following error values:
ENOENT If name contains a non-existant group ID.
ENOMEM If memory needed by PXFGETGRNAM could not be allocated.
EINVAL If ilen < 0 or ilen > LEN(name).
EBADHANDLE
If jgroup is an invalid handle or has an incorrect handle type (UNICOS and UNICOS/mk
systems only).

EXAMPLES
In this example, PXFGETGRNAM is called for information about the group users.
progra m pxf test
intege r jgr oup
intege r ier ror, igid

CALL PXFGET GRN AM(’us ers ’,0,jg roup,i error)


CALL PXFINT GET (jgrou p,’ gr_gid ’,igid ,ierro r)
print *,’ group ID for gro up use rs is ’,igid

end

SEE ALSO
PXFINTGET(3F), PXFSTRGET(3F)

234 004– 2165– 002


PXFGETGROUPS ( 3F ) PXFGETGROUPS ( 3F )

NAME
PXFGETGROUPS – Gets supplementary group IDs

SYNOPSIS
SUBROUTINE PXFGETGROUPS (igidsetsize, igrouplist, ngroups, ierror)
INTEGER igidsetsize, igrouplist(igidsetsize), ngroups, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFGETGROUPS subroutine uses the getgroups(2) system call to fill igrouplist with a supplemental
group list for the calling process.
As a special case, when igidsetsize is zero, PXFGETGROUPS will return the number of supplemental group
IDs for the calling process in the ngroups variable, leaving the igrouplist variable unchanged.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this routine:
igidsetsize An input integer variable containing the size of the igrouplist integer array.
igrouplist An output integer variable or array element that will contain a set of supplemental group IDs
for the calling process. NGROUPS_MAX, found in <sys/param.h> for the UNICOS
operating system and <unistd.h> for IRIX systems, defines the maximum number of
supplemental group IDs for a process.
ngroups An output integer variable that will contain the number of supplemental group IDs for the
calling process.
ierror An output integer variable that contains zero if the variable was changed or nonzero if
PXFGETGROUPS was not successful.
The PXFGETGROUPS routine may return the EINVAL error value if igidsetsize is not equal to zero and is
less than the number of supplementary group IDs.

004– 2165– 002 235


PXFGETGROUPS ( 3F ) PXFGETGROUPS ( 3F )

EXAMPLES
This example finds the number of supplemental group IDs for its process, prints out the number, and then
retrieves the supplemental group IDs and prints each group ID.
pro gram pxf tes t
int eger igi dgr oup lis t, igr oup lis t(6 4), ngr oup s, ier ror , i

c fin d out the num ber of gro ups


igi dgroup lis t = 0
CAL L PXF GET GRO UPS (ig idg rou pli st, igr oup lis t, ngr oup s, ier ror )
pri nt *,’ gro ups for pro ces s = ’,n gro ups ,’ err or = ’,i err or

c cal l pxf get gro ups


igi dgroup lis t = 64
CAL L PXF GET GRO UPS (ig idg rou pli st, igr oup lis t, ngr oup s, ier ror )
pri nt *,’ gro ups for pro ces s = ’,n gro ups ,’ err or = ’,i err or

c pri nt out all gro ups for the pro ces s


do i=1,ng rou ps
print *,’ gid = ’, igr oup lis t(i )
end do

end

This example may return the following results:


groups for pro ces s = 2 err or = 0
groups for pro ces s = 2 err or = 0
gid = 1013
gid = 10533

SEE ALSO
getgroups(2)

236 004– 2165– 002


PXFGETLOGIN ( 3F ) PXFGETLOGIN ( 3F )

NAME
PXFGETLOGIN – Gets user name

SYNOPSIS
SUBROUTINE PXFGETLOGIN (s, ilen, ierror)
CHARACTER*n s
INTEGER ilen, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFGETLOGIN routine uses the cuserid(3C) function to fill s with the user login name associated
with the calling process.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this routine:
s An output character variable or array element for the user’s login name.
ilen An output integer variable containing the length of s.
ierror An output integer variable that contains zero if the user’s login name was successfully acquired
or nonzero if PXFGETLOGIN was unsuccessful.
The PXFGETLOGIN routine may return the ETRUNC error value if the length of s is smaller than the length
of the user’s login name.

EXAMPLES
In this example, PXFGETLOGIN is called and the returned user login name is printed.

004– 2165– 002 237


PXFGETLOGIN ( 3F ) PXFGETLOGIN ( 3F )

pro gra m pxftes t


cha rac ter*16 s
int ege r ile n, ier ror

c find the use r nam e ass oci ated with this proces s
CAL L PXF GETLOG IN(s, ile n, ierror )
pri nt *,’use r nam e = ’,s,’ len gth = ’,ilen ,’ err or = ’,ierr or

end

SEE ALSO
cuserid(3C)

238 004– 2165– 002


PXFGETPGRP ( 3F ) PXFGETPGRP ( 3F )

NAME
PXFGETPGRP – Gets the process group ID

SYNOPSIS
SUBROUTINE PXFGETPGRP (ipgrp, ierror)
INTEGER ipgrp, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFGETPGRP subroutine uses the getpgrp(2) system call to return the process group ID of the
calling process.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this routine:
ipgrp An output integer variable that contain the process group ID for the current process.
ierror An output integer variable that contains a status of zero if the process ID was successfully
acquired.

EXAMPLES
In this example, PXFGETPGRP will return the process group ID for the calling process.

004– 2165– 002 239


PXFGETPGRP ( 3F ) PXFGETPGRP ( 3F )

program pxftes t
integer ipg rp, ier ror
CALL PXF GETPGR P(ipgr p, ier ror)
if (ie rror .eq. 0) the n
pri nt *,’pgr p = ’,ipgr p
else
pri nt *,’err or = ’, ier ror
endif
end

SEE ALSO
getpgrp(2)

240 004– 2165– 002


PXFGETPID ( 3F ) PXFGETPID ( 3F )

NAME
PXFGETPID – Gets the process ID

SYNOPSIS
SUBROUTINE PXFGETPID (ipid, ierror)
INTEGER ipid, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFGETPID subroutine uses the getpid(2) system call to find the current process ID.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this routine:
ipid An output integer variable that contains the process ID of the current process.
ierror An output integer variable that contains a status of zero if the process ID was successfully
acquired.

EXAMPLES
In this example, PXFGETPID returns the current process ID.
progra m pxf tes t
intege r ipi d, ier ror
CALL PXFGET PID (ip id, ier ror )
if (ie rror .eq . 0) the n
pri nt *,’ pid = ’,i pid
else
pri nt *,’ err or = ’,i err or
endif
end

004– 2165– 002 241


PXFGETPID ( 3F ) PXFGETPID ( 3F )

SEE ALSO
getpid(2)

242 004– 2165– 002


PXFGETPPID ( 3F ) PXFGETPPID ( 3F )

NAME
PXFGETPPID – Gets the parent process ID

SYNOPSIS
SUBROUTINE PXFGETPPID (ipid, ierror)
INTEGER ipid, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFGETPPID subroutine uses the getppid(2) system call to find the parent process ID.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this routine:
ipid An output integer variable that contains the parent process ID of the current process.
ierror An output integer variable that contains a status of zero if the process ID was successfully
acquired.

EXAMPLES
In this example, PXFGETPPID returns the current process’ parent process ID.
progra m pxf tes t
intege r ipi d, ier ror
CALL PXFGET PPI D(i pid , ier ror )
if (ie rror .eq . 0) the n
pri nt *,’ pid = ’,i pid
else
pri nt *,’ err or = ’,ierr or
endif
end

004– 2165– 002 243


PXFGETPPID ( 3F ) PXFGETPPID ( 3F )

SEE ALSO
getppid(2)

244 004– 2165– 002


PXFGETPWNAM ( 3F ) PXFGETPWNAM ( 3F )

NAME
PXFGETPWNAM – Gets password information about login name

SYNOPSIS
SUBROUTINE PXFGETPWNAM (name, ilen, jpasswd, ierror)
INTEGER ilen, jpasswd, ierror
CHARACTER*n

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFGETPWNAM routine uses the getpwnam(3C) function to return password information about a login
name. It uses the following components of the passwd structure:
• pw_name: login name
• pw_uid: user ID
• pw_gid: group ID
• pw_dir: default login directory
• pw_shell: default login shell or program
The following components are supported by the UNICOS and IRIX operating systems, but are not part of
the POSIX 1003.9-1992 standard.
• pw_passwd: encrypted password
• pw_age: password age (character string) (unused on IRIX systems)
• pw_comment: comment
• pw_gecos: a comment in the UNICOS operating system; the user’s real name on IRIX systems.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.

004– 2165– 002 245


PXFGETPWNAM ( 3F ) PXFGETPWNAM ( 3F )

The following is a list of valid arguments for this routine:


name An input character variable or array element containing the login name for which password
information is requested.
ilen An input integer variable containing the character length of name. If ilen is zero, trailing blanks
are stripped.
jpasswd An output handle of type passwd created with PXFSTRUCTCREATE(3F).
ierror An output integer variable that contains zero if PXFGETPWNAM was successful or nonzero if
PXFGETPWNAM was not successful.
The PXFGETPWNAM routine may return the following errors:
ENOENT If an entry matching the login name in name was not found.
EBADHANDLE If jpasswd is an invalid handle or has an incorrect handle type (UNICOS and UNICOS/mk
systems only).

EXAMPLES
In this example, the password information will be acquired for the login name root.
pro gra m pxftes t
int ege r ilen, ier ror, val ue
int ege r*8 jpassw d
CAL L PXF STR UCTCRE ATE (’passwd’ ,jp ass wd, ierror )
nam e = ’ro ot’
ile n = 4
CAL L PXF GET PWNAM(nam e,i len,jp ass wd, ier ror)
if (ie rror .eq. 0) the n
pri nt *,’ PASSED: pxfget pwn am call’
els e
pri nt *,’ FAI LED: pxfget pwn am cal l wit h err or = ’,ierr or
end if
CAL L PXF STR UCT FREE(jpas swd ,ie rror)
end

SEE ALSO
getpwnam(3C), PXFSTRUCTCREATE(3F), PXFSTRUCTFREE(3F)

246 004– 2165– 002


PXFGETPWUID ( 3F ) PXFGETPWUID ( 3F )

NAME
PXFGETPWUID – Gets password information by using user ID

SYNOPSIS
SUBROUTINE PXFGETPWUID (name, iuid, jpasswd, ierror)
INTEGER iuid, jpasswd, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
PXFGETPWUID uses the getpwuid(3C) function to return password information about a user ID. It uses
the following components of the passwd structure:
• pw_name: login name
• pw_uid: user ID
• pw_gid: group ID
• pw_dir: default login directory
• pw_shell: default login shell or program
The following components are supported by the UNICOS and IRIX operating systems, but are not part of
the POSIX 1003.9-1992 standard.
• pw_passwd: encrypted password
• pw_age: password age (character string) (unused on IRIX systems)
• pw_comment: comment
• pw_gecos: a comment in the UNICOS operating system; the user’s real name on IRIX systems.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.

004– 2165– 002 247


PXFGETPWUID ( 3F ) PXFGETPWUID ( 3F )

The following is a list of valid arguments for this routine:


name An input character variable or array element containing the login name for which password
information is requested.
iuid An input integer variable containing the user ID for which password information is requested.
jpasswd An output handle of type passwd created with PXFSTRUCTCREATE(3F).
ierror An output integer variable that contains zero if PXFGETPWUID was successful or nonzero if
PXFGETPWUID was not successful.
The PXFGETPWUID routine may return the following errors:
ENOENT If an entry matching the user ID in iuid was not found.
EBADHANDLE If jpasswd is an invalid handle or has an incorrect handle type (UNICOS and UNICOS/mk
systems only).

EXAMPLES
In this example, the password information will be acquired for the login name root.
pro gra m pxftes t
int ege r iuid, ier ror, value
int ege r*8 jpassw d

CAL L PXF STR UCTCRE ATE (’pass wd’ ,jp ass wd,ier ror )
iui d=0
CAL L PXF GETPWU ID( iuid,jpas swd ,ie rro r)
if (ie rro r .eq . 0) then
pri nt *,’PAS SED : pxf get pwuid cal l’
els e
pri nt *,’FAILED : pxf get pwu id call with error = ’,i err or
end if

CAL L PXF STR UCTFRE E(j passwd ,ie rro r)


end

SEE ALSO
getpwnam(3C), PXFSTRUCTCREATE(3F), PXFSTRUCTFREE(3F)

248 004– 2165– 002


PXFGETUID ( 3F ) PXFGETUID ( 3F )

NAME
PXFGETUID – Gets the real user ID

SYNOPSIS
SUBROUTINE PXFGETUID (iuid, ierror)
INTEGER iuid, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFGETUID subroutine uses the getuid(2) system call to get the real user ID.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this routine:
iuid An output integer variable for the real user ID for the current process.
ierror An output integer variable that contains zero if PXFGETUID was successful.

EXAMPLES
This example calls PXFGETUID and prints the current real user ID and returned error.
progra m pxf tes t
intege r iui d, ier r
CALL PXFGET UID (iu id, ier r)
print *,’iui d = ’,i uid ,’ ier r = ’,i err
end

SEE ALSO
getuid(2)

004– 2165– 002 249


PXFINTGET ( 3F ) PXFINTGET ( 3F )

NAME
PXFINTGET – Allows values stored in individual components of a structure to be extracted and used

SYNOPSIS
INTEGER JHANDLE, VALUE, IERROR
CHARACTER*(n) compnam
CALL PXFINTGET (jhandle, compnam, value, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFINTGET() subroutine allows values stored in individual components of a structure to be extracted
and used.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following are arguments to PXFINTGET:
jhandle An input integer that references a structure. jhandle should have been created with
PXFSTRUCTCREATE.
compnam An input character variable. compnam is the name of a component of the structure. compnam
is case-sensitive.
value An output integer variable. Upon successful completion, value is set to the value stored in the
component of jhandle referenced by compnam.
ierror An output integer variable. It contains the exit status.

EXIT STATUS
Upon successful completion of PXFINTGET, the argument ierror is set to 0. If any of the following
conditions occur, ierror is set to the corresponding value:
ENONAME Component name is not defined for this structure
EBADHANDLE If jhandle is an invalid handle or has an incorrect handle type (UNICOS and UNICOS/mk
only).

250 004– 2165– 002


PXFINTSET ( 3F ) PXFINTSET ( 3F )

NAME
PXFINTSET – Allows components of a structure to be set or modified

SYNOPSIS
INTEGER JHANDLE, VALUE, IERROR
CHARACTER*(n) compnam
CALL PXFINTSET (jhandle, compnam, value, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFINTSET subroutine allows components of a structure to be set or modified.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The arguments for PXFINTSET are:
jhandle An input integer variable. jhandle references a structure. jhandle should have been created by
PXFSTRUCTNAME().
compnam An input character variable. compnam is the name of a component of the structure. compnam is
case-sensitive.
value An input integer variable. value is the value to be stored in the component of jhandle referenced
by compnam. The structures and components that can be accessed through PXFINTSET() are
described on the man page for the related routine.
ierror An output integer variable.

EXIT STATUS
Upon successful completion of PXFINTSET(), the argument ierror is set to 0. If any of the following
conditions occur, ierror is set to the corresponding value:
ENONAME Component name is not defined for this structure
EBADHANDLE
If jhandle is an invalid handle or has an incorrect handle type (UNICOS and UNICOS/mk only).

004– 2165– 002 251


PXFISATTY ( 3F ) PXFISATTY ( 3F )

NAME
PXFISATTY – Determines if file descriptor corresponds to a valid file descriptor

SYNOPSIS
SUBROUTINE PXFISATTY (ifildes, isatty, ierror)
INTEGER ifildes, ierror
LOGICAL isatty

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFISATTY routine uses isatty(3C) to determine if ifildes is a valid file descriptor for a terminal.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX, all
arguments must be of default kind unless documented otherwise. On UNICOS and UNICOS/mk, default
kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default kind is KIND=4.
The following is a list of valid arguments for this routine:
ifildes An input integer variable containing the file descriptor to be checked for an associated terminal.
isatty An output logical variable which is .TRUE. when ifildes is a file descriptor with an associated
terminal. Otherwise isatty is .FALSE..
ierror An output integer variable for the PXFISATTY completion status. ierror contains zero if
PXFISATTY was successful.

EXAMPLES

252 004– 2165– 002


PXFISATTY ( 3F ) PXFISATTY ( 3F )

program pxftes t
intege r len , ifilde s, ierror , O_R DON LY
charac ter *20 pat h
logica l isa tty
CALL PXFCTE RMID(p ath ,le n,ierr or)
CAL L PXF CON ST(’O_ RDONLY ’,O _RD ONLY,e rro r)
CAL L PXF OPE N(path ,len,O _RD ONLY,4 00, ifi lde s,e rro r)
CAL L PXF ISA TTY(if ildes, isa tty,ie rro r)
pri nt *,isat ty
end

SEE ALSO
PXFCONST(3F), PXFOPEN(3F)
ttyname(3C)

004– 2165– 002 253


PXFISBLK ( 3F ) PXFISBLK ( 3F )

NAME
PXFISBLK – Tests for block special file

SYNOPSIS
LOGICAL FUNCTION PXFISBLK(m)
INTEGER m

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The logical function PXFISBLK checks if a file is a block special file. The argument m should be supplied
by the st_mode component of the stat structure used by the PXFSTAT(3F) routine.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following argument is valid for this routine:
m An integer input variable containing the file mode.
If the file is a block special file, PXFISBLK returns a logical true, otherwise a logical false is returned.

EXAMPLES
In this example, the /dev/dsk directory is read until a block special file is found or the end of the
directory is reached. If a block special file is found, the file is printed.

254 004– 2165– 002


PXFISBLK ( 3F ) PXFISBLK ( 3F )

program pxftes t
integer ier ror,mo de, ile n,EEND
integer idi rid,jd ire nt, jstat
logical PXFISB LK, found
charac ter *30 name, pat h

CALL PXFSTR UCTCRE ATE (’dire nt’ ,jd ire nt,ier ror)
CAL L PXF STR UCTCRE ATE(’s tat ’,jsta t,i err or)
CAL L PXF CON ST(’EE ND’,EE ND, ierror )
pat h = ’/d ev/ dsk ’
fou nd = .FALSE .
CAL L PXF OPE NDIR(p ath,0, idi rid,ie rro r)
CAL L PXF CHD IR(pat h,0,ie rro r)
do whi le (fo und .eq v. .FALSE .)
CALL PXF READDI R(i dir id,jdi ren t,ierr or)
if (ierro r .eq . EEN D) the n
exi t
endif
CALL PXF STRGET (jd irent, ’d_ nam e’, name,i len,ie rror)
CALL PXF STAT(n ame ,0,jst at, ier ror )
CAL L PXF INTGET (jstat ,’s t_m ode’,m ode ,ie rro r)
if (PX FISBLK (mode) ) the n
fou nd = .TR UE.
end if
enddo

if (fo und .eq v. .TRUE.) then


print *,n ame,’ is a block fil e.’
endif
end

SEE ALSO
PXFCONST(3F), PXFINTSET(3F), PXFSTRUCTCREATE(3F)

004– 2165– 002 255


PXFISCHR ( 3F ) PXFISCHR ( 3F )

NAME
PXFISCHR – Tests for character special file

SYNOPSIS
LOGICAL FUNCTION PXFISCHR(m)
INTEGER m

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The logical function PXFISCHR checks if a file is a character special file. The argument m should be
supplied by the st_mode component of the stat structure used by the PXFSTAT(3F) routine.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX, all
arguments must be of default kind unless documented otherwise. On UNICOS and UNICOS/mk, default
kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default kind is KIND=4.
The following is a valid argument for this routine:
m An integer input variable containing the file mode.
If the file is a character special file, PXFISCHR returns a logical true, otherwise a logical false is returned.

EXAMPLES
In this example, PXFSTAT is called on /dev/tty, which should be a character special file. After
PXFINTGET(3F) returns the mode of /dev/tty, PXFISCHR is called to check the mode of /dev/tty.

256 004– 2165– 002


PXFISCHR ( 3F ) PXFISCHR ( 3F )

program pxftes t
int eger jstat, ierror ,mo de
log ica l pxfisc hr

CAL L PXF STR UCTCRE ATE(’s tat ’,j stat,i err or)
CAL L PXF STA T(’/de v/tty’ ,0, jst at,ier ror )
CAL L PXF INT GET(js tat,’s t_m ode’, mod e, ier ror )
if (PXFIS CHR (mode) .eq v. .TRUE. ) the n
pri nt *,’/de v/tty is a cha racter spe cia l fil e.’
else
pri nt *,’ /dev/t ty sho uld be a charac ter spe cia l fil e, but is not .’
end if
end

This program may display:


/de v/t ty is a cha racter spe cia l fil e.

SEE ALSO
PXFISBLK, PXFINTGET(3F), PXFSTAT(3F), PXFSTRUCTCREATE(3F)

004– 2165– 002 257


PXFISDIR ( 3F ) PXFISDIR ( 3F )

NAME
PXFISDIR – Tests for directory file

SYNOPSIS
LOGICAL FUNCTION PXFISDIR(m)
INTEGER m

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libffio.so which is linked by default when compiling programs with
the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The logical function PXFISDIR checks if a file is a directory file. The argument m should be supplied by
the st_mode component of the stat structure used by the PXFSTAT(3F) routine.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following argument is available for this routine:
m An input integer variable containing the file mode.
If the file is a directory file, PXFISDIR returns a logical true, otherwise a logical false is returned.

EXAMPLES
In this example, the directory / is opened and read until a directory is found or the end of the directory is
reached. If a directory is found, found a directory in / is displayed.

258 004– 2165– 002


PXFISDIR ( 3F ) PXFISDIR ( 3F )

program pxftes t
integer ier ror,mo de, ile n,EEND
integer idi rid,jd ire nt, jstat
logical PXFISD IR, found
charac ter *30 name, pat h

CALL PXFSTR UCTCRE ATE (’dire nt’ ,jd ire nt,ier ror)
CAL L PXF STR UCTCRE ATE(’s tat ’,jsta t,i err or)
CAL L PXF CON ST(’EE ND’,EE ND, ierror )
pat h = ’/’
CAL L PXF OPE NDIR(p ath,0, idi rid,ie rro r)
CAL L PXF CHD IR(pat h,0,ie rro r)
found = .FA LSE .

do whi le (fo und .eqv. .FA LSE .)


CAL L PXF READDI R(idir id, jdi rent,i err or)
if (ierro r .eq . EEND) the n
exit
end if
CAL L PXF STRGET (jdire nt, ’d_nam e’, nam e,i len ,ie rro r)
CAL L PXF STAT(n ame,0, jst at,ier ror )
CALL PXF INTGET (js tat,’s t_m ode ’,m ode,ie rror)
if (PXFIS DIR (mode) ) the n
fou nd = .TRUE.
endif
end do

if (fo und .eqv. .TRUE. ) the n


print *,’fou nd a dir ect ory in /’
end if
end

SEE ALSO
PXFCONST(3F), PXFINTSET(3F), PXFSTAT(3F), PXFSTRUCTCREATE(3F)

004– 2165– 002 259


PXFISFIFO ( 3F ) PXFISFIFO ( 3F )

NAME
PXFISFIFO – Tests for pipe or a FIFO special file

SYNOPSIS
LOGICAL FUNCTION PXFISFIFO(m)
INTEGER m

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The logical function PXFISFIFO checks if a file is a pipe or FIFO special file. The argument m should be
supplied by the st_mode component of the stat structure used by the PXFSTAT(3F) routine.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following argument is valid for this routine:
m An integer input variable containing the file mode.
If the file is a block special file, PXFISFIFO returns a logical true, otherwise a logical false is returned.

EXAMPLES
In this example, a file named testfile in /tmp created by mkfifo(1) is tested to see if it is a FIFO
special file.

260 004– 2165– 002


PXFISFIFO ( 3F ) PXFISFIFO ( 3F )

program pxftes t
integer mod e, ier ror
integer jstat
log ical PXF ISFIFO

CAL L PXF CHD IR(’/t mp’,0, ier ror )


CAL L MKF IFO (’test file’, 644 ,ie rror)
CAL L PXF STR UCTCRE ATE(’s tat ’,j stat,i err or)
CAL L PXF STA T(’tes tfile’ ,0, jst at,ier ror )
CAL L PXF INT GET(js tat,’s t_m ode ’,mode ,ie rro r)
if (PXFIS FIF O(mode ,ierro r) .eqv. .TR UE. ) the n
pri nt *,’PAS SED : PXF ISF IFO tes t’
els e
pri nt *,’FAI LED : PXF ISF IFO tes t’
end if
end

SEE ALSO
PXFINTSET(3F), PXFSTAT(3F), PXFSTRUCTCREATE(3F)
mkfifo(1)

004– 2165– 002 261


PXFISREG ( 3F ) PXFISREG ( 3F )

NAME
PXFISREG – Tests for regular file

SYNOPSIS
LOGICAL FUNCTION PXFISREG(m)
INTEGER m

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The logical function PXFISREG checks if a file is a regular file. The argument m should be supplied by the
st_mode component of the stat structure used by the PXFSTAT(3F) routine. If the file is a regular file,
PXFISREG returns a logical true, otherwise a logical false is returned.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following argument is valid for this routine:
m An integer input variable containing the file mode.

EXAMPLES

262 004– 2165– 002


PXFISREG ( 3F ) PXFISREG ( 3F )

program pxftes t
int eger jstat, ierror ,mo de
log ica l PXFISR EG
CAL L PXF STR UCTCRE ATE(’s tat ’,j stat,i err or)
CAL L PXF STA T(’/et c/pass wd’ ,0, jstat, ier ror )
CAL L PXF INT GET(js tat,’s t_m ode’, mod e, ier ror )
if (PX FIS REG (mode) .eq v. .TR UE. ) the n
pri nt *,’ passwd is a reg ular file.’
else
pri nt *,’ pas swd fil e is not a reg ular file.’
endif
end

SEE ALSO
PXFINTGET(3F), PXFSTAT(3F), PXFSTRUCTCREATE(3F)

004– 2165– 002 263


PXFLINK ( 3F ) PXFLINK ( 3F )

NAME
PXFLINK – Creates a link to a file

SYNOPSIS
CHARACTER*n existf, newf
INTEGER lenexist, lennew, ierror
CALL PXFLINK(existf, lenexist, newf, lennew, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFLINK routine uses the link function to link an existing file to a new file.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this routine:
existf An input character variable or array element containing the name of an existing file.
lenexist An input integer variable containing the length of existf in characters. If lenexist is zero, all
trailing blanks are removed before calling link().
newf An input character variable or array element containing the name of a new file.
lennew An input integer variable containing the length of newf in characters. If lennew is zero, all
trailing blanks are removed before calling link().
ierror An output integer variable that contains zero if the link was successful or nonzero if the link was
not completed.
In addition to the errors returned by the link(2) system call, PXFLINK may return the following errors:
EINVAL If lenexist < 0 or lenexist > LEN(existf) or lennew < 0 or lennew > LEN(newf).
ENOMEM If PXFLINK is unable to obtain memory to copy existf or newf.

264 004– 2165– 002


PXFLINK ( 3F ) PXFLINK ( 3F )

EXAMPLES

progra m tes t
charac ter*(1 2) fil ea, fil eb
intege r len fil a, len filb,i err
filea = ’ex ist fil e’
fileb = ’ne wfi le’
lenfil a = 0
lenfil b = 0
call pxflin k(f ile a,l enf ila ,fi leb ,le nfi lb, ier r)
if (ie rr.ne. 0) the n
pri nt *,’ FAI L: error fro m pxf lin k = ’,i err
else
pri nt *,’ PAS S: No err or fro m pxf lin k = ’
endif
end

004– 2165– 002 265


PXFLOCALTIME ( 3F ) PXFLOCALTIME ( 3F )

NAME
PXFLOCALTIME – Converts to local time

SYNOPSIS
SUBROUTINE PXFLOCALTIME (isecnds, iatime, ierror)
INTEGER isecnds, iatime, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFLOCALTIME routine uses the localtime function to convert seconds since 00:00:00 CTU
(coordinated universal time), January 1, 1970 (the Epoch), to broken-down time. Adjustments for time zone
and daylight savings time are made according to the TZ environment variable.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this routine:
isecnds An input integer variable containing the number of seconds since 00:00:00 CTU, January 1,
1970.
iatime An output integer array with the elements:
iatime(1) = seconds (0-61, for leap seconds)
iatime(2) = minutes (0-59)
iatime(3) = hours (0-23)
iatime(4) = day of the month (1-31)
iatime(5) = month of the year (1-12)
iatime(6) = Gregorian year (e.g., 1995)
iatime(7) = Day of the week (0 = Sunday)
iatime(8) = Day of the year (1-366)

266 004– 2165– 002


PXFLOCALTIME ( 3F ) PXFLOCALTIME ( 3F )

iatime(9) = Daylight savings flag (0 = standard, nonzero = daylight savings)


ierror An output integer variable that contains zero if PXFLOCALTIME was successful or nonzero if
PXFLOCALTIME was unsuccessful.
This routine may return the EINVAL error value if the current value of the TZ environment variable is
invalid. iatime is left unchanged if this error occurs.

EXAMPLES
In this example, the current time, date, and time system are displayed if PXFLOCALTIME and PXFTIME are
successful.
pro gram pxftes t
int eger isecnd s, iatime(9) , ier ror

CAL L PXF TIME(i sec nds,ierro r)


if (ie rror .eq. 0) the n
CAL L PXF LOCALTIME (is ecn ds,iat ime,ie rror)
if (ie rror .eq. 0) the n
pri nt *,’Tim e: ’,I ATIME( 3),’:’ ,IATIM E(2),’ :’,IAT IME(1)
pri nt *,’Dat e: ’,I ATIME( 4),’.’ ,IATIM E(5),’ .’,IAT IME(6)
if (IATIM E(9 ) .eq . 0) the n
pri nt *,’standa rd tim e’
else
print *,’ day light saving s’
end if
els e
pri nt *,’ PXF TIM E err or = ’,ierr or
endif
els e
print *,’PXF TIM E err or = ’,i error
end if
end

This example may display:


Time: 8:3 7:24
Date: 11. 7.1996
day light saving s

SEE ALSO
ctime(3C)

004– 2165– 002 267


PXFOPEN ( 3F ) PXFOPEN ( 3F )

NAME
PXFOPEN – Provides a Fortran interface to the open(2) system call

SYNOPSIS
INTEGER ilen, iopenflag, imode, ifildes, ierror
CHARACTER*n path
CALL PXFOPEN(path, ilen, iopenflag, imode, ifildes, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The routine PXFOPEN provides a subset of the functionality of the open(2) system call.
The path argument identifies the file to be opened. If PXFOPEN successfully opens the file, the file
descriptor is returned in the argument ifildes, and ierror is set to zero. If the file cannot be opened, ierror is
set to the error value.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX, all
arguments must be of default kind unless documented otherwise. On UNICOS and UNICOS/mk, default
kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default kind is KIND=4.
The following is a list of arguments for this routine:
path An input character variable or array element containing the name of the file to be opened.
ilen An input integer variable containing the length of path in characters. If ilen is zero, the trailing
blanks are removed.
iopenflag An input integer variable containing the status flags. See the open(2) man page for more detail.
The value for this variable may be obtained through the use of PXFCONST(3F) or IPXFCONST.
The following values are currently supported for iopenflag:
• O_RDONLY
• O_WRONLY
• O_RDWR
• O_RAW*

268 004– 2165– 002


PXFOPEN ( 3F ) PXFOPEN ( 3F )

• O_LDRAW*
• O_NDELAY
• O_NONBLOCK
• O_NOCTTY
• O_BIG*
• O_APPEND
• O_CREAT
• O_TRUNC
• O_EXCL
• O_PLACE*
• O_RESTART*
• O_SSD*
• O_SYNC
• O_WELLFORMED*
* = UNICOS and UNICOS/mk systems only.
The integer values may be combined through the use of a bitwise inclusive OR function.
imode An input integer variable, denoting the file access permission. The value for this variable may
be retrieved through the use of PXFCONST or IPXFCONST. The following values are currently
supported for imode:
USER READ permissions bit: S_IRUSR
WRITE permissions bit: S_IWUSR
SEARCH/EXECUTE permissions bit: S_IXUSR
Inclusive OR of READ/WRITE/EXECUTE: S_IRWXU
GROUP READ permissions bit: S_IRGRP
WRITE permissions bit: S_IWGRP
SEARCH/EXECUTE permissions bit: S_IXGRP
Inclusive OR of READ/WRITE/EXECUTE: S_IRWXG
OTHER READ permissions bit: S_IROTH
WRITE permissions bit: S_IWOTH
SEARCH/EXECUTE permissions bit: S_IXOTH
Inclusive OR of READ/WRITE/EXECUTE: S_IRWXO
SETID Set user ID on execution: S_ISUID
Set group ID on execution: S_ISGID
The integer values may be combined through the use of a bitwise inclusive OR
function.

004– 2165– 002 269


PXFOPEN ( 3F ) PXFOPEN ( 3F )

ifildes An output integer variable. If the open system call was successful, ifildes will be set to the file
descriptor.
ierror An output integer variable containing the status:
0 If PXFOPEN was successful (the open(2) succeeded)
errno If the open(2) system call failed
EINVAL If ilen is less than 0 or ilen is greater than LEN(path)

NOTES
PXFOPEN does not provide a way to specify the cbits or cblks parameters to open(2).

SEE ALSO
open(2)

270 004– 2165– 002


PXFRENAME ( 3F ) PXFRENAME ( 3F )

NAME
PXFRENAME – Renames a file

SYNOPSIS
CHARACTER*n oldnm, newnm
INTEGER lenold, lennew, ierror
CALL PXFRENAME(oldnm, lenold, newnm, lennew, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFRENAME routine uses the rename() function to change the name of a file.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this routine:
oldnm An input character variable or array element containing the current file name.
lenold An input integer variable containing the length of oldnm in characters. If lenold is zero, all
trailing blanks are removed before calling rename.
newnm An input character variable or array element containing the new name of the file.
lennew An input integer variable containing the length of newnm in characters. If lennew is zero, all
trailing blanks are removed before calling rename.
ierror An output integer variable that contains zero if the renaming of the file was successful or
nonzero if the renaming of the file was not completed.
In addition to the errors returned by rename(2) system call, PXFRENAME may return the following errors:
EINVAL If lenold < 0 or lenold > LEN(old) or lennew < 0 or lennew > LEN(newf).
ENOMEM If PXFRENAME is unable to obtain memory to copy oldnm or newnm.

004– 2165– 002 271


PXFRENAME ( 3F ) PXFRENAME ( 3F )

EXAMPLES

pro gram test


cha racter *(12) fil ea, fil eb
int eger lenfil a, len fil b,i err
fil ea = ’oldna me’
fil eb = ’newna me’
len fila = 0
len filb = 0
cal l pxf rename (fi lea ,le nfi la, fil eb, len fil b,i err )
if (ierr. ne.0) the n
print *,’FAI L: err or fro m pxf ren ame = ’,i err
els e
print *,’PAS S: No err or fro m pxf ren ame = ’
end if
end

272 004– 2165– 002


PXFRMDIR ( 3F ) PXFRMDIR ( 3F )

NAME
PXFRMDIR – Removes a directory entry

SYNOPSIS
CHARACTER*n path
INTEGER ilen, ierror
CALL PXFRMDIR(path, ilen, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFRMDIR subroutine uses the rmdir function to remove a directory entry for the named file.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this routine:
path An input character variable or array element containing the name of a file.
ilen An input integer variable containing the length of path in characters. If ilen is zero, all trailing
blanks are removed before calling rmdir.
ierror An output integer variable that contains a status of zero if the named file was removed.
In addition to the errors returned by the rmdir(2) system call, PXFRMDIR may return the following errors:
EINVAL If ilen less than 0 or ilen is greater than LEN(path).
ENOMEM If PXFRMDIR is unable to obtain memory to copy path

004– 2165– 002 273


PXFRMDIR ( 3F ) PXFRMDIR ( 3F )

EXAMPLES

pro gram test


cha racter *(12) pat h
int eger ilen, ier r
path = ’te stfile ’
ilen = 0
cal l pxf rmdir( pat h,i len ,ie rr)
if (ierr. ne.0) the n
print *,’FAI L: err or fro m pxf rmd ir = ’,i err
els e
print *,’PAS S: No err or fro m pxf rmd ir = ’
end if
end

SEE ALSO
rmdir(2)

274 004– 2165– 002


PXFSETENV ( 3F ) PXFSETENV ( 3F )

NAME
PXFSETENV – Sets environment variable pair

SYNOPSIS
CHARACTER*n name, new
INTEGER len, name, lennew, ioverwrite, ierror
CALL PXFSETENV (name, lenname, new, lennew, ioverwrite, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFSETENV routine uses the putenv(3C) function to change a currently existing "name=value" pair
or create a new name=value pair. The name or new arguments are stripped of trailing blanks if lenname or
lennew are zero.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this routine:
name An input character variable or array element containing the environment name value to be set.
lenname An input integer variable containing the character length of name. If lenname is zero, trailing
blanks are removed.
new An input character variable or array element containing the new environment value for the
name=value environment pair.
lennew An input integer variable containing the character length of new. If lennew is zero, trailing
blanks are removed.
ioverwrite An input integer variable containing a zero or nonzero number. When the value is zero, a
name=value pair with the name value matching name will not be replaced with a new name=new
pair.
A nonzero ioverwrite value will replace the matching name=value pair with name=new pair.

004– 2165– 002 275


PXFSETENV ( 3F ) PXFSETENV ( 3F )

ierror An output integer variable that contains zero if the environment variable was changed or nonzero
if PXFSETENV was not successful.
The PXFSETENV routine may return any of the following error values:
EINVAL If ilen is less than 0 or lenname is greater than LEN(path) or lennew is less than 0 or lennew is
greater than LEN(new).
ENOMEM If PXFSETENV is unable to obtain memory to copy name and new to a new name=value string.

EXAMPLES
In this example, PXFSETENV sets the SHELL environment value to /bin/csh.
progra m tes tpx f
cha rac ter*10 nam e, val
int eger lennam e, lenval , iov erw, ierr
c set input arg uments
nam e=’ SHELL’
ier r=0
lennam e=5
val=’/ bin /csh’
lenval =8
ioverw =1
CAL L PXF SETENV (na me,len name,v al,len val,io ver,ie rr)
c print inp ut argume nts
pri nt *,’nam e=- ’,n ame ,’- ’
print *,’ lennam e=’ ,lenna me
pri nt *,’val =-’ ,va l,’ -’
print *,’ lenval =’,len val
pri nt *,’iot her w=’ ,io the rw
c pri nt output argume nt
pri nt *,’ier r=’ ,ie rr
end

SEE ALSO
setenv(3C)

276 004– 2165– 002


PXFSETGID ( 3F ) PXFSETGID ( 3F )

NAME
PXFSETGID – Sets group ID

SYNOPSIS
SUBROUTINE PXFSETGID (igid, ierror)
INTEGER igid, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFSETGID routine uses the setgid(2) function to set the real group ID, effective group ID, and
saved-set group IDs of the calling process. The following conditions determine the setting of an ID. They
are checked in the following order, and the first condition that is true is applied:
• If the process has appropriate privilege, the real, effective, and saved-set group IDs are all set to igid.
• If ID is equal to either the real group ID, the effective group ID, or the saved-set, group ID is set to igid.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this routine:
igid An input integer variable used to replace the current group ID for the calling process.
ierror An output integer variable that contains zero if PXFSETGID was successful. or nonzero if
PXFSETGID was not successful.
PXFSETGID may return EINVAL if the value of the igid argument is out of range or EPERM if the process
does not have the appropriate privileges and igid does not match the real user ID.

004– 2165– 002 277


PXFSETGID ( 3F ) PXFSETGID ( 3F )

NOTES
On a UNICOS multilevel security (MLS) system, a process with the effective privileges shown is granted the
following abilities:
Privilege Description
PRIV_SETGID The process may set the real group ID, effective group ID, and saved set-
group-ID.
On a UNICOS non-MLS system or a UNICOS MLS system with PRIV_SU enabled, the super user may set
the real group ID, effective group ID, and saved set-group-ID.

EXAMPLES
In this example, the current user ID for the current process will be obtained by calling PXFGETGID and
then setting the group ID for the current process by using the group ID returned by PXFGETGID.
pro gram pxftes t
int eger igid, ier ror

CAL L PXF GETGID (ig id, ier ror )


if (ie rror .eq . 0) the n
CAL L PXF SET GID (ig id, ier ror )
if (ierro r .eq . 0) the n
print *,’ gro up id set to ’,i gid
els e
print *,’ gro up id not set to ’,i gid ,’ bec aus e of err or’
end if
else
pri nt *,’ cou ld not obt ain use r ID err or = ’,i err or
endif
end

SEE ALSO
setgid(2)

278 004– 2165– 002


PXFSETPGID ( 3F ) PXFSETPGID ( 3F )

NAME
PXFSETPGID – Set process group ID

SYNOPSIS
SUBROUTINE PXFSETPGID (ipid, ipgid, ierror)
INTEGER ipid, ipgid, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFSETPGID routine uses the setpgid(2) system call to change the process group ID of the process
with a process ID of ipid. The process group ID may be for an existing process group or a new process
group which will be created. Upon sucessful completion, the process with a process ID of ipid will have its
process group ID set to ipgid.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this routine:
ipid An input integer variable that contains the process ID of the process to change the process group
ID. As a special case, if ipid is zero the process ID of the calling process is used.
ipgid An input integer variable containing the new process group ID.
ierror An output integer variable that contains zero if PXFSETPGID was successful or nonzero if
PXFSETPGID was not successful.
PXFSETPGID may return any of the following error values:
EACCES If the value of ipid matches the process ID of a child process of the calling process and the child
process has successfully executed one of the PXFEXEC(3F) functions.
EINVAL If the value of ipgid is less than 0 or is not a value supported by the implementation.

004– 2165– 002 279


PXFSETPGID ( 3F ) PXFSETPGID ( 3F )

EPERM If the process indicated by ipid is a session leader; if the value of ipid is valid but matches the
process ID of a child process of the calling process and the child process is not in the same
session as the calling process; or if the value of ipgid does not match the process ID of the
process indicated by pid and no process with a process group ID exists that matches the value of
ipgid in the same session as the calling process.
ESRCH If the value of ipid does not match the ID of the calling process or of a child of the calling
process.

EXAMPLES

progra m pxf tes t


intege r ipi d, ierror

CALL PXF GETPID(ip id, ier ror )


if (ierro r .ne . 0) the n
pri nt *,’FAILED : PXF GET PID cal l wit h err or = ’,ierr or
else
CAL L PXF SET PGID(i pid , ipid, ierror )
if (ie rror .eq. 0) the n
pri nt *,’PAS SED : PXF SET PGI D nor mal tes t’
els e
pri nt *,’FAI LED : PXF SET PGI D nor mal test with error = ’,i error
end if
endif
end

SEE ALSO
setpgid(2)

280 004– 2165– 002


PXFSETSID ( 3F ) PXFSETSID ( 3F )

NAME
PXFSETSID – Creates a new session for a calling process

SYNOPSIS
SUBROUTINE PXFSETSID (isid, ierror)
INTEGER isid, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFSETSID routine uses the setsid(2) system call to create a new session for the calling process.
The calling process must not be the process leader for PXFSETSID to be successful.
After the successful completion of PXFSETSID, the calling process will be the session leader for the new
session and the process group leader for the new process group. The calling process also will have no
controlling terminal.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of arguments for this routine:
isid An output integer variable for the new process group ID of the calling process.
ierror An output integer variable that contains zero if PXFSETSID was successful or nonzero if
PXFSETSID was not successful.
This routine may return the EPERM error value if the calling process is already a process group leader, or the
calling process group ID of a process other than the calling process matches the process ID of the calling
process.

EXAMPLES
In this example, PXFFORK(3F) is called to create a child process, which calls PXFSETSID to create a new
session. The child writes the value of ierror to Fortran unit 10 and stops. After the fork, the parent process
waits for the child to finish execution, and then reads from Fortran unit 10. If the value read in from unit 10
is not equal to zero, the child’s call to PXFSETSID was unsucessful.

004– 2165– 002 281


PXFSETSID ( 3F ) PXFSETSID ( 3F )

program pxftes t
intege r isi d, iretpi d, ist at, ier ror , i

CALL PXFFOR K(i retpid ,ierro r)


if (ie rror .ne. 0) the n
pri nt *,’FAI LED : PXFFOR K cal l wit h err or = ’,i err or
else
if (ir etpid .eq . 0) the n
CAL L PXF SETSID (is id, ier ror)
write (10 ,*) ier ror
stop
els e
CALL PXFWAI T(ista t, ire tpid, ier ror )
read (10,*) i
if (i .eq. 0) the n
pri nt *,’PAS SED: PXFSET SID call under normal con dit ion s’
else
pri nt *,’FAI LED: PXFSET SID call with error = ’,i
endif
endif
endif

SEE ALSO
setsid(2)
PXFFORK(3F)

282 004– 2165– 002


PXFSETUID ( 3F ) PXFSETUID ( 3F )

NAME
PXFSETUID – Sets user ID

SYNOPSIS
SUBROUTINE PXFSETUID (iuid, ierror)
INTEGER iuid, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFSETUID routine uses the setuid(2) function to set the real user ID, effective user ID, and saved
set user IDs of the calling process. The following conditions determine the setting of an ID. They are
checked in the following order, and the first condition that is true is applied:
• If the process has appropriate privilege, the real, effective, and saved set user IDs are all set to iuid.
• If the ID is equal to either the real user ID, the effective user ID, or the saved set user, ID is set to iuid.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this routine:
iuid An input integer variable used to replace the current user ID for the calling process.
ierror An output integer variable that contains zero if PXFSETUID was successful or nonzero if
PXFSETUID was not successful.
This routine may return EINVAL if the value of the iuid argument is out of range. or EPERM if the process
does not have the appropriate privileges and if iuid does not match the real user ID.

004– 2165– 002 283


PXFSETUID ( 3F ) PXFSETUID ( 3F )

NOTES
On a UNICOS multilevel security (MLS) system, a process with the effective privileges shown is granted the
following abilities:
Privilege Description
PRIV_SETGID The process may set the real user ID, effective user ID, and saved set-user-ID.
On a UNICOS non-MLS system or a UNICOS MLS system with PRIV_SU enabled, the super user may set
the real user ID, effective user ID, and saved set-user-ID.

EXAMPLES
In this example, the current user ID for the current process will be obtained by calling PXFGETUID and
then seting the user ID for the current process using the group ID returned by PXFGETUID.
pro gram pxftes t
int eger iuid, ier ror

CAL L PXF GETUID (iu id, ier ror )


if (ie rror .eq . 0) the n
CAL L PXF SET UID (iu id, ier ror )
if (ierro r .eq . 0) the n
print *,’ use r id set to ’,i uid
els e
print *,’ use r id not set to ’,i uid ,’ bec aus e of err or’
end if
else
pri nt *,’ cou ld not obt ain use r ID err or = ’,i err or
endif
end

SEE ALSO
setuid(2)
PXFGETUID(3F)

284 004– 2165– 002


PXFSLEEP ( 3F ) PXFSLEEP ( 3F )

NAME
PXFSLEEP – Delays process execution

SYNOPSIS
SUBROUTINE PXFSLEEP(iseconds, isecleft, ierror)
INTEGER iseconds, isecleft, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
The PXFSLEEP subroutine waits iseconds before generating a SIGALRM signal. If a previous PXFSLEEP
has time remaining, isecleft contains the number of seconds until the signal SIGALRM would have been
generated.
The following is a list of arguments for this routine:
iseconds Default integer input variable containing the number of real-time seconds to wait before sending
the calling process a SIGALRM signal.
isecleft Default integer output variable containing the number of seconds left until a previous request
would have generated a SIGALRM signal.
ierror Default integer output variable containing a status of zero if PXFSLEEP was successful.
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX systems,
the default kind is KIND=4.

NOTES
Replace the use of the sleep(3C) function with the subroutine call to PXFSLEEP().

EXAMPLES

004– 2165– 002 285


PXFSLEEP ( 3F ) PXFSLEEP ( 3F )

program pxftes t
integer isecon ds, isecle ft, ier ror

iseconds = 10
isecleft = 0
ierror = 0
CALL PXF SLEEP( ise conds, ise cle ft, ier ror )
if (ie rror .ne. 0) the n
pri nt *,’FAI LED : PXFSLE EP call failed wit h err or = ’,i err or
else
pri nt *,’PAS SED : PXFSLE EP cal l ret urned no err or’
endif
if (isecl eft .ne. 0) the n
print *,’FAI LED : PXF SLE EP, ise cle ft not zer o, =’, ise cle ft
endif
end

SEE ALSO
alarm(2)
sleep(3C)

286 004– 2165– 002


PXFSTAT ( 3F ) PXFSTAT ( 3F )

NAME
PXFSTAT – Retrieves the file status

SYNOPSIS
INTEGER jstat, ilen, ierror
CALL PXFSTAT(path, ilen, jstat, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFSTAT routine uses the stat system call to get the file status.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of arguments for this routine:
path An input character variable or array element containing the name of a file.
ilen An input integer variable containing the length of path in characters. If ilen is zero, all trailing
blanks are removed before calling stat().
jstat An input integer variable or array element containing a handle for a stat structure. This handle
should have been created by a call to the PXFSTRUCTCREATE(3F) routine.
ierror An output integer variable that contains the status:
Zero PXFSTAT returned the status information.
Nonzero PXFSTAT was unable to return the status.
In addition to errors returned by the stat(2) system call, the following errors may occur:
EINVAL If ilen < 0 or ilen > LEN(path).
ENOMEM If PXFSTAT is unable to obtain memory to copy path.
EBADHANDLE If jstat is an invalid handle or has an incorrect handle type (UNICOS and UNICOS/mk
systems only).

004– 2165– 002 287


PXFSTAT ( 3F ) PXFSTAT ( 3F )

The stat structure contains the following components:


• st_mode: File mode.
• st_ino: File serial number.
• st_dev: ID of device containing the file.
• st_nlink: Number of links.
• st_uid: User id of the owner of the file.
• st_gid: Group id of the owner of the file.
• st_size: File size in bytes for regular files. Unspecified for other files.
• st_atime: Last time that data within the file was accessed.
• st_mtime: Last time that data in the file was modified.
• st_ctime: Last time that file status was changed.

EXAMPLES

progra m tes t
character *10 pat h
intege r ile n, jstat, ier r,i mod e, ist ino
path = ’stt.f’
call pxfstr uct create (’s tat ’,jsta t,ierr )
print *,’ str uctcre ate err or = ’,i err
ilen=0
call pxfsta t(p ath, ile n, jst at, ier r)
if (ie rr. ne.0) the n
print *,’ FAI L: err or fro m pxf stat = ’,i err
else
print *,’ PAS S: No err or fro m pxf stat = ’
endif
call pxfint get (jstat ,’s t_i no’,is tino,i err)
call pxfint get (jstat ,’m ode’,i mode,i err)
print *,’ st_ino = ’,i sti no
print *,’mode = ’,imod e
call pxfstr uct free(s tat ,ie rr)
end

288 004– 2165– 002


PXFSTRGET ( 3F ) PXFSTRGET ( 3F )

NAME
PXFSTRGET – Allows values stored in individual components of a structure to be extracted and used

SYNOPSIS
INTEGER jhandle, ilen, ierror
CHARACTER*(n) compnam, value
CALL PXFSTRGET (jhandle, compnam, value, ilen, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The routine PXFSTRGET allows character values stored in individual components of a structure to be
extracted and used.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX, all
arguments must be of default kind unless documented otherwise. On UNICOS and UNICOS/mk, default
kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default kind is KIND=4.
The following are arguments to PXFSTRGET:
jhandle An input integer that references a structure. jhandle should have been created with
PXFSTRUCTCREATE.
compnam An input character variable that is the name of a component of the structure. compnam is case-
sensitive.
value An output character variable. Upon successful completion, value is set to the value stored in the
component of jhandle referenced by compnam. If the length of the data being stored is less than
the declared length of value, value is padded with blanks.
The structures and components that may be accessed through PXFSTRGET are described on the
man page for the related PXF routine. For example, the PXFUNAME man page describes the
components for the utsname structure.
ilen An output integer variable. ilen is set to the actual length of the data assigned to value. If the
length of value is insufficient to contain the data being returned, the data is truncated, and ilen
contains the original length of the data before truncation. In this case, ierror is set to ETRUNC.

004– 2165– 002 289


PXFSTRGET ( 3F ) PXFSTRGET ( 3F )

ierror An output integer variable. Upon successful completion of PXFSTRGET, ierror is set to 0. If
any of the following conditions occur, ierror is set to the corresponding value:
ENONAME Component name is not defined for the specified structure.
ETRUNC The actual length of the data to be copied to value was longer than the
declared length of value.
EBADHANDLE If jhandle is an invalid handle or has an incorrect handle type (UNICOS and
UNICOS/mk systems only).

SEE ALSO
PXFSTRUCTCREATE(3F), PXFUNAME(3F)

290 004– 2165– 002


PXFSTRSET ( 3F ) PXFSTRSET ( 3F )

NAME
PXFSTRSET – Allows values stored in individual components of a structure to be set

SYNOPSIS
INTEGER jhandle, ilen, ierror
CHARACTER*n compnam, value
CALL PXFSTRSET (jhandle, compnam, value, ilen, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The routine PXFSTRSET allows character values stored in individual components of a structure to be set.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following are arguments to PXFSTRSET:
jhandle An input integer that references a structure. jhandle should have been created with
PXFSTRUCTCREATE.
compnam An input character variable. compnam is the name of a component of the structure. compnam is
case-sensitive.
value An input character variable. Upon successful completion, the component of jhandle referenced
by compnam is set to value.
ilen An input integer variable. ilen is the intended length of value. If ilen is zero, then trailing
blanks in value are stripped and ignored.
ierror An output integer variable. Upon successful completion of PXFSTRSET, ierror is set to 0. If
any of the following conditions occur, ierror is set to the corresponding value:
ENONAME Component name is not defined for the specified structure.
EBADHANDLE If jhandle is an invalid handle or has an incorrect handle type (UNICOS and
UNICOS/mk systems only).

004– 2165– 002 291


PXFSTRSET ( 3F ) PXFSTRSET ( 3F )

SEE ALSO
PXFSTRUCTCREATE(3F)

292 004– 2165– 002


PXFSTRUCTCOPY ( 3F ) PXFSTRUCTCOPY ( 3F )

NAME
PXFSTRUCTCOPY – Copies structure

SYNOPSIS
SUBROUTINE PXFSTRUCTCOPY (structname, jhandle1, jhandle2, ierror)
INTEGER jhandle1, jhandle2, ierror
CHARACTER*n structname

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFSTRUCTCOPY routine copies structures created with PXFSTRUCTCREATE(3F). The structure
referenced by jhandle1 is copied to the structure referenced by jhandle2.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following are valid arguments for this routine:
structname An input character variable or array element containing the structure name corresponding to the
two structure handles’ type.
jhandle1 An input structure handle variable to be copied.
jhandle2 An output structure handle variable that will contain a copy of the structure of jhandle1 after
successful execution of PXFSTRUCTCOPY.
ierror An output integer variable that contains zero if PXFSTRUCTCOPY was successful or nonzero if
PXFSTRUCTCOPY was not successful.
This routine may also return any of the following error values:
ENONAME If structname is an invalid structure name, or if structname does not match the jhandle1 and
jhandle2 structure type.
ENOMEM If memory is unavailable to create data structures needed to copy a component.

004– 2165– 002 293


PXFSTRUCTCOPY ( 3F ) PXFSTRUCTCOPY ( 3F )

EBADHANDLE If jhandle1 or jhandle2 is an invalid handle or has an incorrect handle type (UNICOS and
UNICOS/mk only).

EXAMPLES
In this example, two utsname structures are created using PXFSTRUCTCREATE(3F). PXFUNAME(3F) is
called with one utsname structure, which is then copied to the other utsname structure.
pro gra m pxf tes t
int ege r jha ndl e1, jha ndl e2
int ege r ier ror

CAL L PXF STR UCT CRE ATE (’u tsn ame ’,j han dle 1,i err or)
if (ie rro r .ne . 0) the n
pri nt *,’ FAI LED : PXF STR UCT CRE ATE for uts nam e1’
els e
CAL L PXF STR UCT CRE ATE (’u tsn ame ’,j han dle 2,i err or)
if (ie rro r .ne . 0) the n
pri nt *,’ FAI LED : PXF STR UCT CRE ATE for uts nam e2 wit h err or = ’,i err or
els e
CAL L PXF UNA ME( jha ndl e1, ier ror )
if (ie rro r .ne . 0) the n
pri nt *,’ FAI LED : PXF UNA ME for uts nam e1 wit h err or = ’,i err or
els e
CAL L PXF STR UCT COP Y(’ uts nam e’, jha ndl e1, jha ndl e2, ier ror )
if (ie rro r .ne . 0) the n
pri nt *,’ FAI LED : PXF STR UCT COP Y wit h err or = ’, ier ror
els e
pri nt *,’ PAS SED : PXF STR UCT COP Y tes t for uts nam e str uct ’
end if
end if
end if
end if

CAL L PXF STR UCT FRE E(j han dle 1,i err or)
CAL L PXF STR UCT FRE E(j han dle 2,i err or)
end

SEE ALSO
PXFSTRUCTCREATE(3F), PXFUNAME(3F)

294 004– 2165– 002


PXFSTRUCTCREATE ( 3F ) PXFSTRUCTCREATE ( 3F )

NAME
PXFSTRUCTCREATE – Creates an instance of the desired structure and returns a nonzero handle in the
argument jhandle

SYNOPSIS
INTEGER jhandle, ierror
CHARACTER*n structname
CALL PXFSTRUCTCREATE (structname, jhandle, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFSTRUCTCREATE() routine creates an instance of the desired structure and returns a nonzero handle
in the argument jhandle. All further references to this instance of the structure are through this handle. The
initial values of components within the new instance of the structure are undefined.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following are arguments for PXFSTRUCTCREATE:
structname An input character variable. structname specifies which type of structure should be created.
Values for structname that are currently recognized are shown in the following table.
structname must be in lowercase letters; trailing blanks are ignored.
Values for structname:

structname Structure name Header file containing definition

FLOCK flock <fcntl.h>


UTIMBUF utimbuf <utime.h>
UTSNAME utsname <sys/utsname.h>
STAT stat <stat.h>
TMS tms <sys/times.h>
GROUP group <grp.h>
PASSWD passwd <pwd.h>

004– 2165– 002 295


PXFSTRUCTCREATE ( 3F ) PXFSTRUCTCREATE ( 3F )

jhandle An output integer variable. The structure handle is returned in jhandle.


ierror An output integer variable.

EXIT STATUS
Upon successful completion of PXFSTRUCTCREATE, the argument ierror is set to 0. If any of the
following conditions occur, PXFSTRUCTCREATE sets the argument to the corresponding value:
ENONAME Component name is not defined for this structure
ENOHANDLE Instance of the structure could not be created

EXAMPLES

progra m tes t
int eger junam, ier r, ile n
character *15 sna me
* Cre ate STRUCT URE to be used by una me()
cal l pxf struct cre ate (’utsn ame’,j unam,i err)
if (ie rr. ne.0) the n
pri nt *,’FAI L: err or fro m pxf struct create = ’,ierr
endif
* Fil l STR UCTURE thr oug h una me( )
cal l pxf uname( jun am,ier r)
if (ie rr. ne.0) the n
pri nt *,’FAI L: error from pxfuna me = ’,ierr
endif
ilen = 0
* Ret rie ve compon ent sysnam e fro m STR UCTURE
cal l pxf strget (ju nam,’s ysname ’,snam e,ilen ,ierr)
print *, ’sysna me= ’,s name
* Free STRUCTURE
call pxfstr uct fre e(j una m,i err )
if (ie rr. ne.0) the n
pri nt *,’FAI L: err or fro m pxf struct free = ’,i err
endif
end

296 004– 2165– 002


PXFSTRUCTFREE ( 3F ) PXFSTRUCTFREE ( 3F )

NAME
PXFSTRUCTFREE – Deletes the instance of the structure referenced by jhandle

SYNOPSIS
INTEGER jhandle, ierror
CALL PXFSTRUCTFREE (jhandle, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFSTRUCTFREE routine deletes the instance of the structure referenced by jhandle. This structure
should have been created by PXFSTRUCTCREATE(3F).
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following are arguments to PXFSTRUCTFREE():
jhandle An input integer variable. jhandle is a handle for a structure.
ierror An output integer variable. Upon successful completion of PXFSTRUCTFREE(), ierror is set
to 0. This routine will set ierror to EBADHANDLE if jhandle is an invalid handle (UNICOS or
UNICOS/mk systems only).

EXAMPLES

progra m tes t
intege r jst at, ier r, ile n, imo de, ist ino
charac ter *10 pat h
* Cre ate STR UCT URE to be use d by sta t()
call pxf str uct create (’s tat ’,j sta t,i err )
if (ie rr. ne. 0) the n
pri nt *,’ FAI L: err or fro m pxf str uct cre ate = ’,i err
endif

004– 2165– 002 297


PXFSTRUCTFREE ( 3F ) PXFSTRUCTFREE ( 3F )

* Fil l STRUCT URE throug h sta t()


ile n = 0
cal l pxf sta t(path, ilen, jst at, ier r)
if (ie rr.ne.0) the n
print *,’ FAI L: error fro m pxf sta t = ’,i err
end if
* Ret rie ve compon ent s st_ ino and mod e from STRUCT URE
call pxfint get (jstat,’s t_i no’ ,is ino,ie rr)
cal l pxf intget(js tat ,’m ode’,i mod e,i err )
print *, ’st_ino =’, sti no
print *, ’mode =’,mod e
* Fre e STR UCTURE
cal l pxf str uctfree(j sta t,i err )
if (ie rr.ne.0) the n
pri nt *,’FAI L: err or from pxfstr uct free = ’,i err
end if
end

SEE ALSO
PXFSTRUCTCREATE

298 004– 2165– 002


PXFSYSCONF ( 3F ) PXFSYSCONF ( 3F )

NAME
PXFSYSCONF – Retrieves the value of configurable system variables

SYNOPSIS
INTEGER NAME, IVAL, IERROR
CALL PXFSYSCONF (name, ival, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFSYSCONF routine uses the sysconf() function to retrieve the current value for the name
configurable system variable.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
This routine has the following arguments:
name An input integer variable or array element containing the integer value of a symbolic constant for
one of the following configurable system variables defined in POSIX Std. 1003.1, section 4.8.1.2:
ARG_MAX
CHILD_MAX
CLK_TCK
NGROUPS_MAX
OPEN_MAX
STREAM_MAX
TZNAME_MAX
_POSIX_JOB_CONTROL
_POSIX_SAVED_IDS
_POSIX_VERSION
The integer value for each of these symbolic constants is retrieved through the use of PXFCONST
or IPXFCONST. The integer values may be combined through the use of a bitwise inclusive OR
function.

004– 2165– 002 299


PXFSYSCONF ( 3F ) PXFSYSCONF ( 3F )

ival An output integer variable that will contain the value of the system variable name.
ierror An output integer variable that contains zero if PXFSYSCONF was successful or nonzero if name is
an invalid system variable.

EXAMPLES
In this example, PXFSYSCONF will retrieve the value of the CLK_TCK system variable.
pro gram test
int eger ival, ier r, iclktc k
iva l = 0
icl ktck = 0
cal l pxf const (’C LK_TCK ’,iclk tck,ie rr)
if (ie rr. ne.0) the n
pri nt *,’FAI L: error from pxfcon st = ’,ierr
got o 999 9
endif
call pxfsys con f (ic lkt ck, ival, ierr)
if (ie rr. ne.0) the n
pri nt *,’FAI L: error from pxfsys conf = ’,i err
else
pri nt *,’PAS S: err or fro m pxf syscon f = ’,ierr
endif
pri nt *, ’CL K_T CK= ’,i val
9999 con tinue
end

SEE ALSO
PXFCONST(3F)

300 004– 2165– 002


PXFTIME ( 3F ) PXFTIME ( 3F )

NAME
PXFTIME – Gets system time

SYNOPSIS
SUBROUTINE PXFTIME (itime, ierror)
INTEGER itime, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The routine PXFTIME uses the time function to return the number of seconds since 00:00:00 CTU
(coordinated universal time), January 1, 1970 (the Epoch).
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this routine:
itime An output integer variable specifying the number of seconds since 00:00:00 UTC, January 1,
1970.
ierror An output integer variable that contains zero if PXFTIME was successful or nonzero if
PXFTIME was not successful.

EXAMPLES
In this example, PXFTIME returns the current system time in number of seconds since January 1, 1970.

004– 2165– 002 301


PXFTIME ( 3F ) PXFTIME ( 3F )

program testpx f
integer iti me, ier ror
c call PXFTIM E
CAL L PXF TIME(i time, ier ror)
c pri nt output argume nts
print *,’ itime= ’,itim e
print *,’ ierror =’,ier ror
end

SEE ALSO
time(3C)

302 004– 2165– 002


PXFTIMES ( 3F ) PXFTIMES ( 3F )

NAME
PXFTIMES – Gets process times

SYNOPSIS
SUBROUTINE PXFTIMES (jtms, itime, ierror)
INTEGER jtms, itime, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFTIMES subroutine uses the times(2) system call to access system and user CPU time and wall-
clock time for the current process and any child processes.
Components of the tms structure are:
• tms_utime: User CPU time
• tms_stime: System CPU time
• tms_cutime: User CPU time of terminated child processes
• tms_cstime: System CPU time of terminated child processes
The processing time for a child process is included in the tms_cutime and tms_cstime elements of the
tms structure when the parent process waits for child process termination.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this routine:
jtms A handle of type tms created with PXFSTRUCTCREATE(3F).
itime An output integer variable for the number of system hardware clock ticks since some arbitrary
point in the past (for example, system startup time). This point does not change from one
invocation to another during the execution of the process.

004– 2165– 002 303


PXFTIMES ( 3F ) PXFTIMES ( 3F )

ierror An output integer variable that contains zero if PXFTIMES was successful or nonzero if
PXFTIMES was not successful.
PXFTIMES may return the EBADHANDLE error value if jtms is an invalid handle or has an incorrect handle
type.

EXAMPLES
This example shows how to use the PXFTIMES routine to retrieve system and user CPU time information
since the beginning of process execution.
pro gram testpx f
int eger itime, jtm s, ier r, itm p
c cre ate the tms str uct
cal l PXF STRUCT CRE ATE(’t ms’,jt ms,ier r)
pri nt *,’str uct cre ate error = ’,i err
c cal l PXF TIM ES and pri nt out return ed inf ormati on
call PXFTIM ES( jtm s,i tim e,i err )
print *,’ time = ’,i time
cal l PXF INTGET (jt ms,’tm s_utim e’,itm p,ierr )
pri nt *,’tms _ut ime = ’,itmp ,’ ’,i err
cal l PXF INTGET (jt ms,’tm s_stim e’,itm p,ierr )
pri nt *,’tms _st ime = ’,itmp ,’ ’,i err
cal l PXF INTGET (jt ms,’tm s_cuti me’,it mp,ier r)
print *,’ tms_cu tim e = ’,i tmp,’ ’,ierr
cal l PXF INTGET (jt ms,’tm s_csti me’,it mp,ier r)
print *,’ tms_cs tim e = ’,i tmp,’ ’,ierr
c fre e the tms struct
call PXFSTR UCT FRE E(j tms ,ie rr)
end

SEE ALSO
times(2)
PXFSTRUCTCREATE(3F)

304 004– 2165– 002


PXFUCOMPARE ( 3F ) PXFUCOMPARE ( 3F )

NAME
PXFUCOMPARE – Compares unsigned integers

SYNOPSIS
SUBROUTINE PXFUCOMPARE (i1, i2, icmpr, idiff)
INTEGER i1, i2, icmpr, idiff

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFUCOMPARE routine performs comparisons of C unsigned integers returned by some IEEE
FORTRAN 77 routines.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of arguments for this routine:
i1 An input integer variable for a C unsigned integer.
i2 An input integer variable for a C unsigned integer.
icmpr An output integer variable that, on return from the routine, contains one of these values:
– 1 If i1 < i2
0 If i1 = i2
1 If i1 > i2
All of the comparisons are made using C unsigned integer comparisons.
idiff An output integer variable that on return from the routine contains the absolute value of the
difference of i1 and i2. Since the values are C unsigned integers and FORTRAN 77 does not
directly support unsigned integers the value may be negative, which indicates the value is
beyond the maximum positive value of a FORTRAN 77 integer.

EXAMPLES
In this example, the program calls PXFTIMES(3F) to return the process time information and then uses
PXFUCOMPARE to determine if the system time was greater than 1000000000 clock ticks.

004– 2165– 002 305


PXFUCOMPARE ( 3F ) PXFUCOMPARE ( 3F )

pro gra m tes tpx f


int ege r iti me, jtm s, ier r, sti me, icm pr, idi ff

cal l PXF STR UCT CRE ATE (’t ms’ ,jt ms, ier r)
if (ie rr .ne . 0) the n
pri nt *,’ FAI LED : PXF STR UCT CRE ATE cal l wit h err or = ’,i err or
els e
cal l PXF TIM ES( jtm s,i tim e,i err )
if (ie rr .ne . 0) the n
pri nt *,’ FAI LED : PXF TIM ES cal l wit h err or = ’,i err or
els e
cal l PXF INT GET (jt ms, ’tm s_s tim e’, sti me, ier r)
if (ie rr .ne . 0) the n
pri nt *,’ FAI LED : PXF INT GET cal l for tms _st ime wit h err or = ’,i err or
els e
CAL L PXF UCO MPA RE( sti me, 100 000 000 0,i cmp r,i dif f)
if (ic mpr .eq . 1) the n
pri nt *,’ Sys tem tim e lon ger tha n 100 000 000 0 clo ck tic ks. ’
els e
pri nt *,’ Sys tem tim e les s tha n or equ al to 100 000 000 0 clo ck tic ks. ’
end if
end if
end if
end if
end

SEE ALSO
PXFTIMES(3F)

306 004– 2165– 002


PXFUMASK ( 3F ) PXFUMASK ( 3F )

NAME
PXFUMASK – Sets the file creation mask

SYNOPSIS
SUBROUTINE PXFUMASK (icmask, iprevcmask, ierror)
INTEGER icmask, iprevcmask, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFUMASK routine uses the umask(2) system call to change the file mode creation mask of the calling
process. Only the file permission bits of icmask are used.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of arguments for this routine:
icmask An input integer variable for the new file mode creation mask. The symbolic constants used to
compose the file mask can be access by calling PXFCONST(3F).
iprevcmask An output integer variable for the old file mode creation mask.
ierror An output integer variable that will contain a status of zero if the routine was successful.

EXAMPLES
In this example, the program calls PXFUMASK with a file mode creation mask of octal 022. Then a file is
created using the new file creation mask.

004– 2165– 002 307


PXFUMASK ( 3F ) PXFUMASK ( 3F )

pro gra m pxf tes t


int ege r icm ask , ipr evc mas k, imo de, ifi lde s, ifi lem ode , ier ror
int ege r ite mp
int ege r jst at
cha rac ter *3 cma sk

cma sk = ’02 2’
rea d(c mas k,1 ) icm ask
1 for mat (O3 )
CAL L PXF UMA SK( icm ask , ipr evc mas k, ier ror )
CAL L PXF CON ST( ’S_ IRW XU’ ,im ode ,ie rro r)
if (ie rro r .ne . 0) the n
pri nt *,’ FAI LED : PXF CON ST cal l for S_I RWX U wit h err or= ’,i err or
els e
CAL L PXF CON ST( ’S_ IRW XG’ ,it emp ,ie rro r)
if (ie rro r .ne . 0) the n
pri nt *,’ FAI LED : PXF CON ST cal l for S_I RWX G wit h err or= ’,i err or
els e
imo de = IOR (im ode ,it emp )
CAL L PXF CRE AT( ’/t mp/ tem pfi le’ , 0, imo de, ifi lde s, ier ror )
if (ie rro r .ne . 0) the n
pri nt *,’ FAI LED : PXF CRE AT cal l wit h err or = ’,i err or
els e
end if
end if
end

SEE ALSO
umask(2)
PXFCONST(3F)

308 004– 2165– 002


PXFUNAME ( 3F ) PXFUNAME ( 3F )

NAME
PXFUNAME – Retrieves the operating system name

SYNOPSIS
INTEGER junam, ierror
CALL PXFUNAME(junam, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFUNAME routine uses the uname() system call to get the components of the operating system name.
The components of the utsname structure are:
• sysname: Name of the operating system
• nodename: Name of node in the operating system
• release: Current release level of the operating system
• version: Current version level of the release
• machine: Name of hardware type currently executing the program
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this routine:
junam An input integer variable or array element containing a handle for a utsname structure. This
should have been created by a call to the PXFSTRUCTCREATE(3F) routine.
ierror An output integer variable that contains zero if PXFUNAME returned the structure successfully or
nonzero if PXFUNAME was unable to return the structure.

004– 2165– 002 309


PXFUNAME ( 3F ) PXFUNAME ( 3F )

EXAMPLES

pro gram test


int eger junam, ier r, ile n
charac ter*15 sna me, nna me, rel , ver s, mac h
cal l pxf struct cre ate (’u tsn ame ’,j una m,i err )
cal l pxf uname( jun am, ier r)
IF (ierr. ne.0) the n
print *,’FAI L: err or fro m pxf una me = ’,i err
els e
print *,’PAS S: No err or fro m pxf una me = ’
end if
ile n = 0
cal l pxf strget (ju nam ,’s ysn ame ’,s nam e,i len ,ie rr)
ile n = 0
cal l pxf strget (ju nam ,’n ode nam e’, nna me, ile n,i err )
ile n = 0
cal l pxf strget (ju nam ,’r ele ase ’,r el, ile n,i err )
ile n = 0
cal l pxf strget (ju nam ,’v ers ion ’,v ers ,il en, ier r)
ile n = 0
cal l pxf strget (ju nam ,’m ach ine ’,m ach ,il en, ier r)
pri nt *, ’sysna me= ’,s nam e
pri nt *, ’noden ame =’, nna me
pri nt *, ’relea se= ’,r el
pri nt *, ’versi on= ’,v ers
pri nt *, ’machi ne= ’,m ach
cal l pxf struct fre e(j una m,i err )

SEE ALSO
uname(2)
PXFSTRUCTCREATE(3F)

310 004– 2165– 002


PXFUNLINK ( 3F ) PXFUNLINK ( 3F )

NAME
PXFUNLINK – Removes a directory entry

SYNOPSIS
CHARACTER*n path
INTEGER ilen, ierror
CALL PXFUNLINK(path, ilen, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFUNLINK routine uses the unlink(2) system call to remove a directory entry for the named file.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this routine:
path An input character variable or array element containing the name of a file.
ilen An input integer variable containing the length of path in characters. If ilen is zero, all trailing
blanks are removed before calling unlink.
ierror An output integer variable that contains a zero if the named file was removed.
In addition to the errors returned by the unlink(2) system call, PXFUNLINK may return the following
errors:
EINVAL If ilen < 0 or ilen > LEN(path).
ENOMEM If PXFUNLINK is unable to obtain memory to copy path.

004– 2165– 002 311


PXFUNLINK ( 3F ) PXFUNLINK ( 3F )

EXAMPLES

pro gram test


cha racter *(12) pat h
int eger ilen, ier r
path = ’te stfile ’
ilen = 0
cal l pxf unlink (pa th, ile n,i err )
if (ierr. ne.0) the n
print *,’FAI L: err or fro m pxf unl ink = ’,i err
els e
print *,’PAS S: No err or fro m pxf unl ink = ’
end if
end

SEE ALSO
unlink(2)

312 004– 2165– 002


PXFWAIT ( 3F ) PXFWAIT ( 3F )

NAME
PXFWAIT, PXFWAITPID – Obtains information about a calling process’ child process

SYNOPSIS
SUBROUTINE PXFWAIT (istat, iretpid, ierror)
INTEGER istat, iretpid, ierror
SUBROUTINE PXFWAITPID (ipid, istat, ioptions, iretpid, ierror)
INTEGER ipid, istat, ioptions, iretpid, ierror

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The PXFWAIT routine uses the wait(2) system call to obtain information about one of the calling process’s
child processes.
The PXFWAITPID routine uses the waitpid(2) system call to obtain information about one of the calling
process’s child processes.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of arguments for this routine:
ipid An input integer variable containing the child process ID for which information is requested.
• If ipid is equal to – 1, status is requested for any child process; PXFWAITPID is then
equivalent to PXFWAIT.
• If ipid is greater than 0, it specifies the process ID of a single child process for which status
is requested.
• If ipid is equal to 0, status is requested for any child process with a process group ID that is
equal to that of the calling process.
• If ipid is less than – 1, status is requested for any child process with a process group ID that
is equal to the absolute value of ipid.
istat An output integer variable for the status information.
ioptions An input integer variable constructed from an inclusive OR of zero or more of the following
options:

004– 2165– 002 313


PXFWAIT ( 3F ) PXFWAIT ( 3F )

WNOHANG The waitpid system call does not suspend execution of the calling process if
status is not immediately available for one of the calling processes specified by
pid.
WUNTRACED If job control is supported, the status of any child processes specified by pid that
are stopped, and with a status that has not yet been reported since they stopped,
are also reported to the requesting process.
UNICOS and UNICOS/mk systems only:
WMTWAIT Waits for the children of any member of the multitasking group. In UNICOS 9.0
this is the default behavior for both wait and waitpid. The flag is still
provided for source compatibility. To get the previous behavior, see the
description of the WLWPWAIT flag.
WLWPWAIT Waits only for the immediate children of the calling light-weight process (LWP).
This flag is not recommended for general use.
iretpid An output integer variable for the child process ID.
ierror An output integer variable that contains zero if the routine was successful or nonzero if the
routine was not successful.
Any of the following error values may be returned:
ECHILD PXFWAIT: If the calling process has no existing unwaited-for child processes.
PXFWAITPID: The process or process group specified by ipid does not exist or is not a child
of the calling process.
EINTR If receipt of a signal other than the death-of-a-child-process signal.
EINVAL The value of the ioptions argument is not valid.

EXAMPLES

PXFWAIT example:

314 004– 2165– 002


PXFWAIT ( 3F ) PXFWAIT ( 3F )

program pxftes t
integer istat, ire tpid, ipi d, ier ror , i, j

CAL L PXF FORK(i pid,ie rro r)


if (ie rror .ne. 0) the n
print *,’FAI LED : PXF FOR K cal l fai led wit h err or = ’,i err or
else
if (ipid .eq. 0) the n
j = 0
do i=1 ,10 0000
j = j + i
enddo
stop
els e
CALL PXFWAI T(ista t,i retpid ,ie rro r)
if (ierro r .eq . 0) the n
pri nt *,’ PAS SED : PXF WAIT normal tes t’
els e
pri nt *,’ FAILED : PXF WAI T cal l wit h err or = ’,i err or
endif
end if
endif
end

PXFWAITPID example:

004– 2165– 002 315


PXFWAIT ( 3F ) PXFWAIT ( 3F )

program pxftes t
integer istat, ire tpid, ipi d, ierror , i, j, iop tio ns

CALL PXF FORK(i pid,ie rro r)


if (ie rror .ne. 0) the n
print *,’FAI LED : PXF FORK call failed wit h err or = ’,i err or
else
if (ipid .eq. 0) the n
j = 0
do i=1 ,10000 0
j = j + i
enddo
stop
els e
ioptio ns = 0
CALL PXFWAI TPID(i pid ,istat ,io pti ons ,ir etp id, ier ror )
if (ierro r .eq . 0) the n
pri nt *,’ PASSED : PXF WAI TPI D nor mal tes t’
els e
pri nt *,’ FAI LED: PXF WAITPI D cal l wit h err or = ’,i err or
endif
end if
endif
end

SEE ALSO
wait(2), waitpid(2)

316 004– 2165– 002


PXFWIFEXITED ( 3F ) PXFWIFEXITED ( 3F )

NAME
PXFWIFEXITED – Determines if child process exited with exit

SYNOPSIS
LOGICAL FUNCTION PXFWEXITED(istat)
INTEGER istat

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
The logical function PXFWIFEXITED returns the value TRUE if the child process exited with exit().
IPXFWEXITSTATUS() returns part of the bits of argument x from exit(x).
The following argument is used for this routine:
istat An input integer variable with the PXFWAIT or PXFWAITPID output status argument.
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX systems,
the default kind is KIND=4.

EXAMPLES

004– 2165– 002 317


PXFWIFEXITED ( 3F ) PXFWIFEXITED ( 3F )

program pxftes t
integer istat, ire tpid, ipi d, ierror , i, j
logical lwifex ited, PXF WIF EXITED

CALL PXF FOR K(ipid ,ierro r)


if (ierro r .ne . 0) then
print *,’FAI LED : PXF FORK call failed wit h err or = ’,i err or
else
if (ipid .eq. 0) the n
j = 0
do i=1,10 0000
j = j + i
end do
sto p
els e
CALL PXFWAI T(ista t,i ret pid,ie rro r)
if (ierro r .eq . 0) the n
pri nt *,’ PAS SED: PXFWAI T nor mal tes t’
lwi fexite d = PXF WIFEXI TED (is tat )
if (lw ifexit ed .eq v. .TR UE. ) the n ! exi t nor mal ly
print *,’ PXFWIF EXI TED tes t PAS SED’
els e
print *,’ PXF WIFEXI TED return ed FAL SE’
pri nt *,’PXF WAI T ist at = ’, ist at
print *,’PXF WIF EXITED tes t FAI LED ’
end if
els e
print *,’ FAI LED: PXFWAI T cal l wit h err or = ’,i err or
end if
end if
endif
end

SEE ALSO
IPXFWEXITSTATUS, PXFFORK(3F), PXFWAIT(3F)

318 004– 2165– 002


PXFWIFSIGNALED ( 3F ) PXFWIFSIGNALED ( 3F )

NAME
PXFWIFSIGNALED – Determines if the child process terminated because of a signal

SYNOPSIS
LOGICAL FUNCTION PXFWIFSIGNALED(istat)
INTEGER istat

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
The PXFWIFSIGNALED logical function returns TRUE if the child process has terminated because of a
signal. The IPXFWTERMSIG(3F) function returns part of the signal that terminated the child process.
The following argument is used for this routine:
istat An input integer variable with the PXFWAIT or PXFWAITPID output status argument.
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX systems,
the default kind is KIND=4.

EXAMPLES

progra m pxf tes t


intege r ist at, ire tpi d, ipi d, ier ror , ich ldi d, isi g
logica l lwi fsi gna led , PXF WIF SIG NAL ED

CALL PXFFOR K(i pid ,ie rro r)


if (ie rror .ne . 0) the n
pri nt *,’ FAI LED : PXFFOR K cal l fai led wit h err or = ’,i err or
pri nt *,’ ipi d=’ ,ip id

004– 2165– 002 319


PXFWIFSIGNALED ( 3F ) PXFWIFSIGNALED ( 3F )

else
print *,’ PASSED: PXFFOR K cal l’
if(ipi d.e q.0) then
cal l PXFGETPID (ic hldid, ierror )
if( ier ror .ne . 0) the n
pri nt *, ’PXFGE TPI D FAI LED , ier ror =’, ierror
els e
pri nt *, ’PXFGE TPI D PAS SED ’
end if
cal l PXFCONST( "SI GKILL" ,isig, ierror )
if( ier ror .ne . 0) the n
print *, ’PX FCONST FAI LED , ier ror =’, ier ror
els e
print *, ’PX FCONST PAS SED ’
end if
cal l PXF KIL L(ichldid ,is ig, ier ror )
if( ier ror .ne. 0) then
pri nt *, ’PXFKI LL FAI LED , ier ror =’, ier ror
else
print *, ’PX FKILL PAS SED’
end if
els e
CAL L PXF WAI T(istat,i ret pid ,ie rro r)
if (ierro r .eq . 0) the n
pri nt *,’PASSED : PXF WAI T nor mal test’
lwifsigna led = PXFWIF SIGNAL ED(ist at)
if (lwifs ign aled .eqv. .TRUE. ) the n ! exit normal ly
print *,’ PXFWIFSIG NALED test PASSED ’
else
print *,’ PXFWIF SIGNAL ED tes t FAI LED’
print *,’ PXFWIF SIGNAL ED ret urned FALSE’
pri nt *,’PXF WAI T ist at = ’, ist at
pri nt *,’ire tpi d= ’, ire tpi d
end if
else
print *,’ FAI LED: PXFWAI T cal l wit h err or = ’,ierr or
print *,’ PXF WAIT istat = ’, istat
print *,’ ire tpid= ’, iretpi d
end if
end if
endif
print *,’ test complete’
end

320 004– 2165– 002


PXFWIFSIGNALED ( 3F ) PXFWIFSIGNALED ( 3F )

SEE ALSO
IPXFTERMSIG(3F), PXFWAIT(3F)

004– 2165– 002 321


PXFWIFSTOPPED ( 3F ) PXFWIFSTOPPED ( 3F )

NAME
PXFWIFSTOPPED – Determines if a child process has stopped

SYNOPSIS
LOGICAL FUNCTION PXFWIFSTOPPED(istat)
INTEGER istat

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
The PXFWIFSTOPPED logical function returns the value TRUE if the child process has stopped.
The following argument is used for this routine:
istat An input integer variable with the PXFWAIT or PXFWAITPID output status argument.
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX systems,
the default kind is KIND=4.

EXAMPLES

322 004– 2165– 002


PXFWIFSTOPPED ( 3F ) PXFWIFSTOPPED ( 3F )

program pxftes t
int ege r ist at, ire tpi d, ipid, ier ror, iopts, isi g
logical lwifst opp ed, PXF WIF STO PPED

CAL L PXF FORK(i pid,ie rro r)


if (ie rror .ne. 0) the n
print *,’FAI LED : PXF FORK call failed wit h err or = ’,i err or
els e
print *,’FAI LED : PXF FOR K cal l fai led wit h err or = ’,i err or
if (ipid. eq. 0)then !ch ild
cal l PXFGET PID (ichld id, ier ror )
if (ierro r .ne . 0) then
pri nt *, ’PXFGE TPI D FAI LED, ierror =’, ier ror
pri nt *, ’ichld id= ’, ich ldi d
els e
pri nt *, ’PX FGE TPID PASSED ’
endif
call PXFCON ST("SI GST OP" ,isig, ier ror )
if (ierro r .ne . 0) the n
print *, ’PX FCO NST FAI LED , ier ror =’, ier ror
print *, ’is ig= ’, isig
els e
pri nt *, ’PXFCO NST PASSED ’
end if
call PXFKIL L(ichl did ,isig, ier ror )
if (ierro r .ne . 0) the n
pri nt *, ’PXFKI LL FAI LED ierror =’, ier ror
pri nt *, ’ichld id= ’, ichldi d
pri nt *, ’isig= ’, isi g
els e
pri nt *, ’PXFKI LL PAS SED’
end if
sto p "CH ILD "
els e
call PXFCON ST("WU NTR ACE D",iop ts, ier ror )
if (ierro r .ne . 0) the n
print *, ’PX FCO NST FAI LED , ier ror =’, ier ror
pri nt *, ’io pts =’, iop ts
else
print *, ’PX FCO NST PAS SED ’
end if
call PXFWAI TPID(i pid ,is tat,io pts ,ir etp id, ier ror )
if (ie rror.n e.0 )th en
pri nt *, ’PX FWA ITPID FAI LED, ierror =’, ier ror

004– 2165– 002 323


PXFWIFSTOPPED ( 3F ) PXFWIFSTOPPED ( 3F )

print *, ’ipid= ’, ipi d


print *, ’iretpid= ’, ire tpi d
print *, ’iopts=’, iop ts
print *, ’istat=’, ist at
els e
print *, ’PXFWAITP ID PAS SED ’
end if
if (ip id .ne. iretpi d) the n
pri nt *,’exp ect ed pids of chi ld to equal’
pri nt *,’fork pid of child= ’,i pid
print *,’ wait pid of chi ld= ’,iret pid
end if
if (PX FWI FSTOPPED( ist at) )then
pri nt *, ’PX FWI FST OPPED PAS S’
els e
pri nt *, ’IP XFW STO PSI G FAI L’
end if
cal l PXF CON ST("SIGKI LL" ,is ig,ier ror )
if (ie rror .ne. 0) the n
pri nt *, ’PX FCO NST FAI LED , ier ror=’, ier ror
pri nt *, ’is ig= ’, isi g
els e
pri nt *, ’PXFCO NST PAS SED ’
end if
cal l PXF KIL L(ipid,is ig, ier ror )
if (ie rror .ne. 0) the n
print *, ’PXFKILL FAI LED ier ror =’, ier ror
print *, ’ipid= ’, ipi d
print *, ’isig= ’, isi g
els e
pri nt *, ’PXFKI LL PAS SED ’
end if
end if
end if
pri nt *,’ test comple te’
end

SEE ALSO
IPXFWSTOPSIG(3F), PXFWAIT(3F)

324 004– 2165– 002


PXFUTIME ( 3F ) PXFUTIME ( 3F )

NAME
PXFUTIME – Sets access and modification times of a file

SYNOPSIS
CHARACTER*n path
INTEGER ilen, jutimbuf, ierror
CALL PXFUTIME(path, ilen, jutimbuf, ierror)

IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
IEEE standard interface for FORTRAN 77

DESCRIPTION
On IRIX systems, this routine is in libfortran.so which is linked by default when compiling programs
with the MIPSpro 7 Fortran 90 compiler or when compiling programs with the -craylibs option to the
MIPSpro F77 compiler.
The routine PXFUTIME provides the functionality of the utime(2) system call.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on UNICOS, UNICOS/mk, or IRIX
systems, all arguments must be of default kind unless documented otherwise. On UNICOS and
UNICOS/mk, default kind is KIND=8 for integer, real, complex, and logical arguments; on IRIX, the default
kind is KIND=4.
The following is a list of valid arguments for this routine:
path An input character variable or array element containing the name of the file.
ilen An input integer variable containing the length of path in characters. If ilen is zero, all
trailing blanks are removed before calling utime.
jutimbuf An input integer variable. It is a handle for a structure of type utimbuf. The handle must
be created by a call to the PXFSTRUCTCREATE(3F) routine prior to the call to PXFUTIME.
The names of the components of the utimbuf structure are actime and modtime. These
components can be accessed through the PXFINTSET subroutine. The functionality obtained
in utime by passing a NULL can be obtained in PXFUTIME by passing a handle argument
with a value of zero.
ierror An output integer variable that contains zero if the call to utime was successful or nonzero if
the call to utime was not completed.

004– 2165– 002 325


PXFUTIME ( 3F ) PXFUTIME ( 3F )

In addition to the errors returned by the utime(2) system call, PXFUTIME may return the following errors:
EINVAL If ilen is less than 0 or ilen is greater than LEN(path).
ENOMEM If PXFUTIME is unable to obtain memory to copy path.
EBADHANDLE If jutimbuf is an invalid handle or has an incorrect handle type (UNICOS and UNICOS/mk
systems only).

EXAMPLES

progra m tes t

cha racter*12 fil ea, fil eb


integer ilenfi la, ilenfi lb, jutimb uf, ierr

! cre ate fil e


ope n(file=’e xis tfile’ , uni t=9, status =’N EW’ )
wri te(9,* ) ’HI ’, 1.2 , 11, ’GOODB YE’
end file 9
clo se 9

fil ea = ’exist file’


ile nfila = 0
ile nfilb = 0

! Set file access and modifi cat ion tim e to cur ren t tim e
cal l pxf utime( filea, ile nfi la,0,i err )
if (ierr.ne. 0) the n
pri nt *,’ FAIL: pxf utime’
pri nt *,’non zer o sta tus on exi sti ng fil e = ’,i err
else
print *,’ PASS: pxfuti me’
print *,’ zero sta tus on existi ng fil e’
endif

end

The output of this test on a UNICOS system is:


PASS: pxfutime
zero sta tus on exi sting file

326 004– 2165– 002


INDEX

32 bits from 64 bits write ............................................................................... writibm(3F)........................................................ 104


32-bit words write ........................................................................................... writibm(3F)........................................................ 104
Abort NAMELIST job ..................................................................................... rnlskip(3F) ......................................................... 76
Accept data ...................................................................................................... acptbad(3F) ......................................................... 19
Accesses a single string element of a structure component that is an array .. pxfestrget(3F) ................................................ 207
ACPTBAD(3F) ................................................................................................. acptbad(3F) ......................................................... 19
acptbad(3F) ................................................................................................. acptbad(3F) ......................................................... 19
Add characters for NAMELIST ....................................................................... rnl(3F) ................................................................... 73
alarm ................................................................................................................ pxfalarm(3F) ..................................................... 182
Allows an index to be used as the current index by creating a subindex ...... stindx(3F) ............................................................ 86
Allows components of a structure to be set or modified ................................ pxfintset(3F) ................................................... 251
Allows each NAMELIST variable to begin on a new line ............................. wnlline(3F) ......................................................... 96
Allows values stored in individual components of a structure to be
extracted and used ........................................................................................... pxfintget(3F) ................................................... 250
Allows values stored in individual components of a structure to be
extracted and used ........................................................................................... pxfstrget(3F) ................................................... 289
Allows values stored in individual components of a structure to be set ........ pxfstrset(3F) ................................................... 291
Alternate tape path (disable) ........................................................................... startsp(3F) ......................................................... 85
Analogous stride ............................................................................................. fflistio(3C) ..................................................... 137
APUTWA(3F) .................................................................................................... putwa(3F) .............................................................. 64
aputwa(3F) .................................................................................................... putwa(3F) .............................................................. 64
AQCLOSE(3F) ................................................................................................. aqclose(3F) ......................................................... 22
aqclose(3F) ................................................................................................. aqclose(3F) ......................................................... 22
AQIO ............................................................................................................... aqrecall(3F) ....................................................... 27
AQIO close ..................................................................................................... aqclose(3F) ......................................................... 22
AQIO dataset open .......................................................................................... aqopen(3F) ............................................................ 23
AQIO file close ............................................................................................... aqclose(3F) ......................................................... 22
AQIO status .................................................................................................... aqstat(3F) ............................................................ 29
AQIO wait ....................................................................................................... aqwait(3F) ............................................................ 31
AQIO write ..................................................................................................... aqwrite(3F) ......................................................... 32
AQIO(3F) ........................................................................................................ intro_io(3F) ......................................................... 9
aqio(3F) ........................................................................................................ intro_io(3F) ......................................................... 9
AQOPEN(3F) .................................................................................................... aqopen(3F) ............................................................ 23
aqopen(3F) .................................................................................................... aqopen(3F) ............................................................ 23
AQOPENM(3F) ................................................................................................. aqopen(3F) ............................................................ 23
aqopenm(3F) ................................................................................................. aqopen(3F) ............................................................ 23
AQREAD(3F) .................................................................................................... aqread(3F) ............................................................ 25
aqread(3F) .................................................................................................... aqread(3F) ............................................................ 25
AQREADC(3F) ................................................................................................. aqread(3F) ............................................................ 25
aqreadc(3F) ................................................................................................. aqread(3F) ............................................................ 25
AQRECALL(3F) ............................................................................................... aqrecall(3F) ....................................................... 27
aqrecall(3F) ............................................................................................... aqrecall(3F) ....................................................... 27
AQSTAT(3F) .................................................................................................... aqstat(3F) ............................................................ 29
aqstat(3F) .................................................................................................... aqstat(3F) ............................................................ 29
AQWAIT(3F) .................................................................................................... aqwait(3F) ............................................................ 31
aqwait(3F) .................................................................................................... aqwait(3F) ............................................................ 31
AQWRITE(3F) ................................................................................................. aqwrite(3F) ......................................................... 32

004– 2165– 002 Index-1


aqwrite(3F) ................................................................................................. aqwrite(3F) ......................................................... 32
AQWRITEC(3F) ............................................................................................... aqwrite(3F) ......................................................... 32
aqwritec(3F) ............................................................................................... aqwrite(3F) ......................................................... 32
ASNCTL(3F) .................................................................................................... asnctl(3F) ............................................................ 34
asnctl(3F) .................................................................................................... asnctl(3F) ............................................................ 34
ASNFILE(3F) ................................................................................................. assign(3F) ............................................................ 38
asnfile(3F) ................................................................................................. assign(3F) ............................................................ 38
ASNQFILE(3F) ............................................................................................... asnqfile(3F) ....................................................... 36
asnqfile(3F) ............................................................................................... asnqfile(3F) ....................................................... 36
ASNQUNIT(3F) ............................................................................................... asnqfile(3F) ....................................................... 36
asnqunit(3F) ............................................................................................... asnqfile(3F) ....................................................... 36
ASNRM(3F) ...................................................................................................... assign(3F) ............................................................ 38
asnrm(3F) ...................................................................................................... assign(3F) ............................................................ 38
ASNUNIT(3F) ................................................................................................. assign(3F) ............................................................ 38
asnunit(3F) ................................................................................................. assign(3F) ............................................................ 38
Assign environment ........................................................................................ assign(3F) ............................................................ 38
Assign options ................................................................................................. asnqfile(3F) ....................................................... 36
assign processing, C interface ......................................................................... ffassign(3C) ..................................................... 127
ASSIGN(3F) .................................................................................................... assign(3F) ............................................................ 38
assign(3F) .................................................................................................... assign(3F) ............................................................ 38
ASYNCDR(3F) ................................................................................................. asyncms(3F) ......................................................... 40
asyncdr(3F) ................................................................................................. asyncms(3F) ......................................................... 40
Asynchronous .................................................................................................. fflistio(3C) ..................................................... 137
Asynchronous .................................................................................................. ffreada(3C) ....................................................... 152
Asynchronous .................................................................................................. ffwritea(3C) ..................................................... 161
Asynchronous I/O ........................................................................................... ffreada(3C) ....................................................... 152
Asynchronous I/O status check ....................................................................... checkms(3F) ......................................................... 42
Asynchronous mode ........................................................................................ asyncms(3F) ......................................................... 40
Asynchronous read .......................................................................................... ffreada(3C) ....................................................... 152
Asynchronous read .......................................................................................... aqread(3F) ............................................................ 25
Asynchronous status ........................................................................................ aqstat(3F) ............................................................ 29
Asynchronous write ........................................................................................ ffwritea(3C) ..................................................... 161
Asynchronous write ........................................................................................ aqwrite(3F) ......................................................... 32
ASYNCMS(3F) ................................................................................................. asyncms(3F) ......................................................... 40
asyncms(3F) ................................................................................................. asyncms(3F) ......................................................... 40
Bad data .......................................................................................................... acptbad(3F) ......................................................... 19
Bad data skip .................................................................................................. skipbad(3F) ......................................................... 81
blanks for value ............................................................................................... fsup(3F)................................................................. 53
block special files ............................................................................................ pxfisblk(3F) ..................................................... 254
Block tape position ......................................................................................... settp(3F) .............................................................. 79
Blocks in file ................................................................................................... numblks(3F) ......................................................... 60
Buffer record into ............................................................................................ findms(3F) ............................................................ 49
Byte and bit manipulation ............................................................................... intro_pxf(3F) ................................................... 165
C interface for assign processing .................................................................... ffassign(3C) ..................................................... 127
C routines and calls ........................................................................................ intro_applibs(3F) ............................................. 1
callseq(3F) ................................................................................................. callseq(3F) ........................................................... 3
change output value ........................................................................................ fsup(3F)................................................................. 53
Changes the current directory to a specified directory ................................... pxfchdir(3F) ..................................................... 184
Changes the owner and group of a file .......................................................... pxfchown(3F) ..................................................... 189
Changes the root directory to a specified directory ........................................ pxfchroot(3F) ................................................... 191

Index-2 004– 2165– 002


Character changes NAMELIST ....................................................................... rnl(3F) ................................................................... 73
Character functions ......................................................................................... intro_pxf(3F) ................................................... 165
Character read ................................................................................................. readc(3F) .............................................................. 68
Character write ................................................................................................ writec(3F) .......................................................... 102
Check AQIO status ......................................................................................... aqstat(3F) ............................................................ 29
Check status of I/O ......................................................................................... checkms(3F) ......................................................... 42
Check tape position ......................................................................................... checktp(3F) ......................................................... 44
CHECKDR(3F) ................................................................................................. checkms(3F) ......................................................... 42
checkdr(3F) ................................................................................................. checkms(3F) ......................................................... 42
CHECKMS(3F) ................................................................................................. checkms(3F) ......................................................... 42
checkms(3F) ................................................................................................. checkms(3F) ......................................................... 42
Checks status of asynchronous random-access I/O operation ........................ checkms(3F) ......................................................... 42
Checks tape position ....................................................................................... checktp(3F) ......................................................... 44
Checks the accessibility of a named file ......................................................... pxfaccess(3F) ................................................... 180
Checks the status of asynchronous queued I/O requests ................................ aqstat(3F) ............................................................ 29
CHECKTP(3F) ................................................................................................. checktp(3F) ......................................................... 44
checktp(3F) ................................................................................................. checktp(3F) ......................................................... 44
child process exit ............................................................................................ pxfwifexited(3F) ............................................ 317
child process termination ................................................................................ ipxfwtermsig(3F) ............................................ 177
Clears all environment variables ..................................................................... pxfclearenv(3F) .............................................. 193
CLOSDR(3F) .................................................................................................... closms(3F) ............................................................ 46
closdr(3F) .................................................................................................... closms(3F) ............................................................ 46
Close and finalize random access file ............................................................. wclose(3F) ............................................................ 93
Close AQIO file .............................................................................................. aqclose(3F) ......................................................... 22
Close file ......................................................................................................... ffopen(3C) ......................................................... 141
Close volume .................................................................................................. closev(3F) ............................................................ 45
Closes an asynchronous queued I/O file ......................................................... aqclose(3F) ......................................................... 22
Closes volume and mounts next volume in Volume Identifier list ................ closev(3F) ............................................................ 45
CLOSEV(3F) .................................................................................................... closev(3F) ............................................................ 45
closev(3F) .................................................................................................... closev(3F) ............................................................ 45
CLOSMS(3F) .................................................................................................... closms(3F) ............................................................ 46
closms(3F) .................................................................................................... closms(3F) ............................................................ 46
Compares unsigned integers ........................................................................... pxfucompare(3F) .............................................. 305
Compatibility of libraries among machines .................................................... intro_applibs(3F) ............................................. 1
Component name ............................................................................................ pxfstructcreate(3F) ..................................... 295
Components ..................................................................................................... pxfintget(3F) ................................................... 250
Components ..................................................................................................... pxfintset(3F) ................................................... 251
Controls function of ASSIGN, ASNFILE, ASNUNIT, and ASNRM
routines ............................................................................................................ asnctl(3F) ............................................................ 34
Conversion input type ..................................................................................... rnltype(3F) ......................................................... 77
Converts to local time ..................................................................................... pxflocaltime(3F) ............................................ 266
Copies structure ............................................................................................... pxfstructcopy(3F) ......................................... 293
Create subindex ............................................................................................... stindx(3F) ............................................................ 86
Creates a link to a file ..................................................................................... pxflink(3F)........................................................ 264
Creates a new file or rewrites an existing file ................................................ pxfcreat(3F) ..................................................... 199
Creates a new session for a calling process ................................................... pxfsetsid(3F) ................................................... 281
Creates a process ............................................................................................. pxffork(3F)........................................................ 219
Creates an instance of the desired structure and returns a nonzero handle
in the argument jhandle .................................................................................. pxfstructcreate(3F) ..................................... 295
Data ................................................................................................................. ffread(3C) ......................................................... 149

004– 2165– 002 Index-3


Data accept ...................................................................................................... acptbad(3F) ......................................................... 19
Data bad skip .................................................................................................. skipbad(3F) ......................................................... 81
Data buffer a record ........................................................................................ findms(3F) ............................................................ 49
Data reading .................................................................................................... getwa(3F) .............................................................. 57
Data transfer (asynchronous) .......................................................................... aqread(3F) ............................................................ 25
Data writing .................................................................................................... write(3F) ............................................................ 100
Defines a group of processes to be associated with a global file. .................. glio_group(3F) ................................................ 163
delay process execution .................................................................................. pxfsleep(3F) ..................................................... 285
Delays process execution ................................................................................ pxfsleep(3F) ..................................................... 285
Delete characters for NAMELIST ................................................................... rnl(3F) ................................................................... 73
Deletes the instance of the structure referenced by jhandle ........................... pxfstructfree(3F) ......................................... 297
Delimiter NAMELIST change ......................................................................... wnl(3F) ................................................................... 94
Describes performance options available with the FFIO layers ..................... intro_ffio(3F) ................................................ 113
Details the calling sequence for UNICOS systems ........................................ callseq(3F) ........................................................... 3
Determines action if type mismatch occurs across equal sign on
NAMELIST input record ................................................................................. rnltype(3F) ......................................................... 77
Determines if a child process has stopped ..................................................... pxfwifstopped(3F) ......................................... 322
Determines if child process exited with exit ............................................... pxfwifexited(3F) ............................................ 317
Determines if file descriptor corresponds to a valid file descriptor ............... pxfisatty(3F) ................................................... 252
Determines if the child process terminated because of a signal .................... pxfwifsignaled(3F) ....................................... 319
directory file test ............................................................................................. pxfisdir(3F) ..................................................... 258
Disable EOV processing ................................................................................. setsp(3F) .............................................................. 78
Disables special tape processing ..................................................................... endsp(3F) .............................................................. 48
Disk random access write ............................................................................... writms(3F) .......................................................... 105
Echo lines NAMELIST .................................................................................... rnlecho(3F) ......................................................... 75
Enable EOV processing .................................................................................. setsp(3F) .............................................................. 78
Enables and disables EOV processing ............................................................ setsp(3F) .............................................................. 78
Enables special tape processing ...................................................................... startsp(3F) ......................................................... 85
ENDSP(3F) ...................................................................................................... endsp(3F) .............................................................. 48
endsp(3F) ...................................................................................................... endsp(3F) .............................................................. 48
Environment list .............................................................................................. pxfgetenv(3F) ................................................... 226
Environment name .......................................................................................... pxfgetenv(3F) ................................................... 226
EOV processing .............................................................................................. setsp(3F) .............................................................. 78
Error unit NAMELIST ..................................................................................... rnlecho(3F) ......................................................... 75
error values returned ....................................................................................... pxfconst(3F) ..................................................... 195
Executes a new process image file ................................................................. pxfexecv(3F) ..................................................... 209
ffassign(3C) .............................................................................................. ffassign(3C) ..................................................... 127
ffbksp(3C) ................................................................................................... ffseek(3C) ......................................................... 156
ffbkspf(3C) ................................................................................................. ffseek(3C) ......................................................... 156
ffclose(3C) ................................................................................................. ffopen(3C) ......................................................... 141
ffclosef(3C) .............................................................................................. ffopen(3C) ......................................................... 141
fffcntl(3C) ................................................................................................. fffcntl(3C) ....................................................... 128
ffflush(3C) ................................................................................................. ffread(3C) ......................................................... 149
FFIO ................................................................................................................ ffstrerror(3C) ................................................ 160
FFIO ................................................................................................................ ffwritea(3C) ..................................................... 161
FFIO error string ............................................................................................. ffstrerror(3C) ................................................ 160
FFIO specifications ......................................................................................... intro_ffio(3F) ................................................ 113
FFIO(3F) ........................................................................................................ intro_ffio(3F) ................................................ 113
ffio(3F) ........................................................................................................ intro_ffio(3F) ................................................ 113
ffiolock(3C) .............................................................................................. ffiolock(3C) ..................................................... 136

Index-4 004– 2165– 002


ffiounlock(3C) .......................................................................................... ffiolock(3C) ..................................................... 136
fflistio(3C) .............................................................................................. fflistio(3C) ..................................................... 137
fflistreq structure .................................................................................... fflistio(3C) ..................................................... 137
ffopen(3C) ................................................................................................... ffopen(3C) ......................................................... 141
ffopenf(3C) ................................................................................................. ffopen(3C) ......................................................... 141
ffopens(3C) ................................................................................................. ffopen(3C) ......................................................... 141
ffpos(3C) ...................................................................................................... ffpos(3C) ............................................................ 145
ffread(3C) ................................................................................................... ffread(3C) ......................................................... 149
ffreada(3C) ................................................................................................. ffreada(3C) ....................................................... 152
ffreadf(3C) ................................................................................................. ffread(3C) ......................................................... 149
ffseek(3C) ................................................................................................... ffseek(3C) ......................................................... 156
ffseekf(3C) ................................................................................................. ffseek(3C) ......................................................... 156
ffsetsp(3C) ................................................................................................. ffsetsp(3C) ....................................................... 159
FFSTRERROR(3C) .......................................................................................... ffstrerror(3C) ................................................ 160
ffstrerror(3C) .......................................................................................... ffstrerror(3C) ................................................ 160
ffweod(3C) ................................................................................................... ffread(3C) ......................................................... 149
ffweodf(3C) ................................................................................................. ffread(3C) ......................................................... 149
ffweof(3C) ................................................................................................... ffread(3C) ......................................................... 149
ffweoff(3C) ................................................................................................. ffread(3C) ......................................................... 149
ffwrite(3C) ................................................................................................. ffread(3C) ......................................................... 149
ffwritea(3C) .............................................................................................. ffwritea(3C) ..................................................... 161
ffwritef(3C) .............................................................................................. ffread(3C) ......................................................... 149
FIFO speical file test ....................................................................................... pxfisfifo(3F) ................................................... 260
File close (random access) .............................................................................. wclose(3F) ............................................................ 93
File descriptor ................................................................................................. pxffileno(3F) ................................................... 218
File descriptor ................................................................................................. gtstdptr(3F) ....................................................... 59
file descriptor check ........................................................................................ pxfisatty(3F) ................................................... 252
File memory reduce ........................................................................................ stindx(3F) ............................................................ 86
File open ......................................................................................................... openms(3F) ............................................................ 61
File size in blocks ........................................................................................... numblks(3F) ......................................................... 60
File stride ........................................................................................................ fflistio(3C) ..................................................... 137
FILE structure ................................................................................................. gtstdptr(3F) ....................................................... 59
File tape position ............................................................................................. settp(3F) .............................................................. 79
fileattr(3F) ............................................................................................... asnqfile(3F) ....................................................... 36
Finalizes changes and closes word-addressable, random-access file .............. wclose(3F) ............................................................ 93
FINDMS(3F) .................................................................................................... findms(3F) ............................................................ 49
findms(3F) .................................................................................................... findms(3F) ............................................................ 49
Flexible File I/O .............................................................................................. fffcntl(3C) ....................................................... 128
Flexible File I/O .............................................................................................. ffopen(3C) ......................................................... 141
Flexible File I/O .............................................................................................. ffpos(3C) ............................................................ 145
Flexible File I/O .............................................................................................. ffread(3C) ......................................................... 149
Flexible File I/O .............................................................................................. ffseek(3C) ......................................................... 156
Flexible File I/O .............................................................................................. ffsetsp(3C) ....................................................... 159
Flock structure ................................................................................................. pxffcntl(3F) ..................................................... 216
FLUSH(3F) ...................................................................................................... flush(3F) .............................................................. 51
flush(3F) ...................................................................................................... flush(3F) .............................................................. 51
Foreign dataset conversion .............................................................................. ffopen(3C) ......................................................... 141
Foreign dataset conversion .............................................................................. ffread(3C) ......................................................... 149
Foreign dataset conversion .............................................................................. ffseek(3C) ......................................................... 156
Format output control ..................................................................................... wnl(3F) ................................................................... 94

004– 2165– 002 Index-5


Fortran output change ..................................................................................... fsup(3F)................................................................. 53
FSUP(3F) ........................................................................................................ fsup(3F)................................................................. 53
fsup(3F) ........................................................................................................ fsup(3F)................................................................. 53
FSUPC(3F) ...................................................................................................... fsup(3F)................................................................. 53
fsupc(3F) ...................................................................................................... fsup(3F)................................................................. 53
Full record (read) ............................................................................................ readc(3F) .............................................................. 68
Full-record mode ............................................................................................. write(3F) ............................................................ 100
Full-record read ............................................................................................... read(3F)................................................................. 66
Function control (ASSIGN) ............................................................................ asnctl(3F) ............................................................ 34
Function of ASSIGN and other routines ........................................................ asnctl(3F) ............................................................ 34
Generates terminal pathname .......................................................................... pxfctermid(3F) ................................................ 202
Get FFIO error message string ....................................................................... ffstrerror(3C) ................................................ 160
Gets effective user ID ..................................................................................... pxfgeteuid(3F) ................................................ 229
Gets group information using the group ID ................................................... pxfgetgrgid(3F) .............................................. 231
Gets group information using the group name ............................................... pxfgetgrnam(3F) .............................................. 233
Gets information about an opened tape file .................................................... gettp(3F) .............................................................. 54
Gets password information about login name ................................................ pxfgetpwnam(3F) .............................................. 245
Gets password information by using user ID ................................................. pxfgetpwuid(3F) .............................................. 247
Gets process times .......................................................................................... pxftimes(3F) ..................................................... 303
Gets supplementary group IDs ........................................................................ pxfgetgroups(3F) ............................................ 235
Gets system time ............................................................................................. pxftime(3F)........................................................ 301
Gets the effective group ID ............................................................................ pxfgetegid(3F) ................................................ 225
Gets the parent process ID .............................................................................. pxfgetppid(3F) ................................................ 243
Gets the pathname of the working directory .................................................. pxfgetcwd(3F) ................................................... 223
Gets the process group ID .............................................................................. pxfgetpgrp(3F) ................................................ 239
Gets the process ID ......................................................................................... pxfgetpid(3F) ................................................... 241
Gets the real group ID .................................................................................... pxfgetgid(3F) ................................................... 230
Gets the real user ID ....................................................................................... pxfgetuid(3F) ................................................... 249
Gets user name ................................................................................................ pxfgetlogin(3F) .............................................. 237
GETTP(3F) ...................................................................................................... gettp(3F) .............................................................. 54
gettp(3F) ...................................................................................................... gettp(3F) .............................................................. 54
GETWA(3F) ...................................................................................................... getwa(3F) .............................................................. 57
getwa(3F) ...................................................................................................... getwa(3F) .............................................................. 57
glio_group(3F) .......................................................................................... glio_group(3F) ................................................ 163
glio_group_mpi(3F) ................................................................................. glio_group(3F) ................................................ 163
glio_group_shmem(3F) ............................................................................ glio_group(3F) ................................................ 163
GTSTDPTR(3F) ............................................................................................... gtstdptr(3F) ....................................................... 59
gtstdptr(3F) ............................................................................................... gtstdptr(3F) ....................................................... 59
IBM floating-point .......................................................................................... readibm(3F) ......................................................... 70
IBM words read .............................................................................................. readibm(3F) ......................................................... 70
IBM words write ............................................................................................. writibm(3F)........................................................ 104
IBM-from-Cray read ....................................................................................... readibm(3F) ......................................................... 70
IEEE(3F) ........................................................................................................ intro_pxf(3F) ................................................... 165
Index (write master) ........................................................................................ closms(3F) ............................................................ 46
Initial value ..................................................................................................... pxfstructcreate(3F) ..................................... 295
Initiates a list of I/O requests using flexible file I/O ...................................... fflistio(3C) ..................................................... 137
Initiates EOV processing for files opened using flexible file I/O .................. ffsetsp(3C) ....................................................... 159
Input ................................................................................................................ read(3F)................................................................. 66
Input type mismatch ........................................................................................ rnltype(3F) ......................................................... 77
Input wait for end ........................................................................................... waitms(3F) ............................................................ 91

Index-6 004– 2165– 002


Interlanguage calls .......................................................................................... intro_applibs(3F) ............................................. 1
interpret child process exit .............................................................................. pxfwifexited(3F) ............................................ 317
interpret exit argument .................................................................................... ipxfwexitstatus(3F) ..................................... 171
interpret signal number ................................................................................... ipxfwstopsig(3F) ............................................ 174
intro1(3F) .................................................................................................... intro_applibs(3F) ............................................. 1
intro5(3F) .................................................................................................... intro_io(3F) ......................................................... 9
intro9(3F) .................................................................................................... intro_pxf(3F) ................................................... 165
INTRO_APPLIBS(3F) ................................................................................... intro_applibs(3F) ............................................. 1
intro_applibs(3F) ................................................................................... intro_applibs(3F) ............................................. 1
Introduction to CrayLibs Application Libraries .............................................. intro_applibs(3F) ............................................. 1
Introduction to Fortran-callable I/O routines .................................................. intro_io(3F) ......................................................... 9
introduction to I/O routines ............................................................................. intro_io(3F) ......................................................... 9
Introduction to PXF POSIX library ................................................................ intro_pxf(3F) ................................................... 165
INTRO_FFIO(3F) .......................................................................................... intro_ffio(3F) ................................................ 113
intro_ffio(3F) .......................................................................................... intro_ffio(3F) ................................................ 113
INTRO_IO(3F) ............................................................................................... intro_io(3F) ......................................................... 9
intro_io(3F) ............................................................................................... intro_io(3F) ......................................................... 9
INTRO_PXF(3F) ............................................................................................. intro_pxf(3F) ................................................... 165
intro_pxf(3F) ............................................................................................. intro_pxf(3F) ................................................... 165
intro_specialibs(3F) ............................................................................ intro_pxf(3F) ................................................... 165
I/O asynchronous ............................................................................................ aqopen(3F) ............................................................ 23
I/O check of status .......................................................................................... checkms(3F) ......................................................... 42
I/O mode (asynchronous) ................................................................................ asyncms(3F) ......................................................... 40
I/O mode to synchronous ................................................................................ syncms(3F) ............................................................ 88
I/O open .......................................................................................................... openms(3F) ............................................................ 61
I/O read (asynchronous) .................................................................................. aqread(3F) ............................................................ 25
I/O request ....................................................................................................... ffreada(3C) ....................................................... 152
I/O requests ..................................................................................................... fflistio(3C) ..................................................... 137
I/O routines ..................................................................................................... intro_io(3F) ......................................................... 9
I/O wait (AQIO) ............................................................................................. aqwait(3F) ............................................................ 31
I/O wait (asynchronous) .................................................................................. aqwait(3F) ............................................................ 31
I/O wait (asynchronous operation) .................................................................. waitms(3F) ............................................................ 91
I/O write (AQIO) ............................................................................................ aqwrite(3F) ......................................................... 32
IPXFARGC(3F) ............................................................................................... ipxfargc(3F) ..................................................... 170
ipxfargc(3F) ............................................................................................... ipxfargc(3F) ..................................................... 170
IPXFCONST(3F) ............................................................................................. pxfconst(3F) ..................................................... 195
ipxfconst(3F) ............................................................................................. pxfconst(3F) ..................................................... 195
IPXFWEXITSTATUS(3F) .............................................................................. ipxfwexitstatus(3F) ..................................... 171
ipxfwexitstatus(3F) .............................................................................. ipxfwexitstatus(3F) ..................................... 171
IPXFWSTOPSIG(3F) ...................................................................................... ipxfwstopsig(3F) ............................................ 174
ipxfwstopsig(3F) ...................................................................................... ipxfwstopsig(3F) ............................................ 174
IPXFWTERMSIG(3F) ...................................................................................... ipxfwtermsig(3F) ............................................ 177
ipxfwtermsig(3F) ...................................................................................... ipxfwtermsig(3F) ............................................ 177
ISUP(3F) ........................................................................................................ fsup(3F)................................................................. 53
isup(3F) ........................................................................................................ fsup(3F)................................................................. 53
ISUPC(3F) ...................................................................................................... fsup(3F)................................................................. 53
isupc(3F) ...................................................................................................... fsup(3F)................................................................. 53
Length of output line ...................................................................................... wnllong(3F) ......................................................... 97
Library buffering ............................................................................................. pxffileno(3F) ................................................... 218
Line length on output ...................................................................................... wnllong(3F) ......................................................... 97

004– 2165– 002 Index-7


List .................................................................................................................. fflistio(3C) ..................................................... 137
Makes bad data available ................................................................................ acptbad(3F) ......................................................... 19
Manipulate files ............................................................................................... fffcntl(3C) ....................................................... 128
Manipulate files ............................................................................................... ffpos(3C) ............................................................ 145
Manipulate files ............................................................................................... ffsetsp(3C) ....................................................... 159
Manipulates characters recognized by NAMELIST ........................................ rnl(3F) ................................................................... 73
Master index (write) ........................................................................................ closms(3F) ............................................................ 46
Memory less for file ........................................................................................ stindx(3F) ............................................................ 86
Mode (asynchronous) ...................................................................................... asyncms(3F) ......................................................... 40
Mode to synchronous ...................................................................................... syncms(3F) ............................................................ 88
modify output value ........................................................................................ fsup(3F)................................................................. 53
Mount next volume ......................................................................................... closev(3F) ............................................................ 45
NAMELIST delimiter change .......................................................................... wnl(3F) ................................................................... 94
NAMELIST error unit ..................................................................................... rnlecho(3F) ......................................................... 75
NAMELIST input changes .............................................................................. rnl(3F) ................................................................... 73
NAMELIST record skip ................................................................................... rnlskip(3F) ......................................................... 76
NAMELIST variable on new line .................................................................... wnlline(3F) ......................................................... 96
NUMBLKS(3F) ................................................................................................. numblks(3F) ......................................................... 60
numblks(3F) ................................................................................................. numblks(3F) ......................................................... 60
Obtains information about a calling process’ child process ........................... pxfwait(3F)........................................................ 313
Open AQIO file ............................................................................................... aqopen(3F) ............................................................ 23
Open file .......................................................................................................... ffopen(3C) ......................................................... 141
Open file .......................................................................................................... openms(3F) ............................................................ 61
Open random access ....................................................................................... wopen(3F) .............................................................. 98
OPENDR(3F) .................................................................................................... openms(3F) ............................................................ 61
opendr(3F) .................................................................................................... openms(3F) ............................................................ 61
OPENMS(3F) .................................................................................................... openms(3F) ............................................................ 61
openms(3F) .................................................................................................... openms(3F) ............................................................ 61
Opens a file for asynchronous queued I/O ..................................................... aqopen(3F) ............................................................ 23
Opens a local file as a random-access file that can be accessed or
changed by the record-addressable, random-access file I/O routines ............. openms(3F) ............................................................ 61
Opens a word-addressable, random-access file ............................................... wopen(3F) .............................................................. 98
Opens or closes a file using flexible file I/O .................................................. ffopen(3C) ......................................................... 141
Output characters ............................................................................................ writec(3F) .......................................................... 102
Output data ...................................................................................................... write(3F) ............................................................ 100
Output format control ..................................................................................... wnl(3F) ................................................................... 94
Output line length ........................................................................................... wnllong(3F) ......................................................... 97
Output unit NAMELIST .................................................................................. rnlecho(3F) ......................................................... 75
output value change ........................................................................................ fsup(3F)................................................................. 53
Output wait for end ......................................................................................... waitms(3F) ............................................................ 91
Packing routines .............................................................................................. intro_pxf(3F) ................................................... 165
Partial record (read) ........................................................................................ readc(3F) .............................................................. 68
Partial-record mode ......................................................................................... write(3F) ............................................................ 100
Partial-record read ........................................................................................... read(3F)................................................................. 66
Pascal routines and calls ................................................................................. intro_applibs(3F) ............................................. 1
Performs directory operations ......................................................................... pxfdirectory(3F) ............................................ 204
Performs functions on files opened using flexible file I/O ............................. fffcntl(3C) ....................................................... 128
Ported COS routines ....................................................................................... intro_pxf(3F) ................................................... 165
Position at tape block ...................................................................................... settp(3F) .............................................................. 79
Position information ........................................................................................ gettp(3F) .............................................................. 54

Index-8 004– 2165– 002


Positions a tape file at a tape block and/or a tape volume ............................. settp(3F) .............................................................. 79
Positions files opened using flexible file I/O .................................................. ffpos(3C) ............................................................ 145
Posix routine ................................................................................................... ipxfargc(3F) ..................................................... 170
Posix routine ................................................................................................... pxfgetarg(3F) ................................................... 222
process execution delay .................................................................................. pxfsleep(3F) ..................................................... 285
Provide locking for FFIO functions ................................................................ ffiolock(3C) ..................................................... 136
Provides a Fortran interface to the open(2) system call ............................... pxfopen(3F)........................................................ 268
Provides a subset of fcntl(2) functionality, except the third argument is
always an integer ............................................................................................ pxffcntl(3F) ..................................................... 216
Provides asynchronous read using flexible file I/O ........................................ ffreada(3C) ....................................................... 152
Provides asynchronous write using flexible file I/O ....................................... ffwritea(3C) ..................................................... 161
Provides flexible file I/O ................................................................................. ffread(3C) ......................................................... 149
Provides library interface to assign processing ............................................... ffassign(3C) ..................................................... 127
Provides library interface to assign processing .......................................... assign(3F) ............................................................ 38
Provides user control of NAMELIST output format ....................................... wnl(3F) ................................................................... 94
PUTWA(3F) ...................................................................................................... putwa(3F) .............................................................. 64
putwa(3F) ...................................................................................................... putwa(3F) .............................................................. 64
PXFACCESS(3F) ............................................................................................. pxfaccess(3F) ................................................... 180
pxfaccess(3F) ............................................................................................. pxfaccess(3F) ................................................... 180
PXFALARM(3F) ............................................................................................... pxfalarm(3F) ..................................................... 182
pxfalarm(3F) ............................................................................................... pxfalarm(3F) ..................................................... 182
PXFCHDIR(3F) ............................................................................................... pxfchdir(3F) ..................................................... 184
pxfchdir(3F) ............................................................................................... pxfchdir(3F) ..................................................... 184
PXFCHMOD(3F) ............................................................................................... pxfchmod(3F) ..................................................... 186
pxfchmod(3F) ............................................................................................... pxfchmod(3F) ..................................................... 186
PXFCHOWN(3F) ............................................................................................... pxfchown(3F) ..................................................... 189
pxfchown(3F) ............................................................................................... pxfchown(3F) ..................................................... 189
PXFCHROOT(3F) ............................................................................................. pxfchroot(3F) ................................................... 191
pxfchroot(3F) ............................................................................................. pxfchroot(3F) ................................................... 191
PXFCLEARENV(3F) ........................................................................................ pxfclearenv(3F) .............................................. 193
pxfclearenv(3F) ........................................................................................ pxfclearenv(3F) .............................................. 193
pxfclosedir(3F) ........................................................................................ pxfdirectory(3F) ............................................ 204
PXFCLOSEDIR,(3F) ...................................................................................... pxfdirectory(3F) ............................................ 204
PXFCONST(3F) ............................................................................................... pxfconst(3F) ..................................................... 195
pxfconst(3F) ............................................................................................... pxfconst(3F) ..................................................... 195
PXFCREAT(3F) ............................................................................................... pxfcreat(3F) ..................................................... 199
pxfcreat(3F) ............................................................................................... pxfcreat(3F) ..................................................... 199
PXFCTERMID(3F) .......................................................................................... pxfctermid(3F) ................................................ 202
pxfctermid(3F) .......................................................................................... pxfctermid(3F) ................................................ 202
pxfdirectory(3F) ...................................................................................... pxfdirectory(3F) ............................................ 204
PXFESTRGET(3F) .......................................................................................... pxfestrget(3F) ................................................ 207
pxfestrget(3F) .......................................................................................... pxfestrget(3F) ................................................ 207
PXFEXECV(3F) ............................................................................................... pxfexecv(3F) ..................................................... 209
pxfexecv(3F) ............................................................................................... pxfexecv(3F) ..................................................... 209
PXFEXECVE(3F) ............................................................................................. pxfexecv(3F) ..................................................... 209
pxfexecve(3F) ............................................................................................. pxfexecv(3F) ..................................................... 209
PXFEXECVP(3F) ............................................................................................. pxfexecv(3F) ..................................................... 209
pxfexecvp(3F) ............................................................................................. pxfexecv(3F) ..................................................... 209
PXFFCNTL(3F) ............................................................................................... pxffcntl(3F) ..................................................... 216
pxffcntl(3F) ............................................................................................... pxffcntl(3F) ..................................................... 216

004– 2165– 002 Index-9


PXFFILENO(3F) ............................................................................................. pxffileno(3F) ................................................... 218
pxffileno(3F) ............................................................................................. pxffileno(3F) ................................................... 218
PXFFORK(3F) ................................................................................................. pxffork(3F)........................................................ 219
pxffork(3F) ................................................................................................. pxffork(3F)........................................................ 219
PXFGETARG(3F) ............................................................................................. pxfgetarg(3F) ................................................... 222
pxfgetarg(3F) ............................................................................................. pxfgetarg(3F) ................................................... 222
PXFGETCWD(3F) ............................................................................................. pxfgetcwd(3F) ................................................... 223
pxfgetcwd(3F) ............................................................................................. pxfgetcwd(3F) ................................................... 223
PXFGETEGID(3F) .......................................................................................... pxfgetegid(3F) ................................................ 225
pxfgetegid(3F) .......................................................................................... pxfgetegid(3F) ................................................ 225
PXFGETENV(3F) ............................................................................................. pxfgetenv(3F) ................................................... 226
pxfgetenv(3F) ............................................................................................. pxfgetenv(3F) ................................................... 226
PXFGETEUID(3F) .......................................................................................... pxfgeteuid(3F) ................................................ 229
pxfgeteuid(3F) .......................................................................................... pxfgeteuid(3F) ................................................ 229
PXFGETGID(3F) ............................................................................................. pxfgetgid(3F) ................................................... 230
pxfgetgid(3F) ............................................................................................. pxfgetgid(3F) ................................................... 230
PXFGETGRGID(3F) ........................................................................................ pxfgetgrgid(3F) .............................................. 231
pxfgetgrgid(3F) ........................................................................................ pxfgetgrgid(3F) .............................................. 231
PXFGETGRNAM(3F) ........................................................................................ pxfgetgrnam(3F) .............................................. 233
pxfgetgrnam(3F) ........................................................................................ pxfgetgrnam(3F) .............................................. 233
PXFGETGROUPS(3F) ...................................................................................... pxfgetgroups(3F) ............................................ 235
pxfgetgroups(3F) ...................................................................................... pxfgetgroups(3F) ............................................ 235
PXFGETLOGIN(3F) ........................................................................................ pxfgetlogin(3F) .............................................. 237
pxfgetlogin(3F) ........................................................................................ pxfgetlogin(3F) .............................................. 237
PXFGETPGRP(3F) .......................................................................................... pxfgetpgrp(3F) ................................................ 239
pxfgetpgrp(3F) .......................................................................................... pxfgetpgrp(3F) ................................................ 239
PXFGETPID(3F) ............................................................................................. pxfgetpid(3F) ................................................... 241
pxfgetpid(3F) ............................................................................................. pxfgetpid(3F) ................................................... 241
PXFGETPPID(3F) .......................................................................................... pxfgetppid(3F) ................................................ 243
pxfgetppid(3F) .......................................................................................... pxfgetppid(3F) ................................................ 243
PXFGETPWNAM(3F) ........................................................................................ pxfgetpwnam(3F) .............................................. 245
pxfgetpwnam(3F) ........................................................................................ pxfgetpwnam(3F) .............................................. 245
PXFGETPWUID(3F) ........................................................................................ pxfgetpwuid(3F) .............................................. 247
pxfgetpwuid(3F) ........................................................................................ pxfgetpwuid(3F) .............................................. 247
PXFGETUID(3F) ............................................................................................. pxfgetuid(3F) ................................................... 249
pxfgetuid(3F) ............................................................................................. pxfgetuid(3F) ................................................... 249
PXFINTGET(3F) ............................................................................................. pxfintget(3F) ................................................... 250
pxfintget(3F) ............................................................................................. pxfintget(3F) ................................................... 250
PXFINTSET(3F) ............................................................................................. pxfintset(3F) ................................................... 251
pxfintset(3F) ............................................................................................. pxfintset(3F) ................................................... 251
PXFISATTY(3F) ............................................................................................. pxfisatty(3F) ................................................... 252
pxfisatty(3F) ............................................................................................. pxfisatty(3F) ................................................... 252
PXFISBLK(3F) ............................................................................................... pxfisblk(3F) ..................................................... 254
pxfisblk(3F) ............................................................................................... pxfisblk(3F) ..................................................... 254
PXFISCHR(3F) ............................................................................................... pxfischr(3F) ..................................................... 256
pxfischr(3F) ............................................................................................... pxfischr(3F) ..................................................... 256
PXFISCONST(3F) .......................................................................................... pxfconst(3F) ..................................................... 195
pxfisconst(3F) .......................................................................................... pxfconst(3F) ..................................................... 195
PXFISDIR(3F) ............................................................................................... pxfisdir(3F) ..................................................... 258
pxfisdir(3F) ............................................................................................... pxfisdir(3F) ..................................................... 258

Index-10 004– 2165– 002


PXFISFIFO(3F) ............................................................................................. pxfisfifo(3F) ................................................... 260
pxfisfifo(3F) ............................................................................................. pxfisfifo(3F) ................................................... 260
PXFISREG(3F) ............................................................................................... pxfisreg(3F) ..................................................... 262
pxfisreg(3F) ............................................................................................... pxfisreg(3F) ..................................................... 262
PXFLINK(3F) ................................................................................................. pxflink(3F)........................................................ 264
pxflink(3F) ................................................................................................. pxflink(3F)........................................................ 264
PXFLOCALTIME(3F) ...................................................................................... pxflocaltime(3F) ............................................ 266
pxflocaltime(3F) ...................................................................................... pxflocaltime(3F) ............................................ 266
PXFOPEN(3F) ................................................................................................. pxfopen(3F)........................................................ 268
pxfopen(3F) ................................................................................................. pxfopen(3F)........................................................ 268
PXFOPENDIR(3F) .......................................................................................... pxfdirectory(3F) ............................................ 204
pxfopendir(3F) .......................................................................................... pxfdirectory(3F) ............................................ 204
PXFREADDIR(3F) .......................................................................................... pxfdirectory(3F) ............................................ 204
pxfreaddir(3F) .......................................................................................... pxfdirectory(3F) ............................................ 204
PXFRENAME(3F) ............................................................................................. pxfrename(3F) ................................................... 271
pxfrename(3F) ............................................................................................. pxfrename(3F) ................................................... 271
PXFREWINDDIR(3F) ...................................................................................... pxfdirectory(3F) ............................................ 204
pxfrewinddir(3F) ...................................................................................... pxfdirectory(3F) ............................................ 204
PXFRMDIR(3F) ............................................................................................... pxfrmdir(3F) ..................................................... 273
pxfrmdir(3F) ............................................................................................... pxfrmdir(3F) ..................................................... 273
PXFSETENV(3F) ............................................................................................. pxfsetenv(3F) ................................................... 275
pxfsetenv(3F) ............................................................................................. pxfsetenv(3F) ................................................... 275
PXFSETGID(3F) ............................................................................................. pxfsetgid(3F) ................................................... 277
pxfsetgid(3F) ............................................................................................. pxfsetgid(3F) ................................................... 277
PXFSETPGID(3F) .......................................................................................... pxfsetpgid(3F) ................................................ 279
pxfsetpgid(3F) .......................................................................................... pxfsetpgid(3F) ................................................ 279
PXFSETSID(3F) ............................................................................................. pxfsetsid(3F) ................................................... 281
pxfsetsid(3F) ............................................................................................. pxfsetsid(3F) ................................................... 281
PXFSETUID(3F) ............................................................................................. pxfsetuid(3F) ................................................... 283
pxfsetuid(3F) ............................................................................................. pxfsetuid(3F) ................................................... 283
PXFSLEEP(3F) ............................................................................................... pxfsleep(3F) ..................................................... 285
pxfsleep(3F) ............................................................................................... pxfsleep(3F) ..................................................... 285
PXFSTAT(3F) ................................................................................................. pxfstat(3F)........................................................ 287
pxfstat(3F) ................................................................................................. pxfstat(3F)........................................................ 287
PXFSTRGET(3F) ............................................................................................. pxfstrget(3F) ................................................... 289
pxfstrget(3F) ............................................................................................. pxfstrget(3F) ................................................... 289
PXFSTRSET(3F) ............................................................................................. pxfstrset(3F) ................................................... 291
pxfstrset(3F) ............................................................................................. pxfstrset(3F) ................................................... 291
PXFSTRUCTCOPY(3F) ................................................................................... pxfstructcopy(3F) ......................................... 293
pxfstructcopy(3F) ................................................................................... pxfstructcopy(3F) ......................................... 293
PXFSTRUCTCREATE(3F) .............................................................................. pxfstructcreate(3F) ..................................... 295
pxfstructcreate(3F) .............................................................................. pxfstructcreate(3F) ..................................... 295
PXFSTRUCTFREE(3F) ................................................................................... pxfstructfree(3F) ......................................... 297
pxfstructfree(3F) ................................................................................... pxfstructfree(3F) ......................................... 297
PXFSYSCONF(3F) .......................................................................................... pxfsysconf(3F) ................................................ 299
pxfsysconf(3F) .......................................................................................... pxfsysconf(3F) ................................................ 299
PXFTIME(3F) ................................................................................................. pxftime(3F)........................................................ 301
pxftime(3F) ................................................................................................. pxftime(3F)........................................................ 301
PXFTIMES(3F) ............................................................................................... pxftimes(3F) ..................................................... 303
pxftimes(3F) ............................................................................................... pxftimes(3F) ..................................................... 303

004– 2165– 002 Index-11


PXFUCOMPARE(3F) ........................................................................................ pxfucompare(3F) .............................................. 305
pxfucompare(3F) ........................................................................................ pxfucompare(3F) .............................................. 305
PXFUMASK(3F) ............................................................................................... pxfumask(3F) ..................................................... 307
pxfumask(3F) ............................................................................................... pxfumask(3F) ..................................................... 307
PXFUNAME(3F) ............................................................................................... pxfuname(3F) ..................................................... 309
pxfuname(3F) ............................................................................................... pxfuname(3F) ..................................................... 309
PXFUNLINK(3F) ............................................................................................. pxfunlink(3F) ................................................... 311
pxfunlink(3F) ............................................................................................. pxfunlink(3F) ................................................... 311
PXFUTIME(3F) ............................................................................................... pxfutime(3F) ..................................................... 325
pxfutime(3F) ............................................................................................... pxfutime(3F) ..................................................... 325
PXFWAIT(3F) ................................................................................................. pxfwait(3F)........................................................ 313
pxfwait(3F) ................................................................................................. pxfwait(3F)........................................................ 313
PXFWAITPID(3F) .......................................................................................... pxfwait(3F)........................................................ 313
pxfwaitpid(3F) .......................................................................................... pxfwait(3F)........................................................ 313
PXFWIFEXITED(3F) ...................................................................................... pxfwifexited(3F) ............................................ 317
pxfwifexited(3F) ...................................................................................... pxfwifexited(3F) ............................................ 317
PXFWIFSIGNALED(3F) ................................................................................. pxfwifsignaled(3F) ....................................... 319
pxfwifsignaled(3F) ................................................................................. pxfwifsignaled(3F) ....................................... 319
PXFWIFSTOPPED(3F) ................................................................................... pxfwifstopped(3F) ......................................... 322
pxfwifstopped(3F) ................................................................................... pxfwifstopped(3F) ......................................... 322
Query assign options ....................................................................................... asnqfile(3F) ....................................................... 36
Queue read request .......................................................................................... aqread(3F) ............................................................ 25
Queue write request ........................................................................................ aqwrite(3F) ......................................................... 32
Queues a simple or compound asynchronous I/O read request ...................... aqread(3F) ............................................................ 25
Queues a simple or compound asynchronous I/O write request .................... aqwrite(3F) ......................................................... 32
Random access and asynchronous I/O ............................................................ asyncms(3F) ......................................................... 40
Random access buffering ................................................................................ findms(3F) ............................................................ 49
Random access close (with index) .................................................................. closms(3F) ............................................................ 46
Random access I/O ......................................................................................... aqopen(3F) ............................................................ 23
Random access I/O check ............................................................................... checkms(3F) ......................................................... 42
Random access I/O mode ............................................................................... syncms(3F) ............................................................ 88
Random access open ....................................................................................... openms(3F) ............................................................ 61
Random access read ........................................................................................ getwa(3F) .............................................................. 57
Random access synchronous ........................................................................... syncms(3F) ............................................................ 88
Read asynchronously ....................................................................................... aqread(3F) ............................................................ 25
Read characters ............................................................................................... readc(3F) .............................................................. 68
Read data ......................................................................................................... getwa(3F) .............................................................. 57
Read from file ................................................................................................. ffreada(3C) ....................................................... 152
Read IBM words ............................................................................................. readibm(3F) ......................................................... 70
Read random access ........................................................................................ readms(3F) ............................................................ 71
Read record ..................................................................................................... findms(3F) ............................................................ 49
Read words ...................................................................................................... read(3F)................................................................. 66
READ(3F) ........................................................................................................ read(3F)................................................................. 66
read(3F) ........................................................................................................ read(3F)................................................................. 66
READC(3F) ...................................................................................................... readc(3F) .............................................................. 68
readc(3F) ...................................................................................................... readc(3F) .............................................................. 68
READCP(3F) .................................................................................................... readc(3F) .............................................................. 68
readcp(3F) .................................................................................................... readc(3F) .............................................................. 68
READDR(3F) .................................................................................................... readms(3F) ............................................................ 71
readdr(3F) .................................................................................................... readms(3F) ............................................................ 71

Index-12 004– 2165– 002


READIBM(3F) ................................................................................................. readibm(3F) ......................................................... 70
readibm(3F) ................................................................................................. readibm(3F) ......................................................... 70
READMS(3F) .................................................................................................... readms(3F) ............................................................ 71
readms(3F) .................................................................................................... readms(3F) ............................................................ 71
READP(3F) ...................................................................................................... read(3F)................................................................. 66
readp(3F) ...................................................................................................... read(3F)................................................................. 66
Reads a record from a random-access file to memory ................................... readms(3F) ............................................................ 71
Reads characters, full or partial record mode ................................................. readc(3F) .............................................................. 68
Reads record into data buffers used by random-access routines .................... findms(3F) ............................................................ 49
Reads two IBM 32-bit floating-point words from each Cray Research
64-bit word ...................................................................................................... readibm(3F) ......................................................... 70
Reads words, full or partial record modes ...................................................... read(3F)................................................................. 66
Record read random access ............................................................................. readms(3F) ............................................................ 71
Record skip NAMELIST ................................................................................. rnlskip(3F) ......................................................... 76
Record-oriented data ....................................................................................... ffread(3C) ......................................................... 149
Reduce file memory ........................................................................................ stindx(3F) ............................................................ 86
regular files ...................................................................................................... pxfisreg(3F) ..................................................... 262
Removes a directory entry .............................................................................. pxfrmdir(3F) ..................................................... 273
Removes a directory entry .............................................................................. pxfunlink(3F) ................................................... 311
Renames a file ................................................................................................. pxfrename(3F) ................................................... 271
Replacement character NAMELIST ................................................................ wnl(3F) ................................................................... 94
Repositions a flexible file I/O file ................................................................... ffseek(3C) ......................................................... 156
Requests tape synchronization ........................................................................ tsync(3F) .............................................................. 90
Retrieves the file status ................................................................................... pxfstat(3F)........................................................ 287
Retrieves the operating system name .............................................................. pxfuname(3F) ..................................................... 309
Retrieves the value of configurable system variables ..................................... pxfsysconf(3F) ................................................ 299
Return .............................................................................................................. numblks(3F) ......................................................... 60
Returns a command-line argument ................................................................. pxfgetarg(3F) ................................................... 222
Returns a value for the environment name ..................................................... pxfgetenv(3F) ................................................... 226
Returns lower bit of signal that terminates a child process ........................... ipxfwtermsig(3F) ............................................ 177
Returns part of the lower bits of signal number that terminates child
process ............................................................................................................. ipxfwstopsig(3F) ............................................ 174
Returns pointer to standard file ....................................................................... gtstdptr(3F) ....................................................... 59
Returns the assign options currently in effect for a file name or unit
number ............................................................................................................ asnqfile(3F) ....................................................... 36
Returns the current size of a file in 4096-byte blocks ................................... numblks(3F) ......................................................... 60
Returns the file descriptor for a specified unit ............................................... pxffileno(3F) ................................................... 218
Returns the lower bits of exit argument ...................................................... ipxfwexitstatus(3F) ..................................... 171
Returns the number of command-line arguments excluding the command
name ................................................................................................................ ipxfargc(3F) ..................................................... 170
Returns the value associated with symbolic constants ................................... pxfconst(3F) ..................................................... 195
rnl(3F) ........................................................................................................... rnl(3F) ................................................................... 73
RNLCOMM(3F) ................................................................................................. rnl(3F) ................................................................... 73
rnlcomm(3F) ................................................................................................. rnl(3F) ................................................................... 73
RNLDELM(3F) ................................................................................................. rnl(3F) ................................................................... 73
rnldelm(3F) ................................................................................................. rnl(3F) ................................................................... 73
RNLECHO(3F) ................................................................................................. rnlecho(3F) ......................................................... 75
rnlecho(3F) ................................................................................................. rnlecho(3F) ......................................................... 75
RNLFLAG(3F) ................................................................................................. rnl(3F) ................................................................... 73
rnlflag(3F) ................................................................................................. rnl(3F) ................................................................... 73

004– 2165– 002 Index-13


RNLREP(3F) .................................................................................................... rnl(3F) ................................................................... 73
rnlrep(3F) .................................................................................................... rnl(3F) ................................................................... 73
RNLSEP(3F) .................................................................................................... rnl(3F) ................................................................... 73
rnlsep(3F) .................................................................................................... rnl(3F) ................................................................... 73
RNLSKIP(3F) ................................................................................................. rnlskip(3F) ......................................................... 76
rnlskip(3F) ................................................................................................. rnlskip(3F) ......................................................... 76
RNLTYPE(3F) ................................................................................................. rnltype(3F) ......................................................... 77
rnltype(3F) ................................................................................................. rnltype(3F) ......................................................... 77
routines(3F) ............................................................................................... intro_pxf(3F) ................................................... 165
schedule alarm ................................................................................................. pxfalarm(3F) ..................................................... 182
Schedule alarm signal ..................................................................................... pxfalarm(3F) ..................................................... 182
SEEK(3F) ........................................................................................................ getwa(3F) .............................................................. 57
seek(3F) ........................................................................................................ getwa(3F) .............................................................. 57
Selects NAMELIST output line length ............................................................ wnllong(3F) ......................................................... 97
Separator NAMELIST change ......................................................................... wnl(3F) ................................................................... 94
Set I/O mode ................................................................................................... asyncms(3F) ......................................................... 40
Set process group ID ....................................................................................... pxfsetpgid(3F) ................................................ 279
Sets access and modification times of a file ................................................... pxfutime(3F) ..................................................... 325
Sets environment variable pair ........................................................................ pxfsetenv(3F) ................................................... 275
Sets file modes for a named file ..................................................................... pxfchmod(3F) ..................................................... 186
Sets group ID .................................................................................................. pxfsetgid(3F) ................................................... 277
Sets I/O mode for random-access routines to asynchronous .......................... asyncms(3F) ......................................................... 40
Sets I/O mode for random-access routines to synchronous ............................ syncms(3F) ............................................................ 88
Sets the file creation mask .............................................................................. pxfumask(3F) ..................................................... 307
Sets user ID ..................................................................................................... pxfsetuid(3F) ................................................... 283
SETSP(3F) ...................................................................................................... setsp(3F) .............................................................. 78
setsp(3F) ...................................................................................................... setsp(3F) .............................................................. 78
SETTP(3F) ...................................................................................................... settp(3F) .............................................................. 79
settp(3F) ...................................................................................................... settp(3F) .............................................................. 79
Size of file ....................................................................................................... numblks(3F) ......................................................... 60
Skip bad data .................................................................................................. skipbad(3F) ......................................................... 81
Skip record NAMELIST .................................................................................. rnlskip(3F) ......................................................... 76
SKIPBAD(3F) ................................................................................................. skipbad(3F) ......................................................... 81
skipbad(3F) ................................................................................................. skipbad(3F) ......................................................... 81
SKIPF(3F) ...................................................................................................... skipf(3F) .............................................................. 83
skipf(3F) ...................................................................................................... skipf(3F) .............................................................. 83
Skips bad data ................................................................................................. skipbad(3F) ......................................................... 81
Skips files ........................................................................................................ skipf(3F) .............................................................. 83
special character files ...................................................................................... pxfischr(3F) ..................................................... 256
Special tape processing ................................................................................... startsp(3F) ......................................................... 85
Special tape processing (disable) .................................................................... endsp(3F) .............................................................. 48
Specifies output unit for NAMELIST error messages and echo lines ............ rnlecho(3F) ......................................................... 75
Standard file descriptor ................................................................................... gtstdptr(3F) ....................................................... 59
Standard libraries ............................................................................................ intro_applibs(3F) ............................................. 1
STARTSP(3F) ................................................................................................. startsp(3F) ......................................................... 85
startsp(3F) ................................................................................................. startsp(3F) ......................................................... 85
Status of AQIO requests ................................................................................. aqstat(3F) ............................................................ 29
Status of I/O .................................................................................................... checkms(3F) ......................................................... 42
STINDR(3F) .................................................................................................... stindx(3F) ............................................................ 86
stindr(3F) .................................................................................................... stindx(3F) ............................................................ 86

Index-14 004– 2165– 002


STINDX(3F) .................................................................................................... stindx(3F) ............................................................ 86
stindx(3F) .................................................................................................... stindx(3F) ............................................................ 86
Stream pointer ................................................................................................. gtstdptr(3F) ....................................................... 59
Stream-oriented data ....................................................................................... ffread(3C) ......................................................... 149
Structure .......................................................................................................... pxfstructcreate(3F) ..................................... 295
Structure components ...................................................................................... pxfintget(3F) ................................................... 250
Structure components ...................................................................................... pxfintset(3F) ................................................... 251
Structure instances .......................................................................................... pxfstructfree(3F) ......................................... 297
Structure instances .......................................................................................... pxfsysconf(3F) ................................................ 299
Subindex creation ............................................................................................ stindx(3F) ............................................................ 86
Suppress values in Fortran edit-directed output ............................................. fsup(3F)................................................................. 53
Suspend for AQIO requests ............................................................................ aqwait(3F) ............................................................ 31
SYNCDR(3F) .................................................................................................... syncms(3F) ............................................................ 88
syncdr(3F) .................................................................................................... syncms(3F) ............................................................ 88
Synchronize I/O mode .................................................................................... syncms(3F) ............................................................ 88
Synchronous read ............................................................................................ getwa(3F) .............................................................. 57
Synchronously and asynchronously reads data from the word-addressable,
random-access file ........................................................................................... getwa(3F) .............................................................. 57
SYNCMS(3F) .................................................................................................... syncms(3F) ............................................................ 88
syncms(3F) .................................................................................................... syncms(3F) ............................................................ 88
Takes appropriate action when an undesired NAMELIST group is
encountered ..................................................................................................... rnlskip(3F) ......................................................... 76
Tape block position at ..................................................................................... settp(3F) .............................................................. 79
Tape data accepting ........................................................................................ acptbad(3F) ......................................................... 19
Tape file position ............................................................................................ gettp(3F) .............................................................. 54
Tape position ................................................................................................... skipf(3F) .............................................................. 83
Tape position (checks) .................................................................................... checktp(3F) ......................................................... 44
Tape processing (disable) ................................................................................ endsp(3F) .............................................................. 48
Tape processing (disable) ................................................................................ startsp(3F) ......................................................... 85
Tape skip data ................................................................................................. skipbad(3F) ......................................................... 81
Tape synchronization ...................................................................................... tsync(3F) .............................................................. 90
terminal pathname ........................................................................................... pxfctermid(3F) ................................................ 202
Tests for block special file .............................................................................. pxfisblk(3F) ..................................................... 254
Tests for character special file ........................................................................ pxfischr(3F) ..................................................... 256
Tests for directory file ..................................................................................... pxfisdir(3F) ..................................................... 258
Tests for pipe or a FIFO special file .............................................................. pxfisfifo(3F) ................................................... 260
Tests for regular file ........................................................................................ pxfisreg(3F) ..................................................... 262
Timing routines ............................................................................................... intro_pxf(3F) ................................................... 165
TSYNC(3F) ...................................................................................................... tsync(3F) .............................................................. 90
tsync(3F) ...................................................................................................... tsync(3F) .............................................................. 90
Type conversion on input ............................................................................... rnltype(3F) ......................................................... 77
Type mismatch on input ................................................................................. rnltype(3F) ......................................................... 77
Unit NAMELIST errors ................................................................................... rnlecho(3F) ......................................................... 75
unitattr(3F) ............................................................................................... asnqfile(3F) ....................................................... 36
Variable NAMELIST on new line ................................................................... wnlline(3F) ......................................................... 96
Wait for AQIO request ................................................................................... aqrecall(3F) ....................................................... 27
Wait for I/O .................................................................................................... waitms(3F) ............................................................ 91
WAITDR(3F) .................................................................................................... waitms(3F) ............................................................ 91
waitdr(3F) .................................................................................................... waitms(3F) ............................................................ 91
WAITMS(3F) .................................................................................................... waitms(3F) ............................................................ 91

004– 2165– 002 Index-15


waitms(3F) .................................................................................................... waitms(3F) ............................................................ 91
Waits for completion of an asynchronous I/O operation ................................ waitms(3F) ............................................................ 91
Waits for completion of asynchronous queued I/O request ........................... aqrecall(3F) ....................................................... 27
Waits for completion of asynchronous queued I/O requests .......................... aqwait(3F) ............................................................ 31
WCLOSE(3F) .................................................................................................... wclose(3F) ............................................................ 93
wclose(3F) .................................................................................................... wclose(3F) ............................................................ 93
wnl(3F) ........................................................................................................... wnl(3F) ................................................................... 94
WNLDELM(3F) ................................................................................................. wnl(3F) ................................................................... 94
wnldelm(3F) ................................................................................................. wnl(3F) ................................................................... 94
WNLFLAG(3F) ................................................................................................. wnl(3F) ................................................................... 94
wnlflag(3F) ................................................................................................. wnl(3F) ................................................................... 94
WNLLINE(3F) ................................................................................................. wnlline(3F) ......................................................... 96
wnlline(3F) ................................................................................................. wnlline(3F) ......................................................... 96
WNLLONG(3F) ................................................................................................. wnllong(3F) ......................................................... 97
wnllong(3F) ................................................................................................. wnllong(3F) ......................................................... 97
WNLREP(3F) .................................................................................................... wnl(3F) ................................................................... 94
wnlrep(3F) .................................................................................................... wnl(3F) ................................................................... 94
WNLSEP(3F) .................................................................................................... wnl(3F) ................................................................... 94
wnlsep(3F) .................................................................................................... wnl(3F) ................................................................... 94
WOPEN(3F) ...................................................................................................... wopen(3F) .............................................................. 98
wopen(3F) ...................................................................................................... wopen(3F) .............................................................. 98
Word addressable open ................................................................................... wopen(3F) .............................................................. 98
Word-addressable data .................................................................................... getwa(3F) .............................................................. 57
Word-addressable file close ............................................................................ wclose(3F) ............................................................ 93
Word-addressable file read .............................................................................. getwa(3F) .............................................................. 57
Word-addressable write ................................................................................... putwa(3F) .............................................................. 64
Words read ...................................................................................................... read(3F)................................................................. 66
WRITDR(3F) .................................................................................................... writms(3F) .......................................................... 105
writdr(3F) .................................................................................................... writms(3F) .......................................................... 105
Write AQIO .................................................................................................... aqwrite(3F) ......................................................... 32
Write characters .............................................................................................. writec(3F) .......................................................... 102
Write IBM words ............................................................................................ writibm(3F)........................................................ 104
Write master index .......................................................................................... closms(3F) ............................................................ 46
Write to random-access ................................................................................... putwa(3F) .............................................................. 64
Write words ..................................................................................................... write(3F) ............................................................ 100
WRITE(3F) ...................................................................................................... write(3F) ............................................................ 100
write(3F) ...................................................................................................... write(3F) ............................................................ 100
WRITEC(3F) .................................................................................................... writec(3F) .......................................................... 102
writec(3F) .................................................................................................... writec(3F) .......................................................... 102
WRITECP(3F) ................................................................................................. writec(3F) .......................................................... 102
writecp(3F) ................................................................................................. writec(3F) .......................................................... 102
WRITEP(3F) .................................................................................................... write(3F) ............................................................ 100
writep(3F) .................................................................................................... write(3F) ............................................................ 100
Writes characters, full or partial record mode ................................................ writec(3F) .......................................................... 102
Writes data buffered by Fortran output statements to a file ........................... flush(3F) .............................................................. 51
Writes master index and closes random-access file ........................................ closms(3F) ............................................................ 46
Writes to a random-access file on disk ........................................................... writms(3F) .......................................................... 105
Writes to a word-addressable, random-access file .......................................... putwa(3F) .............................................................. 64
Writes two IBM 32-bit floating-point words from each Cray 64-bit word .... writibm(3F)........................................................ 104
Writes words, full or partial record mode ...................................................... write(3F) ............................................................ 100

Index-16 004– 2165– 002


WRITIBM(3F) ................................................................................................. writibm(3F)........................................................ 104
writibm(3F) ................................................................................................. writibm(3F)........................................................ 104
WRITMS(3F) .................................................................................................... writms(3F) .......................................................... 105
writms(3F) .................................................................................................... writms(3F) .......................................................... 105

004– 2165– 002 Index-17

You might also like