WPC= 2BV[Z 3|d2cpi (M)LtTddd,dp@~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 ;XH`%O,(,{O P7PCourier 10cpiPrestige Elite 12cpi (M)Prestige Elite 12cpi Bold (D)Prestige Elite 12cpi Italic (D)Courier 10cpi (Bold)Courier 10cpi (Italic)2k Courier 10cpiPrestige Elite 12cpi (M)Prestige Elite 12cpi Bold (D)Prestige Elite 12cpi Italic (D)Courier 10cpi (Bold)Courier 10cpi (Italic)CG Times (Scalable)"m'^(,>CCwh,,,Cw,,,,CCCCCCCCCC,,w;w`T[cTO`c,4^Tyc`M`YHTc`~``V,,,CC,;C;C;,CC%%C%hCCCC14%CC`CC;;C;,CCCCC,,,,CCCCCCCCC%`;`;`;`;`;wY[;T;T;T;T;,%,%,%,%cC`C`C`C`CcCcCcCcC`C`;cC`C`C`CcCMC`;`;`;[;[;[;[;cCT;T;T;T;`C`C`C`C`C`CcCcC,%,%,%,%aJ4^CT%T%T%T%T%cCcOcCcC`C`Cw`Y1Y1Y1H4H4H4H4T%T%T%cCcCcCcCcCcC~``CV;V;V;cCT%cCY1H4T%`C`CcC`CcC,CC,,,/N```CCC,;66CCuCCCwwC/CCCCw/,,EECw##CCQQeCC`COooJJwK,EC~/"``C`E``wwCwwwC,,`Qw``````````x,C`CJCw`YC,C`;CM`hV``````````>``````oYQh`9O```````C```````;````;```````````````````````````````````````````,```,```,```,``````````````QTJQJY;T4V;cC`;,%^;YJyJc;YC`;`QMCQCCT;`;YQ`JhQQQQ4C%%;;;Q;QQQQ,,CCCCCCCQQQQQQQQQQQQQQQQQQQ4444444CCCCCCCCCCCCCCCCCCCC%%%%%%%%%%%%;;;;;;;;;;;;;;;;;;;QQQQQQQQQQQQQQQQQQQQ,M`Tc,``QC;,x uoq1 wMw.(#4UUUUUUUUUUUUU     J&5at'{)#}|2PkCLlP#test uP (testLL&LLLV2A#X2PkCLlP# load123lab  TP  1load123labU+@?#X2PkCLlP# str123tok TP  hstr123tok& vLv ww.(#4UUUUUUUUUUUUU     J&5at'{)#}|2PkCLlP#test uP (testLL&LLLU1@}6#X2PkCLlP# out123fmt  TP  1out123fmtS)>?#X2PkCLlP# w123int TP Chw123int& vLv ww.(#4UUUUUUUUUUUUUk$$kk$k$kkkkkk l ggly my ssmy msmsy y mJ&5at'{)#}|2PkCLlP#test uP (testLL&LLL M __MV2AiY#X2PkCLlP# rd123ddfld  TP  1rd123ddfldW-B )#X2PkCLlP# get123level TP  Rget123level& vLv    tyt  z x[! F!zF!W3BD&#X2PkCLlP# rd123ddsfld  TP  Ord123ddsfldV,A_#&#X2PkCLlP# is123intgr TP  Ois123intgr.(#4UUUUUUUUUUUUUJ&5[J'u(#}|2PkCLlP#test uP 'test#nn#&##nn# o$ YoY$ %~%3 *~*3'H' " "H'H "H "''HrHrk k HrHk Hk rrH& l(l (}( k k o"okV2A<[#X2PkCLlP# rd123ddrec  TP  rd123ddrecW-B#X2PkCLlP# get123level TP  ,get123levelT*? #X2PkCLlP# g123fstr TP J-g123fstr& J   J J J   JV,Afr#X2PkCLlP# ld123ddrec TP  .ld123ddrec& k&u$@u$n+n+@u$@n+@n+u$u$@V,A%)#X2PkCLlP# set123stat TP  /&%set123stat.(#4UUUUUUUUUUUUU q q  q q   q  k k kk  kJ&5[J'u(#}|2PkCLlP#test uP 'test.yy.&..yy. z/ [z[/&|m|v v m|mv mv ||mH` HB"B"` H` B"` B"HH` & l(l www | n#nrW3B)#X2PkCLlP# get123level  TP  Rget123level& l sksW3B8#X2PkCLlP# rd123ddsfld  TP  rd123ddsfldV,AMY&#X2PkCLlP# ld123ddrec TP  Old123ddrecU+@} , #X2PkCLlP# bld123lab TP  U bld123labU+@  #X2PkCLlP# bld123fmt TP  +E bld123fmt& cvv vov pw$w %ww&GgGA"A"gGgA"gA"GGgV,A ##X2PkCLlP# is123intgr TP  )Lis123intgr& e&|$i|$v+v+i|$iv+iv+|$|$iV,A%)%#X2PkCLlP# set123stat TP  7&Nset123stat& (l(.(#4UUUUUUUUUUUUU q q  q q   q  k k kk  kJ&5[J'u(#}|2PkCLlP#test uP 'test.yy.&..yy. z/ [z[/&|m|v v m|mv mv ||mH` HB"B"` H` B"` B"HH` & l(l www | n#nrW3B)#X2PkCLlP# get123level  TP  Rget123level& l sksT0?#X2PkCLlP# rd123fld  TP rd123fldT*?&#X2PkCLlP# ld123rec TP Old123recU+@j , #X2PkCLlP# get123fmt TP  U get123fmtV,A }  #X2PkCLlP# set123stat TP  E set123stat& cvv vov pw$w %ww&GgGA"A"gGgA"gA"GGgW-B\ ##X2PkCLlP# ret123match TP  Lret123match& e&|$i|$v+v+i|$iv+iv+|$|$iS)>o&K)%#X2PkCLlP# i123toa TP &Ni123toa& (l(.(#4UUUUUUUUUUUUUJ&5[J'u(#}|2PkCLlP#test uP 'test(ss(&((ss( t) XtX)&rHrk k HrHk Hk rrH& l(l (~( k l jjT0?#X2PkCLlP# rd123rec  TP  rd123recW-B#X2PkCLlP# get123level TP  ,get123level&]H]V"V"H]HV"HV"]]HT*?^ #X2PkCLlP# ld123rec TP m,ld123rec     V,AW "J #X2PkCLlP# set123stat TP  s set123stat$H$++H$H+H+$$HT*?a&)#X2PkCLlP# g123fstr TP &-g123fstr& ngn& C C CC  C   D VVDU+@Z/#X2PkCLlP# end123rec TP  (end123rec.(#4UUUUUUUUUUUUUCC&CCC D YYDJ,5[J'u(#}|2PkCLlP#test uP 'test&rHrk k HrHk Hk rrH ooU+@ #X2PkCLlP# rd123sfld TP  (rd123sfldW-B#X2PkCLlP# get123level TP  ,get123level& p6p l(l '}' k k v*(v _q_  & F F FF  FV,AsH#X2PkCLlP# free123lab TP  +free123lab'H' " "H'H "H "''HT*?( #X2PkCLlP# ld123rec TP 7-ld123recl$Gl$f+f+Gl$Gf+Gf+l$l$GW-B%)#X2PkCLlP# ret123match TP  %+ret123matchxi xq q i xi q i q xxi S)>j F% #X2PkCLlP# i123toa TP N i123toa l l  l l   l V,AG I( #X2PkCLlP# setup123lb TP  Q setup123lbWi WP"P"i Wi P"i P"WWi W-B % #X2PkCLlP# incre123lab TP  N incre123lab$i $++i $i +i +$$i U+@& )% #X2PkCLlP# get123fmt TP  k&N get123fmtzzzzzV,A](6#X2PkCLlP# set123stat TP  _set123stat& }k} ((.(#4UUUUUUUUUUUUUwwwwwJ&5at'{)#}|2PkCLlP#test uP (testLL&LLLT0?#X2PkCLlP# ret123dv  TP 1ret123dv& vLv wwU1@2#X2PkCLlP# str123tok  TP  [str123tok.(#4UUUUUUUUUUUUUJ&5[J'u(#}|2PkCLlP#test uP 'test#nn#&##nn# l o"okT0?#X2PkCLlP# ret123fv  TP ret123fv& faa znz&_K_Y"Y"K_KY"KY"__KV,A #X2PkCLlP# get123dval TP  /get123dval N   N N N   NU+@D #X2PkCLlP# get123fmt TP  2get123fmt.(#4UUUUUUUUUUUUU     J&5at'{)#}|2PkCLlP#test uP (testLL&LLLU1@cK#X2PkCLlP# ret123pdm  TP  1ret123pdmW-B!?#X2PkCLlP# ret123match TP  rhret123match& vLv ww uT #dp@~rQwl@#  p KFIPS PUB 123 Function Library Software Documentation Section Four: Routine Descriptions pH tT 5/93` `  $hh*06pp<B  HxxN T 4X` hp x (#%'0*,.8135@8:0*$$ !!I|.(#ddLOAD_LAB.GEM<*A,e#dp@~rQwl@#  uT , The load123lab Structure Tree$(#(#(#(#!'#$ 0X0*$$'#c!!0  uT U uS ` `  $hh*06pp<B  H load123tagp ĈROUTINE: ` ` load123tagp PURPOSE: ` ` To load tag pairs into a data descriptive tag pair structure.(#` ARGUMENT LIST:  tT  ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT ` ` string[]$hh*CHAR06Ipp<TAG PAIR STRING  tTa ` ` load123tagp() hh*LOGICAL6Opp<SUCCESS FLAG(#h EXTERNAL FUNCTION REFERENCES: ` ` NONE GLOBAL REFERENCES: ` ` DATA DESCRIPTIVE FILE CONTROL RECORD STRUCTURE (CR) ` ` DATA DESCRIPTIVE LEADER STRUCTURE (DL) ` ` DATA DESCRIPTIVE TAG PAIR STRUCTURE (TL) ` ` FILE MANAGEMENT STRUCTURE (FM) GLOBAL VARIABLES:  tT ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT ` ` cur_fm$hh*PTR06Ipp<CURRENT POINTER TO FILE(#p ` `  $hh*06pp<MANAGEMENT STRUCTURE ENTRY GLOBAL CONSTANTS:  tT ` ` NAME $hh*TYPE06DESCRIPTION  tT! ` ` NC $hh*CHAR06NULL CHARACTER  H PROCESSING:  uT! ` ` Routine load123tagp() retrieves the DDR ordered tag pairs from  tT" character string string, based upon the tag size in the DDR leader,"0*$$  tT and builds the tag pair list (tl). A header tl structure is allocated and its pointers initialized to 'NULL'. Tag pairs are  tTX retrieved from string until none remain.(#`  tT ` ` A pair of tags is copied from string to the internal variables  tT first_tag and second_tag. The character pointer index is updated to point to the next tag pair in the string after copying the tags. A  tT4 tl structure is allocated for each tag pair with first_tag and  tT` second_tag being copied to tag_1 and tag_2, respectively. Each  tT structure is appended to the list. When index points to the end of  uT the string, load123tagp() returns 'success'.(#`  uT ` ` During processing, load123tagp() returns an error when an invoked C library function fails.(#` ` ` This routine does not invoke any lower level FIPS PUB 123 Function Library routines.(#` 0*$$  uT U A, uS ` `  $hh*06pp<B  H l123tos ĄROUTINE: l123tos PURPOSE: ` ` To convert a long integer to a character string and change its byte ordering when specified.(#` ARGUMENT LIST:  tT ` ` NAME $hh*TYPE06USEpp<DESCRIPTION   tT) ` ` num $hh*LONG06Ipp<NUMBER TO BE CONVERTED  tT ` ` string[]$hh*PTR06Opp<CHARACTER STRING  tT ` ` reverse$hh*LOGICAL6Ipp<REVERSE BYTE ORDER FLAG ` `  $hh*06pp<1 - REVERSE  tTI  ` `  $hh*06pp<0 - DO NOT REVERSE  tT ` ` l123tos() hh*LOGICAL 6Opp<SUCCESS FLAG EXTERNAL FUNCTION REFERENCES: ` ` NONE GLOBAL REFERENCES: ` ` NONE GLOBAL VARIABLES: ` ` NONE GLOBAL CONSTANTS: ` ` NONE PROCESSING:  uT! ` ` Routine l123tos() moves a long integer to a four byte character string variable to be returned to the calling procedure. The"0*$$ reverse flag indicates the direction to store the four bytes in the long integer.(#` ` ` This routine does not invoke any lower level routine.(#` 0*$$  uT   uS ` `  $hh*06pp<B  H out123fmt ĆROUTINE: ` `  OUT123FMT PURPOSE: ` ` To write format string to output file.(#` ARGUMENT LIST:  tT  ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT ` ` fp $hh*PTR06Ipp<FILE POINTER TO A TEMPORARY FILE(#p  tT) ` ` ct_ptr$hh*PTR06Ipp<POINTER TO FORMAT CONTROL STRUCTURE(#p  tT ` ` out123fmt()$hh*LOGICAL6Opp<SUCCESS FLAG EXTERNAL FUNCTION REFERENCES:  tT ` ` NAME $hh*0DESCRIPTION  tTi ` ` out123fmt()` $Xhh*0FUNCTION TO WRITE THE FORMAT STRING(#h ` `  $hh*0TO OUTPUT FILE  tT ` ` w123int()` $Xhh*X0FUNCTION TO WRITE AN INTEGER TO(# ` `  $hh*0OUTPUT FILE GLOBAL REFERENCES: ` ` FORMAT CONTROLS STRUCTURE (FC) GLOBAL VARIABLES: ` ` NONE GLOBAL CONSTANTS: ` ` NONE PROCESSING:  uT ` ` Routine out123fmt() uses a recursive traversal of the format control structure tree to create a string containing the format. Input  tT*# parameter ct_ptr provides the base case to either stop the recursion*#0*$$ process or continue processing. If the value is 'NULL', the function exits and returns. Otherwise, the process continues. The first section of the code processes a left node of a subtree. If the repetition number field of a node has a value of zero, the node contains a format control and the data type and associated widths or delimiters are written to the temporary output file. If the node has a repetition value greater than one, that value is written to  uT4 the temporary output file. Routine out123fmt() is recursively invoked to print the left subtree format controls. The right subtree is printed next. A right subtree value of 'NULL' and a repetition value of zero, signals the end of a format control list. The current node is assigned the value of the parents right child. This assignment allows the routine to backup levels of nesting in the format controls list.(#`  uT ` ` During processing, out123fmt() returns 'failure' when an invoked routine fails.(#`  0*$$ A!I|.(#ddOUT_FMT.GEM <*A,d#dp@~rQwl@#  uT ^ The out123fmt Structure Tree$(#(#(#(#A'#$0 0*$$'#c!A 0  uT  uS ` `  $hh*06pp<B  H pop123rs ąROUTINE: pop123rs PURPOSE: ` ` To pop a repetition number from the top of the repetition stack.(#` ARGUMENT LIST:  tT  ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT ` ` rnum $hh*INT06Opp<REPETITION NUMBER  tTa ` ` pop123rs()$hh*LOGICAL6Opp<SUCCESS FLAG EXTERNAL FUNCTION REFERENCES: ` ` NONE GLOBAL REFERENCES: ` ` FILE MANAGEMENT STRUCTURE (FM) ` ` FORMAT REPETITION STACK STRUCTURE (RS) GLOBAL VARIABLES:  tT ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT ` ` cur_fm$hh*PTR06Ipp<CURRENT POINTER FOR FILE(#p ` `  $hh*06pp<MANAGEMENT STRUCTURE ENTRY GLOBAL CONSTANTS: ` ` NONE PROCESSING:  uT ` ` Routine pop123rs() removes a repetition stack structure from the rs  uT structure list. If the stack list is empty, pop123rs() returns  uT 'failure'. Otherwise, pop123rs() removes a structure from the front of the repetition stack list which simulates popping the repetition  tTd" number off the top of a stack, and returns 'success'.(#` # 0*$$Ԍ tT ` ` This routine features repetition number rnum as its argument to  uT, preserve the calling sequence of push123rs() . Routine pop123rs() is invoked when the repetition number of the first structure in the  tT stack list is zero; thus, rnum is assigned the value 0 before removing the structure from the list.(#`  uT  ` ` During processing, pop123rs() returns 'failure' if the stack list is empty.(#` ` ` This routine does not invoke any lower level routines.(#`  0*$$  uT  uS ` `  $hh*06pp<B  H push123rs ĆROUTINE: push123rs PURPOSE: ` ` To push a repetition number on the repetition stack.(#` ARGUMENT LIST:  tT  ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT ` ` rnum $hh*INT06Ipp<REPETITION NUMBER  tTa ` ` push123rs()$hh*LOGICAL6Opp<SUCCESS FLAG EXTERNAL FUNCTION REFERENCES: ` ` NONE GLOBAL REFERENCES: ` ` FILE MANAGEMENT STRUCTURE (FM) ` ` FORMAT REPETITION STACK STRUCTURE (RS) GLOBAL VARIABLES:  tT ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT ` ` cur_fm$hh*PTR06Ipp<CURRENT POINTER FOR FILE(#p ` `  $hh*06pp<MANAGEMENT STRUCTURE ENTRY GLOBAL CONSTANTS: ` ` NONE PROCESSING:  uT ` ` Routine push123rs() allocates a repetition stack structure (rs) and  tT assigns the repetition number rnum to the rs structure. The structure is then inserted at the front of the stack list which simulates pushing the repetition number onto a stack. Routine  uTb"  push123rs() then returns 'success'.(#` # 0*$$Ԍ uT ԙ` ` During processing, push123rs() returns 'failure' when dynamic  tT- allocation of an rs structure fails.(#` ` ` This routine does not invoke any lower level routines.(#` 0*$$  uT     uS ` `  $hh*06pp<B  H rd123ddfld ćROUTINE: rd123ddfld PURPOSE: ` ` To retrieve a field of a DDR.(#` ARGUMENT LIST:  tT  ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT ` ` fp $hh*PTR06Ipp<FILE POINTER  tTa ` ` tag[] $hh*PTR06O pp<TAG  tT) ` ` rd_str[]$hh*PTR06Opp<STRING CONSISTING OF CURRENT CONCATENATED FIELD OF DDR(#p  tT ` ` status$hh*INT060pp<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  tT ` ` rd123ddfld()hh*LOGICAL6Opp<SUCCESS FLAG EXTERNAL FUNCTION REFERENCES:  tT ` ` NAME $hh*DESCRIPTION  tT ` ` get123level() hh*RETRIEVES APPROPRIATE DATA STRUCTURE LAYER(#h  tTq ` ` is123intgr() hh*DETERMINES IF INPUT STRING IS INTEGER VALUE(#h  tT9 ` ` rd123ddsfld() hh*RETRIEVES DESCRIPTIVE RECORD SUBFIELD(#h GLOBAL REFERENCES: ` ` DATA DESCRIPTIVE LEADER STRUCTURE (DL) ` ` FILE MANAGEMENT STRUCTURE (FM) GLOBAL VARIABLES:  tTA ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT ` ` cur_fm$hh*PTR06Ipp<CURRENT POINTER FOR FILE(#p ` `  $hh*06pp<MANAGEMENT STRUCTURE ENTRY  tTa" ` ` glb_str[MAXSIZ]hh*CHAR06I/Opp<GLOBAL CHARACTER STRING(#p ` `  $hh*06pp<USED FOR PROCESSING)#0*$$ԌGLOBAL CONSTANTS:  tT ` ` NAME $hh*TYPE06DESCRIPTION  tT  ` ` FT_STR[2]$hh*CHAR0h6CHARACTER STRING CONTAINING THE(# ` `  $hh*06FIELD TERMINATOR  tT ` ` UT_STR[2]$ hh*CHAR06CHARACTER STRING CONTAINING THE(# ` `  $hh*06UNIT TERMINATOR PROCESSING:  uT( ` ` Routine rd123ddfld() reads the next DDR field from the correct data structures of the DDR. Each subfield is read from the appropriate  uT structure by rd123ddsfld() .(#`  tT ` ` The appropriate fm structure is obtained based upon file pointer fp.  uT Initially, rd123ddsfld() is invoked repeatedly to read a subfield from the data structures until the start of the next field is  uT_ reached, i.e., rd123ddsfld() returns a status of 'start of field'  tT (6) or 'start of record' (2) in order to ensure that an assembled  uT field begins with the correct subfield. However, if rd123ddsfld()  tT returns a tag indicating a useraugmented file description (0..2),  uT or the file interchange level is 1, rd123ddsfld() is only invoked  tT> once. The resulting subfield is contained in string rd_str.(#`  tT ` ` If the returned tag is not '0..2' and the file interchange level is  tT not 1, the string rd_str contains the field control for the field to  uT be read. Routine rd123ddsfld() is invoked repeatedly to retrieve  tT the remaining subfields from the appropriate structures corresponding to the current field. As each subfield is retrieved,  tTs a unit terminator and the subfield are concatenated to rd_str.(#` "0*$$Ԍ` ` A field terminator is concatenated to the string containing the  uT, assembled field before rd123ddfld() returns 'success'.(#`  uT ` ` During processing, rd123ddfld() returns an error when an invoked routine fails.(#` 0*$$ a!I|.(#ddRD_DDFLD.GEM<*A,k#dp@~rQwl@#  uT , The rd123ddfld Structure Tree ă$(#(#(#(#a'#$ 0,0*$$'#c!a0  uT  0+ uS ` `  $hh*06pp<B  H rd123ddrec ćROUTINE: rd123ddrec PURPOSE: ` ` To read the DDR.(#` ARGUMENT LIST:  tT  ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT ` ` fp $hh*PTR06Ipp<FILE POINTER  tTa ` ` string[]$hh*PTR060pp<RECORD READ  HxxN T  tT) ` ` status$hh*INT060pp<STATUS  tT  $hh* 6 pp<0 = FAILURE  tT  hh*06 pp<1 = OKAY  tT  hh*06pp<2 = START OF RECORD  tTI  hh*06pp<3 = END OF RECORD  tT  $hh*06pp<4 = END OF FILE  tT  ` `  hh*06pp<5 = END OF FIELD  tT  ` `  $hh*06pp<6 = START OF FIELD  tTi ` ` rd123ddrec()hh*LOGICAL6Opp<SUCCESS FLAG EXTERNAL FUNCTION REFERENCES:  tT ` ` NAME $hh*DESCRIPTION  tT ` ` g123fstr()` $hh*READS A FULL CHARACTER STRING(#  tT ` ` get123level() hh*RETRIEVES APPROPRIATE DATA STRUCTURE(#h ` `  $hh*LAYER  tTq ` ` ld123ddrec() hh*LOADS THE DATA DESCRIPTIVE RECORD(#h ` `  $hh*INFORMATION INTO STRUCTURES FOR REFERENCE  tT ` ` set123stat() hh*SET STATUS FLAG(#h GLOBAL REFERENCES: ` ` DATA DESCRIPTIVE LEADER (DL) ` ` DATA DESCRIPTIVE RECORD STRUCTURE (DD) ` ` FILE MANAGEMENT STRUCTURE (FM) GLOBAL VARIABLES:  tT ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tTa" ` ` cur_fm$hh*PTR06Ipp<CURRENT POINTER FOR FILE(#p ` `  $hh*06pp<MANAGEMENT STRUCTURE ENTRY)#0*$$ԌGLOBAL CONSTANTS: ` ` NONE PROCESSING:  uT@ ` ` Routine rd123ddrec() retrieves the DDR from file pointer fp based upon the record length within the leader. The record is returned as  tT character string string. The variable status is initialized to  tT 'failure' (0) and the correct fm structure is obtained based upon  uT fp. If the DDR does not currently reside in memory, ld123ddrec() is invoked to load the record into the appropriate data structures. If  uTJ  ld123ddrec() fails, the C library function feof() is called to determine whether an 'end of file' marker was encountered during  tT loading. If 'end of file' was encountered, status is set to 'end of  uT file' (4) and rd123ddrec() returns 'failure'.(#` ` ` If the record length within the leader is zero, the DDR exceeds 99,999 bytes and must be calculated. The record length is calculated by summing the field length and the field position of the last DDR field and the base address of the data descriptive area.(#`  uT ` ` The file is rewound and g123fstr() retrieves the DDR into string  uT1 based upon the record length. Routine set123stat() determines the  tT^ status of the file: if the returned status is not 'end of file'  tT (4), status is set to 'end of record' (3). The subfield state is  uT set to 'out of bounds' (5) and rd123ddrec() returns 'success'.(#`  uT ` ` During processing, rd123ddrec() returns 'failure' when an invoked routine fails.(#` h"0*$$ !I|.(#ddRD_DDREC.GEM<*A,e#dp@~rQwl@#  uT , The rd123ddrec Structure Tree$(#(#(#(#'#$ 0,0*$$'#c!0  uT 0+4 uS ` `  $hh*06pp<B  H rd123ddsfld ĈROUTINE: rd123ddsfld PURPOSE: ` ` To retrieve a DDR subfield.(#` ARGUMENT LIST:  tT  ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT ` ` fp $hh*PTR06Ipp<FILE POINTER  tTa ` ` tag[] $hh*PTR06O pp<TAG  tT) ` ` rd_str[]$hh*PTR06Opp<SUBFIELD STRING(#p  tT ` ` status$hh*INT06Opp<STATUS  tT  $ 0 pp<0 = FAILURE  tT  hh* 06 pp<1 = OKAY  tTI  hh* 06pp<2 = START OF RECORD  tT  hh* 06pp<3 = END OF RECORD  tT  $hh*06pp<4 = END OF FILE  tT  ` `  hh*06pp<5 = END OF FIELD  tTi  ` `  $hh*06pp<6 = START OF FIELD  tT1 ` ` rd123ddsfld()hh*LOGICAL6Opp<SUCCESS FLAG EXTERNAL FUNCTION REFERENCES:  tTQ ` ` NAME $hh*DESCRIPTION  tT ` ` bld123fmt()` $hh*BUILDS A FORMAT STRING FROM THE FORMAT (# ` `  $hh*CONTROL STRUCTURE  tTq ` ` bld123lab()` $hh*BUILDS A LABEL STRING FROM THE DATA(# ` `  $hh*DESCRIPTIVE RECORD LABEL SUBFIELD ` `  $hh*STRUCTURE  tT ` ` get123level() hh*RETRIEVES APPROPRIATE LEVEL FROM FILE(#h ` `  $hh*MANAGEMENT STRUCTURE  tTY ` ` is123intgr() hh*DETERMINES IF A STRING IS AN INTEGER(#h  tT! ` ` ld123ddrec() hh*READS THE DATA DESCRIPTION RECORD AND LOADS THE INFORMATION INTO THE DATA STRUCTURE FOR REFERENCE(#h  tT ` ` set123stat() hh*CHECKS FOR END OF FILE AND SETS STATUS(#h ` `  $hh*FLAG GLOBAL REFERENCES: ` ` DATA DESCRIPTIVE FILE CONTROL RECORD STRUCTURE (CR)(#` ` ` DATA DESCRIPTIVE LEADER STRUCTURE (DL) ` ` DATA DESCRIPTIVE RECORD STRUCTURE (DD))#0*$$Ԍ` ` DATA DESCRIPTIVE TAG PAIR STRUCTURE (TL) ` ` FILE MANAGEMENT STRUCTURE (FM) GLOBAL VARIABLES:  tT ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tTx ` ` cur_fm$ hh*PTRX0X6I/OXpp<CURRENT POINTER TO FILE MANAGEMENT STRUCTURE ENTRY(#p GLOBAL CONSTANTS:  tT` ` ` NAME $hh*TYPE06DESCRIPTION  tT ` ` FCDSTYPE$hh*INT0X6RELATIVE POSITION OF FIELD CONTROL DATA STRUCTURE TYPE IN THE DATA DESCRIPTIVE FIELDS(#  tTH ` ` FCDTYPE$hh*INT0X6RELATIVE POSITION OF FIELD(# ` `  $hh*06CONTROL DATA TYPE IN THE DATA ` `  $hh*06DESCRIPTIVE FIELDS  tT ` ` NC $hh*CHAR06NULL CHARACTER PROCESSING:  uTP ` ` Routine rd123ddsfld() invokes get123level() to retrieve the  tT} appropriate fm structure. If the data descriptive record has not  uT been loaded, ld123ddrec() is invoked to load it. The variable  tT status is then initialized to 'okay'.(#` ` ` The data descriptive subfield state controls the flow of the process. There are four possible integer values associated with the DDR subfield state:(#`  tT ` ` X oX$field control subfield (1)(#  tT ` `  o` $name subfield (2)(#  tT6! ` `  o` $labels subfield (3)(#  tTb" ` `  o` $formats subfield (4)(# #0*$$Ԍ` ` Any other DDR subfield values are considered to be out of range.(#`  uTX ` ` Routine rd123ddsfld() examines sf_state_dd for a value of 'out of bounds' (5) which indicates the need to advance to the next field of the current DDR. If a value of 'out of bounds' is found, the  tT routine advances to the next field and initializes state to 'field control'. An error is returned if a next field is not available.(#`  uTa ` ` Routine rd123ddsfld() then evaluates two special cases:(#`  tT ` ` X oX$File interchange level onelevel one files contain only the name subfield(#  tT> ` ` X oX$Tag value indicates a file description fieldthe user augmented file description is returned as the desired  tT output subfield. The variable state is then set to  tT 'finished' (5) and output status to 'end of field' (5). If the tag does not indicate a file description, the routine returns the subfield corresponding to the subfield state value.(# ` ` The necessary subfield to be returned is based upon the current  tT value of state: (#`  tT" ` ` X oX$Field controlif the subfield state has the value of 1,  tTN the current field control is returned; status is set to  tTz 'start of record' (2) for the first field; or status is set to 'start of field' (6)(#  tT! ` ` X oX$Namea subfield state value of 2 is expected in this case. The tag value is examined first. A tag*#0*$$ indicating a file control returns the file title or the  tT, name subfield is returned. The appropriate status is  tTX assigned and state is incremented(#  tT ` ` X oX$Subfieldthis state examines the tag value. If the tag indicates a file control field, the tag pair list is  uT returned. Otherwise, bld123lab() is invoked to build the labels string, which is then returned to the calling routine(#  tT ` ` X oX$Formatsa subfield value of 4 is expected in this case.  uT Routine bld123fmt() is invoked to build the format string which is returned to the calling routine. The  tT> appropriate status and state are assigned.(#  uT ` ` Routine rd123ddsfld() returns 'failure' if an invoked routine fails.(#` 0*$$ !I|.(#ddRD_DDSFL.GEM<*A,f#dp@~rQwl@#  uT The rd123ddsfld Structure Tree$(#(#(#(#'#$ 0,0*$$'#c!0  uT Њ4Eɿ uS ` `  $hh*06pp<B  H rd123fld ąROUTINE: rd123fld PURPOSE: ` ` To retrieve a DR field.(#` ARGUMENT LIST:  tT  ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT ` ` fp $hh*PTR06Ipp<FILE POINTER  tTa ` ` tag[] $hh*PTR06Opp<FIELD TAG  tT) ` ` leadid[]$hh*PTR06Opp<LEADER IDENTIFIER  tT ` ` rd_str[]$hh*PTR06Opp<READ FIELD  tT ` ` str_len$hh*LONG06Opp<BYTE LENGTH OF RD_STR  tT ` ` status$hh*INT060pp<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  tT ` ` rd123fld()$hh*LOGICAL6Opp<SUCCESS FLAG EXTERNAL FUNCTION REFERENCES:  tT ` ` NAME $hh*DESCRIPTION  tTq ` ` get123fmt()` $hh*RETRIEVES A SINGLE FORMAT FROM THE FORMAT(# ` `  $hh*STRUCTURE  tT ` ` get123level() hh*RETRIEVES APPROPRIATE fm ENTRY FOR THIS(#h ` `  $hh*FILE POINTER  tT ` ` i123toa()$hh*CONVERTS AN INTEGER TO A CHARACTER STRING(#h  tTY ` ` ld123rec()` $hh*LOADS DATA RECORD INFORMATION INTO DATA(# ` `  $hh*STRUCTURES FOR REFERENCE  tT ` ` ret123match() hh*FINDS ASSOCIATED DATA DESCRIPTIVE MATCH(#h ` `  $hh*TO DATA RECORD  tTy ` ` set123stat() hh*CHECKS IF EOF AND SETS STATUS FLAG(#h GLOBAL REFERENCES: ` ` DATA DESCRIPTIVE RECORD STRUCTURE (DD)(#` ` ` DATA RECORD (DR) ` ` DATA RECORD DATA VALUE SUBFIELD STRUCTURE (DV))#0*$$Ԍ` ` DATA RECORD LEADER STRUCTURE (RL) ` ` DIMENSION LENGTHS STRUCTURE (DM)(#` ` ` FILE MANAGEMENT STRUCTURE (FM) GLOBAL VARIABLE:  tT ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT@ ` ` cur_fm$hh*PTR06I/Opp<CURRENT POINT TO FILE(#p ` `  $hh*06pp<MANAGEMENT STRUCTURE ENTRY GLOBAL CONSTANTS:  tT( ` ` NAME $hh*TYPE06DESCRIPTION  tT ` ` BYTE_S$hh*INT06NUMBER OF BITS IN A BYTE(#`  tT ` ` FT_STR$hh*CHAR0X6CHAR STRING WITH FIELD TERMINATOR (RS) 1/14 FOLLOWED BY NULL CHARACTER(#  tT ` ` NC $hh*CHAR06NULL CHARACTER  tT ` ` UT $hh*CHAR06UNIT TERMINATOR (US) 1/15  tT ` ` UT_STR$hh*CHAR0X6STRING CONTAINING UNIT TERMINATOR FOLLOWED BY THE NULL CHARACTER(# PROCESSING:  uT ` ` Routine rd123fld() retrieves a DR field as a character string from the correct data structures of the current DR. Adjacent fixedlength bit fields are returned in either a compressed or  tT uncompressed format, indicated by the member compress in the fm structure. The default is set to 'uncompressed'. Compressed bit data subfields are only used internally to the FIPS PUB 123 software  uT! and are not returned to the user by rd123sfld . The appropriate fm  tTN structure is obtained based upon the file pointed to by fp. If the  uTz next dr structure does not exist, ld123rec() is invoked to load a DR from the input file. The corresponding DDR tag is located based  tT upon the tag in the dr structure and the DR field is recreated from the appropriate structures.(#` +#0*$$Ԍ` ` If the number of dimensions is greater than zero, each dimension length is concatenated to the string, and separated by a unit  tTX terminator. Then each data value is retrieved from the dv structure list and concatenated to the string. If no format controls exist for the DR field, the unit terminator is used to separate the individual subfields. (#` ` ` After the data values have been placed in the string, the field terminator is concatenated to the string marking the end of the DR field. The tag and leader identifier are set to the tag of the  tT current dr structure and the leader identifier of the rl structure,  tT respectively. If other structures still remain in the dr structures  tT list, status is set to 'okay' (1) if it is not currently 'start of  uT< record' (2). If there are no remaining dr structures, set123stat()  uTi is called to check for 'end of file' (4). If set123stat() does not  tT return an 'end of file' status, status is set to 'end of record'.(#`  uT ` ` During processing, rd123fld() returns an error when an invoked lower level routine returns a 'failure' status.(#` G0*$$ !I|.(#ddRD_FLD.GEM<*Glc#dp@~rQwl@#  uT  The rd123fld Structure Tree$(#(#(#(#'#$ 0,0*$$'#c!0  uT ElSɿ uS ` `  $hh*06pp<B  H rd123rec ąROUTINE: ` ` rd123rec PURPOSE: ` ` To read the next record.(#` ARGUMENT LIST:  tT  ` ` NAME $TYPEhh*0USE6DESCRIPTION  tT ` ` fp $PTRhh*0I6FILE POINTER  tTa ` ` string[]$PTRhh*0O6RECORD READ  tT) ` ` status$INThh*0O6STATUS  tT  $ hh*060 = FAILURE  tT  $hh* 061 = OKAY  tT  hh*062 = START OF RECORD  tTI  hh*063 = END OF RECORD  tT  $hh*064 = END OF FILE  tT  ` `  hh*065 = END OF FIELD  tT  ` `  $hh*066 = START OF FIELD  tTi ` ` str_len$LONGhh*0O6LENGTH OF STRING  H  tT1 ` ` rd123rec()$LOGICAL0O6SUCCESS FLAG EXTERNAL FUNCTION REFERENCES:  tTQ ` ` NAME $hh*DESCRIPTION  tT ` ` end123rec()$hh*COMPLETE PREVIOUS RECORD  tT ` ` g123fstr()` $hh*READS A CHARACTER STRING(#  tTq ` ` get123level() hh*RETRIEVES APPROPRIATE DATA STRUCTURE LAYER(#h  tT9 ` ` ld123rec()` $Xhh*LOAD A DATA RECORD INTO STRUCTURE(#h  tT ` ` set123stat() hh*SET STATUS FLAG(#h GLOBAL REFERENCES: ` ` DATA RECORD LEADER STRUCTURE (RL) ` ` FILE MANAGEMENT STRUCTURE (FM) GLOBAL VARIABLES:  tT ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT! ` ` cur_fm$hh*PTR06I/Opp<CURRENT POINTER TO FILE(#p ` `  $hh*06pp<MANAGEMENT STRUCTURE ENTRY )#0*$$ԌGLOBAL CONSTANTS:  tT ` ` NAME $hh*TYPE0X6DESCRIPTION(#  tT  ` ` NC $hh*CHAR06NULL CHARACTER PROCESSING:  uT ` ` Routine rd123rec() reads the next DR from file pointer fp and loads it into the appropriate data structures. The status and character string for the DR are initialized to 'failure' and empty,  tTU respectively, and the appropriate fm structure is obtained. The remainder of the processing depends upon the no leader directory  tT flag within the current fm structure.(#` ` ` If no leader exists within the DR, the record length is retrieved from the DR leader currently in memory. The record length is adjusted to exclude the leader and directory that are absent in the  uT Data Record to be read. Routine end123rec() is invoked to remove the previous DR from memory. The current position of the internal  uT file pointer is saved and ld123rec() loads the DR into memory. The internal file pointer is repositioned to its previous location  uT; (start of current record) and g123fstr() retrieves the previously loaded DR from the file.(#`  uT ` ` However, if the DR to be read contains a leader, end123rec() removes the previous DR from memory. The current position of the internal  uT file pointer is saved, ld123rec() loads the DR into memory and the internal file pointer is repositioned to its previous location (start of current record). The record length is retrieved from the  uT! leader and g123fstr() retrieves the previously loaded DR from the file.(#` " 0*$$Ԍ tT ԙ` ` The record is returned in parameter rd_str and the length in bytes  tT, is returned in str_len. If the record contains adjacent fixedlength bit subfields they are returned in a compressed format.(#`  uT ` ` Routine set123stat() is invoked after retrieving the DR string to determine whether or not the retrieved record was the last one in  tT  the file. If status returned is not 'end of file' (4), status is  uT5 set to 'okay' (1). Regardless of status, rd123rec() returns 'success'.(#`  uT ` ` During processing, rd123rec() returns 'failure' when:(#`  tT ` `  ` $oXhh*An invoked routine fails(#h  tTk ` `  X$oXhh*An invoked C library function which manages the internal file pointer fails.(#h !0*$$ !I|.(#ddRD_REC.GEM"<*Glc#dp@~rQwl@#  uT  The rd123rec Structure Tree$(#(#(#(#'#$ 0,"0*$$'#c!"0  uT lS_ɿ uS ` `  $hh*06pp<B  H rd123sfld ĆROUTINE: rd123sfld PURPOSE: ` ` To retrieve a subfield of a DR.(#` ARGUMENT LIST:  tT  ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT ` ` fp $hh*PTR06Ipp<FILE POINTER  tTa ` ` tag[] $hh*PTR06Opp<FIELD IDENTIFIER  tT) ` ` leadid[]` $Xhh*PTR06Opp<LEADER IDENTIFIER (#p  tT ` ` rd_str[]` $Xhh*PTRX0X6OXpp<STRING CONSISTING OF CURRENT CONCATENATED FIELD OF DDR(#p  tT ` ` str_len$hh*LONG06Opp<BYTE LENGTH OF RD_STR T  tTI ` ` status$hh*INT06Opp<STATUS  tT  hh*06pp<0 = FAILURE  tT  hh*06pp<1 = OKAY  tT  hh* 06pp<2 = START OF RECORD  tTi  hh*06 pp<3 = END OF RECORD  tT1  $hh*06pp<4 = END OF FILE  tT  ` `  hh*06pp<5 = END OF FIELD  tT  ` `  $hh*06pp<6 = START OF FIELD EXTERNAL FUNCTION REFERENCES:  tT ` ` NAME $hh*DESCRIPTION  tTq ` ` free123lab() hh*FREES LABELS POINTER STRUCTURE (#h  tT9 ` ` get123fmt()` $Xhh*RETRIEVES A SINGLE FORMAT FROM THE FORMAT STRUCTURE(#h  tT ` ` get123level() hh*RETRIEVES APPROPRIATE DATA STRUCTURE LAYER (#h  tT ` ` incre123lab() hh*INCREMENTS A LABEL FOR THE CORRESPONDING DATA VALUE (#h  tT! ` ` i123toa()` $Xhh*CONVERTS AN INTEGER INTO A CHARACTER STRING(#h  tT ` ` ld123rec()` $Xhh*READS THE DATA RECORD LOADING THE INFORMATION IN THE DATA STRUCTURES FOR REFERENCE (#h  tTy ` ` ret123match() hh*FINDS ASSOCIATED DATA DESCRIPTIVE MATCH TO DATA RECORD (#h  tT ` ` set123stat() hh*CHECKS FOR EOF AND SETS STATUS FLAG(#h  tT ` ` setup123lb() hh*SETS UP LABELS POINTER STRUCTURE (#h )##0*$$ԌGLOBAL REFERENCES: ` ` DATA DESCRIPTIVE RECORD STRUCTURE (DD) ` ` DATA RECORD DATA VALUE SUBFIELD STRUCTURE (DV) ` ` DATA RECORD LEADER STRUCTURE (RL) ` ` DATA RECORD STRUCTURE (DR) ` ` DIMENSION LENGTHS STRUCTURE (DM) ` ` FILE MANAGEMENT STRUCTURE (FM) ` ` LABELS POINTER STRUCTURE (LP)(#` GLOBAL VARIABLES:  tT` ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT ` ` cur_fm$hh*PTR06I/Opp<CURRENT POINTER TO FILE(#p ` `  $hh*06pp<MANAGEMENT STRUCTURE ENTRY GLOBAL CONSTANTS:  tT ` ` NAME $hh*TYPE06DESCRIPTION  tTh ` ` BYTE_S$hh*INT06NUMBER OF BITS IN A BYTE  tT0 ` ` NC $hh*CHAR06NULL CHARACTER PROCESSING:  uT ` ` Routine rd123sfld() retrieves a DR subfield as a character string of  tT  length str_len. The subfield contents vary depending upon the values of the subfield state. Possible values of subfield state are:(#`  tT ` `  o$field control subfield (1)  tT ` `  o$name subfield (2)  tT ` `  o$labels subfield (3)  tTA ` `  o$formats subfield (4). ` ` If the current record contains adjacent fixedlength bit subfields  uT" they are returned by subsequent calls to rd123sfld() . Each fixed"$0*$$ԫ tT length bit subfield starts at the first bit of rd_str and is filled on the right with binary zeros to complete the last character.(#`  tT ` ` The appropriate fm structure is obtained based upon file pointer fp input to the routine. If the subfield state is 'out of bounds' (4),  uT  free123lab() is invoked to free the labels structures and the present DR header structure is examined to determine whether  uT5  ld123rec() should load a DR from the input data file, or the current  tTb DR pointer should be updated to the next dr structure in the  uT existing list. If ld123rec() fails, the read status is set to 'end of file' (4) if an EOF was encountered. If an EOF was not  uT encountered but ld123rec() failed, the read status is set to  uT 'failure'. In either case, rd123sfld() returns 'failure'.  tTA Otherwise, the corresponding dd structure is found based upon the  tTm tag in the dr structure. The remainder of the processing depends upon the number of dimensions of the DR field or the subfield state.(#` ` ` If the number of dimensions is greater than zero and the subfield state is not 'data value', the subfield state is examined. If the state is 'number of dimensions', the output string is set to the number of dimensions after converting it to character and the subfield state is incremented to length of dimension. If the read status is not 'start of record' (2) the current DR pointer is at the  tT structure following the header, and status, it is set to 'start of record'. If the current DR pointer is not the structure following the header, the read status is set to 'start of field' (6). Then,  tT} the dimension lengths pointer in the fm structure is set to the  tT dimension length header pointer of the dr structure.(#` ` ` If the subfield state is 'dimension length' and the current dimension lengths structure pointer does not exist, subfield state-#%0*$$  uT is set to data value and setup123lb() builds the lp structure list if it does not exist. Then, the format tree pointers are initialized to the format root. If the dimension lengths structure  tT pointer of the fm structure exists, the length is retrieved from the  tT current dm structure and converted to character for the output string.(#` ` ` If the number of dimensions is less than or equal to zero and subfield state is not 'data value', the subfield state is  uT incremented to 'data value' and setup123lb() is invoked to build the labels structure if the labels exist. The format tree pointers are  tT initialized to the format root, and if status is not 'start of  tT record' then status is set to 'start of field'.(#` ` ` If the subfield state is 'data value', the value and its corresponding label and format are retrieved from the appropriate structures in the following manner. First, the current values  tT pointer is examined. If it is equal to the dr values header, the current data values structure pointers are initialized to the next  tTF value set of the dv header structure. The format pointers are initialized to the format root and the read status is set based upon  tT the current dr pointer and the number of dimensions. If the current  tT dr structure follows the header and its number of dimensions field is zero, the read status is set to 'start of record'. If the  tT" current dr structure does not follow the header and the number of dimensions is zero, the read status is set to 'start of field'. If  tTz the current dv structure is not equal to the dr values header, the  tT current dv structure pointer is set to the next structure in its list.(#` !&0*$$Ԍ` ` If the subfield is not the first, the corresponding labels pointer  uT, is incremented via incre123lab() and get123fmt() retrieves the  tTY corresponding data format. If the current dv structure exists and contains a data value, the output string is set to the data value. If the structure contains no data value, the output string is set to  tT a null character string. If the current dv structure does not exist, the data values pointers are set to the next value set.  tT5 Then, the output string is set to the data value in the dv strcuture or a null character if the data value does not exist. However, if  tT the current dv structure does not exist, the read status is set to  uT zero and rd123sfld() returns 'failure'.(#` ` ` If no data values remain in the structures, the read status and the  uT> subfield state are set. If set123stat() does not return an 'end of file' status, status is set to 'end of record'; otherwise, if the returned status is not 'start of record', status is set to 'end of field'. (#`  uT ` ` During processing, rd123sfld() returns an error when:(#`  tTH ` ` X oX$An invoked routine fails(#  tT ` ` X oX$The data value pointer is set to the next value set and the its structure does not point to a data value.(# '0*$$ !I|K.(#ddRD_SFLD.GEM(<*Gle#dp@~rQwl@#  uT ^ The rd123sfld Structure Tree $(#(#(#(#'#$ 0(0*$$'#+"(0  uT _%{ɿ uS ` `  $hh*06pp<B  H ret123dv ąROUTINE: ret123dv PURPOSE: ` ` To return delimited data values stored in a structure.(#` ARGUMENT LIST:  tT  ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT ` ` b_ptr[]$hh*PTR06Ipp<CHARACTER POINTER TO BUFFER  tTa ` ` prim_dms$hh*INT06Ipp<PRIMARY DIMENSION LENGTH  tT) ` ` ret123dv()$hh*LOGICAL6Opp<SUCCESS FLAG EXTERNAL FUNCTION REFERENCES:  tTI ` ` NAME $hh*DESCRIPTION  tT ` ` str123tok()$ hh*RETURNS A POINTER TO A STRING TOKEN(#h GLOBAL REFERENCES: ` ` DATA RECORD DATA VALUE SUBFIELD STRUCTURE (DV) ` ` DATA RECORD STRUCTURE (DR) ` ` FILE MANAGEMENT STRUCTURE (FM) GLOBAL VARIABLES:  tT ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT9 ` ` cur_fm$hh*PTR06Ipp<CURRENT POINTER TO FILE (#p ` `  $hh*06pp<MANAGEMENT STRUCTURE ENTRY GLOBAL CONSTANTS:  tT! ` ` NAME $hh*TYPE06DESCRIPTION  tT ` ` DEL_STR[3]$hh*CHAR0h6CHARACTER STRING CONTAING THE FIELD(# ` `  $hh*06AND UNIT TERMINATORS  tTA ` ` FT $hh*CHAR06FIELD TERMINATOR (RS) 1/14  tT ` ` NC $hh*CHAR06NULL CHARACTER  tT ` ` UT_STR[2]$hh*CHAR0X6CHARACTER STRING CONTAINING THE(# ` `  $hh*06UNIT TERMINATOR )#)0*$$ԌPROCESSING:  uTX ` ` Routine ret123dv() retrieves delimited data values as a character  tT string from character string b_ptr passed into the routine. Data values delimited by either unit or field terminators are retrieved repeatedly from the string until no data values remain or the number  tT  of primary dimensions prim_dms has been reached.(#`  tTa ` ` Temporary buffer tmp_buf is allocated and the string b_ptr is copied to the allocated space. The temporary buffer's starting address is  uT stored temporarily because str123tok() , when later invoked, modifies its string pointer argument which is the starting memory address of  uT the string. After processing is completed and before ret123dv()  tT? returns 'success', the temporary buffer space tmp_buf is released  tTk using the original starting address st_tmpbuf.(#`  tT ` ` A dv structure is allocated for the header of the data values structure list. Its pointers are initialized and the structure is  tT assigned to the values pointer in the current dr structure and the  tTG row_dvh pointer in the fm structure.(#`  uT ` ` Routine str123tok() is invoked and returns a character pointer to a  tT string delimited by a terminator in tmp_buf.  The returned pointer  tT is assigned to val_str.  If the pointer is not 'NULL', a second dv structure is allocated and its pointers are initialized to 'NULL'.  tTP Memory space is allocated and the string pointed to by val_str is  tT| copied to the space. The pointer to the new dv structure containing the data value is assigned to the following:(#`  tT" ` `  oX$The next value set pointer in row_dvh of the fm structure(#,#*0*$$Ԍ tT ԙ` `  oX$The current dv structure pointer of the fm structure(#  tTX ` `  oX$The row_dvh pointer of the fm structure.(# ` ` The value counter is initialized to 1 and similar processing as described above is initiated. The processing involves:(#`  tT4 ` ` X oX$Allocating a values structure and copying the retrieved  uT` string value from str123tok() to it(#  tT ` ` X oX$Assigning the structure to the appropriate pointers(#  tT ` ` X oX$Incrementing the value counter(#  uTi ` ` X oX$Invoking str123tok() to retrieve another string pointer  tT from tmp_buf.(#  tT ` ` The pointer to the new dv structure containing the data value is assigned to the following:(#`  tTr ` `  o$The next value pointer of the current dv structure(#  tT ` `  oX$The current dv structure pointer of the fm structure.(#  uT ` ` Data values are retrieved repeatedly from tmp_buf until str123tok() returns a 'NULL' pointer or the required number of values have been  tTO obtained as limited by the number of primary dimensions prim_dms.(#`  uT ` ` During processing, ret123dv() returns 'failure' when:(#`  tT" ` `  oX$An invoked C library function fails(#  tT,# ` `  o$Dynamic allocation of a dv structure fails(#,#+0*$$Ԍ tT ` `  oX$Dynamic allocation of a character string fails.(# !!I| .(#ddRET_DV.GEM,<*Glc#dp@~rQwl@#  uT  The ret123dv Structure Tree$(#(#X(#(#!'#$0X,0*$$ '##!,0  uT %{nɿ uS ` `  $hh*06pp<B  H ret123fv ąROUTINE: ret123fv PURPOSE: ` ` To input formatted data values and store in a structure.(#` ARGUMENT LIST:  tT  ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT ` ` fp $hh*PTR06Ipp<FILE POINTER  tTa ` ` prim_dms$hh*INT06Ipp<PRIMARY DIMENSION LENGTH  tT) ` ` comprssd$hh*INT06Ipp<INDICATOR FOR COMPRESSED ADJACENT FIXEDLENGTH BINARY SUBFIELDS(#p  tT ` ` ret123fv()$hh*LOGICAL6Opp<LOGICAL SUCCESS FLAG EXTERNAL FUNCTION REFERENCES:  tT ` ` NAME $hh*DESCRIPTION  tT1 ` ` get123dval()hh*FUNCTION TO RETRIEVE DATA VALUE  tT ` ` get123fmt()$ hh*FUNCTION TO RETRIEVE FORMAT CONTROL(#h GLOBAL REFERENCES: ` ` DATA RECORD DATA VALUE SUBFIELD STRUCTURE (DV) ` ` DATA RECORD STRUCTURE (DR) ` ` FILE MANAGEMENT STRUCTURE (FM) GLOBAL VARIABLES:  tT ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tTY ` ` cur_fm$hh*PTR06Ipp<CURRENT POINTER TO FILE(#p ` `  $hh*06pp<MANAGEMENT STRUCTURE ENTRY  tT ` ` glb_str[MAXSIZ]hh*CHARX0X6I/OXpp<GLOBAL CHARACTER STRING USED FOR PROCESSING(#p )#-0*$$ԌGLOBAL CONSTANTS:  tT ` ` NAME $hh*TYPE06DESCRIPTION  tT  ` ` FT $hh*CHAR06FIELD TERMINATOR (RS) 1/14  tT ` ` MAXSIZ$hh*INT0h6MAXIMUM AMOUNT OF CONTIGUOUS MEMORY SPACE(#  tTx ` ` NC $hh*CHAR06NULL CHARACTER PROCESSING:  uT( ` ` Routine ret123fv() retrieves formatted data values as a character  tTU string from file pointer fp. Data values are retrieved repeatedly until a field terminator is encountered or the number of primary  tT dimensions prim_dms have been reached.(#`  tT ` ` A dv structure is allocated for the header of the data values structure list. Its pointers are initialized and the structure is  tT] assigned to the values pointer in the current dr structure. An 'end of field' (5) flag is initialized to false and data value retrieval is initiated.(#`  uT  ` ` Routine get123fmt() is invoked to retrieve the format controls for  uT: the subfield to be retrieved. Routine get123dval() is invoked to retrieve the data value as a character string based upon the format  tT controls. The parameter comprssd indicates whether to retrieve the value from a commpressed or uncompressed record. C library function  uT  strchr() is invoked to determine whether a field terminator is in the character string. If the field terminator is not within the character string, the end of the field was not reached and the 'end of field' flag is set to 'false'; otherwise, the 'end of field' flag is set to 'true' as a field terminator is contained in the character string. If the 'end of field' flag is not set based upon the".0*$$ contents of the character string, a character is retrieved from the file and examined to determine if the 'end of field' has been reached. If the retrieved character is an 'end of file' marker, or the character is a field terminator and the width retrieved by  uT  get123fmt() is nonzero, the 'end of field' flag is set to 'true'; otherwise, the retrieved character is pushed back to the file.(#`  tT5 ` ` A second dv structure is allocated and its pointers are initialized  uTa to 'NULL'. If get123dval() retrieved a data value, memory space is allocated and the data value is copied to the space. The pointer to  tT the new dv structure containing the data value is assigned to the following:(#`  tT> ` `  o$The next value set pointer in row_dvh of the fm structure(#  tT ` `  oX$The current dv structure pointer of the fm structure(#  tT ` `  o$The row_dvh pointer of the fm structure.(# ` ` The value counter is initialized to 1 and a similar processing loop is entered as described above. The processing involves: invoking  uT  get123fmt() and get123dval() to produce a data value; allocating a values structure and copying the retrieved value to it; assigning the structure to the appropriate pointers; and incrementing the value counter. Data values are retrieved repeatedly until the 'end of field' flag becomes 'true' or the required number of values have been obtained as limited by the number of primary dimensions  tT prim_dms. The difference between this data value retrieval and the processing described earlier is the structure pointers which are set!/0*$$  tT to the allocated dv structure. The pointer to the new dv structure containing the data value is assigned to the following:(#`  tT ` `  o$The next value pointer of the current dv structure(#  tT ` `  oX$The current dv structure pointer of the fm structure.(#  uT ` ` During processing, ret123fv() returns 'failure' when:(#`  tTa ` ` X oX$An invoked routine or C library function fails(#  tT ` `  o$Dynamic allocation of a dv structure fails.(# 00*$$ A!I|.(#ddRET_FV.GEM1<* Glc#dp@~rQwl@#  uT  The ret123fv Structure Tree$(#(#(#(#A'#$ 0,10*$$'#c!A10  uT n%ɿ uS ` `  $hh*06pp<B  H ret123match ĈROUTINE: ret123match PURPOSE: ` ` To find an associated data descriptive entry for the current DR entry.(#` ARGUMENT LIST:  tT ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tTa ` ` tag $hh*PTR06Ipp<INTERNAL NAME OF ASSOCIATED FIELD(#p  tT ` ` ret123match() hh*LOGICAL6Opp<SUCCESS FLAG(#h EXTERNAL FUNCTION REFERENCES: ` ` NONE GLOBAL REFERENCES: ` ` DATA DESCRIPTIVE RECORD STRUCTURE (DD)(#` ` ` FILE MANAGEMENT STRUCTURE (FM) ` `  GLOBAL VARIABLES:  tT ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tT ` ` cur_fm$hh*PTR06Ipp<CURRENT POINTER TO FILE(#p ` `  $hh*06pp<MANAGEMENT STRUCTURE ENTRY GLOBAL CONSTANTS: ` ` NONE PROCESSING:  uTA ` ` Routine ret123match() finds the associated DDR entry for the current  tTn DR field based upon the character string tag. The dd structure list  tT! is traversed until a tag in the structure matches the input tag.(#` "20*$$Ԍ uT ` ` Routine ret123match() returns 'failure' when a corresponding tag is  tT- not found in any dd structure in the list.(#` ` ` This routine does not invoke any lower level routines.(#` 30*$$  uT %ɿ uS ` `  $hh*06pp<B  H ret123pdm ćROUTINE: RET123PDM PURPOSE: ` ` To calculate the size of the primary dimension of array data with labels.(#` ARGUMENT LIST:  tT ` ` NAME $hh*TYPE06USEpp<DESCRIPTION  tTa ` ` pdm X$hh*INT06O` pp<SIZE OF PRIMARY DIMENSION(#p  tT) ` ` ret123pdm()$ hh*LOGICAL6Opp<SUCCESS FLAG(#h EXTERNAL FUNCTION REFERENCES:  tTI ` ` NAME $hh*DESCRIPTION  tT ` ` ret123match() hh*RETRIEVES DATA DESCRIPTION ENTRY(#h GLOBAL REFERENCES: ` ` DATA DESCRIPTIVE LABEL SUBFIELD STRUCTURE (SL) ` ` DATA DESCRIPTIVE RECORD STRUCTURE (DD) ` ` DATA RECORD STRUCTURE (DR) ` ` FILE MANAGEMENT STRUCTURE (FM) 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:  uT! ` ` Routine ret123pdm() calculates the primary dimension of array data  tT" using labels and returns primary dimension pdm. The labels in the"40*$$  tT first label set in the sl structure list, representing columns, are counted. If labels exist within this set, the number of columns is  uTX assigned to pdm and ret123pdm() returns 'success'. However, if no labels exist within the first set, the labels in the second set, representing rows, are counted. The number of rows is assigned to  uT pdm and ret123pdm() returns 'success'.(#`  uT6 ` ` During processing, ret123pdm() returns 'failure' when:(#`  tT ` ` X oX$An invoked routine fails(#  tT ` ` X oX$No labels exist in either the first or second labels set.(# k50*$$ a!I|.(#ddRET_PDM.GEM6<* d#dp@~rQwl@#  uT ^ The ret123pdm Structure Tree$(#(#(#(#a'#$