WPCtE 2B[Z Prestige Elite 12cpi (M)3|ddp@~rQ@HP LaserJet IIIDHPLASIII.PRSdp@~rQ,\,Bj@3|d2 M ZOZ(HP LaserJet IIIHPLASIII.PRSx  @,\,BjX@?xxx,wx6X@8;X@LtTddd,wldp@~rQ@uSddd,'dp,`QtTddd,EdphQQH?xxx,ex `B;X?xxx,zAx6Nh ;XH9=;w4QY ȃ w<t wr :4u w Q Y ^ZYXV^Courier 10cpiPrestige Elite 12cpi (M)Prestige Elite 12cpi Bold (D)Prestige Elite 12cpi Italic (D)Courier 10cpi (Bold)Courier 10cpi (Italic)2iQk k]3ke+.(#4UUUUUUUUUUUUU K K KK  K   L LJ&5[J'u(#}|2PkCLlP#test uP 'test& l o"ok faa znz&_K_Y"Y"K_KY"KY"__KU+@U#X2PkCLlP# bak123rec TP  0bak123recT*?` #X2PkCLlP# ld123rec TP o/ld123rec$oo$&$$oo$V2Ay2#X2PkCLlP# rt123pvfld  TP  rt123pvfld.(#4UUUUUUUUUUUUUo$$oo$o$o aap 2$2$prrrrry my ssmy msmsy y mJ&5at'{)#}|2PkCLlP#test uP (testLL&LLLW3BOd#X2PkCLlP# rt123pvsfld  TP  1rt123pvsfldV,A )#X2PkCLlP# free123lab TP  : Rfree123lab& vLv    tyt  z x[! F!zF!V2Asu.#X2PkCLlP# setup123lb  TP  Wsetup123lbU+@w"+#X2PkCLlP# rd123sfld TP  Trd123sfld.(#4UUUUUUUUUUUUUJ&5at'{)#}|2PkCLlP#test uP (testLL&LLLV2Ac.#X2PkCLlP# set123stat  TP  0set123stat&W-B@^A#X2PkCLlP# get123level TP  jget123level& xDx.(#4UUUUUUUUUUUUU#nn#&##nn#J,5[J'u(#}|2PkCLlP#test uP 'test&'H' " "H'H "H "''HrHrk k HrHk Hk rrH& l(l (}( k k o"okX4CO#X2PkCLlP# stor123dv  TP  f stor123dvY/D#X2PkCLlP# free123lab TP  , free123lab U+@  #X2PkCLlP# get123fmt TP  ^-get123fmt& J   J J J   JX.C 5#X2PkCLlP# setup123lb TP  (. setup123lb& k&y$Oy$s+s+Oy$Os+Os+y$y$OW-B%'*#X2PkCLlP# incre123lab TP  G&(incre123lab.(#4UUUUUUUUUUUUU#nn#&##nn#J,5[J'u(#}|2PkCLlP#test uP 'test&'H' " "H'H "H "''HrHrk k HrHk Hk rrH& l(l (}( k k o"okW3B#X2PkCLlP# uld123ddrec  TP  fuld123ddrecW-B) #X2PkCLlP# cmp123dddir TP  ,cmp123dddirS)>  #X2PkCLlP# w123int TP ^-w123int& J   J J J   JX.C #X2PkCLlP# cmp123ddlead TP  (.cmp123ddlead& k&$C$++C$C+C+$$C %%D **DV,A%)#X2PkCLlP# rd123ddfld TP  G&(rd123ddfld.(#4UUUUUUUUUUUUU#nn#&##nn#J,5[J'u(#}|2PkCLlP#test uP 'test&'H' " "H'H "H "''HrHrk k HrHk Hk rrH& l(l (}( k k o"okU1@~%#X2PkCLlP# uld123rec  TP  uld123recW-B #X2PkCLlP# cmp123drdir TP  ,cmp123drdirS)>  #X2PkCLlP# w123int TP ^-w123int& J   J J J   JX.C #X2PkCLlP# cmp123drlead TP  ;.cmp123drlead& k&$C$++C$C+C+$$C %%D **DT*?^&)#X2PkCLlP# rd123fld TP &(rd123fld.(#4UUUUUUUUUUUUUJ&5at'{)#}|2PkCLlP#test uP (testLL&LLLW3B7#X2PkCLlP# ver123ddtag  TP  Gver123ddtag&V,AA#X2PkCLlP# is123intgr TP  Ajis123intgr& xDx.(#4UUUUUUUUUUUUUJ&5at'{)#}|2PkCLlP#test uP (testLL&LLLS/>#X2PkCLlP# w123int  TP 00w123int&S)>A#X2PkCLlP# i123toa TP Aji123toa& xDx.(#4UUUUUUUUUUUUU k k kk  kJ&5[J'u(#}|2PkCLlP#test uP 'test.yy.&..yy. z/ [z[/&|m|v v m|mv mv ||m& l(l vcv | n#nrW3B)#X2PkCLlP# get123level  TP  Rget123level& l sksV2AYe#X2PkCLlP# wr123ddfld  TP  wr123ddfldV,Au@&#X2PkCLlP# cki123nfld TP  Ocki123nfld& cvv vov pw$w %ww&GgGA"A"gGgA"gA"GGgV,A ##X2PkCLlP# is123intgr TP  )Lis123intgr& e (l(&$k$~+~+k$k~+k~+$$k %%l **lDd D>">"d Dd >"d >"DDd  e  !!e  b b  b b   b U+@}  #X2PkCLlP# str123tok TP  F str123tokW-B%"*&#X2PkCLlP# wr123ddsfld TP  &Owr123ddsfldW-B  #X2PkCLlP# er123ddsfld TP  H er123ddsfld.(#4UUUUUUUUUUUUU(ss(&((ss( t) YtY)& K K KK  KJ&5[J'u(#}|2PkCLlP#test uP 'test& l o"ok faa znz&_K_Y"Y"K_KY"KY"__KW-Bb#X2PkCLlP# get123level TP  0get123levelV,A #X2PkCLlP# ld123ddrec TP  /ld123ddrecV,A0k#X2PkCLlP# wr123ddrec TP   wr123ddrec.(#4UUUUUUUUUUUUUMiMG"G"iMiG"iG"MMi j !!j q q  q q   q  k k kk  kJ&5[J'u(#}|2PkCLlP#test uP 'test.yy.&..yy. z/ [z[/&H` HB"B"` H` B"` B"HH` & l(l www | n#nr i sksW3B+#X2PkCLlP# wr123ddsfld  TP  |wr123ddsfldV,A8&#X2PkCLlP# is123intgr TP  Ois123intgrV,AI B, #X2PkCLlP# load123lab TP  U load123labV,A  #X2PkCLlP# load123fmt TP  E load123fmt& cvv vov pw$w %ww e&|$i|$v+v+i|$iv+iv+|$|$iW-B%*%#X2PkCLlP# load123tagp TP  %Nload123tagp& (l(&aia[ [ iai[ i[ aaiW-B%#X2PkCLlP# get123level TP  Nget123levelW-BN %#X2PkCLlP# beg123ddrec TP  Nbeg123ddrec.(#4UUUUUUUUUUUUU k k kk  kJ&5[J'u(#}|2PkCLlP#test uP 'test.yy.&..yy. z/ [z[/&|m|v v m|mv mv ||m& l(l vcv | n#nrW3B)#X2PkCLlP# get123level  TP  Rget123level& l sksU1@Y#X2PkCLlP# wr123fld  TP   wr123fldU+@uJ&#X2PkCLlP# beg123rec TP  Obeg123rec& cvv vov pw$w %ww&GgGA"A"gGgA"gA"GGgX.Cx!##X2PkCLlP# ret123match TP  )Lret123match & e (l(&$k$~+~+k$k~+k~+$$kDd D>">"d Dd >"d >"DDd  b b  b b   b V,A} Q #X2PkCLlP# load123fld TP  F load123fldV,A%j)&#X2PkCLlP# str123tok TP  &O str123tokW-B ! #X2PkCLlP# stc123empty TP  H stc123empty z z u VVu.(#4UUUUUUUUUUUUUk$$kk$k$kkkkkk l ggly my ssmy msmsy y mJ&5at'{)#}|2PkCLlP#test uP (testLL&LLL M __MT0?#X2PkCLlP# wr123rec  TP 1wr123recW-B )#X2PkCLlP# get123level TP  Rget123level& vLv    tyt  z x[! F!zF!U1@k@&#X2PkCLlP# end123rec  TP  Oend123recT*?"&#X2PkCLlP# ld123rec TP Old123rec.(#4UUUUUUUUUUUUUXEXR"R"EXER"ER"XXE E !!EJ&5[J'u(#}|2PkCLlP#test uP 'testrHrk k HrHk Hk rrH& l(l (}( k k o"ok& J   J J J   J& k&$B$|+|+B$B|+B|+$$BW-B#X2PkCLlP# get123level TP  ,get123levelW-B%#X2PkCLlP# ret123match TP  v.ret123matchU+@ #X2PkCLlP# beg123rec TP  )beg123recU+@&)#X2PkCLlP# stor123dv TP  W&'stor123dv%pp%&%%pp% q& [q[&U1@1#X2PkCLlP# wr123sfld  TP   wr123sfld uT #dp@~rQwl@#  ӊX` hp x (#%'0*,.8135@8: the current dm structure is encountered. The current pointer is set  tTj to the previous dm structure.(#` ` ` If the subfield state is neither 'number of dimensions' nor 'dimension length', the remainder of the processing locates the previous subfield based upon the data value state. If the current  tTF dr structure is not 'NULL', the current data value pointer is  tTr examined to determine if it is the first value in the dv structure list. If the current data value pointer equals the head pointer of  tT the dv structure list and the number of dimensions is zero, state is  uT changed to 'number of dimensions' and rt123pvsfld() returns 'failure'. However, if the number of dimensions is not zero, the  tTO current dm structure pointer is set to the last structure in the  tT{ list and state is set to 'dimension length'.(#` ` ` If the current data value pointer does not equal the head pointer of  tT! the dv structure list, the previous subfield is a data value. The current data value pointer is examined again to determine the method+#0*$$ of locating the previous subfield: if the current data value pointer is 'NULL', no previous data value exists, thus the last data value in the field is returned; if the current data value pointer is the first data value, the current pointer is set to the head pointer  tT of the dv structure list; otherwise, the subfield preceding the current subfield is returned.(#`  uT4 ` ` If the current data value pointer is 'NULL', free123lab() is invoked  uTa to deallocate the labels pointer structure and setup123lb() builds the new set of labels. The format tree pointers are initialized to the format root pointers, and the current data value pointer and current dimension length pointer are set to their respective header  uT pointers. Routine rd123sfld() then retrieves subfields until status 'end of field' or 'end of record' is returned.(#` ` ` As stated above, if the current data value pointer is the first data  tT value, the current pointer is set to the head pointer of the dv structure list. No additional processing is performed.(#` ` ` If the current data value pointer is neither 'NULL' nor the first data value, the previous subfield is located by searching for the current subfield. The current data value pointer is temporarily stored and used to determine when the previous subfield is located. The format tree pointers are initialized to the format root and the  tT# current data value pointer is set to the head pointer of the dv  uTO structure. Routine rd123sfld() is invoked repeatedly until the  tT| structure following the previously read dv structure equals the  tT temporary pointer. The search for the correct dv structure continues throughout all data value sets.(#` "0*$$Ԍ tT ` ` If the current dr structure is 'NULL' for the data value subfield  tT, state, state is set to 'number of dimensions' and the function returns a 'failure'.(#`  uT ` ` During processing, rt123pvsfld() returns an error when:(#`  tT  ` ` X oX$An invoked routine fails(#  tTa ` ` X oX$The subfield state is 'number of dimensions' when entering this routine(#  tT ` ` X oX$The current data value pointer equals the head pointer  tT of the dv structure list and 'number of dimensions' equals zero(#  tT ` ` X oX$The current dr structure is 'NULL'.(#0*$$ A!I|.(#ddRT_PVSFL.GEM<* f#dp@~rQwl@#  uT The rt123pvsfld Structure Tree$(#(#(#(#A'#$ 0,0*$$'#c!A0  uT x ɿ uS ` `  $hh*06pp<B  H set123stat ćROUTINE: set123stat PURPOSE: ` ` To check for end of file and set status flag.(#` ARGUMENT LIST:  tT  ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT ` ` fp $hh*PTR06Ipp<FILE POINTER  tTa ` ` status$hh*INT060pp<STATUS  tT)  hh* 06pp<0 = FAILURE  tT  hh*06pp<1 = OKAY  tT  hh* 06pp<2 = START OF RECORD  tT  hh*0 6pp<3 = END OF RECORD  tTI  $hh*06pp<4 = END OF FILE  tT  ` `  hh*06pp<5 = END OF FIELD  tT  ` `  $hh*06pp<6 = START OF FIELD  tT ` ` set123stat()hh*LOGICAL6Opp<RETURN STATUS EXTERNAL FUNCTION REFERENCES:  tT ` ` FUNCTION$hh*DESCRIPTION  tTQ ` ` get123level() hh*RETRIEVES THE APPROPRIATE DATA STRUCTURE LEVEL(#h GLOBAL REFERENCES: ` ` FILE MANAGEMENT STRUCTURE (FM) GLOBAL VARIABLES:  tTY ` ` NAME $hh*TYPE 06USEpp<DESCRIPTIONē  tT ` ` cur_fm$hh*PTR06Ipp<CURRENT POINTER TO FILE(#p ` `  $hh*06pp<MANAGEMENT STRUCTURE ENTRY GLOBAL CONSTANTS: ` ` NONE )# 0*$$ԌPROCESSING:  uTX ` ` Routine set123stat() determines whether or not the internal file  tT pointer for file pointer fp is at the end of the file. The  tT appropriate fm structure is obtained and the open mode is examined. (#` ` ` If the file was opened in read mode, a character is retrieved from the file and examined to determined whether or not the end of the file has been reached. If the retrieved character is the 'end of file' marker, ASCII decimal code 26, or ASCII decimal code 94,  tT status is set to 'end of file' (4). If the character is not an end of file, the internal file pointer is moved to its previous position  uT and set123stat() returns 'success'.(#` ` ` If the file was opened in write mode, no additional processing is  uT performed and set123stat() returns 'success'.(#`  uT ` ` During processing, set123stat() returns 'failure' when an invoked routine fails.(#`  0*$$ a!I|.(#ddSET_STAT.GEM <*Gle#dp@~rQwl@#  uT , The set123stat Structure Tree$(#(#(#(#a'#$ 0, 0*$$'#c!a 0  uT "ɿ uT ` `  $hh*06pp< B setup123lb ĄROUTINE: setup123lb PURPOSE: ` ` To initialize the labels pointer (LP) structure.x` ARGUMENT LIST:  tT  ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT ` ` setup123lb()hh*LOGICAL6Opp<SUCCESS FLAG EXTERNAL FUNCTION REFERENCES: ` ` NONE GLOBAL REFERENCES: ` ` DATA DESCRIPTIVE LABEL SUBFIELD STRUCTURE (SL) ` ` DATA DESCRIPTIVE RECORD STRUCTURE (DD) ` ` FILE MANAGEMENT STRUCTURE (FM) ` ` LABELS POINTER STRUCTURE (LP) GLOBAL VARIABLES:  tTQ ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT ` ` cur_fm$hh*PTR06Ipp<CURRENT POINTER TO FILE(#p ` `  $hh*06pp<MANAGEMENT STRUCTURE ENTRY GLOBAL CONSTANTS: ` ` NONE PROCESSING:  uTy ` ` Routine setup123lab() creates the lp structure list to contain the  tT first label within each label set of the sl structure list. First,  tT the header lp structure is allocated and its pointers are  tT! initialized to 'NULL'. The current and header lp structure pointers  tT*# in the fm structure are set to the new pointer; the current sl*# 0*$$  tT structure pointer in the fm structure is initialized to the labels  tT, pointer of the current dd structure.(#`  tT ` ` If the header sl structure is not the only entry in the list, a new  tT lp structure is allocated and inserted in the lp structure list. Both the first and current pointers of the new structure are  tT assigned the pointer to the first label in the sl structure label  tT4 set. Thus, the lp structure list will have a structure  tT` corresponding to each label set in the sl structure list. The  tT current lp structure in the fm structure is then reset to the list header.(#`  uT ` ` During processing, setup123lab() returns an error when dynamic  tT= allocation of an lp structure fails.(#` ` ` This routine does not invoke any lower level routines.(#`  0*$$  uT "$)ɿ uT ` `  $hh*06pp<B stc123empty ăROUTINE: stc123empty PURPOSE: ` ` To determine if a DR structure is empty.(#` ARGUMENT LIST:  tT  ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT ` ` stc123empty()hh*LOGICAL6O pp<STRUCTURE EMPTY FLAG EXTERNAL FUNCTION REFERENCES: ` ` NONE GLOBAL REFERENCES: ` ` DATA RECORD STRUCTURE (DR) ` ` FILE MANAGEMENT STRUCTURE (FM) ` `  GLOBAL VARIABLES:  tT ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tTQ ` ` cur_fm$hh*PTR06Ipp<CURRENT POINTER TO FILE(#p ` `  $hh*06pp<MANAGEMENT STRUCTURE ENTRY GLOBAL CONSTANTS: ` ` NONE PROCESSING:  uT ` ` Routine stc123empty() determines whether the structures for a DR contain data values or are empty. An empty structure flag is  tT initialized to 'true' and the dr structure list is traversed until a values pointer is found or the end of the list is reached. If a  tTb" values pointer is encountered, the empty structure flag is set tob"0*$$  uT 'false'. Function stc123empty() returns the value of the empty structure flag.(#` ` ` This routine does not invoke any lower level routines.(#` 0*$$  uT $),Gl uS ` `  $hh*06pp<B  H s123tol ĄROUTINE: s123tol PURPOSE: ` ` To convert a character string to a long integer and change its byte ordering when specified.(#` ARGUMENT LIST:  tT ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT) ` ` string[] hh*PTR 6I pp<CHARACTER STRING  tT ` ` num hh*LONG 6O pp<NUMBER TO BE CONVERTED  tT ` ` reverse hh*LOGICAL 6I pp<REVERSE BYTE ORDER FLAG  tT  06pp<1 - REVERSE  tTI  hh*06pp<0 - DO NOT REVERSE  tT  ` ` s123tol() hh*LOGICAL 6O pp<SUCCESS FLAG EXTERNAL FUNCTION REFERENCES: ` ` NONE GLOBAL REFERENCES: ` ` NONE GLOBAL VARIABLES: ` ` NONE GLOBAL CONSTANTS: ` ` NONE PROCESSING:  uT ` ` Routine s123tol() moves a four byte character string to a long integer variable to be returned to the calling procedure. The!0*$$ reverse flag indicates the direction to store the four bytes in the  tT, long integer. (#` ` ` This routine does not invoke any lower level routines.(#` 0*$$  uT ,h0ɿ uS ` `  $hh*06pp<B  H stor123dv ĆROUTINE: ` ` stor123dv PURPOSE: ` ` To store a data value string in a storage structure. ARGUMENT LIST:  tT  ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT ` ` wr_str$hh*PTR06Ipp<STRING CONTAINING A DR SUBFIELD  tTa ` ` str_len$hh*LONG06Ipp<LENGTH OF WR_STR(#p  tT) ` ` stor123dv()$hh*LOGICAL6Opp<SUCCESS FLAG EXTERNAL FUNCTION REFERENCES:  tTI ` ` NAME $hh*DESCRIPTION  tT ` ` free123lab()hh*FREES THE LABEL POINTER STRUCTURE  tT ` ` get123fmt()` $Xhh*RETRIEVES A SINGLE FORMAT FROM THE FORMAT STRUCTURE(#h  tT1 ` ` incre123lb() hh*INCREMENTS THE POINTER TO THE NEXT LABEL(#h  tT ` ` setup123lb() hh*SETS UP LABELS POINTER STRUCTURE(#h GLOBAL REFERENCES: ` `  DATA DESCRIPTIVE LABEL SUBFIELD STRUCTURE (SL) ` `  DATA DESCRIPTIVE LEADER STRUTURE (DL) ` `  DATA DESCRIPTIVE RECORD STRUCTURE (DD) ` `  DATA RECORD DATA VALUE SUBFIELD STRUCTURE (DV) ` `  DATA RECORD STRUCTURE (DR) ` `  DIMENSION LENGTHS STRUCTURE (LP) ` `  FILE MANAGEMENT STRUCTURE (FM) ` `  LABEL POINTER STRUCTURE (LP) GLOBAL VARIABLES:  tTy ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT ` ` cur_fm$hh*PTR06Ipp<CURRENT POINTER TO FILE(#p ` `  $hh*06pp<MANAGEMENT STRUCTURE ENTRY )#0*$$ԌGLOBAL CONSTANTS:  tT ` ` NAME $hh*TYPE06DESCRIPTION  tT  ` ` FCDSTYPE$hh*INT0h6RELATIVE POSITION OF THE DATA STRUCTURE TYPE WITHIN THE FIELD CONTROL(#  tTx ` ` NC $hh*CHAR06NULL CHARACTER  tT@ ` ` SEP $hh*CHAR0X6SEPARATOR FOR ADJACENT DELIMITERS T(# ` `  PROCESSING:  uT ` ` Routine stor123dv() allocates a dv structure for data value wr_str and stores it in the appropriate position within the values list.  tTI The byte length of wr_str is input in parameter str_len. The new dv structure's position within the list is determined by the associated labels or the dimension length for array data. The current values  tT pointer is set to the new dv structure after it is correctly positioned within the values list.(#`  tTQ ` ` Initially, a dv structure is allocated and its pointers are  tT} initialized to 'NULL'. If the string length of wr_str is greater than 1, memory space is allocated and the value is copied to the space. The pointer to the space is assigned to the value field of  tT the dv structure and the correct position within the values list is sought.(#` ` ` If the values structure list for the current DR field is empty, a  tT header dv structure is allocated for the list. If the file interchange level is 2 or 3 and labels exist, the label sets in the  tT sl structure list are traversed until a set containing a label other  uT5! than its header is located. Routine setup123lb() is invoked to set up the labels pointer structure within the located label set. If format controls are present regardless of whether labels are present#0*$$  uT or not, get123fmt() is invoked to locate the corresponding format  tT- structure within the format tree for the data value. The dv structure containing the data value is then inserted into the values list.(#`  uT ` ` If the values structure list is not empty, get123fmt() and  uT   incre123lab() are invoked to update the format structure and labels structure pointers, respectively. The current field control for the data value is examined to determine whether the value is array data.(#` ` ` If the data value is array data and labels exist, the labels structure list is examined to determine if the value is to be positioned in the current value set or the next set. If there is no  tT? label in the current set other than the header: the new dv structure containing the value is assigned to the next value set; the labels pointer is set to the next label set; and the label sets  tT in the sl structure list are traversed until a set containing a label other than the header is located. Otherwise, if there is a label in the current set, the current label pointer is set to the next label in the set and the next value pointer is set to the new  tTs dv structure.(#` ` ` However, if the data value is array data and labels do not exist,  tT the new dv structure is placed in the values structure list based  tT# upon the first dimension length in the dm structure list. If the number of values in the current set are less than the dimension  tT{ length, the new dv structure is appended to the current value set.  tT Otherwise, the new dv structure is positioned first in the next value set.(#` ` ` (#` !0*$$Ԍ` ` If the field control indicates the data value is not array data, the  tT, new dv structure is appended to the current value set.(#`  uT ` ` During processing, routine stor123dv() returns 'failure' when:(#`  tT ` ` X oX$An invoked routine or C library function fails(#  tT  ` ` X oX$Dynamic allocation of a dv structure fails(#  tT5 ` `  oX$Dynamic allocation of a character string fails.(# !I|%.(#ddSTOR_DV.GEM<*Gld#dp@~rQwl@#  uT ^ The stor123dv Structure Tree$(#(# (#(#'#$0#0*$$%'#+0  uT h0Aɿ uS ` `  $hh*06pp<B  H str123tok ĆROUTINE: str123tok PURPOSE:  tT ` ` To read a string as a series of zero or more tokens using delims as the set of of characters serving as delimiters of the tokens and also to return a pointer to the first token on the first call, and on subsequent calls return each of the other tokens until there are no more tokens.(#` ARGUMENT LIST:  tT) ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT ` ` string[]$hh*PTR 06I/Opp<STRING POINTER  tT ` ` delims[]$hh*PTR06Ipp<CHARACTER STRING CONTAINING DELIMITERS(#p  tT ` ` str_len$hh*LONG06Opp<LENGTH OF STRING  tT ` ` str123tok()$hh*PTR06Opp<POINTER TO TOKEN STRING EXTERNAL FUNCTION REFERENCES: ` ` NONE GLOBAL REFERENCES: ` ` NONE GLOBAL VARIABLES: ` ` NONE GLOBAL CONSTANTS:  tTY ` ` NAME $hh*TYPE06DESCRIPTION  tT ` ` NC $hh*CHAR06NULL CHARACTER PROCESSING:  uT! ` ` Routine str123tok() invokes the function strspn() to move the string  uT" pointer past leading delimiters. Function strpbrk() is called next"0*$$ to find the first occurrence of a delimiter within the input string. If no delimiters are found on the initial invocation, the entire  uTX string is returned. Otherwise, function strpbrk() returns the  uT position of the first occurrence. Routine str123tok() then splits the string by placing a null character at that position and returns the second half of the string as an output parameter. The first half is considered to be the token. The token string is then  tT6 returned as the routine function value. Output parameter, str_len, returns the length in bytes of the token string.(#`  uT ` ` During processing, str123tok() returns an error when the input string is empty.(#` ` ` This routine does not invoke any lower level routines.(#` ?0*$$  uT AHɿ uS ` `  $hh*06pp<B  H uld123ddrec ĈROUTINE: uld123ddrec PURPOSE: ` ` To write the DDR to the output file.(#` ARGUMENT LIST: ` ` NONE(#` EXTERNAL FUNCTION REFERENCES:  tT) ` ` NAME $hh*DESCRIPTION  tT ` ` cmp123dddir() hh*COMPUTES DATA DESCRIPTIVE RECORD DIRECTORY(#h  tT ` ` cmp123ddlead() hh*COMPUTES DATA DESCRIPTIVE RECORD LEADER FIELD(#h  tTI ` ` rd123ddfld()hh*RETRIEVES A FIELD OF DATA DESCRIPTIVE RECORD  tT ` ` w123int()$Xhh*FUNCTION TO WRITE AN INTEGER(#h GLOBAL REFERENCES: ` ` DATA DESCRIPTIVE LEADER STRUCTURE (DL) ` ` DATA DESCRIPTIVE RECORD STRUCTURE (DD) ` ` FILE MANAGEMENT STRUCTURE (FM) ` `  GLOBAL VARIABLES:  tT ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tTq ` ` cur_fm$hh*PTR06Ipp<CURRENT POINTER TO FILE(#p ` `  $hh*06pp<MANAGEMENT STRUCTURE ENTRY  tT ` ` glb_str2[MAXSIZ]hh*CHAR06I/Opp<GLOBAL CHARACTER STRING(#p ` `  $hh*06pp<USED FOR PROCESSING GLOBAL CONSTANTS:  tT ` ` NAME $hh*TYPE06DESCRIPTION  tTy ` ` FT $hh*CHAR06FIELD TERMINATOR (RS) 1/14  tTA ` ` MAXSIZ$hh*INT06MAXIMUM RECORD LENGTH )#0*$$ԌPROCESSING:  uTX ` ` Routine uld123ddrec() writes the leader, directory and fields of the  tT DDR to the file specified by fp in the current fm structure.  uT Routines cmp123dddir() and cmp123ddlead() are invoked to compute the directory and leader, respectively, for the DDR fields contained in  tT  the dd structure list. Each field in the computed leader and  uT6 directory is written by either w123int() (for integer data) or a C library function. If the record length in the leader is greater  tT than 99,999 bytes (MAXREC), zero is written to the file's record length field within the leader. The directory of the DDR is created  tT by traversing the dd structure list and writing the tag, field length, and field position to the file. A field terminator is written to the file to separate the directory and the data descriptive area to be written.(#`  uT ` ` The dd structure list is then traversed; rd123ddfld() is invoked to  tT  retrieve a string containing the field data from each dd structure  uT in memory. Routine uld123ddrec() then writes this string to the specified file.(#`  uT ` ` During processing, uld123ddrec() returns 'failure' when an invoked routine fails.(#` 0*$$ !I|.(#ddULD_DDRE.GEM<*Glf#dp@~rQwl@#  uT The uld123ddrec Structure Tree$(#(#(#(#'#$ 0,0*$$'#c!0  uT H Pɿ uS ` `  $hh*06pp<B  H uld123rec ĆROUTINE: ` `  uld123rec PURPOSE: ` ` To write the DR to the output file.(#` ARGUMENT LIST: ` ` NONE(#` EXTERNAL FUNCTION REFERENCES:  tT) ` ` NAME $hh*DESCRIPTION(#`  tT ` ` cmp123drdir()hh*COMPUTES THE DATA RECORD DIRECTORY(#h  tT ` ` cmp123drlead()hh*COMPUTES THE DATA RECORD LEADER FIELD(#h  tTI ` ` rd123fld()$hh*FUNCTION TO RETRIEVE DATA RECORD FIELD(#  tT ` ` w123int()` $hh*FUNCTION TO WRITE IN A INTEGER(# GLOBAL REFERENCES: ` ` DATA RECORD LEADER STRUCTURE (RL) ` ` DATA RECORD STRUCTURE (DR) ` ` FILE MANAGEMENT STRUCTURE (FM) ` ` RECORD POINTER STRUCTURE (RP)(#` GLOBAL VARIABLES:  tT ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT9 ` ` cur_fm$hh*PTR06Ipp<CURRENT POINTER TO FILE(#p ` `  $hh*06pp<MANAGEMENT STRUCTURE ENTRY  tT ` ` glb_str2[MAXSIZ]hh*CHAR06Opp<GLOBAL CHARACTER STRING USED FOR PROCESSING(#p GLOBAL CONSTANTS:  tT ` ` NAME $hh*TYPE06DESCRIPTION  tTA ` ` BLNK_SP$hh*CHAR06BLANK SPACE CHARACTER  tT ` ` DB_DIGIT$hh*INT0 6NUMBER OF DIGITS IN DATA AREA BASE ADDRESS(#  tT! ` ` FT_STR[2]$hh*CHAR0h6CHARACTER STRING CONTAINING FIELD TERMINATOR (RS) 1/14(#  tT)# ` ` MAXREC$hh*INT06MAXIMUM RECORD LENGTH)#0*$$Ԍ tT ` ` RES_3SP[4]$hh*CHAR0X6CHARACTER STRING OF RESERVED SPACE THREE POSITIONS LONG(#  tT ` ` RES_SP[6]$hh*CHAR0X6CHARACTER STRING OF RESERVED SPACE FIVE POSITIONS LONG(#  tT  ` ` RL_DIGIT$hh*INT06NUMBER OF RECORD LENGTH DIGITS PROCESSING:  uT ` ` Routine uld123rec() examines the no leader directory flag (NLD) and  tT the record pointer (NLD_RP) of the current fm structure. If the flag is set and the record pointer is not 'NULL', the DR leader and its directory entries are omitted when writing the DR. Otherwise,  uT  uld123rec() computes the header and directory values and writes them to the output file pointed to by the current file pointer. A field terminator is written at the end of the directory entries. Each DR field is then written to the output file.(#`  uT^ ` ` During processing, uld123rec() returns 'failure' when an invoked routine fails.(#` 0*$$ !I|.(#ddULD_REC.GEM<*Gld#dp@~rQwl@#  uT ^ The uld123rec Structure Tree$(#(#(#(#'#$ 0,0*$$'#c!0  uT  PWɿ uT ` `  $hh*06pp<B ver123ddtag ăROUTINE: ver123ddtag PURPOSE: ` ` To verify the order of data descriptive tags.(#` ARGUMENT LIST:   tT  ` ` NAME $hh*TYPE06USEpp<DESCRIPTION   tT ` ` ver123ddtag() hh*LOGICAL 6O pp<VERIFY DATA DESCRIPTIVE TAGS FLAG(#p EXTERNAL FUNCTION REFERENCES:  tT ` ` NAME $hh*DESCRIPTION  tTI ` ` is123intgr() hh*DETERMINE IF A STRING IS COMPRISED OF INTEGERS(#h GLOBAL REFERENCES: ` ` DATA DESCRIPTIVE LEADER STRUCTURE (DL) ` ` DATA DESCRIPTIVE RECORD STRUCTURE (DD) ` ` FILE MANAGEMENT STRUCTURE (FM) GLOBAL VARIABLES:  tT ` ` NAME $hh*TYPE06USEpp<DESCRIPTION   tTq ` ` cur_fm hh*PTR06Ipp<CURRENT POINTER TO FILE MANAGEMENT STRUCTURE ENTRY (#p GLOBAL CONSTANTS:  tTY ` ` NAME $hh*TYPE06DESCRIPTION  tT ` ` nftag123$hh*INT0h6NUMBER OF FIELD TAGS DEFINED BY FIPS 123 INTERCHANGE STANDARD(# PROCESSING:  uTa" ` ` Routine ver123ddtag() verifies that defined FIPS PUB 123 numeric tags occur in ascending order before any occurrence of other tags in#0*$$ the DDR. The routine also verifies that the required numeric tag 0..1 exists in the data record. Tag order is not verified for level 3 interchange files.(#` !I|H .(#ddVER_TAG.GEM<* l#dp@~rQwl@#  uT The ver123ddtag Structure Tree ă$(#(#(#(#'#$00*$$H '#&0  uT W&[ɿ uT ` `  $hh*06pp<B ver123drtag ĂROUTINE: ver123drtag PURPOSE: ` ` To verify the order of DR tags with those in the DDR.(#` ARGUMENT LIST:  tT  ` ` NAME $hh*TYPE06USEpp<DESCRIPTION   tT ` ` ver123drtag()hh*LOGICAL6Opp<VERIFY DATA RECORD TAGS FLAG(#p EXTERNAL FUNCTION REFERENCES:  tT ` ` NAME $hh*DESCRIPTION  tTI ` ` is123intgr() hh*DETERMINE IF A STRING IS COMPRISED OF INTEGERS(#h GLOBAL REFERENCES: ` ` DATA DESCRIPTIVE LEADER STRUCTURE (DL) ` ` DATA DESCRIPTIVE RECORD STRUCTURE (DD) ` ` DATA RECORD STRUCTURE (DR) ` ` FILE MANAGEMENT STRUCTURE (FM) GLOBAL VARIABLES:  tT ` ` NAME $hh*TYPE06USEpp<DESCRIPTION   tTq ` ` cur_fm hh*PTR06Ipp<CURRENT POINTER TO FILE MANAGEMENT STRUCTURE ENTRY (#p GLOBAL CONSTANTS: ` ` NONE PROCESSING:  uT ` ` Routine ver123drtag() verifies that the tags in the DR are in the same order as they appear in the data descriptive file. The routine also verifies that the required numeric tag 0..1 exists in the data record. Tag order is not verified for level 3 interchange files.(#` # 0*$$  uT &[^ɿ uS ` `  $hh*06pp<B  H w123int ĄROUTINE: w123int PURPOSE: ` ` To write out an integer value in ASCII.(#` ARGUMENT LIST:  tT  ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT ` ` fp $hh*PTR06Ipp<OUTPUT FILE POINTER  tTa ` ` i_val $hh*INT06Ipp<INTEGER VALUE  tT) ` ` o_len $hh*INT06Ipp<OUTPUT LENGTH(#h  tT ` ` w123int()$ hh*LOGICAL6Opp<SUCCESS FLAG(#p EXTERNAL FUNCTION REFERENCES:  tT ` ` NAME $hh*DESCRIPTION  tT ` ` i123toa()` $Xhh*CONVERTS AN INTEGER INTO A CHARACTER STRING(#h GLOBAL REFERENCES: ` ` NONE GLOBAL VARIABLES: ` ` NONE GLOBAL CONSTANTS: ` ` NONE PROCESSING:  uT ` ` Routine w123int() writes an integer to file pointer fp. The output  tT length o_len describes the number of bytes the integer is to occupy  uT within the file. Routine i123toa() converts the integer to  tT7! character string int_str. If the integer output length is zero,  tTc" int_str is written without considering its output length. If the  uT# string length exceeds the output length, w123int() returns#!0*$$ 'failure'. Otherwise, the difference between the string and output  tT, length is calculated and assigned to l_dif. The character 0 is  tTX written l_dif times to pad the file before writing int_str.(#`  uT ` ` During processing, w123int() returns 'failure' when string length  tT s_len exceeds output length o_len.(#` !I|.(#ddWINT.GEM"<*Glb#dp@~rQwl@#  uT  The w123int Structure Tree$(#(#5(#(#'#$ 0a""0*$$'#)"0  uT ^scɿ uT ` `  $hh*06pp<B wr123ddfld ĂROUTINE: ` `  wr123ddfld PURPOSE: ` ` To write a data descriptive field to an output buffer to be physically written when the record is complete.(#` ARGUMENT LIST:  tT ` ` NAME $hh*TYPE0 6USEpp<DESCRIPTION  tTa ` ` fp $hh*PTR06Ipp<FILE POINTER  tT) ` ` tag[] $hh*PTR06Ipp<FIELD IDENTIFIER  tT ` ` wr_str[]$hh*PTR06Ipp<STRING CONTAINING A DDR FIELD  tT ` ` option` $Xhh*INT06Ipp<WRITE FIELD  HOPTION(#p ` `  $hh*06pp<0 = FAILURE ` `  $hh*06pp<1 = OKAY ` `  $hh*06pp<2 = START OF RECORD ` `  $hh*06pp<3 = END OF RECORD ` `  $hh*06pp<4 = END OF FILE (DR) ` `  $hh*06pp<5 = END OF FIELD ` `  $hh*06pp<6 = START OF FIELD  tT ` ` wr123ddfld() hh*LOGICAL6Opp<SUCCESS FLAG(#h EXTERNAL FUNCTION REFERENCES:  tT ` ` NAME $hh*DESCRIPTION  tT ` ` cki123nfld() hh*CHECKS STRING FOR NULL FIELDS AND SEPARATES  tTq DELIMITERS6(#h  tT9 ` ` er123ddsfld() hh*ERASES PREVIOUS SUBFIELD IN A DATA DESCRIPTIVE RECORD(#h  tT ` ` get123level() hh*RETRIEVES APPROPRIATE DATA STRUCTURE LAYER(#h  tT ` ` is123intgr() hh*DETERMINES IF CHARACTER STRING IS AN INTEGER(#h  tTY ` ` str123tok()` $hh*RETURNS A POINTER TO A STRING TOKENxxN(#  tT! ` ` wr123ddsfld() hh*WRITES THE NEXT DATA DESCRIPTIVE SUBFIELD (#h GLOBAL REFERENCES:  tTA ` ` DATA DESCRIPTIVE LEADER STRUCTURE (DL) ` ` FILE MANAGEMENT STRUCTURE (FM) )##0*$$ԌGLOBAL VARIABLES:  tT ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT  ` ` cur_fm$hh*PTR06Ipp<CURRENT POINTER TO FILE MANAGEMENT STRUCTURE(#p  tT ` ` glb_str[MAXSIZ]hh*CHAR06I/Opp<GLOBAL STRING BUFFER GLOBAL CONSTANTS:  tT ` ` NAME $hh*TYPE06DESCRIPTION  tT` ` ` DEL_STR[3]$hh*CHAR0X6CHARACTER STRING CONTAINING THE UNIT AND FIELD TERMINATORS(#  tT ` ` LVL23FCL$hh*INT0h6FIELD CONTROL LENGTH FOR FILE INTERCHANGE LEVELS 2 AND 3(#  tT ` ` NC $hh*CHAR0h6NULL CHARACTER(#  tTH ` ` SEP_STR[2]$hh*CHAR0X6CHARACTER STRING CONTAINING SEPARATOR FOR ADJACENT DELIMITERS(#  tT ` ` UT_STR[2]$hh*CHAR0h6CHARACTER STRING CONTAINING THE UNIT TERMINATOR(# PROCESSING:  uTP ` ` X Routine wr123ddfld() writes a DDR field from the string passed into the routine to the correct data structure for the DDR.  tT Another character string sub_str is dynamically allocated and the input string is copied into the new string for processing.  uT Routine wr123ddsfld is called to write each subfield of the string to the appropriate structures.(#  tT ` ` X The appropriate fm structure is obtained based upon file  tT pointer fp. If the input option is 'failure' (0) or 'out of  uT bounds', wr123ddfld() returns a failure. If the option is  tT valid (1 through 6), the input string is copied to sub_str  uT7! and cki123nfld() is invoked to ensure that delimiters in the  tTd" new string are not adjacent. If the input option is 'start ofd"$0*$$  tT record' (2), the subfield option is set to 'start of record' (2); otherwise, it is set to 'start of field' (6).(#  tT ` ` X If the input tag is not the user augmented file description tag (0..2) or the file is not an interchange level 1 file,  uT  wr123ddsfld() is invoked to write the field control of the  tT  string to a dr structure. (Note: The augmented file description field and fields in level 1 files do not have field controls.) The string pointer is advanced to the  tT character following the field control and the subfield option is set to 'okay' (1).(#  uT ` ` X If the string points to a unit terminator, wr123ddsfld() is invoked once to write the name subfield. Then, routine  uTj  str123tok() is invoked to extract the next DDR subfield from  uT the string. Routines wr123ddsfld() and str123tok() are invoked repeatedly to write each subfield returned by  uT  str123tok() to the appropriate structures until no subfields remain in the string. All subfields are written with 'okay' (1).(#  tT ` `  X The subfield written is stored temporarily into a global string. When the next extracted subfield is 'NULL',  uT  er123ddsfld() is invoked to erase the last subfield written in  tT& order to rewrite it with the correct subfield option. If the  tTR input option is 'end of file' (4) or 'end of record' (3), the  tT~ subfield option is set to the same value. Otherwise, if the file interchange level is '1' or the input tag is the user  tT augmented file description tag (0..2), the subfield option is set to 'start of field' (6); if the file interchange level is  tT.# not 1 and the input tag is not 0..2, the subfield option is.#%0*$$  uT set to 'end of field' (5). wr123ddsfld() is then invoked to rewrite the subfield from the global string with the correct  tTY subfield option.(#  uT ` ` X During processing, routine wr123ddfld() returns an error when:(#  tT  ` ` X X$oXhh*An invoked routine or C library function fails(#h  tT6 ` ` X X$oXhh*The input option is 'failure' or 'out of bounds'.(#h !!I|&.(#ddWR_DDFLD.GEM&<* e#dp@~rQwl@#  uT , The wr123ddfld Structure Tree$(#(# (#(#!'#$0#&0*$$&'#+!&0  uT sc^tɿ uS ` `  $hh*06pp<B  H wr123ddrec ćROUTINE: wr123ddrec PURPOSE: ` ` To write a DDR.(#` ARGUMENT LIST:  tT  ` ` NAME $hh*TYPE0 6USEpp<DESCRIPTION  tT ` ` fp $hh*PTR06Ipp<FILE POINTER  tTa ` ` string[]` $Xhh*PTR 06Ipp<DATA DESCRIPTIVE RECORD(#h  tT) ` ` status$hh*INT06I/Opp<STATUS ` `  $hh*06pp<0 = FAILURE ` `  $hh*06pp<1 = OKAY ` `  $hh*06pp<2 = START OF RECORD ` `  $hh*06pp<3 = END OF RECORD ` `  $hh*06pp<4 = END OF FILE ` `  $hh*06pp<5 = END OF FIELD ` `  $hh*06pp<6 = START OF FIELD  tTi ` ` wr123ddrec() hh*LOGICAL6Opp<SUCCESS FLAG(#h EXTERNAL FUNCTION REFERENCES:  tT ` ` NAME $hh*DESCRIPTION  tT ` ` get123level() hh*RETRIEVES APPROPRIATE DATA STRUCTURE LAYER(#h  tT ` ` ld123ddrec() hh*READS THE DATA DESCRIPTIVE RECORD AND PLACES THE INFORMATION INTO A STRUCTURE FOR REFERENCE(#h GLOBAL REFERENCES: ` ` FILE MANAGEMENT STRUCTURE (FM) GLOBAL VARIABLES:  tT ` ` NAME $TYPEhh*0USE6DESCRIPTION  tTy ` ` cur_fm$PTRhh*0I/Oh6CURRENT POINTER TO FILE MANAGEMENT STRUCTURE ENTRY(# GLOBAL CONSTANTS: ` ` NONE )#'0*$$ԌPROCESSING:  uTX ` ` Routine wr123ddrec() writes the DDR contained in string to file  tT pointer fp. The initial status is temporarily stored and it is  tT reset to 'failure'. The appropriate fm structure is obtained based  tT upon fp and the file is rewound to ensure the file contains only one DDR. The string containing the DDR is written to the file and the position of the internal file pointer is retrieved. The file is rewound again in order to load the DDR into memory.(#`  uT ` ` The open mode is changed to read and ld123ddrec() is invoked to load the previously written DDR into the appropriate data structures.  uT Routine ld123ddrec() can only process a DDR from a file opened in read mode. The open mode is reset to write and the internal file pointer is moved to its previous position.(#`  tT ` ` The last field of the resulting dd structure list is located. The  tT subfield state is set to 'out of bounds' and status is reset to its  uT initial value before wr123ddrec() returns 'success'.(#`  uTt ` ` During processing, wr123ddrec() returns 'failure' when:(#`  tT ` `  o$An invoked routine fails(#  tT% ` `  oX$An invoked C library function which manages the internal file pointer fails.(# }(0*$$ A!I|.(#ddWR_DDREC.GEM)<* Gle#dp@~rQwl@#  uT , The wr123ddrec Structure Tree$(#(#(#(#A'#$ 0,)0*$$'#c!A)0  uT ^t8|ɿ uT ` `  $hh*06pp<B wr123ddsfld ĂROUTINE: ` `  wr123ddsfld PURPOSE: ` ` To write a data descriptive subfield to an output buffer to be physically written when the record is complete.(#` ARGUMENT LIST:  tT ` ` NAME $hh*TYPE0 6USEpp<DESCRIPTION  tTa ` ` fp $hh*PTR06Ipp<FILE POINTER  tT) ` ` tag[] $hh*PTR06Ipp<FIELD IDENTIFIER  tT ` ` wr_str[]$hh*PTR06Ipp<STRING CONTAINING A DDR FIELD  tT  ` ` option` $hh*INT06I` pp<WRITEBSUBFIELD OPTION(#p ` `  $hh*06pp<0 = FAILURE ` `  $hh*06pp<1 = OKAY ` `  $hh*06pp<2 = START OF RECORD ` `  $hh*06pp<3 = END OF RECORD ` `  $hh*06pp<4 = END OF FILE (DR) ` `  $hh*06pp<5 = END OF FIELD ` `  $hh*06pp<6 = START OF FIELD  tT ` ` wr123ddsfld() hh*LOGICAL6Opp<SUCCESS FLAG(#h EXTERNAL FUNCTION REFERENCES:  tT ` ` NAME $hh*DESCRIPTION  tT ` ` beg123ddrec() hh*BEGIN A DATA DESCRIPTIVE RECORD (#h  tTq ` ` get123level() hh*RETRIEVES APPROPRIATE DATA STRUCTURE LAYER(#h  tT9 ` ` is123intgr() hh*DETERMINES WHETHER OR NOT A CHARACTER STRING IS AN INTEGER(#h  tT ` ` load123fmt() hh*LOADS FORMATS INTO THE FORMAT TREE STRUCTURE (#h  tT ` ` load123lab() hh*LOADS LABELS INTO DD LABEL SUBFIELDxxNSTRUCTURE (#h  tTY ` ` load123tagp()hh*LOADS TAG PAIRS INTO THE STRUCTURE (#h GLOBAL REFERENCES: ` ` DATA DESCRIPTIVE FILE CONTROL RECORD STRUCTURE (CR) ` ` DATA DESCRIPTIVE LEADER STRUCTURE (DL) ` ` DATA DESCRIPTIVE RECORD STRUCTURE (DD) ` ` FILE MANAGEMENT STRUCTURE (FM) )#*0*$$ԌGLOBAL VARIABLES:  tT ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT  ` ` cur_fm$hh*PTR06Ipp<CURRENT POINTER TO FILE MANAGEMENT STRUCTURE ENTRY(#p ` `  GLOBAL CONSTANTS:  tT ` ` NAME $hh*TYPE06DESCRIPTION  tT ` ` FCDSTYPE$hh*INT0X6RELATIVE POSITION OF THE DATA STRUCTURE TYPE WITHIN THE FIELD(# ` `  $hh*06CONTROL  tT ` ` FCDTYPE$hh*INT0X6RELATIVE POSITION OF THE DATA(# ` `  $hh*06TYPE WITHIN THE FIELD CONTROL  tT ` ` NC $hh*CHAR06NULL CHARACTER  tTH ` ` SEP_STR[2]$hh*CHAR0X6CHARACTER STRING CONTAINING SEPARATOR FOR ADJACENT DELIMITERS(# PROCESSING:  uT   ` ` Routine wr123ddsfld() dynamically allocates the appropriate data structures in memory and writes the DDR subfield, passed into the  tT routine as character string wr_str, to the data structures.  tTE Processing is based upon the input option and the DDR subfield state. If the subfield to be written is the first subfield of the  tT DDR, a 'start of record' (2) option must be passed into  uT  wr123ddsfld() in order to initialize the dd structure list which represents the DDR. If the subfield is the first subfield of a  tT" field, a 'start of field' (6) option must be passed into  uTN  wr123ddsfld() to allocate the required dd structure and append it to the existing list.(#`  uT ` ` Routine wr123ddsfld() execution ends and returns 'success' after  tT" subfield wr_str is processed within the correct option/subfield  uT,# state block. If wr123ddsfld() returns 'failure', the DDR subfield,#+0*$$ state remains unchanged to indicate to other routines the subfield state in which the error occurred.(#`  tT ` ` The appropriate fm structure is obtained based upon file pointer fp. If the subfield state is 'out of bounds', it is reset to 'name' for a file interchange level of 1; otherwise, the subfield state is set to 'field control'. The remainder of the processing depends upon  tT4 the input option and the subfield state.(#`  tT ` ` If the input option is 'start of record' or 'start of field', the  tT input tag is examined to determine if the subfield requires special  uT processing. If the option is 'start of record', beg123ddrec() is  tT invoked to initialize the dd structure list for the DDR. A dd  tT= structure is allocated, its pointers are initialized to 'NULL', tag is copied to the structure's tag field, and the structure is  tT appended to the dd structure list. Two tag values may then be processed: the file control tag (0..0) or the user augmented file description tag (0..2).(#`  tTE ` ` If the input tag is '0..0', the tag size in the dl structure is set  tTq to the length of the current tag if the tag size in the structure is  tT zero. If the cr structure does not exist, a cr structure is allocated and its pointers are initialized to 'NULL'. If the file  tT interchange level is not 1, the string wr_str is copied to the field  tT! control field of the current dd structure and the subfield state is incremented to 'name'. Otherwise, the file interchange level is 1  tTy which contains no field controls; thus, wr_str contains the file title. Memory space is allocated and the file title is copied to the space. The pointer to the string is assigned to the file title  tT! field of the cr structure and the subfield state is set to 'out of bounds'.(#` )#,0*$$Ԍ tT ԙ` ` If the input tag is '0..2', the cr structure is examined to determine if it exists. If the structure does not exist, it is allocated and its pointers are initialized to 'NULL'. Memory space  tT is allocated and wr_str containing the useraugmented file description is copied to the space. The pointer to the string is  tT assigned to the useraugmented file description field of the cr structure and the subfield state is set to 'out of bounds'.(#`  tT` ` ` If the tag is neither '0..0' nor '0..2', the subfield in wr_str is processed as a field entry based upon the subfield state.(#`  tT ` `  o$If the subfield state is 'field control', wr_str is  tT copied to the field control field of the current dd structure and the subfield state is incremented to 'name subfield'(#  tT ` ` X oX$If the subfield state is 'name subfield', memory space  tT is allocated and wr_str containing the field name is copied to the space. The pointer is assigned to the  tTD name field of the current dd structure. If the file interchange level is 1, the subfield state is set to 'out of bounds'. Otherwise, the subfield state is set based upon the field control:(#  tT  ` `  ` $hh*0If the field is not an elementary data structure, the subfield state is incremented to 'labels subfield'(# ` `  ` $(#  tT ` ` X X$Xhh*©X0If the field is an elementary data structure having a bit field data type,!-0*$$ subfield state is set to 'formats'; otherwise, it is set to 'out of bounds'.(#  uT ` ` For the labels and formats subfield states, wr123ddsfld() returns 'failure'.(#`  tT  ` ` If the input option is 'okay' or 'end of field', the structure  tT5 following the dd structure header is checked to ensure that a structure has been allocated for the field. If it does not exist,  uT  wr123ddsfld() returns 'failure'. If the structure exists, subfield processing is based upon the subfield state.(#`  uT ` `  oX$If the subfield state is 'field control', wr123ddsfld() returns 'failure' because field control processing is invalid for this input option(#  tT ` `  o$If the subfield state is name, the input tag is examined for '0..0'. If the tag is '0..0', memory space is allocated and the file title is copied to the space. The pointer is assigned to the file title field of the  tTs cr structure. If the file interchange level is 3, the subfield state is incremented to 'labels subfield'; otherwise, subfield state is set to 'out of bounds'(#  tT# ` `  o$If the subfield state is 'name subfield' but the input  tTO tag is not '0..0', memory space is allocated and the field name is copied to the space. The pointer is  tT assigned to the name field of the current dd structure. If the file interchange level is 1, the subfield state is set to 'out of bounds'. Otherwise, the subfield state is set based upon the field control:(#+#.0*$$Ԍ tT ԙ` ` X $hh*0If the field is not an elementary data structure, the subfield state is incremented to 'labels subfield'(# ` `  (#  tT ` `  $hh*0If the field is an elementary data structure having a bit field data type, subfield state is set to format; otherwise, it is set to 'out of bounds'(#  tT ` `  o$If the subfield state is labels and the input tag is  uT '0..0', load123tagp() is invoked to load the tag pair  tT list into a tl structure list and the subfield state is  tT set to 'out of bounds'. If the input tag is not '0..0'  uT= and wr_str contains labels, load123lab() is invoked to  tTj load the field's labels into the sl structure list and the subfield state is incremented to 'formats'(#  tT ` `  o$If the subfield state is 'formats' and wr_str contains  uT format controls, load123fmt() is invoked to load the  tTG field's format controls into the fc structure list which simulates a binary tree. The subfield state is incremented to 'out of bounds'.(#  tT ` ` If the input option is 'end of field' instead of 'okay', the subfield state is set to 'out of bounds'.(#`  tT{ ` ` If the input option is 'end of field' or 'end of record' and the  tT input tag is '0..2', memory space is allocated and wr_str containing the useraugmented file description is copied to the space. The pointer to the string is assigned to the useraugmented file!/0*$$  tT description field of the cr structure. If the input tag is not '0..2', subfield processing is based upon the subfield state.(#`  tT ` `  oX$If the subfield state is 'field control', a dd structure is allocated, its pointers are initialized to 'NULL',  tT tag is copied to the structure's tag field, and the  tT structure is appended to the dd structure list(#  tT` ` `  oX$If the subfield state is 'name', the file interchange  tT level and the input tag are examined to determine the required processing(#  tT ` `  $hh*` 0If the file interchange level is 1, a dd structure is allocated, its pointers are  tTh initialized to 'NULL', tag is copied to the structure's tag field, and the structure is  tT appended to the dd structure list(#  tT ` `  X$hh*0If the input tag is '0..0', memory space is allocated and the file title is copied to the space. The pointer to the string is  tT assigned to the file title field of the cr structure(#  tT  ` `  ` $Xhh*©X0If the file interchange level is not 1 and  tTL the input tag is not '0..0', memory space is allocated and the field name is copied to the space. The pointer is assigned to  tT the name field of the current dd structure.(# !00*$$Ԍ tT ` `  o$If the subfield state is 'labels' and the input tag is  uT, '0..0', load123tagp() is invoked to load the tag pair  tTY list into a tl structure list. If the input tag is not  uT '0..0' and wr_str contains labels, load123lab() is  tT invoked to load the field's labels into the sl structure list(#  tT6 ` `  o$If the subfield state is 'formats' and wr_str contains  uTb format controls, load123fmt() is invoked to load the  tT field's format controls into the fc structure list which simulates a binary tree.(#  tT ` ` Processing the 'end of record' or 'end of file' option is complete after the subfield state is set to 'out of bounds'.(#`  uT ` ` If the input option is 'failure', wr123ddsfld() returns 'failure'.(#`  uT ` ` During processing, routine wr123ddsfld() returns 'failure' when:(#`  tTI ` ` X oX$An invoked routine or C library function fails(#  tT ` `  oX$Dynamic allocation of a dd structure failed(#  tT ` ` X oX$Dynamic allocation of a cr structure failed(#  tTQ ` `  o$Dynamic allocation of a character string failed(#  tT ` ` X oX$Invalid subfield state is encountered for option(# -#10*$$Ԍ tT ` ` X oX$The dd structure of first DDR field does not exist for  tT, 'okay' or 'endoffield' option(#  tTX ` `  o$option is 'failure' when entering this routine.(# a!I|H .(#ddWR_DDSFL.GEM2<*  f#dp@~rQwl@#  uT The wr123ddsfld Structure Tree$(#(#(#(#a'#$ 020*$$H '#&a20  uT 8|ɿ uS ` `  $hh*06pp<B  H wr123fld ąROUTINE: wr123fld PURPOSE: ` ` To write a DR field to an output buffer to be physically written when the record is complete.(#` ARGUMENT LIST:  tT ` ` NAME $hh*TYPE0 6USEpp<DESCRIPTION  tTa ` ` fp $hh*PTR06Ipp<FILE POINTER  tT) ` ` tag[] $hh*PTR06Ipp<FIELD IDENTIFIER  tT ` ` leadid$hh*CHAR06Ipp<LEADER IDENTIFIER  tT ` ` wr_str[]$hh*PTR06Ipp<STRING CONTAINING A DDR FIELD(#p  tT ` ` str_len$hh*LONG06Ipp<LENGTH OF WR_STR  tTI  ` ` option$ hh*INT06Ipp<WRITE FIELD OPTION(#p ` `  $hh*06pp<0 = FAILURE ` `  $hh*06pp<1 = OKAY ` `  $hh*06pp<2 = START OF RECORD ` `  $hh*06pp<3 = END OF RECORD ` `  $hh*06pp<4 = END OF FILE (DR) ` `  $hh*06pp<5 = END OF FIELD ` `  $hh*06pp<6 = START OF FIELD  tT ` ` wr123fld()` $hh*LOGICAL6Opp<SUCCESS FLAG(# EXTERNAL FUNCTION REFERENCES:  tT ` ` NAME $hh*DESCRIPTION  tT9 ` ` beg123rec()` $hh*BEGINS A DATA RECORD(#  tT ` ` get123level() hh*RETRIEVES APPROPRIATE DATA STRUCTURE LAYER (#h  tT ` ` load123fld() hh*RETRIEVES DR FIELD VALUES FROM THE INDICATED FILE(#h  tT ` ` ret123match() hh*RETURNS ASSOCIATED DATA DESCRIPTIVE RECORD STRUCTURE(#h  tT! ` ` stc123empty() hh*DETERMINES IF A DATA RECORD STRUCTURE IS EMPTY(#h  tT ` ` str123tok()` $hh*RETURNS A POINTER TO A STRING TOKEN(# GLOBAL REFERENCES: ` ` DATA RECORD LEADER STRUCTURE (RL) ` ` DATA RECORD STRUCTURE (DR) ` ` FILE MANAGEMENT STRUCTURE (FM) )#30*$$ԌGLOBAL VARIABLES:  tT ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT  ` ` cur_fm$hh*PTR06Ipp<CURRENT POINTER TO FILE MANAGEMENT STRUCTURE ENTRY(#p GLOBAL CONSTANTS:  tT ` ` NAME $hh*TYPE06DESCRIPTION  tT ` ` FP_LEN$hh*INT0h6LENGTH OF FILE NAME INCLUDING THE(# ` `  $hh*06PATH  tT( ` ` FT $hh*CHAR0h6FIELD TERMINATOR (RS) 1/14(#  tT ` ` NC $hh*CHAR06NULL CHARACTER PROCESSING:  uT ` ` Routine wr123fld() writes a DR field to the correct data structure  tT for the current DR from the input string wr_str with length str_len.  tT The appropriate fm structure is obtained based upon file pointer fp. A temporary character string, the same size as the input string, is dynamically allocated. The input string is copied to the temporary character string and written to the temporary file. Then, routine  uT  load123fld is called to perform the actual loading of the field into memory.(#` ` ` A field must be in uncompressed format if it contains adjacent fixedlength bit subfields.(#`  uT ` ` During processing, routine wr123fld() returns an error when:(#`  tT ` ` X oX$An invoked routine fails(# c"40*$$Ԍ tT ԙ` ` X oX$The write option is 'failure' or an invalid value when entering this routine(#  tT ` ` X oX$Dynamic allocation of a character string failed.(# !I|t.(#ddWR_FLD.GEM5<* Glc#dp@~rQwl@#  uT  The wr123fld Structure Tree$(#(#(#(#'#$ 0 50*$$t'#?'50  uT ɿ uS ` `  $hh*06pp<B  H wr123rec ąROUTINE: wr123rec PURPOSE: ` ` To write a DR.(#` ARGUMENT LIST:  tT  ` ` NAME  $hh*TYPE06USEpp<DESCRIPTION  tT ` ` fp $hh*PTR06Ipp<FILE POINTER  tTa ` ` string[]$hh*PTR06Ipp<DATA RECORD  tT) ` ` str_len$hh*LONG06Ipp<LENGTH OF STRING(#p  tT ` ` status$hh*INT06I/Opp<STATUS  tT ` `  $hh*06 pp<0 = FAILURE ` `  $hh*06pp<1 = OKAY ` `  $hh*06pp<2 = START OF RECORD ` `  $hh*06pp<3 = END OF RECORD ` `  $hh*06pp<4 = END OF FILE ` `  $hh*06pp<5 = END OF FIELD ` `  $hh*06pp<6 = START OF FIELD  tT1 ` ` wr123rec()$hh*LOGICAL6Opp<SUCCESS FLAG EXTERNAL FUNCTION REFERENCES:  tTQ ` ` NAME $hh*DESCRIPTION  tT ` ` end123rec()$hh*COMPLETE PREVIOUS RECORD IF DATA IN BUFFER  tT ` ` get123level() hh*RETRIEVES APPROPRIATE DATA STRUCTURE LAYER(#h  tTq ` ` ld123rec()$hh*LOADS DATA RECORD INTO STRUCTURES GLOBAL REFERENCES: ` ` NONE GLOBAL VARIABLES: ` ` NONE GLOBAL CONSTANTS: ` ` NONE )#60*$$ԌPROCESSING:  uTX ` ` Routine wr123rec() invokes get123level() to retrieve the appropriate data structure layer. Previous record processing is ended by  uT invocation of end123rec() . Routine end123rec() writes any previous record to the file and the current internal file pointer position is saved. The input record is then written to the file pointed to by  tT6 file pointer fp. After physically writing the record, the internal file pointer is repositioned to the first byte of the record written, and the record is loaded into the internal data structure  uT by ld123rec() . This will allow additional processing to the record. The internal file pointer is repositioned to the beginning of the record written.(#`  uTk ` ` The record should be input to wr123rec() in a compressed format if it contains adjacent fixedlength bit subfields.(#`  uT ` ` Routine wr123rec() fails upon 'failure' of invoked external functions and C library functions.(#` I70*$$ !I|.(#ddWR_REC.GEM8<* Glc#dp@~rQwl@#  uT  The wr123rec Structure Tree$(#(#(#(#'#$ .ɿ uS ` `  $hh*06pp<B  H wr123sfld ĆROUTINE: wr123sfld PURPOSE: ` ` To write a DR subfield to an output buffer to be physically written when the record is complete.(#` ARGUMENT LIST:  tT ` ` NAME $hh*TYPE0 6USEpp<DESCRIPTION  tTa ` ` fp $hh*PTR06Ipp<FILE POINTER  tT) ` ` tag[] $hh*PTR06Ipp<FIELD IDENTIFIER  tT ` ` leadid$hh*CHAR06Ipp<LEADER IDENTIFIER  tT ` ` wr_str[]$hh*PTR06Ipp<STRING CONTAINING A DDR TFIELD(#p  tT ` ` str_len$hh*INT06Ipp<LENGTH OF WR_STR  tTI  ` ` option$ hh*INT06Ipp<WRITE FIELD OPTION(#p ` `  $hh*06pp<0 = FAILURE ` `  $hh*06pp<1 = OKAY ` `  $hh*06pp<2 = START OF RECORD ` `  $hh*06pp<3 = END OF RECORD ` `  $hh*06pp<4 = END OF FILE ` `  $hh*06pp<5 = END OF FIELD ` `  $hh*06pp<6 = START OF FIELD EXTERNAL FUNCTION REFERENCES:  tT ` ` NAME $hh*DESCRIPTION  tTq ` ` beg123rec()` $Xhh*BEGINS A DATA RECORD (#h  tT9 ` ` get123level()hh*RETRIEVES APPROPRIATE DATA STRUCTURE LEVEL (#h  tT ` ` ret123match()hh*FINDS THE ASSOCIATED DATA DESCRIPTIVE RECORD MATCH TO THE DATA RECORD (#h  tT ` ` stor123dv()$hh*STORES DATA IN STORAGE STRUCTURES(#h GLOBAL REFERENCES: ` ` DATA DESCRIPTIVE RECORD STRUCTURE (DD)(#` ` ` DATA RECORD LEADER STRUCTURE (RL) ` ` DATA RECORD STRUCTURE (DR) ` ` DIMENSION LENGTHS STRUCTURE (DM) ` ` FILE MANAGEMENT STRUCTURE (FM) )#90*$$ԌGLOBAL VARIABLES:  tT ` ` NAME $TYPEhh*0USE6DESCRIPTION  tT  ` ` cur_fm$PTRhh*0Ih6CURRENT POINTER TO FILE(# ` `  $hh*06MANAGEMENT STRUCTURE ENTRY GLOBAL CONSTANTS:  tT ` ` NAME $hh*TYPE06DESCRIPTION  tT ` ` FCDSTYPE$hh*INT0h6RELATIVE POSITION OF THE DATA STRUCTURE TYPE WITHIN THE FIELD CONTROL(#  tT ` ` NC $hh*CHAR06NULL CHARACTER  H PROCESSING:  uT ` ` Routine wr123sfld() writes a DR subfield from the input string  tT wr_str to the correct data structure for the current DR. The input  tT parameter str_len contains the byte length of wr_str. The  tT% appropriate fm structure and dd structure are located based upon the  tTQ file pointer fp and tag input to the routine, respectively. If the subfield state is 'out of bounds' (4), the subfield state is determined by the field control of the current DR being processed and the labels pointer for the current DDR entry:(#`  tT- ` ` X oX$If the field control is 'NULL' or zero (indicating elementary data), the subfield state is set to 'data value' (3)(#  tT ` ` X oX$If the labels field in the dd structure is 'NULL' and field control is 2 (indicating array data), subfield state is set to 'number of dimensions' (1)(# a":0*$$Ԍ tT ` `  o` $Otherwise, subfield state is set to 'data value' (3).  tT, The subfield state is saved in init_state and processing continues depending on the input write option and the subfield state.(# ` ` If the write option is 'start of record' (2):(#`  uT4 ` ` X oX$Routine beg123rec() is invoked to allocate the DR header structure for the new record and the subfield state is reset to its initial value(#  tT ` ` X oX$The leader identifier of the rl structure is set to the input leader identifier.(# ` ` If the write option is 'start of record' (2) or 'start of field' (6):(#`  uT ` ` X oX$If the no leader directory flag is set the dr structure is allocated, initialized, and appended to the DR header  uTF structure previously allocated by beg123rec() (#  tT ` ` X oX$If the record does not contain a leader, the current DR pointer is changed to point to the structure following the header in the DR list(#  tTO ` ` X oX$The subfield state determines in which structure the input string is stored:(#  tT ` ` X X$Xhh*©X0If the subfield state is 'number of  tT! dimensions' (1), the input string wr_str is stored in the num_dim field of the new DR+#;0*$$ and subfield state is incremented to 'dimension length' (2)(#  tT ` ` X X$Xhh*©X0If subfield state is 'dimension length' (2), a 'failure' is returned, since this state is in conflict with the write option of 'start of record' or 'start of field'(#  tT` ` ` X X$Xhh*©X0If the subfield state is 'data value' (3),  uT  stor123dv() is invoked to store the input  tT string in the dv structure. If the file interchange level is 1 or the field control indicates elementary data (0), the subfield state is incremented to 'out of bounds' (4).(# ` ` If the write option is 'okay' (6) or 'end of field' (5), the subfield state is examined to determine the processing for this option: (#`  tTq ` ` X oX$If the subfield state is 'number of dimensions' (1),  uT  wr123sfld() returns 'failure' since this state is in conflict with the specified write option(#  tT" ` ` X oX$If the subfield state is 'dimension length' (2), a dm structure is allocated and the input string is stored in  tTz the length field. The new structure is appended to the  tT dm structure list and the number of dimension length entries is incremented. If the number of entries equals  tT! the number of dimensions of the dr structure, the subfield state is set to 'data value' (3)(#*#<0*$$Ԍ uT ԙ` ` X oX$If the subfield state is 'data value' (3), stor123dv()  tT- is called to store the input string into dv structure. If the file interchange level is 1 or the field control indicates 'elementary data' (0), the subfield state is incremented to 'out of bounds' (4).(# ` ` Upon completing the processing based upon the subfield state, the write option is examined. If the write option is 'end of file' (5),  uTa the subfield state is set to 'out of bounds'. Routine wr123sfld() returns 'failure' for any other subfield state.(#`  uT ` ` During processing, wr123sfld() returns an error when:(#`  tT? ` ` X oX$An invoked routine fails(#  tT ` ` X oX$The open mode for the file corresponding to the passed file pointer is not write(#  tT ` ` X oX$The dynamic allocation of a dr structure failed(#  tTs ` `  o` $An invalid subfield state is encountered for the current write option(#  tT ` ` X oX$The dynamic allocation of a dm structure failed(#  tTO ` ` X o$An invalid write option is encountered.(# ` `  (#` =0*$$ !I|.(#ddWR_SFLD.GEM><* Gld#dp@~rQwl@#  uT ^ The wr123sfld Structure Tree$(#(#(#(#'#$