User Tools

Site Tools


cdc:nos2.source:nam5871:opensio

OPENSIO

Table Of Contents

  • [00002] PROC OPENSIO( (FET),(OPTION), STATIS )
  • [00072] PROC ABORT
  • [00073] PROC MESSAGE
  • [00074] PROC OPEN
  • [00075] PROC RECALL
  • [00076] FUNC XCOD C(10)

Source Code

OPENSIO.txt
  1. *DECK OPENSIO
  2. PROC OPENSIO( (FET),(OPTION), STATIS );
  3. BEGIN # OPENSIO #
  4. CONTROL NOLIST; # EXECUSRS #
  5. CONTROL LIST;
  6. *IF DEF,IMS
  7. #
  8. **
  9. *
  10. * 1. PROC NAME AUTHOR DATE
  11. * OPENSIO M. D. PICKARD 77/01/10
  12. *
  13. * 2. FUNCTIONAL DESCRIPTION
  14. * OPENSIO WILL OPEN AN EXISTING SUPIO RANDOM FILE OR CREATE
  15. * A NEW SUPIO RANDOM FILE.
  16. *
  17. * 3. METHOD USED
  18. * IF THE FET IS RANDOM, THE FILE IS OPENED W/ ALTER IF THE
  19. * OPTION IS NEW OR W/ THE OPTION IF OPTION IS NOT NEW. IF THE
  20. * OPEN IS SUCCESSFUL AND THE OPTION WAS NEW, THE INITIAL SUPIO
  21. * INDEX IS BUILT. IF THE OPTION WAS NOT NEW THE INDEX IS
  22. * CHECKED TO SEE IF IT IS A SUPIO INDEX AND THAT THE INDEX
  23. * AREA LENGTH IS LARGE ENOUGH. IF THE AREA IS NOT LARGE
  24. * ENOUGH, THE NEEDED LENGTH IS PLACE IN THE FIRST WORD OF THE
  25. * INDEX AREA
  26. *
  27. * 4. ENTRY PARAMETERS
  28. * FET ADDRESS OF THE FET
  29. * THE FET MUST CONTAIN THE INDEX BUFFER
  30. * FWA AND LENGTH IN WORD FET+7
  31. * OPTION OPEN OPTION
  32. * 0 - READ/WRITE WITH REWIND
  33. * "NEW" - OPEN W/ ALTER AS NEW FILE
  34. * "ALTER" - READ/WRITE, REWIND
  35. * "ALTERNR" - READ/WRITE, NO REWIND
  36. * "NR" - NO REWIND
  37. * "READ" - READ, REWIND
  38. * "READNR" - READ, NO REWIND
  39. * "WRITE" - WRITE, REWIND
  40. * "WRITENR" - WRITE, NO REWIND
  41. *
  42. * 5. EXIT PARAMETERS
  43. * STATIS RETURN STATUS
  44. * 0 = OPEN SUCCESSFUL
  45. * NOTSIOF - NOT A SUPIO FILE
  46. * INDXSML - INDEX AREA TO SMALL
  47. * INDXERR - INDEX POINTER IN ERROR
  48. * RANRSEQ - RANDOM REQ. ON SEQ. FILE
  49. *
  50. * 6. COMDECKS CALLED
  51. * SIODEFS SUPIO SYMPL DEFS
  52. * SIOBASE SUPIO BASED ARRAY DEFINITIONS
  53. *
  54. * 7. ROUTINES CALLED
  55. * OPEN MACREL OPEN SYMPL INTERFACE
  56. * RECALL MACREL CPU RECALL SYMPL INTERFACE
  57. *
  58. * 8. DAYFILE MESSAGES
  59. * NONE.
  60. *
  61.  #
  62. *ENDIF
  63. *CALL SIODEFS
  64. *CALL SIOBASE
  65. ITEM
  66. FET U, # FET ADDRESS #
  67. OPTION C(10), # OPEN OPTION #
  68. STATIS U, # RETURN STATUS #
  69. TEMP C(10); # FOR INTEGER TO CHARACTER CONVERSION #
  70. XREF
  71. BEGIN
  72. PROC ABORT;
  73. PROC MESSAGE;
  74. PROC OPEN;
  75. PROC RECALL;
  76. FUNC XCOD C(10);
  77. END
  78.  
  79. DEF INDXAT # O"23" #; # INDEX BUFFER TOO SMALL ABN. TERM. CODE #
  80.  
  81. ARRAY ABNTMSG [0:0] S(4);
  82. BEGIN
  83. ITEM ABNTMSG1 C(0,0,33) = ["OPEN ERROR, ABN. TERM. CODE = XX."];
  84. ITEM ABNTMSG2 C(3,0,2);
  85. ITEM ABNTMSGZ U(3,18,42) = [ 0 ];
  86. END
  87.  
  88. P<SIOFET> = FET; # FORMAT FET #
  89. IF FETRAN[0]
  90. THEN # FET IS A RANDOM FET #
  91. BEGIN # SEE IF INDEX POINTERS ARE OK #
  92. IF ( FETINDX[0] GQ 2 ) AND ( FETINDL GQ MINSIOI )
  93. THEN # INDEX POINTERS OK #
  94. BEGIN # SEE IF OPTION IS NEW #
  95. P<SIOINDX> = FETINDX[0]; # FORMAT INDEX AREA #
  96. FETFST[0] = FETINDX[0]; # SET CIRCULAR BUFFER PARAMS FOR #
  97. # EXISTING FILES #
  98. FETIN[0] = FETINDX[0];
  99. FETOUT[0] = FETINDX[0];
  100. FETLMT[0] = FETINDX[0] + FETINDL[0] + 1;
  101. FETEP[0] = TRUE;
  102. IF OPTION EQ "NEW"
  103. THEN
  104. OPEN(SIOFET,"ALTER"); # OPEN W/ ALTER #
  105. ELSE
  106. OPEN(SIOFET,OPTION); # OPEN W/ SPECIFIED OPTION #
  107. RECALL(SIOFET); # WAIT TIL COMPLETE BIT SET #
  108. FETEP[0] = FALSE;
  109. IF FETABNT[0] EQ INDXAT
  110. THEN # INDEX BUFFER TOO SMALL #
  111. BEGIN
  112. FETABNT[0] = 0; # CLEAR FOR NEXT USER OF FET #
  113. STATIS = INDXSML; # INDEX AREA TOO SMALL #
  114. RETINDL[0] = (LINDX[0] + 1) * 2; # NEEDED SIZE #
  115. RETURN; # ***** EXIT ***** #
  116.  
  117. END
  118. IF FETABNT[0] NQ 0
  119. THEN # OPEN ERROR #
  120. BEGIN
  121. TEMP = XCOD(FETABNT[0]);
  122. ABNTMSG2[0] = C<8,2>TEMP;
  123. MESSAGE(ABNTMSG,3);
  124. ABORT;
  125. END
  126. IF FETRAN[0]
  127. THEN # OPEN WAS SUCCESSFUL #
  128. BEGIN # SEE IF OPTION WAS NEW #
  129. IF OPTION EQ "NEW"
  130. THEN # OPTION IS NEW #
  131. BEGIN # OPTION IS NEW, INITIALIZE SUPIO INDEX #
  132. SIONAME[0] = "SUPIOINDEX"; # SUPIO INDEX NAME IN HEADER #
  133. CINDX[0] = 0; # INITIALIZE CURRENT POSITION #
  134. LINDX[0] = 0; # INITIALIZE LAST INDEX ORDINAL USED #
  135. HDRRSV[0] = 0; # CLEAR HEADER RESERVED #
  136. STATIS = 0; # SUCCESSFUL COMPLETE #
  137. END
  138. ELSE # OPTION WAS NOT NEW #
  139. BEGIN # SEE IF FILE WAS A SUPIO FILE #
  140. IF SIONAME[0] NQ "SUPIOINDEX"
  141. THEN # NOT A SUPIO INDEX #
  142. BEGIN
  143. STATIS = NOTSIOF; # NOT A SUPIO FILE #
  144. END
  145. ELSE # FILE IS SUPIO FILE #
  146. BEGIN # SEE IF INDEX BUFFER WAS BIG ENOUGH #
  147. IF ( ( LINDX[0] + 1 ) * SIOINDL ) GR FETINDL[0]
  148. THEN # INDEX TOO SMALL #
  149. BEGIN
  150. STATIS = INDXSML; # INDEX AREA TOO SMALL #
  151. RETINDL[0] = ( LINDX[0] + 1 ) * 2; # NEEDED SIZE #
  152. END
  153. ELSE
  154. STATIS = 0; # EVERYTHING IS OK. #
  155. END
  156. END
  157. END
  158. ELSE # FILE NOT SUPIO FILE, RANDOM BIT CLEARED #
  159. STATIS = RANRSEQ; # RANDOM REQUEST ON SEQUENTIAL FILE #
  160. END
  161. ELSE # INDEX POINTERS NOT GOOD #
  162. STATIS = INDXERR; # INDEX POINTER ERROR ON OPEN #
  163. END
  164. ELSE # FET IS NOT A RANDOM FET #
  165. STATIS = RANRSEQ; # RANDOM REQUEST ON SEQUENTIAL FILE #
  166. RETURN;
  167. END
  168. TERM # OPENSIO #
cdc/nos2.source/nam5871/opensio.txt ยท Last modified: 2023/08/05 17:23 by Site Administrator