User Tools

Site Tools


cdc:nos2.source:nam5871:qtput

Table of Contents

QTPUT

Table Of Contents

  • [00005] PROC QTPUT(WSA)
  • [00096] PROC NP$ERR
  • [00097] PROC NETPUT
  • [00124] ENTRY PROC QTTIP(WSA)

Source Code

QTPUT.txt
  1. *DECK QTPUT
  2. USETEXT AIPDEF
  3. USETEXT QTRMCOM
  4. USETEXT QTRMNIT
  5. PROC QTPUT(WSA);
  6. *IF DEF,IMS
  7. #
  8. *1DC QTPUT
  9. *
  10. * 1. PROC NAME AUTHOR DATE
  11. * QTPUT J.C. LEE 79/01/12
  12. *
  13. * 2. FUNCTIONAL DESCRIPTION
  14. * SEND A MESSAGE TO A SPECIFIED TERMINAL.
  15. *
  16. * 3. METHOD USED
  17. * ENTRY POINT QTPUT:
  18. * SET QTTIPCALL FLAG TO FALSE.
  19. * ENTRY POINT QTTIP:
  20. * SET QTTIPCALL FLAG TO TRUE.
  21. * IF NETON NOT SUCCESSFUL,
  22. * CALL NP$ERR TO ISSUE DAYFILE MSG AND ABORT APP.
  23. * ELSE (NETON HAS COMPLETED),
  24. * IF CONNECTION NUMBER IS BAD,
  25. * SET SEC-RETURN-CODE FIELD IN NIT TO ERROR CODE.
  26. * ELSE (CONNECTION EXISTS),
  27. * IF CONNECTION HAS BEEN LOANED TO ANOTHER APP,
  28. * SET SEC-RETURN-CODE FIELD IN NIT TO ERROR CODE.
  29. * ELSE (CONNECTION BELONGS TO THIS APPLICATION),
  30. * IF CONNECTION IS IN WRONG STATE,
  31. * SET SEC-RETURN-CODE FIELD IN NIT TO ERROR CODE.
  32. * ELSE (CONNECTION IS IN GOOD STATE FOR CALL),
  33. * IF CONNECTION IS AT BLOCK LIMIT,
  34. * SET SEC-RETURN-CODE FIELD IN NIT TO ERROR CODE.
  35. * ELSE (BLOCK CAN BE SENT TO NAM),
  36. * IF A-A DISPLAY CODE CONNECTION
  37. * AND DATA BLOCK IS WRONG SIZE,
  38. * SET SEC-RETURN-CODE FIELD IN NIT TO ERROR CODE.
  39. * ELSE (OKAY TO SEND BLOCK),
  40. * IF DISPLAY CODE DATA,
  41. * IF SIZE NOT SPECIFIED,
  42. * SCAN DATA BLOCK TO DETERMINE SIZE.
  43. * IF TERMINAL CONNECTION,
  44. * ADD LINE TERMINATOR TO END OF DATA BLOCK.
  45. * SET UP APPLICATION BLOCK HEADER WORD.
  46. * CALL NETPUT TO SEND DATA BLOCK TO NAM.
  47. *
  48. * 4. ENTRY CONDITIONS
  49. * NIT$STATE - CURRENT STATE OF THE CONNECTION
  50. * NIT$C$ABL - CURRENT APPLICATION BLOCK LIMIT OF THE CONNECTION
  51. * NIT$CHAR$SET - CHARACTER SET TO BE USED
  52. * NIT$CON - CONNECTION TO RECEIVE THE OUTPUT DATA
  53. * NIT$CTLC - CURRENT TEXT LENGTH IN CHARACTERS
  54. * NIT$MTLC - MAXIMUM TEXT LENGTH ALLOWED
  55. * NIT$INT$MSG - SET IF DATA IS A -BLK-, CLEARED IF A -MSG-
  56. * NIT$QDATA - SET IF DATA IS QUALIFIED DATA
  57. * WSA - LOCATION OF MESSAGE TEXT TO BE OUTPUT
  58. *
  59. * 5. EXIT CONDITIONS
  60. * NIT$RC - RETURN CODE, 0 IF DATA IS SENT TO NAM, AND 5 IF
  61. * THE APPLICATION BLOCK LIMIT IS EXCEEDED.
  62. * NIT$ABN - LAST ABN SENT IS INCREMENTED BY 1
  63. * NIT$C$ABL - CURRENT ABL IS DECREMENTED BY 1
  64. *
  65. * 6. COMDECKS CALLED AND SYMPL TEXTS USED.
  66. * AIPDEF NP$CRT QTRMCOM QTRMNIT
  67. *
  68. * 7. ROUTINES CALLED
  69. * NETPUT - AIP PROCEDURE TO OUTPUT DATA TO NETWORK
  70. * NP$ERR - AIP PROCEDURE TO DAYFILE ERROR MESSAGES
  71. *
  72. * 8. DAYFILE MESSAGES
  73. * NETWORK APPLICATION ABORTED, RC = 72.
  74. * QTPUT: REQUEST INVALID BEFORE QTOPEN.
  75. *
  76. *
  77.  #
  78. *ENDIF
  79.  
  80. #
  81.   CONTROL DEFINITIONS
  82. #
  83. CONTROL PRESET;
  84. CONTROL PACK;
  85. CONTROL DISJOINT;
  86. CONTROL INERT;
  87. CONTROL FASTLOOP;
  88.  
  89. *CALL NP$CRT
  90.  
  91. #
  92.   ROUTINES CALLED
  93. #
  94. XREF
  95. BEGIN
  96. PROC NP$ERR; # DAYFILE ERROR MESSAGES #
  97. PROC NETPUT; # OUTPUT DATA TO NETWORK #
  98. END
  99. #
  100.   LOCAL VARIABLES
  101. #
  102. ARRAY WSA [0:204] S(1); # OUTPUT MESSAGE TEXT AREA #
  103. BEGIN
  104. ITEM WSA$WORD C(0,0,WC);
  105. ITEM WSA$LSW I;
  106. END
  107.  
  108. ITEM
  109. ACN I, # CONNECTION NUMBER #
  110. I I, # TEMPORARY VARIABLE #
  111. J I, # TEMPORARY VARIABLE #
  112. K I, # TEMPORARY VARIABLE #
  113. LEN I; # TEXT LENGTH IN CHARACTERS #
  114. ITEM QTTIPCALL B ;
  115. CONTROL EJECT;
  116. #
  117.   BEGIN QTPUT PROCESSING
  118. #
  119. BEGIN
  120.  
  121. QTTIPCALL = FALSE ;
  122. GOTO QTPUT1 ;
  123.  
  124. ENTRY PROC QTTIP(WSA) ;
  125. QTTIPCALL = TRUE ;
  126.  
  127. QTPUT1:
  128. IF NOT NETON$STATUS # CHECK IF NETON IS COMPLETED #
  129. THEN
  130. IF QTTIPCALL
  131. THEN
  132. NP$ERR("74") ;
  133. ELSE
  134. NP$ERR("72") ; # QTPUT CALLED BEFORE NETTED ON #
  135.  
  136. P<NIT> = NIT$ADDR;
  137. NIT$RC[0] = S"QTPUTREJ"; # INITIALIZE TO BAD CALL #
  138. ACN = NIT$CON[0]; # SPECIFIED ACN #
  139.  
  140. IF (NIT$STATE[ACN] EQ S"NULL") OR
  141. (NIT$STATE[ACN] EQ S"WCONENDN") OR
  142. (ACN EQ 0) OR
  143. (ACN GR NIT$NO$TERMS[0])
  144. THEN # CONNECTION IS NONEXISTENT #
  145. BEGIN
  146. NIT$S$RC[0] = S"BADCN"; # RETURN LOGICAL ERROR REASON CODE #
  147. END
  148. ELSE # CONNECTION EXISTS OR LOANED #
  149. BEGIN
  150. IF (NIT$STATE[ACN] EQ S"LEND") OR
  151. (NIT$STATE[ACN] EQ S"LENT")
  152. THEN # CONNECTION HAS BEEN LOANED TO ANOTHER AP#
  153. BEGIN
  154. NIT$S$RC[0] = S"CONLOANED"; # STORE REASON FOR BAD CALL #
  155. END
  156. ELSE # CONNECTION EXISTS #
  157. BEGIN
  158. IF (NIT$STATE[ACN] EQ S"LIMBO") OR
  159. (NIT$STATE[ACN] EQ S"POSE") OR
  160. ( (NIT$STATE[ACN] GQ STATE"WAITPRU") AND
  161. (NIT$STATE[ACN] LQ STATE"PRUEOO" ) ) OR
  162. (NIT$STATE[ACN] EQ S"LENDRET")
  163. THEN # DATA CANNOT BE SENT ON CON IN THIS STATE#
  164. BEGIN
  165. NIT$S$RC[0] = S"BADSTATE"; # STORE REASON FOR BAD CALL #
  166. END
  167. ELSE # CONNECTION IS IN GOOD STATE FOR CALL #
  168. BEGIN
  169. IF NIT$C$ABL[ACN] EQ 0
  170. THEN # ABL HAS BEEN EXCEEDED #
  171. BEGIN
  172. NIT$S$RC[0] = S"OVERABL"; # STORE REASON FOR BAD CALL #
  173. END
  174. ELSE # OKAY TO SEND DATA BLOCK ON THIS CON #
  175. BEGIN
  176. LEN = NIT$CTLC[0]; # TEXT LENGTH IN CHARACTERS #
  177.  
  178. K = NIT$MTLC[0] - (NIT$MTLC[0]/4)*4;
  179. J = NIT$CTLC[0] - (NIT$CTLC[0]/4)*4;
  180. IF (NIT$DEVTYP[ACN] NQ 0) AND
  181. (NIT$CHAR$SET[0] EQ CT6DISPLAY) AND
  182. ( ( (LEN EQ 0) AND (K NQ 0) ) OR
  183. ( (LEN NQ 0) AND (J NQ 0) ) )
  184. THEN # BAD SIZE FOR DISPLAY CODE DATA ON A-A #
  185. BEGIN
  186. NIT$S$RC[0] = S"AAACT4ERR"; # STORE REASON FOR BAD CAL#
  187. END
  188. ELSE # GOOD QTPUT CALL #
  189. BEGIN
  190. NIT$RC[0] = S"OK"; # NORMAL COMPLETION RETURN CODE #
  191. IF NIT$CHAR$SET[0] EQ CT6DISPLAY
  192. THEN # MESSAGE IS IN DISPLAY CODE #
  193. BEGIN
  194. IF LEN EQ 0
  195. THEN # COMPUTE MESSAGE LENGTH #
  196. BEGIN # SCAN BACKWARD FOR NON-BLANK#
  197. K = NIT$MTLC[0]-(NIT$MTLC[0]/10)*10;
  198. FOR I=NIT$MTLC[0]/10 WHILE C<K,1>WSA$WORD[I] EQ " "
  199. AND I GQ 0
  200. DO
  201. BEGIN
  202. IF K EQ 0
  203. THEN
  204. BEGIN
  205. K = 9;
  206. I = I - 1;
  207. END
  208. ELSE
  209. BEGIN
  210. K = K - 1;
  211. END
  212. END
  213. LEN = (I*10) + K + 1;
  214. IF NIT$DEVTYP[ACN] NQ 0
  215. THEN # NEED TO ROUND UP TO NEAREST MULT OF 4 #
  216. BEGIN
  217. LEN = ((LEN+3)/4)*4;
  218. END
  219. END
  220.  
  221. IF NIT$DEVTYP[ACN] EQ 0
  222. THEN # TERMINAL CONNECTION #
  223. BEGIN
  224. J = LEN/10;
  225. K = LEN-(J*10); # NO OF CHARS IN LAST WORD #
  226. FOR I=K STEP 1 UNTIL 9 DO
  227. BEGIN # FORM 0 BYTES TERMINATOR #
  228. C<I,1> WSA$WORD[J] = 0;
  229. END
  230. IF K EQ 9
  231. THEN # LINE TERMINATOR IS 66 0 BITS #
  232. BEGIN
  233. J = J+1;
  234. WSA$LSW[J] = 0;
  235. END
  236.  
  237. LEN = (J+1)*10; # LENGTH OF OUTPUT MESSAGE #
  238. END
  239.  
  240. END
  241.  
  242. NIT$ABN[ACN] = NIT$ABN[ACN] + 1;
  243. NIT$C$ABL[ACN] = NIT$C$ABL[ACN] - 1;
  244.  
  245. ABHWORD[0] = 0; # INITIALIZE ABH WORD #
  246. #
  247.   SET UP ABH WORD
  248. #
  249. ABHADR[0] = ACN ;
  250. ABHABN[0] = NIT$ABN[ACN] ;
  251. ABHACT[0] = NIT$PUTSET[0] ;
  252.  
  253. IF QTTIPCALL
  254. THEN
  255. BEGIN
  256. ABHABT[0] = APPCMD; # BLOCK TYPE 3 FOR QTTIP CASE #
  257. END
  258. ELSE # QTPUT CALL #
  259. BEGIN
  260. IF NIT$INT$MSG EQ 0
  261. THEN
  262. BEGIN
  263. IF NIT$QDATA[0] EQ 0
  264. THEN # NOT QUALIFIED DATA #
  265. BEGIN
  266. ABHABT[0] = APMSG ;
  267. END
  268. ELSE # QUALIFIED MSG BLOCK #
  269. BEGIN
  270. ABHABT[0] = APPQMSG; # SET BLOCK TYPE IN ABH #
  271. END
  272. END
  273. ELSE # BLOCK BLOCK TYPE #
  274. BEGIN
  275. IF NIT$QDATA[0] EQ 0
  276. THEN # NOT QUALIFIED DATA #
  277. BEGIN
  278. ABHABT[0] = APPBLK ; # SET BLOCK TYPE IN ABH #
  279. END
  280. ELSE # QUALIFIED MSG BLOCK #
  281. BEGIN
  282. ABHABT[0] = APPQBLK; # SET BLOCK TYPE IN ABH #
  283. END
  284. END
  285.  
  286. IF NIT$DEVTYP[ACN] EQ 0
  287. THEN # TERMINAL CONNECTION #
  288. BEGIN
  289. IF NIT$XPTSET[0] EQ 1
  290. THEN
  291. BEGIN
  292. ABHXPT[0] = 1 ;
  293. END
  294. END
  295. ELSE # APPLICATION-TO-APPLICATION CONNECTION #
  296. BEGIN
  297. IF NIT$CHAR$SET[0] EQ CT6DISPLAY
  298. THEN # SENDING DISPLAY CODE ON A-TO-A CON #
  299. BEGIN
  300. ABHACT[0] = CT8ASCII; # CHANGE CHAR SET TO ASCII#
  301. LEN = (LEN/4)*3; # CONVERT TLC FOR ACT=2 #
  302. END
  303. END
  304. END # QTPUT CALL #
  305. ABHTLC[0] = LEN;
  306. NIT$DN$ABH[ACN] = ABHWORD[0]; # SET LAST DOWNLINE ABH #
  307.  
  308. NETPUT(HEADER, WSA); # SEND DATA TO TERMINAL #
  309.  
  310. END
  311. END
  312. END
  313. END
  314. END
  315. RETURN;
  316. END
  317. TERM
cdc/nos2.source/nam5871/qtput.txt ยท Last modified: 2023/08/05 17:23 by Site Administrator