Table of Contents

SFORM

Table Of Contents

  • [00008] SCREEN FORMATTING OBJECT ROUTINES.
  • [00575] NEXTCHAR - GETS THE NEXT CHARACTER FROM VARDATA.
  • [00609] UPPER - CONVERT CHARACTER TO UPPER CASE.
  • [00641] SFATTR$ - SET FIELD ATTRIBUTES.
  • [00818] SFCLOS$ - CLOSE PANEL.
  • [01029] SFCSET$ - SET CHARACTER SET.
  • [01090] SFGETF$ - GET FIELD CHARACTER STRING.
  • [01140] SFDQUE$ - DEQUEUE A PIECE OF DATA FOR THIS TERMINAL.
  • [01250] SFGETI$ - GET INTEGER VALUE.
  • [01352] SFGETK - GET FUNCTION KEY.
  • [01380] SFGETN$ - GET TERMINAL MODEL NAME.
  • [01436] SFGETP$ - GET LAST CURSOR POSITION.
  • [01491] SFGETR$ - GET REAL VALUE.
  • [01581] SFMODE$ - QTRM MODE SWITCHING FUNCTION.
  • [01675] SFNQUE$ - ENQUEUE A BLOCK FOR A TERMINAL (ACN).
  • [01798] SFLUSH$ - FLUSH DATA ALREADY WRITTEN TO SCREEN.
  • [01839] SFOPEN$ - OPEN PANEL.
  • [02054] SFPOSR$ - POSITION TABLE ROW.
  • [02101] SFSETF$ - SET FIELD CHARACTER STRING.
  • [02151] SFQTRM$ - INTERFACE BETWEEN QTRM AND SFORM.
  • [02317] SFSETP$ - SET CURSOR POSITION.
  • [02364] SFSREA$ - READ PANEL USING INSTRING.
  • [02421] SFSSHO - SHOW PANEL USING INSTRING AND OUTSTRING.
  • [02468] SFSWRI$ - SCREEN FORMAT WRITE FUNCTION.
  • [02547] BFIELD - BLANK FIELD IN VARDATA.
  • [02598] CLRLNS - CLEAR LINES.
  • [02635] CPANEL - CLEAN PANEL.
  • [02703] DATEVL - DATE VALIDATION.
  • [02861] ERRMSG - ERROR MESSAGE PROCEDURE.
  • [02987] FFIELD - FIND INPUT FIELD.
  • [03050] FFIRST - FIND FIRST INPUT FIELD.
  • [03097] FMATCH - FIND ENTRY IN MATCH LIST.
  • [03207] FUNKEY - PROCESS FUNCTION KEY ACTION.
  • [03441] GETADD - GET ADDRESS.
  • [03519] GETNUM - GET NUMERIC VALUE OF SUBFIELD.
  • [03571] GFIELD - GET FIELD INDEX.
  • [03638] IRANGE - RANGE VALIDATION FOR INTEGER VARIABLES.
  • [03692] MATCHV - MATCH VALIDATION.
  • [03734] MCLEAN - MESSAGE CLEAN.
  • [03790] MMATCH - MOVE MATCH VALUE INTO VARIABLE FIELD.
  • [03840] MOVEFLD - MOVE FIELD.
  • [03969] MOVEST - MOVE STRING.
  • [04062] MVA8A8 - MOVE ASCII8 STRING.
  • [04138] MVASA8 - MOVE AND TRANSLATE ASCII TO ASCII8.
  • [04250] MVA8AS - MOVE AND TRANSLATE ASCII8 TO ASCII.
  • [04381] MVA8DC - MOVE AND TRANSLATE ASCII8 TO DISPLAY CODE.
  • [04461] MVDCA8 - MOVE AND TRANSLATE DISPLAY CODE TO ASCII8.
  • [04540] NCHECK - CHECK NUMERIC FIELD.
  • [04776] PICVAL - PERFORM PICTURE VALIDATION.
  • [04866] POSARR - POSITION PANEL RECORD BASED ARRAYS.
  • [04911] POSTWO - POSITION PANEL RECORD BASED ARRAYS FOR SFATTR.
  • [04952] PSTRNG - PRINT MESSAGE STRING.
  • [05188] READIN - READ INPUT FROM TERMINAL.
  • [05831] READSF - READ SCREEN FORMATTED PANEL.
  • [05995] RESTFLD - RESTORE DESTROYED FIELD.
  • [06036] REWFLD - REWRITE FIELDS.
  • [06106] REALRANGE - RANGE VALIDATION FOR REAL VARIABLES.
  • [06159] SETATR - SET FIELD ATTRIBUTES.
  • [06191] SETFSF - SET FIELD STATUS FLAGS FOR PANEL.
  • [06248] SETSRN - SET SCREEN.
  • [06312] SFLOAD - LOAD PANEL.
  • [06432] SKPBLK - SKIP BLANKS.
  • [06476] TABKEY - PROCESS TAB KEY.
  • [06571] VALIDF - VALIDATE FIELD.
  • [06706] WRIALL - WRITE ALL PANELS.
  • [06781] WRIBOX - WRITE BOX.
  • [06873] WRIPAN - WRITE PANEL.
  • [07006] WRITES - WRITE SCREEN.
  • [07075] WRIVAR - WRITE VARIABLE.
  • [07169] WRIVCH - WRITE CHARACTER INTO VARDATA.

Source Code

SFORM.txt
  1. PROC SFORM;
  2.  
  3. # TITLE SFORM - SCREEN FORMATTING OBJECT ROUTINES. #
  4.  
  5. BEGIN # SFORM #
  6.  
  7. #
  8. *** SFORM - SCREEN FORMATTING OBJECT ROUTINES.
  9. *
  10. * COPYRIGHT CONTROL DATA SYSTEMS INC. 1992.
  11. #
  12.  
  13. DEF EDITORVDT #0#; # STAND ALONE VERSION OF VIRTERM #
  14. DEF EUROPEAN #0#; # NOT EUROPEAN NUMERIC FORMAT #
  15. *IF DEF,LIST
  16. DEF LISTCON #1#; # EXPANDED COMMON DECKS #
  17. *ELSE
  18. DEF LISTCON #0#; # NO EXPANDED COMMON DECKS #
  19. *ENDIF
  20. DEF SINGLE #1#; # SINGLE USER (VIRTERM) #
  21. DEF MULTI #0#; # NOT A MULTI-USER #
  22. *IF UNDEF,QTRM
  23. DEF QTRMV #0#; # NOT QTRM VERSION #
  24. *ELSE
  25. DEF QTRMV #1#; # QTRM VERSION #
  26. *ENDIF
  27.  
  28. XDEF
  29. BEGIN
  30. PROC SFATTR$; # SET FIELD ATTRIBUTES #
  31. PROC SFCLOS$; # UNLOAD PANEL #
  32. PROC SFCSET$; # SET CHARACTER SET #
  33. *IF DEF,QTRM
  34. PROC SFDQUE$; # QTRM DEQUEUE TERMINAL DATA #
  35. *ENDIF
  36. PROC SFGETF$; # GET FIELD CHARACTER STRING #
  37. PROC SFGETI$; # GET INTEGER VALUE #
  38. PROC SFGETK; # GET FUNCTION KEY INPUT #
  39. PROC SFGETN$; # GET TERMINAL MODEL NAME #
  40. PROC SFGETP$; # GET FUNCTION KEY POSITION #
  41. PROC SFGETR$; # GET REAL VALUE #
  42. PROC SFLUSH$; # FLUSH OUTPUT TO SCREEN #
  43. *IF DEF,QTRM
  44. PROC SFMODE$; # QTRM SET TERMINAL MODE #
  45. PROC SFNQUE$; # QTRM ENQUEUE TERMINAL DATA #
  46. *ENDIF
  47. PROC SFOPEN$; # LOAD PANEL AND OPEN FOR USE #
  48. PROC SFPOSR$; # POSITION TABLE ROW #
  49. PROC SFSETF$; # SET FIELD CHARACTER STRING #
  50. *IF DEF,QTRM
  51. PROC SFQTRM$; # QTRM IDENTIFY USER #
  52. *ENDIF
  53. PROC SFSETP$; # SET CURSOR POSITION FOR READ #
  54. PROC SFSREA$; # READ PANEL FROM TERMINAL #
  55. *IF UNDEF,QTRM
  56. PROC SFSSHO$; # WRITE AND READ PANEL #
  57. *ENDIF
  58. PROC SFSWRI$; # WRITE PANEL TO TERMINAL #
  59. END
  60.  
  61. XREF
  62. BEGIN
  63. *CALL COMFXVT
  64. *IF DEF,QTRM
  65. PROC CMMALF; # CMM ALLOCATE A BLOCK #
  66. PROC CMMFRF; # CMM FREE A BLOCK #
  67. *ENDIF
  68. PROC VDTCLO; # CLOSE TERMINAL #
  69. PROC VDTFOS; # FLUSH OUTPUT TO SCREEN #
  70. *IF UNDEF,QTRM
  71. PROC VDTGSL; # GET TERMINAL MODEL #
  72. *ENDIF
  73. PROC VDTMSG$; # DAYFILE AND B-DISPLAY MESSAGE #
  74. *IF UNDEF,QTRM
  75. PROC VDTOPN; # OPEN TERMINAL #
  76. *ENDIF
  77. END
  78.  
  79. XREF
  80. BEGIN
  81. PROC ABORT; # ABORT THE PROGRAM/USER #
  82. FUNC GFP; # GENERATE FLOATING POINT VALUE #
  83. PROC LCP; # LOAD CAPSULE #
  84. PROC PLT; # PANEL LOAD TABLE #
  85. PROC UCP; # UNLOAD CAPSULE #
  86. END
  87. CONTROL EJECT;
  88.  
  89. # DEFINITIONS FOR COMMONLY USED CHARACTER VALUES, PSEUDO WHILE LOOP, #
  90. # AND VALIDFIELD (DEFINED AS =FIELD GQ 0= ) WHICH IS FREQUENTLY USED #
  91. # IN THE CODE TO DETERMINE IF THE FIELD IN QUESTION IS A VALID ONE. #
  92.  
  93. DEF ASTERISK #O"0052"#; # 12 BIT ASTERISK #
  94. DEF BLANK #O"0040"#; # 12 BIT BLANK #
  95. DEF CAPA #O"0101"#; # 12 BIT UPPER CASE A #
  96. DEF CAPE #O"0105"#; # 12 BIT UPPER CASE E #
  97. DEF CAPZ #O"0132"#; # 12 BIT UPPER CASE Z #
  98. DEF CSMR #O"0067"#; # SYSTEM CHARACTER SET MODE WORD #
  99. DEF COMMA #O"0054"#; # 12 BIT COMMA #
  100. DEF DOLLAR #O"0044"#; # 12 BIT DOLLAR SIGN #
  101. DEF LOWA #O"0141"#; # 12 BIT LOWER CASE A #
  102. DEF LOWZ #O"0172"#; # 12 BIT LOWER CASE Z #
  103. DEF MINUS #O"0055"#; # 12 BIT MINUS SIGN #
  104. DEF NINECH #O"0071"#; # 12 BIT NINE (CHARACTER) #
  105. DEF PANHEADLEN #5#; # LENGTH OF PANEL HEADER #
  106. DEF PERIOD #O"0056"#; # 12 BIT PERIOD #
  107. DEF PLUS #O"0053"#; # 12 BIT PLUS SIGN #
  108. DEF VALIDFIELD #FIELD GQ 0#; # VALID INPUT FIELD #
  109. DEF WHYLE #FOR DUMMY = DUMMY WHILE#; # PSUEDO WHILE LOOP #
  110. DEF XMASKOF #B<51,9>#; # X COORDINATE PART OF FLDPOS #
  111. DEF YMASKOF #B<45,6>#; # Y COORDINATE PART OF FLDPOS #
  112. DEF ZEROCH #O"0060"#; # 12 BIT ZERO (CHARACTER) #
  113.  
  114. # COMFVDT CONTAINS STATUS SWITCHES USED BY SFORM, VIRTERM AND FSE. #
  115. *CALL COMFVDT
  116. *IF DEF,QTRM
  117.  
  118. # COMFVD3 CONTAINS STORAGE LOCATIONS USED BY BOTH VIRTERM AND SFORM. #
  119. *ENDIF
  120. *IFCALL QTRM,COMFVD3
  121. CONTROL EJECT;
  122.  
  123. ITEM DUMMY I; # DUMMY PARAMETER #
  124.  
  125. BASED ARRAY ARRLIST [0:0] S(2); # ARRAY LIST #
  126. BEGIN
  127. ITEM ARRNAME C(00,00,07); # ARRAY NAME #
  128. ITEM ARRCURROW U(01,00,12); # CURRENT ROW ON SCREEN #
  129. ITEM ARRTOPROW U(01,18,18); # TOP ROW ON SCREEN #
  130. ITEM ARRNUMROWS U(01,36,08); # NUMBER OF ROWS ON SCREEN #
  131. ITEM ARRNUMVARS U(01,44,08); # NUMBER OF VARIABLES PER ROW #
  132. END
  133.  
  134. BASED ARRAY ARR2LIST [0:0] S(2); # ARRAY LIST FOR *SFATTR* #
  135. BEGIN
  136. ITEM ARR2CURROW U(01,00,12); # CURRENT ROW ON SCREEN #
  137. ITEM ARR2NUMVAR U(01,44,08); # NUMBER OF VARIABLES PER ROW #
  138. END
  139.  
  140. BASED ARRAY ATTLIST [0:0] P(1); # ATTRIBUTE LIST #
  141. BEGIN
  142. ITEM ATTMASK U(00,00,12); # ATTRIBUTE MASK FOR *VDTSAM* #
  143. ITEM ATTLINEWT U(00,58,02); # LINE WEIGHT FOR *VDTBOX* #
  144. END
  145.  
  146. BASED ARRAY ATT2LIST [0:0] P(1); # ATTRIBUTE LIST FOR *SFATTR* #
  147. BEGIN
  148. ITEM ATT2MASK U(00,00,12); # ATTRIBUTE MASK FOR VDTSAM #
  149. END
  150.  
  151. BASED ARRAY BOXLIST [0:0] P(1); # BOX LIST #
  152. BEGIN
  153. ITEM BOXWORD U(00,00,60); # FULL WORD #
  154. ITEM BOXATTORD U(00,00,12); # ATTRIBUTE ORDINAL #
  155. ITEM BOXCHAR U(00,12,04); # LINE DRAWING CHARACTER #
  156. ITEM BOXYCORD U(00,16,06); # Y COORDINATE #
  157. ITEM BOXXCORD U(00,22,09); # X COORDINATE #
  158. ITEM BOXREPEAT U(00,31,09); # REPEAT COUNT FOR THIS CHAR. #
  159. END
  160.  
  161. BASED ARRAY CORE[0:0] P(1); # MEMORY #
  162. BEGIN
  163. ITEM COREWORD I(00,00,60); # FULL WORD #
  164. END
  165.  
  166. BASED ARRAY FLDLIST [0:0] P(1); # FIELD LIST #
  167. BEGIN
  168. ITEM FLDENTRY U(00,00,60); # FULL WORD #
  169. ITEM FLDVARFLAG B(00,00,01); # VARIABLE FIELD FLAG #
  170. ITEM FLDATTORD U(00,01,07); # FIELD ATTRIBUTE ORDINAL #
  171. ITEM FLDINPUTV B(00,08,01); # INPUT FIELD FLAG #
  172. ITEM FLDOUTPUTV B(00,09,01); # OUTPUT FIELD FLAG #
  173. ITEM FLDSTFLAGS U(00,10,04); # FIELD STATUS FLAGS #
  174. ITEM FLDENTERED B(00,10,01); # INPUT ENTERED IN FIELD FLAG #
  175. ITEM FLDVALID B(00,11,01); # INPUT PASSED VALIDATION #
  176. ITEM FLDREWRITE B(00,12,01); # REWRITE FIELD ON SCREEN FLAG #
  177. ITEM FLDACTIVE B(00,13,01); # ACTIVE FIELD FLAG #
  178. ITEM FLDVARORD U(00,15,08); # ORDINAL INTO VARLIST FOR FIELD #
  179. ITEM FLDCONOS U(00,18,18); # CONSTANT OFFSET INTO RECORD #
  180. ITEM FLDVDTCORD U(00,23,13); # CHARACTER ORDINAL IN VARDATA #
  181. ITEM FLDLENGTH U(00,36,09); # LENGTH IN 12 BIT CHARACTERS #
  182. ITEM FLDPOS U(00,45,15); # COORDINATES OF FIELD #
  183. ITEM FLDYCORD U(00,45,06); # Y COORDINATE OF FIELD #
  184. ITEM FLDXCORD U(00,51,09); # X COORDINATE OF FIELD #
  185. END
  186.  
  187. BASED ARRAY FLD2LIST [0:0] P(1); # FIELD LIST FOR *SFATTR* #
  188. BEGIN
  189. ITEM FLD2ATTORD U(00,01,07); # FIELD ATTRIBUTE ORDINAL #
  190. ITEM FLD2INPUTV B(00,08,01); # INPUT FIELD FLAG #
  191. ITEM FLD2OUTPUT B(00,09,01); # OUTPUT FIELD FLAG #
  192. ITEM FLD2ENTERE B(00,10,01); # INPUT ENTERED IN FIELD FLAG #
  193. ITEM FLD2VALID B(00,11,01); # INPUT PASSED VALIDATION #
  194. ITEM FLD2REWRIT B(00,12,01); # REWRITE FIELD ON SCREEN FLAG #
  195. ITEM FLD2VARORD U(00,15,08); # ORDINAL INTO VARLIST FOR FIELD #
  196. END
  197.  
  198. BASED ARRAY FROMSTRING [0:0] P(1); # FROM STRING #
  199. BEGIN
  200. ITEM FROMSTRIU U(00,00,60); # FROMSTRING WORD (INTEGER) #
  201. END
  202.  
  203. BASED ARRAY FUNLIST [0:0] S(1); # FUNCTION LIST #
  204. BEGIN
  205. ITEM FUNWORD U(00,00,60); # FIRST WORD OF ENTRY #
  206. ITEM FUNASG U(00,26,18); # VARIABLE ASSIGNMENT OFFSET #
  207. ITEM FUNACT U(00,44,09); # FUNCTION ACTION TO BE TAKEN #
  208. ITEM FUNGENERIC B(00,53,01); # GENERIC FUNTION KEY FLAG #
  209. ITEM FUNNUMBER I(00,54,06); # FUNCTION NUMBER #
  210. END
  211.  
  212. BASED ARRAY MATCHLIST [0:0] S(2); # MATCH LIST #
  213. BEGIN
  214. ITEM MATCHWORD U(00,00,60); # FIRST WORD OF MATCH LIST ENTRY #
  215. ITEM MATCH C(00,00,20); # TWO WORD MATCH ITEM #
  216. END
  217.  
  218. BASED ARRAY PANELHEADR [0:0] S(5); # PANEL HEADER #
  219. BEGIN
  220. ITEM PANELNME C(00,00,07); # PANEL NAME #
  221. ITEM PANPRIPAN B(00,58,01); # PRIMARY PANEL (NOT OVERLAY) #
  222. ITEM PANNUMLNES U(01,00,06); # NUMBER OF LINES IN PANEL #
  223. ITEM PANRECLEN U(01,06,18); # LENGTH OF PANEL IN WORDS #
  224. ITEM PANSTRFUN U(01,24,18); # START OF FUNCTION LIST OFFSET #
  225. ITEM PANSTRVAR U(01,42,18); # START OF VARIABLE LIST OFFSET #
  226. ITEM PANVERSION U(02,00,06); # VERSION NUMBER #
  227. ITEM PANSTRATT U(02,06,18); # START OF ATTRIBUTE LIST OFFSET #
  228. ITEM PANSTRARR U(02,24,18); # START OF ARRAY LIST OFFSET #
  229. ITEM PANSTRFLD U(02,42,18); # START OF FIELD LIST OFFSET #
  230. ITEM PANSTRBOX U(03,06,18); # START OF BOX LIST OFFSET #
  231. ITEM PANMSGLEN U(03,36,09); # MESSAGE FIELD LENGTH #
  232. ITEM PANMSGYCRD U(03,45,06); # MESSAGE Y COORDINATE #
  233. ITEM PANMSGXCRD U(03,51,09); # MESSAGE X CORRDINATE #
  234. ITEM PANNUMBYTE U(04,00,13); # NUMBER OF BYTES IN VAR DATA #
  235. ITEM PANNUMCOLS U(04,13,09); # NUMBER OF COLUMNS IN PANEL #
  236. END
  237. CONTROL EJECT;
  238.  
  239. BASED ARRAY PANEL2HEAD [0:0] S(5); # PANEL HEADER FOR *SFATTR* #
  240. BEGIN
  241. ITEM PANEL2NME C(00,00,07); # PANEL NAME #
  242. ITEM PAN2RECLEN U(01,06,18); # LENGTH OF PANEL IN WORDS #
  243. ITEM PAN2STRFUN U(01,24,18); # START OF FUNCTION LIST OFFSET #
  244. ITEM PAN2STRVAR U(01,42,18); # START OF VARIABLE LIST OFFSET #
  245. ITEM PAN2STRATT U(02,06,18); # START OF ATTRIBUTE LIST OFFSET #
  246. ITEM PAN2STRARR U(02,24,18); # START OF ARRAY LIST OFFSET #
  247. ITEM PAN2STRFLD U(02,42,18); # START OF FIELD LIST OFFSET #
  248. ITEM PAN2STRBOX U(03,06,18); # START OF BOX LIST OFFSET #
  249. END
  250.  
  251. BASED ARRAY PLTABLE [0:0] S(2); # PANEL LOAD TABLE #
  252. BEGIN
  253. ITEM PLTWORDONE U(00,00,60); # WORD ONE OF TWO #
  254. ITEM PLTENAME C(00,00,07); # PANEL NAME #
  255. ITEM PLTENTRYNM U(00,48,12); # SEQUENCE NUMBER ON SCREEN #
  256. ITEM PLTWORDTWO U(01,00,60); # WORD TWO OF TWO #
  257. ITEM PLTSLFLAG B(01,00,01); # STATIC LOAD FLAG #
  258. ITEM PLTOPENFLG B(01,01,01); # PANEL OPEN FLAG #
  259. ITEM PLTNUMQTRM I(01,24,12); # NUMBER OF QTRM USERS OF PANEL #
  260. ITEM PLTNUMONSC U(01,36,12); # NUMBER OF PANELS ON SCREEN #
  261. ITEM PLTADDR U(01,42,18); # MEMORY ADDRESS OF PANEL #
  262. ITEM PLTNUMENT U(01,48,12); # CURRENT NUMBER OF ENTRIES #
  263. END
  264.  
  265. BASED ARRAY RECORD [0:0] P(1); # PANEL RECORD #
  266. BEGIN
  267. ITEM RECWORDC C(00,00,10); # PANEL RECORD WORD (CHARACTER) #
  268. ITEM RECWORDR R(00,00,60); # PANEL RECORD WORD (REAL) #
  269. ITEM RECWORDU U(00,00,60); # PANEL RECORD WORD (INTEGER) #
  270. END
  271.  
  272. BASED ARRAY TOSTRING [0:0] P(1); # TO STRING #
  273. BEGIN
  274. ITEM TOSTRIU U(00,00,60); # TOSTRING WORD (INTEGER) #
  275. END
  276.  
  277. BASED ARRAY VARLIST [0:0] S(2); # VARIABLE LIST #
  278. BEGIN
  279. ITEM VARMUSCON B(00,00,01); # MUST CONTAIN (A VALUE) #
  280. ITEM VARFLDNUM U(00,01,09); # FIELD ORDINAL #
  281. ITEM VARROWNUM U(00,10,08); # ROW NUMBER #
  282. ITEM VARARRORD U(00,18,05); # ARRAY ORDINAL #
  283. ITEM VARMUSENTR B(00,23,01); # MUST ENTER DATA IN FIELD #
  284. ITEM VARMUSFILL B(00,24,01); # MUST FILL FIELD WITH DATA #
  285. ITEM VARMUSKNOW B(00,25,01); # * NOT ALLOWED #
  286. ITEM VARTYPE U(00,26,02); # VARIABLE TYPE (INT CHAR REAL) #
  287. ITEM VARPICTYPE U(00,28,08); # PICTURE TYPE #
  288. ITEM VARVALTYPE U(00,36,06); # VALIDATION TYPE #
  289. ITEM VARVALR B(00,40,01); # RANGE VALIDATION #
  290. ITEM VARVALM B(00,41,01); # MATCH VALIDATION #
  291. ITEM VARVALOS U(00,42,18); # VALIDATION OFFSET #
  292. ITEM VARNME C(01,00,07); # VARIABLE NAME (DISPLAY CODE) #
  293. ITEM VARHSOS U(01,42,18); # HELP STRING OFFSET #
  294. END
  295.  
  296. BASED ARRAY VAR2LIST [0:0] S(2); # VARIABLE LIST FOR *SFATTR* #
  297. BEGIN
  298. ITEM VAR2FLDNUM U(00,01,09); # FIELD ORDINAL #
  299. ITEM VAR2ARRORD U(00,18,05); # ARRAY ORDINAL #
  300. ITEM VAR2TYPE U(00,26,02); # VARIABLE TYPE (INT CHAR REAL) #
  301. ITEM VAR2NME C(01,00,07); # VARIABLE NAME (DISPLAY CODE) #
  302. END
  303.  
  304. BASED ARRAY VDATA [0:0] P(1); # VAR DATA #
  305. BEGIN
  306. ITEM VDATAC C(00,00,10); # VARDATA WORD (CHARACTER) #
  307. ITEM VDATAU U(00,00,60); # VARDATA WORD (INTEGER) #
  308. END
  309.  
  310. ARRAY CHARCONV1 [0:127] P(1); # DISPLAY CODE TO ASCII8 #
  311. BEGIN
  312. ITEM DC2A8 U(00,00,60)= [
  313. O"0072", O"0101", O"0102", O"0103", # COLON A B C #
  314. O"0104", O"0105", O"0106", O"0107", # D E F G #
  315. O"0110", O"0111", O"0112", O"0113", # H I J K #
  316. O"0114", O"0115", O"0116", O"0117", # L M N O #
  317. O"0120", O"0121", O"0122", O"0123", # P Q R S #
  318. O"0124", O"0125", O"0126", O"0127", # T U V W #
  319. O"0130", O"0131", O"0132", O"0060", # X Y Z 0 #
  320. O"0061", O"0062", O"0063", O"0064", # 1 2 3 4 #
  321. O"0065", O"0066", O"0067", O"0070", # 5 6 7 8 #
  322. O"0071", O"0053", O"0055", O"0052", # 9 PLUS MINUS ASTERISK #
  323. O"0057", O"0050", O"0051", O"0044", # SLANT LPAREN RPAREN DOLLAR #
  324. O"0075", O"0040", O"0054", O"0056", # EQUAL BLANK COMMA PERIOD #
  325. O"0043", O"0133", O"0135", O"0045", # POUND LBRAC RBRAC PERCENT #
  326. O"0042", O"0137", O"0041", O"0046", # QUOTE UNDERLINE XPOINT AMPER #
  327. O"0047", O"0077", O"0074", O"0076", # APOSTROPHE QMARK LTHAN GTHAN #
  328. O"0100", O"0134", O"0136", O"0073", # ATSIGN REVSLANT CIRCUM SEMI #
  329. O"0040", O"0040", O"0040", O"0040", # BLANK FILL #
  330. O"0040", O"0040", O"0040", O"0040", # BLANK FILL #
  331. O"0040", O"0040", O"0040", O"0040", # BLANK FILL #
  332. O"0040", O"0040", O"0040", O"0040", # BLANK FILL #
  333. O"0040", O"0040", O"0040", O"0040", # BLANK FILL #
  334. O"0040", O"0040", O"0040", O"0040", # BLANK FILL #
  335. O"0040", O"0040", O"0040", O"0040", # BLANK FILL #
  336. O"0040", O"0040", O"0040", O"0040", # BLANK FILL #
  337. O"0040", O"0040", O"0040", O"0040", # BLANK FILL #
  338. O"0040", O"0040", O"0040", O"0040", # BLANK FILL #
  339. O"0040", O"0040", O"0040", O"0040", # BLANK FILL #
  340. O"0040", O"0040", O"0040", O"0040", # BLANK FILL #
  341. O"0040", O"0040", O"0040", O"0040", # BLANK FILL #
  342. O"0040", O"0040", O"0040", O"0040", # BLANK FILL #
  343. O"0040", O"0040", O"0040", O"0040", # BLANK FILL #
  344. O"0040", O"0040", O"0040", O"0040"]; # BLANK FILL #
  345. END
  346.  
  347. ARRAY CHARCONV2 [0:127] P(1); # ASCII8 TO DISPLAY CODE #
  348. BEGIN
  349. ITEM A82DC U(00,00,60)= [
  350. O"55", O"55", O"55", O"55", # BLANK FILL #
  351. O"55", O"55", O"55", O"55", # BLANK FILL #
  352. O"55", O"55", O"55", O"55", # BLANK FILL #
  353. O"55", O"55", O"55", O"55", # BLANK FILL #
  354. O"55", O"55", O"55", O"55", # BLANK FILL #
  355. O"55", O"55", O"55", O"55", # BLANK FILL #
  356. O"55", O"55", O"55", O"55", # BLANK FILL #
  357. O"55", O"55", O"55", O"55", # BLANK FILL #
  358. O"55", O"66", O"64", O"60", # BLANK XMARK QUOTE POUND #
  359. O"53", O"63", O"67", O"70", # DOLLAR PERCENT AMPER APOS #
  360. O"51", O"52", O"47", O"45", # LPAREN RPAREN ASTERISK PLUS #
  361. O"56", O"46", O"57", O"50", # COMMA MINUS PERIOD SLANT #
  362. O"33", O"34", O"35", O"36", # 0 1 2 3 #
  363. O"37", O"40", O"41", O"42", # 4 5 6 7 #
  364. O"43", O"44", O"00", O"77", # 8 9 COLON SEMI #
  365. O"72", O"54", O"73", O"71", # LTHAN EQUAL GTHAN QMARK #
  366. O"74", O"01", O"02", O"03", # ATSIGN UCA UCB UCC #
  367. O"04", O"05", O"06", O"07", # UCD UCE UCF UCG #
  368. O"10", O"11", O"12", O"13", # UCH UCI UCJ UCK #
  369. O"14", O"15", O"16", O"17", # UCL UCM UCN UCO #
  370. O"20", O"21", O"22", O"23", # UCP UCQ UCR UCS #
  371. O"24", O"25", O"26", O"27", # UCT UCU UCV UCW #
  372. O"30", O"31", O"32", O"61", # UCX UCY UCZ LBRAC #
  373. O"75", O"62", O"76", O"65", # RSLANT RBRAC CIRCUM ULINE #
  374. O"74", O"01", O"02", O"03", # GRAVE LCA LCB LCC #
  375. O"04", O"05", O"06", O"07", # LCD LCE LCF LCG #
  376. O"10", O"11", O"12", O"13", # LCH LCI LCJ LCK #
  377. O"14", O"15", O"16", O"17", # LCL LCM LCN LCO #
  378. O"20", O"21", O"22", O"23", # LCP LCQ LCR LCS #
  379. O"24", O"25", O"26", O"27", # LCT LCU LCV LCW #
  380. O"30", O"31", O"32", O"61", # LCX LCY LCZ LBRAC #
  381. O"75", O"62", O"76", O"55"]; # VLINE RBRAC TILDE DEL(NO EQ) #
  382. END
  383.  
  384. ARRAY CHARCONV3 [1:7] P(1); # SPECIAL ASCII CODES #
  385. BEGIN
  386. ITEM AS2A8 U(00,00,60)= [
  387. O"0100", O"0136", O"0040", # ATSIGN CIRCUMFLEX (BLANK) #
  388. O"0072", O"0040", O"0040", # COLON (BLANK) (BLANK) #
  389. O"0140"]; # RSLANT #
  390. END
  391. CONTROL EJECT;
  392.  
  393.  
  394. ARRAY TERMSTAT [0:0] P(15); # TERMINAL STATUS FLAGS #
  395. BEGIN
  396. ITEM TERMSTATWD U(00,00,60) = [0]; # FULL WORD #
  397. ITEM TERABNTERM B(00,00,01); # ABNORMAL TERMINATION #
  398. ITEM TERASCFLAG B(00,01,01); # ASCII CODE SET FLAG #
  399. ITEM TERAS8FLAG B(00,02,01); # ASCII8 CODE SET FLAG #
  400. ITEM TERCURSSET B(00,03,01); # CURSOR SET BY SFSETP$ #
  401. ITEM TERCNWRIOV B(00,04,01); # OVERLAY WRITE ALLOWED #
  402. ITEM TERDONTCLR B(00,05,01); # RESPECT ENTERED/REWRITE #
  403. ITEM TERFUNCGEN B(00,06,01); # GENERIC FUNCTION KEY FLAG #
  404. ITEM TERHELPREQ B(00,07,01); # HELP REQUESTED #
  405. ITEM TERMESREAD B(00,08,01); # MESSAGE READ BY USER #
  406. ITEM TERMESWRIT B(00,09,01); # MESSAGE WRITTEN #
  407. ITEM TERMISSINP B(00,10,01); # INPUT OUTSIDE OF FIELD #
  408. ITEM TERNOINVRS B(00,11,01); # NO INPUT VARIABLES IN PANEL #
  409. ITEM TERNOREWRT B(00,12,01); # NOT REWRITING VARIABLES #
  410. ITEM TERNRMTERM B(00,13,01); # NORMAL TERMINATION #
  411. ITEM TERPENDHLP B(00,14,01); # HELP (AFTER SOFT TABS) #
  412. ITEM TERREADFLG B(00,15,01); # CALLING PROCEDURE IS READ #
  413. ITEM TERREWFLDS B(00,16,01); # REWRITE FIELDS #
  414. ITEM TERREWSCRN B(00,17,01); # COMPLETE SCREEN REWRITE #
  415. ITEM TERSCREENM B(00,18,01); # SCREEN/LINE MODE FLAG #
  416. ITEM TERSHOWFLG B(00,19,01); # CALLING PROCEDURE IS SHOW #
  417. ITEM TERVDTBOOC B(00,20,01); # CALLED VDTBOO YET FLAG #
  418. ITEM TERRESERV0 U(00,21,37); # RESERVED #
  419. ITEM TERQTRMSOL B(00,58,01); # QTRM SCREEN OR LINE FLAG #
  420. ITEM TERWAITINP B(00,59,01); # QTRM WAITING FOR INPUT #
  421. ITEM TERACTPANL C(01,00,07) = [" "]; # ACTIVE PANEL NAME #
  422. ITEM TERACTPLTI I(01,42,18) = [0]; # GLOBAL ACTIVE PLT INDEX #
  423. ITEM TERHEADTHR U(02,00,60); # WORD THREE #
  424. ITEM TERPTRHGTC U(02,00,04); # PROTECTED RIGHT BEHAVIOR #
  425. ITEM TERPTLEFTC U(02,04,04); # PROTECTED LEFT BEHAVIOR #
  426. ITEM TERPTUPCUR U(02,08,04); # PROTECTED UP BEHAVIOR #
  427. ITEM TERPTDNCUR U(02,12,04); # PROTECTED DOWN BEHAVIOR #
  428. ITEM TERUNRHGTC U(02,16,04); # UNPROTECTED RIGHT BEHAVIOR #
  429. ITEM TERUNLEFTC U(02,20,04); # UNPROTECTED LEFT BEHAVIOR #
  430. ITEM TERUNUPCUR U(02,24,04); # UNPROTECTED UP BEHAVIOR #
  431. ITEM TERUNDNCUR U(02,28,04); # UNPROTECTED DOWN BEHAVIOR #
  432. ITEM TERRESERV2 U(02,32,28); # RESERVED #
  433. ITEM TERHEADFOU U(03,00,60); # WORD FOUR #
  434. ITEM TERCURADDT U(03,00,06); # CURSOR ADDRESSING TYPE #
  435. ITEM TERCURBIAS I(03,06,08); # CURSOR BIAS FOR POSTIONING #
  436. ITEM TERLEFTCUR U(03,14,04); # CURSOR LEFT BEHAVIOR #
  437. ITEM TERRGHTCUR U(03,18,04); # CURSOR RIGHT BEHAVIOR #
  438. ITEM TERUPCURSR U(03,22,04); # CURSOR UP BEHAVIOR #
  439. ITEM TERDWNCRSR U(03,26,04); # CURSOR DOWN BEHAVIOR #
  440. ITEM TERLEFTCHR U(03,30,04); # CHARACTER LEFT BEHAVIOR #
  441. ITEM TERRGHTCHR U(03,34,04); # CHARACTER RIGHT BEHAVIOR #
  442. ITEM TERLASTPOS U(03,38,04); # LAST POSITION BEHAVIOR (CHAR) #
  443. ITEM TERXFIRSTY B(03,42,01); # X BEFORE Y IN CURSOR OUTPUT #
  444. ITEM TERXDECIML U(03,43,03); # X COORDINATE COUNT IF DECIMAL #
  445. ITEM TERYDECIML U(03,46,03); # Y COORDINATE COUNT IF DECIMAL #
  446. ITEM TERRESERV3 U(03,49,11); # RESERVED #
  447. ITEM TERHEADFIV U(04,00,60); # WORD FIVE #
  448. ITEM TERVTHOMEU B(04,00,01); # HOME UP FLAG #
  449. ITEM TERPROTECT B(04,01,01); # TERMINAL HAS PROTECT #
  450. ITEM TERVTDIFSS B(04,02,01); # DIFFERENT SCREEN SIZES #
  451. ITEM TERVTUNUSD B(04,03,01); # UNUSED #
  452. ITEM TERGUARDMD B(04,04,01); # TERMINAL HAS GUARD/HIDDEN MODE #
  453. ITEM TERTABHOME B(04,05,01); # PROTECTED TAB GOES TO HOME #
  454. ITEM TERTABPROT B(04,06,01); # TABS TO UNPROTECTED FIELDS #
  455. ITEM TERVTABSTP B(04,07,01); # TABS TO TAB STOP #
  456. ITEM TERSIZECLR B(04,08,01); # SIZE CHANGE CLEARS SCREEN #
  457. ITEM TERTABAUTO B(04,09,01); # TERMINAL HAS AUTOMATIC TABBING #
  458. ITEM TERTYPHEAD B(04,10,01); # TYPE AHEAD ENABLED #
  459. ITEM TERBLCKMDE B(04,11,01); # BLOCK MODE TERMINAL #
  460. ITEM TERPTDWFLN B(04,12,01); # PROT TABS DO NOT WRAP FWD LINE #
  461. ITEM TERPTDWFPG B(04,13,01); # PROT TABS WILL NOT WRAP PAGE #
  462. ITEM TERPTDWBLN B(04,14,01); # PROT TABS DO NOT WRAP BKW LINE #
  463. ITEM TERPTDWBPG B(04,15,01); # PROT TABS DO NOT WRAP BKW PAGE #
  464. ITEM TERUNDWFLN B(04,16,01); # UNPROT TABS DO NOT WRAP FWD LN #
  465. ITEM TERUNDWFPG B(04,17,01); # UNPROT TABS DO NOT WRAP FWD PG #
  466. ITEM TERUNDWBLN B(04,18,01); # UNPROT TABS DO NOT WRAP BKW LN #
  467. ITEM TERUNDWBPG B(04,19,01); # UNPROT TABS DO NOT WRAP BKW PG #
  468. ITEM TERATTRCHR B(04,20,01); # ATTRIBUTE CHARACTER NEEDS BYTE #
  469. ITEM TERATTRSET B(04,21,01); # RESET ATTRIBUTES BEFORE VDTPOS #
  470. ITEM TERSNDSPLR B(04,22,01); # SEND DISPLAY REWRITE FOR SFORM #
  471. ITEM TERSNDSPLH B(04,23,01); # SEND DISPLAY ON HELP FOR SFORM #
  472. ITEM TERNOTMASK B(04,24,01); # ATTRIBUTES ARE NOT MASKABLE #
  473. ITEM TERNOTCHAR B(04,25,01); # ATTRIBUTES ARE LINE/PAGE BASED #
  474. ITEM TERNOVDTEO B(04,26,01); # DISABLE OUTPUT END (ERR. EXIT) #
  475. ITEM TERPROCLRS B(04,27,01); # PROTECT ALL CLEARS THE SCREEN #
  476. ITEM TERCLEARSM B(04,28,01); # CLEARS ACROSS PROTECTED FIELDS #
  477. ITEM TERRSBIT29 B(04,29,01); # RESERVED FOR CDC (FUTURE CODE) #
  478. ITEM TERRSBIT30 B(04,30,01); # RESERVED FOR CDC (FUTURE CODE) #
  479. ITEM TERRSBIT31 B(04,31,01); # RESERVED FOR CDC (FUTURE CODE) #
  480. ITEM TERRSBIT32 B(04,32,01); # RESERVED FOR CDC (FUTURE CODE) #
  481. ITEM TERRSBIT33 B(04,33,01); # RESERVED FOR CDC (FUTURE CODE) #
  482. ITEM TERRSBIT34 B(04,34,01); # RESERVED FOR CDC (FUTURE CODE) #
  483. ITEM TERRSBIT35 B(04,35,01); # RESERVED FOR CDC (FUTURE CODE) #
  484. ITEM TERRSBIT36 B(04,36,01); # RESERVED FOR CDC (FUTURE CODE) #
  485. ITEM TERINSTL01 B(04,37,01); # RESERVED FOR INSTALLATION CODE #
  486. ITEM TERINSTL02 B(04,38,01); # RESERVED FOR INSTALLATION CODE #
  487. ITEM TERINSTL03 B(04,39,01); # RESERVED FOR INSTALLATION CODE #
  488. ITEM TERINSTL04 B(04,40,01); # RESERVED FOR INSTALLATION CODE #
  489. ITEM TERINSTL05 B(04,41,01); # RESERVED FOR INSTALLATION CODE #
  490. ITEM TERINSTL06 B(04,42,01); # RESERVED FOR INSTALLATION CODE #
  491. ITEM TERINSTL07 B(04,43,01); # RESERVED FOR INSTALLATION CODE #
  492. ITEM TERINSTL08 B(04,44,01); # RESERVED FOR INSTALLATION CODE #
  493. ITEM TERINSTL09 B(04,45,01); # RESERVED FOR INSTALLATION CODE #
  494. ITEM TERINSTL10 B(04,46,01); # RESERVED FOR INSTALLATION CODE #
  495. ITEM TERINSTL11 B(04,47,01); # RESERVED FOR INSTALLATION CODE #
  496. ITEM TERINSTL12 B(04,48,01); # RESERVED FOR INSTALLATION CODE #
  497. ITEM TERINSTL13 B(04,49,01); # RESERVED FOR INSTALLATION CODE #
  498. ITEM TERINSTL14 B(04,50,01); # RESERVED FOR INSTALLATION CODE #
  499. ITEM TERINSTL15 B(04,51,01); # RESERVED FOR INSTALLATION CODE #
  500. ITEM TERINSTL16 B(04,52,01); # RESERVED FOR INSTALLATION CODE #
  501. ITEM TERINSTL17 B(04,53,01); # RESERVED FOR INSTALLATION CODE #
  502. ITEM TERINSTL18 B(04,54,01); # RESERVED FOR INSTALLATION CODE #
  503. ITEM TERINSTL19 B(04,55,01); # RESERVED FOR INSTALLATION CODE #
  504. ITEM TERINSTL20 B(04,56,01); # RESERVED FOR INSTALLATION CODE #
  505. ITEM TERLEAVESM U(04,57,03); # FUNCTION KEY MARK COUNT #
  506. ITEM TERSOFTPOS I(05,00,24); # POSITION OF FIRST SOFT TAB #
  507. ITEM TERCURSOFF I(05,24,18); # CURSOR OFFSET POSITION #
  508. ITEM TERCURSROW I(05,42,18); # CURSOR ROW POSITION #
  509. ITEM TERCURSVAR C(06,00,07); # CURSOR VARIABLE POSITION #
  510. ITEM TERASC8ATD U(06,42,06) = [58];# ASCII FOR 6/12 AT/D #
  511. ITEM TERSOFTTAB I(06,48,12); # NUMBER OF SOFT TABS PENDING #
  512. ITEM TERPREVPOS U(07,00,60); # PREVIOUS ATTRIBUTE POSITION #
  513. ITEM TERFLDADDR U(08,00,60); # FIELD LIST ADDRESS #
  514. ITEM TERFLDFRST I(09,00,30); # POSITION OF FIRST INPUT FIELD #
  515. ITEM TERFLDLAST I(09,30,30); # POSITION OF LAST INPUT FIELD #
  516. ITEM TERFUNCPOS U(10,00,24) = [0]; # LAST FUNCTION KEY POSITION #
  517. ITEM TERFUNCORD I(10,24,12); # FUNCTION KEY ORDINAL #
  518. ITEM TERHELPFLD I(10,36,24) = [0]; # HELP FIELD INDEX #
  519. ITEM TERMODNAME C(11,00,07) = [" "]; # TERMINAL MODEL NAME #
  520. ITEM TERXXXXXXX U(11,42,18); # RESERVED FOR FUTURE (CDC) USE #
  521. ITEM TERNUMCOLS U(12,00,60) = [0]; # NUMBER OF COLUMNS ON SCREEN #
  522. ITEM TERNUMLNES U(13,00,60) = [0]; # NUMBER OF LINES ON SCREEN #
  523. ITEM TERCURVORD I(14,00,60); # CURRENT VIDEO ATTR. ORDINAL #
  524. END
  525. *IF DEF,QTRM
  526. CONTROL EJECT;
  527.  
  528. DEF FDASIZE #17#; # FIELD DATA AREA - QTRM SWAP #
  529. DEF PLTSIZE #22#; # PANEL LOAD TABLE - QTRM SWAP #
  530. DEF Q$HEADLEN #3#; # QTRM QUEUE HEADER LENGTH #
  531. DEF Q$BLKSIZE #1000#; # QTRM BUFFER LENGTH #
  532. DEF SFORMOFFSET #00#; # PANEL CONTROL TABLE OFFSET #
  533. DEF SFORMSIZE #15#; # SFORM VARIABLES - QTRM SWAP #
  534. DEF VDTASIZE #20#; # VARIABLE DATA - QTRM SWAP #
  535. DEF VTERMSIZE #O"336"#; # VIRTERM VARIABLES - QTRM SWAP #
  536.  
  537. DEF FDAOFFSET #VTERMOFFSET+VTERMSIZE#;
  538. DEF PCTSIZE #SFORMSIZE+VTERMSIZE+FDASIZE+PLTSIZE+VDTASIZE #;
  539. DEF PLTOFFSET #FDAOFFSET+FDASIZE#;
  540. DEF VDTAOFFSET #PLTOFFSET+PLTSIZE#;
  541. DEF VTERMOFFSET #SFORMOFFSET+SFORMSIZE#;
  542.  
  543. CONTROL EJECT;
  544.  
  545. COMMON COMVDT; # VIRTERM COMMON AREA #
  546.  
  547. BEGIN # COMVDT #
  548.  
  549. ARRAY COMVDT$WDS [0:0] P(VTERMSIZE); # TEMPORARY VIRTERM AREA #
  550. BEGIN
  551. ITEM COMVDT$WD0 U(00,00,60); # WORD ZERO (INTEGER) #
  552. END
  553.  
  554. END # COMVDT #
  555.  
  556. ARRAY TERMSTHLD [0:0] P(SFORMSIZE); # TERMSTAT HOLD AREA #
  557. BEGIN
  558. ITEM TERINITHLD U(00,00,60); # WORD ZERO (INTEGER) #
  559. END
  560.  
  561. ARRAY VDTSTHLD [0:0] P(VTERMSIZE); # VIRTERM HOLD AREA (INIT) #
  562. BEGIN
  563. ITEM VDTINITHLD U(00,00,60); # WORD ZERO (INTEGER) #
  564. END
  565. *ENDIF
  566. CONTROL EJECT;
  567.  
  568. FUNC NEXTCHAR(FLDIND,INDEX);
  569.  
  570. # TITLE NEXTCHAR - GET NEXT CHARACTER FROM VARDATA. #
  571.  
  572. BEGIN # NEXTCHAR #
  573.  
  574. #
  575. ** NEXTCHAR - GETS THE NEXT CHARACTER FROM VARDATA.
  576. *
  577. * THIS FUNCTION RETURNS THE CHARACTER IN POSITION INDEX OF VARIABLE
  578. * FLDIND IN VARDATA.
  579. *
  580. * FUNC NEXTCHAR(FLDIND,INDEX)
  581. *
  582. * FLDIND = POINTER INTO FIELD LIST FOR VARIABLE.
  583. * INDEX = RELATIVE POSITION OF CHARACTER IN VARDATA.
  584. *
  585. * EXIT CHARACTER FROM VARDATA.
  586. #
  587. ITEM FLDIND; # VARLIST POINTER OF VARIABLE #
  588. ITEM INDEX; # RELATIVE POSITION OF CHARACTER #
  589.  
  590. ITEM CHARIND; # CHARACTER INDEX IN VARDATA #
  591. ITEM CHARNUM; # CHARACTER POSITION IN VARDATA #
  592. ITEM WORDIND; # WORD INDEX IN VARDATA #
  593.  
  594. CHARNUM = FLDVDTCORD[FLDIND] + INDEX;
  595. WORDIND = CHARNUM / 5;
  596. CHARIND = CHARNUM - 5*WORDIND;
  597. NEXTCHAR = B<12*CHARIND,12>VDATAU[WORDIND];
  598.  
  599. END # NEXTCHAR #
  600. CONTROL EJECT;
  601.  
  602. FUNC UPPER(CHARAC);
  603.  
  604. # TITLE UPPER - CONVERT CHARACTER TO UPPER CASE. #
  605.  
  606. BEGIN # UPPER #
  607.  
  608. #
  609. ** UPPER - CONVERT CHARACTER TO UPPER CASE.
  610. *
  611. * UPPER CONVERTS LOWER CASE CHARACTERS TO UPPER CASE AND
  612. * LEAVES UPPER CASE CHARACTERS ALONE.
  613. *
  614. * PROC UPPER(CHARAC)
  615. *
  616. * ENTRY CHARAC = CHARACTER TO BE CONVERTED.
  617. *
  618. * EXIT UPPER CASE CHARACTER.
  619. #
  620. ITEM CHARAC; # CHARACTER TO BE CONVERTED #
  621.  
  622. IF CHARAC GQ LOWA AND CHARAC LQ LOWZ THEN
  623. BEGIN # IF LOWER CASE #
  624. UPPER = CHARAC LXR BLANK; # CONVERT TO LOWER CASE #
  625. END
  626. ELSE
  627. BEGIN # IF UPPER CASE #
  628. UPPER = CHARAC; # DON'T CONVERT #
  629. END
  630.  
  631. END # UPPER #
  632. CONTROL EJECT;
  633.  
  634. PROC SFATTR$(NAME,NLENGTH,NOFFSET,NEWORD,OLDORD);
  635.  
  636. # TITLE SFATTR$ - SET FIELD ATTRIBUTES. #
  637.  
  638. BEGIN # SFATTR$ #
  639.  
  640. #
  641. ** SFATTR$ - SET FIELD ATTRIBUTES.
  642. *
  643. * THIS PROCEDURE SETS NEW FIELD ATTRIBUTES FOR A VARIABLE FIELD.
  644. *
  645. * PROC SFATTR$(NAME,NLENGTH,NOFFSET,NEWORD,OLDORD)
  646. *
  647. * ENTRY NAME = NAME OF VARIABLE FIELD TO BE CHANGED.
  648. * NLENGTH = LENGTH IN SIX BIT CHARACTERS.
  649. * NOFFSET = OFFSET INTO VARIABLE NAME.
  650. * NEWORD = NEW ATTRIBUTE ORDINAL.
  651. *
  652. * EXIT OLDORD = OLD ATTRIBUTE ORDINAL.
  653. * = - 3 IF ORDINAL NOT LEGAL.
  654. * = - 2 IF FIELD NOT FOUND IN PANEL.
  655. * = - 1 IF ATTRIBUTE NOT FOUND IN PANEL.
  656. *
  657. * USES TERREWFLDS.
  658. #
  659. ITEM NAME C(11); # NAME OF VARIABLE FIELD #
  660. ITEM NLENGTH I; # LENGTH IN SIX BIT CHARACTERS #
  661. ITEM NOFFSET I; # OFFSET INTO NAME #
  662. ITEM NEWORD I; # REQUESTED ATTRIBUTE ORDINAL #
  663. ITEM OLDORD I; # OLD ATTRIBUTE ORDINAL #
  664.  
  665. ITEM FLDINDEX I; # INDEX INTO FIELD LIST #
  666. ITEM FIELDNAME C(7); # FIELD NAME, LEFT JUSTIFIED #
  667. ITEM I I; # LOOP COUNTER #
  668. ARRAY ATTRIBUTES [0:0] P(1); # HOLDS OLD AND NEW ATTRIBUTES #
  669. BEGIN
  670. ITEM ATTFULLONE U(00,00,60); # FULL WORD #
  671. ITEM ATTUNUSED U(00,00,18); # UNUSED #
  672. ITEM ATTINDEX I(00,18,18); # INDEX INTO ATTRIBUTE LIST #
  673. ITEM ATTNEWMASK U(00,36,12); # TWELVE BIT ATTRIBUTE MASK #
  674. ITEM ATTNEWLOGI B(00,36,01); # LOGICAL OR PHYSICAL ATTRIBUTE #
  675. ITEM ATTNEWPROT B(00,37,01); # PROTECT #
  676. ITEM ATTNEWGARD B(00,38,01); # GUARD MODE #
  677. ITEM ATTNEWLORD U(00,42,06); # LOGICAL ORDINAL #
  678. ITEM ATTOLDMASK U(00,48,12); # TWELVE BIT ATTRIBUTE MASK #
  679. ITEM ATTOLDLOGI B(00,48,01); # LOGICAL OR PHYSICAL ATTRIBUTE #
  680. ITEM ATTOLDPROT B(00,49,01); # PROTECT #
  681. ITEM ATTOLDGARD B(00,50,01); # GUARD MODE #
  682. ITEM ATTOLDLORD U(00,54,06); # LOGICAL ORDINAL #
  683. END
  684. ARRAY ATTMORDNLS [0:35] P(1); # ATTRIBUTE MASK BY ORDINAL #
  685. BEGIN
  686. ITEM ATTMASKORD U(00,00,60) = [
  687. O"6000", O"5000", O"4000", O"6001", O"5001", # 0 1 2 3 4 #
  688. O"4001", O"6002", O"5002", O"4002", O"6003", # 5 6 7 8 9 #
  689. O"5003", O"4003", O"6004", O"5004", O"4004", # 10 11 12 13 14 #
  690. O"6005", O"5005", O"4005", O"6006", O"5006", # 15 16 17 18 19 #
  691. O"4006", O"6007", O"5007", O"4007", O"6010", # 20 21 22 23 24 #
  692. O"5010", O"4010", O"6011", O"5011", O"4011", # 25 26 27 28 29 #
  693. O"6012", O"5012", O"4012", O"6013", O"5013", # 30 31 32 33 34 #
  694. O"4013"]; # 35 #
  695. END
  696.  
  697. IF NLENGTH LS 1 THEN NLENGTH = 7; # CRACK PARAMETER #
  698. FIELDNAME = C<NOFFSET,NLENGTH>NAME;
  699.  
  700. OLDORD = - 3; # PRESET ORDINAL NOT LEGAL #
  701. IF NEWORD LS 0 OR NEWORD GQ 36 THEN RETURN;
  702.  
  703. OLDORD = - 2; # PRESET FIELD NOT FOUND #
  704. ATTFULLONE[0] = 0; # CLEAR WORD #
  705.  
  706. FLDINDEX = -1;
  707. FOR I = 0 STEP 1 WHILE VAR2TYPE[I] NQ 0 AND FLDINDEX EQ - 1 DO
  708. BEGIN # LOOK FOR VARIABLE VARNAME #
  709. IF VAR2NME[I] EQ FIELDNAME THEN
  710. BEGIN # FOUND SPECIFIED VARIABLE #
  711. FLDINDEX = I;
  712. END
  713. END
  714.  
  715. IF FLDINDEX NQ -1 THEN
  716. BEGIN # IF FIELD FOUND IN VAR2LIST #
  717. IF VAR2ARRORD[FLDINDEX] NQ 0 THEN
  718. BEGIN # IF ARRAY MEMBER #
  719. FLDINDEX = FLDINDEX + # FIND THAT FIELD #
  720. ARR2NUMVAR[VAR2ARRORD[FLDINDEX]-1] *
  721. ARR2CURROW[VAR2ARRORD[FLDINDEX]-1];
  722. END
  723. FLDINDEX = VAR2FLDNUM[FLDINDEX] - 1;
  724. ATTNEWMASK[0] = ATTMASKORD[NEWORD];
  725. ATTOLDMASK[0] = ATT2MASK[FLD2ATTORD[FLDINDEX]];
  726. IF PAN2STRARR NQ 0 THEN
  727. BEGIN # IF TABLE(S) IN PANEL #
  728. OLDORD = PAN2STRARR[0] - PAN2STRATT[0];
  729. END
  730. ELSE
  731. BEGIN # NO TABLES #
  732. IF PAN2STRBOX NQ 0 THEN
  733. BEGIN # IF BOXES #
  734. OLDORD = PAN2STRBOX[0] - PAN2STRATT[0];
  735. END
  736. ELSE
  737. BEGIN # NO BOXES OR TABLES #
  738. OLDORD = (PAN2RECLEN[0] - PAN2STRATT[0]) - 1;
  739. END
  740. END
  741. ATTINDEX[0] = 0; # SEARCH ATTRIBUTE LIST IN PANEL #
  742. WHYLE ATT2MASK[ATTINDEX[0]] NQ ATTNEWMASK[0] AND
  743. ATTINDEX[0] LS OLDORD DO
  744. BEGIN # UNTIL END OF PANEL ATTRIBUTES #
  745. ATTINDEX[0] = ATTINDEX[0] + 1;
  746. END
  747. IF ATTINDEX[0] LS OLDORD THEN
  748. BEGIN # IF NEW ATTRIBUTE IS IN PANEL #
  749. OLDORD = - 1; # PRESET BAD OLD ATTRIBUTE #
  750. IF ATTOLDLOGI[0] THEN
  751. BEGIN # IF OLD ATTRIBUTE WAS LOGICAL #
  752. OLDORD = 0; # SEARCH ATTMORDNLS LIST #
  753. WHYLE ATTOLDMASK[0] NQ ATTMASKORD[OLDORD] AND OLDORD LS 36 DO
  754. BEGIN # UNTIL END OF ATTMORDNLS #
  755. OLDORD = OLDORD + 1;
  756. END
  757. IF OLDORD GQ 36 THEN OLDORD = - 1;
  758. END
  759. ELSE
  760. BEGIN # PHYSICAL ATTRIBUTES #
  761. IF ATTOLDPROT[0] THEN
  762. BEGIN # IF OUTPUT ONLY #
  763. ATTINDEX[0] = 2;
  764. OLDORD = 3;
  765. END
  766. ELSE
  767. BEGIN # NOT OUTPUT ONLY #
  768. IF NOT ATTOLDGARD[0] THEN
  769. BEGIN # IF INPUT OUTPUT #
  770. ATTINDEX[0] = 1;
  771. OLDORD = 2;
  772. END
  773. END
  774. END
  775. IF OLDORD GQ 0 THEN
  776. BEGIN # IF CHANGE IS INDEED POSSIBLE #
  777. FLD2ATTORD[FLDINDEX] = ATTINDEX[0];
  778. TERREWFLDS[0] = TRUE; # SIGNAL FIELD REWRITE #
  779. FLD2VALID[FLDINDEX] = FALSE; # RESET FIELD STATUS-S #
  780. FLD2REWRIT[FLDINDEX] = TRUE;
  781. FLD2ENTERE[FLDINDEX] = FALSE;
  782. IF ATTNEWGARD[0] THEN
  783. BEGIN # IF NEW MASK SHOWS GUARD #
  784. FLD2INPUTV[FLDINDEX] = TRUE;
  785. FLD2OUTPUT[FLDINDEX] = FALSE;
  786. END
  787. ELSE
  788. BEGIN # NO GUARD #
  789. IF ATTNEWPROT[0] THEN
  790. BEGIN # IF NEW MASK SHOWS PROTECT #
  791. FLD2INPUTV[FLDINDEX] = FALSE;
  792. FLD2OUTPUT[FLDINDEX] = TRUE;
  793. END
  794. ELSE
  795. BEGIN # NO GUARD OR PROTECT #
  796. FLD2INPUTV[FLDINDEX] = TRUE;
  797. FLD2OUTPUT[FLDINDEX] = TRUE;
  798. END
  799. END
  800. END
  801. END
  802. ELSE
  803. BEGIN # NEW ATTRIBUTE NOT IN PANEL #
  804. OLDORD = - 1; # CHANGE NOT POSSIBLE #
  805. END
  806. END
  807.  
  808. END # SFATTR$ #
  809. CONTROL EJECT;
  810.  
  811. PROC SFCLOS$(NAME,NLENGTH,NOFFSET,MODEFLAG);
  812.  
  813. # TITLE SFCLOS$ - CLOSE PANEL. #
  814.  
  815. BEGIN # SFCLOS$ #
  816.  
  817. #
  818. ** SFCLOS$ - CLOSE PANEL.
  819. *
  820. * THIS PROCEDURE CLOSES THE SPECIFIED PANEL (UNLOADING IT USING
  821. * THE FAST DYNAMIC LOADER IF IT IS NOT A STATICALLY LOADED PANEL)
  822. * AND UPDATES THE PANEL LOAD TABLE TO REFLECT THE UNLOAD. IN ADD-
  823. * ITION IF THE MODEFLAG IS SET TO ONE THE TERMINAL WILL BE RESET
  824. * TO LINE MODE AND THE SCREEN CLEARED, IF THE MODEFLAG IS SET TO
  825. * TWO THE TERMINAL WILL BE RESET TO LINE MODE WITH NO CHANGE TO
  826. * THE DATA ON THE SCREEN.
  827. *
  828. * PROC SFCLOS$(NAME,NLENGTH,NOFFSET,MODEFLAG)
  829. *
  830. * ENTRY NAME = NAME OF PANEL TO BE CLOSED.
  831. * NLENGTH = LENGTH IN SIX BIT CHARACTERS.
  832. * NOFFSET = OFFSET INTO NAME.
  833. * MODEFLAG = 0, REMAIN IN SCREEN MODE.
  834. * 1, RESET TERMINAL TO LINE MODE,
  835. * CLEAR SCREEN.
  836. * 2, RESET TERMINAL TO LINE MODE.
  837. *
  838. * EXIT PANEL UNLOADED IF POSSIBLE, PLT UPDATED, TERMINAL
  839. * SET TO LINE MODE IF MODEFLAG IS NON ZERO, SCREEN
  840. * CLEARED IF MODEFLAG EQUAL TO ONE.
  841. *
  842. * CALLS ERRMSG, UCP, VDTBOO, VDTCLO, VDTCLS, VDTMSG$, VDTPOS,
  843. * VDTSTM.
  844. *
  845. * USES TERACTIVEP, TERACTPANI, TERCNWRIOV, TERREADFLG,
  846. * TERMESREAD, TERMESWRIT, TERSCREENM, TERSHOWFLG.
  847. #
  848. ITEM NAME C(11); # NAME OF PANEL TO CLOSE #
  849. ITEM NLENGTH I; # LENGTH IN SIX BIT CHARACTERS #
  850. ITEM NOFFSET I; # OFFSET INTO NAME #
  851. ITEM MODEFLAG I; # FLUSH OUTPUT/CLEAR SCREEN FLAG #
  852.  
  853. ITEM BLANKNAME C(7) = " "; # BLANK PANEL NAME #
  854. ITEM FATAL B = FALSE; # NOT A FATAL ERROR #
  855. ITEM LINE I = 0; # INDICATES LINE MODE TO VDT #
  856. ITEM MSG C(25); # DAYFILE ERROR MESSAGE #
  857. ITEM MSGB I = 0; # BLANK B DISPLAY #
  858. ITEM NAMEINDEX I; # INDEX OF PANEL IF FOUND #
  859. ITEM NUMBER I; # ON SCREEN SEQUENCE NUMBER #
  860. ITEM PANELADDR I; # MEMORY ADDRESS OF PANEL #
  861. ITEM PANELNAME C(7); # PANEL NAME, LEFT JUSTIFIED #
  862. ITEM PLTCOUNT I; # COUNTER TO MOVE UP ENTRIES #
  863. ITEM PLTINDEX I; # INDEX INTO PANEL LOAD TABLE #
  864. ITEM PNAME C(6) = "SFCLOS"; # PROCEDURE NAME #
  865. ITEM RECALL I = 1; # RECALL PARAMTER FOR VDTCLO #
  866. ITEM UNLOADSTAT I; # UNLOAD STATUS FROM F.D.L. #
  867.  
  868. IF NLENGTH LS 1 THEN NLENGTH = 7; # CRACK PARAMETER #
  869. PANELNAME = C<NOFFSET,NLENGTH>NAME; # LEFT JUSTIFY PANEL NAME #
  870.  
  871. *IF UNDEF,QTRM
  872. P<PLTABLE> = LOC(PLT); # REFERENCE PANEL LOAD TABLE #
  873. *ELSE
  874. P<PLTABLE> = NIT$PCT[NIT$CON] + PLTOFFSET; # REFERENCE USER PLT #
  875.  
  876. SFCLOS1:
  877.  
  878. *ENDIF
  879. PANELADDR = 0;
  880.  
  881. FOR PLTINDEX = 1 STEP 1 WHILE
  882. PANELADDR EQ 0 AND PLTINDEX LQ PLTNUMENT[0] DO
  883. BEGIN # CHECK FOR PANEL NAME IN TABLE #
  884. IF PLTENAME[PLTINDEX] EQ PANELNAME THEN
  885. BEGIN # IF PANEL NAME FOUND #
  886. PANELADDR = PLTADDR[PLTINDEX]; # SAVE ADDRESS OF PANEL RECORD #
  887. NAMEINDEX = PLTINDEX; # SAVE INDEX INTO PLT #
  888. END
  889. END
  890.  
  891. IF PANELADDR NQ 0 THEN
  892. BEGIN # IF PANEL NAME IN TABLE #
  893. *IF DEF,QTRM
  894. IF P<PLTABLE> NQ LOC(PLT) THEN
  895. BEGIN # IF NOT GLOBAL PLT #
  896. NUMBER = PLTENTRYNM[NAMEINDEX];
  897. FOR PLTCOUNT = NAMEINDEX STEP 1 UNTIL PLTNUMENT[0] DO
  898. BEGIN # MOVE ENTRIES UP #
  899. PLTWORDONE[PLTCOUNT] = PLTWORDONE[PLTCOUNT+1];
  900. PLTWORDTWO[PLTCOUNT] = PLTWORDTWO[PLTCOUNT+1];
  901. END
  902. PLTWORDONE[PLTNUMENT[0]] = 0; # CLEAR LAST ENTRY #
  903. PLTWORDTWO[PLTNUMENT[0]] = 0;
  904. PLTNUMENT[0] = PLTNUMENT[0] - 1;
  905. IF NUMBER NQ 0 THEN
  906. BEGIN # IF PANEL WAS ON SCREEN #
  907. FOR PLTCOUNT = 1 STEP 1 UNTIL PLTNUMENT[0] DO
  908. BEGIN # UPDATE SEQUENCE NUMBERS #
  909. IF PLTENTRYNM[PLTCOUNT] GR NUMBER THEN
  910. BEGIN
  911. PLTENTRYNM[PLTCOUNT] = PLTENTRYNM[PLTCOUNT] -1;
  912. END
  913. END
  914. PLTNUMONSC[0] = PLTNUMONSC[0] - 1;
  915. END
  916. P<PLTABLE> = LOC(PLT); # RESET FOR GLOBAL PLT #
  917. GOTO SFCLOS1; # CONTINUE #
  918. END
  919. # DECREMENT COUNT IN GLOBAL PLT #
  920. PLTNUMQTRM[NAMEINDEX] = PLTNUMQTRM[NAMEINDEX] - 1;
  921.  
  922. *ENDIF
  923. NUMBER = PLTENTRYNM[NAMEINDEX];
  924. IF PANELNAME EQ TERACTPANL[0] THEN
  925. BEGIN # IF CLOSING ACTIVE PANEL #
  926. TERACTPANL[0] = BLANKNAME;
  927. TERACTPLTI[0] = 0;
  928. END
  929. *IF UNDEF,QTRM
  930. IF NOT PLTSLFLAG[NAMEINDEX] THEN
  931. *ELSE
  932. IF NOT PLTSLFLAG[NAMEINDEX] AND PLTNUMQTRM[NAMEINDEX] EQ 0 THEN
  933. *ENDIF
  934. BEGIN # UNLOAD DYNAMIC PANEL #
  935. UCP(PANELNAME,PANELADDR,UNLOADSTAT);
  936. IF UNLOADSTAT NQ 0 THEN
  937. BEGIN # ISSUE DAYFILE MESSAGE #
  938. MSG = " NOT UNLOADED. ";
  939. ERRMSG(PANELNAME,PNAME,MSG,FATAL);
  940. END
  941. FOR PLTCOUNT = NAMEINDEX STEP 1 UNTIL PLTNUMENT[0] DO
  942. BEGIN # MOVE REMAINING ENTRIES UP ONE #
  943. PLTWORDONE[PLTCOUNT] = PLTWORDONE[PLTCOUNT+1];
  944. PLTWORDTWO[PLTCOUNT] = PLTWORDTWO[PLTCOUNT+1];
  945. END
  946. PLTWORDONE[PLTNUMENT[0]] = 0; # CLEAR LAST ENTRY IN TABLE #
  947. PLTWORDTWO[PLTNUMENT[0]] = 0;
  948. PLTNUMENT[0] = PLTNUMENT[0] - 1; # UPDATE NUMBER OF ENTRIES #
  949. END
  950. ELSE
  951. BEGIN # CHECK STATUS OF STATIC PANEL #
  952. IF PLTOPENFLG[NAMEINDEX] THEN
  953. BEGIN # IF STATIC PANEL IS OPEN #
  954. PLTOPENFLG[NAMEINDEX] = FALSE; # CLOSE STATIC PANEL #
  955. PLTENTRYNM[NAMEINDEX] = 0; # CLEAR SEQUENCE NUMBER #
  956. END
  957. ELSE
  958. BEGIN # IF STATIC PANEL ALREADY CLOSED #
  959. MSG = " ALREADY CLOSED. ";
  960. ERRMSG(PANELNAME,PNAME,MSG,FATAL);
  961. END
  962. END
  963. IF NUMBER NQ 0 THEN
  964. BEGIN # IF PANEL WAS ON SCREEN #
  965. FOR PLTCOUNT = 1 STEP 1 UNTIL PLTNUMENT[0] DO
  966. BEGIN # UPDATE SEQUENCE NUMBERS #
  967. IF PLTENTRYNM[PLTCOUNT] GR NUMBER THEN
  968. BEGIN
  969. PLTENTRYNM[PLTCOUNT] = PLTENTRYNM[PLTCOUNT] - 1;
  970. END
  971. END
  972. PLTNUMONSC[0] = PLTNUMONSC[0] - 1;
  973. END
  974. END
  975. ELSE
  976. BEGIN # IF PANEL NAME NOT IN TABLE #
  977. MSG = " NOT IN PLT. ";
  978. ERRMSG(PANELNAME,PNAME,MSG,FATAL);
  979. END
  980. IF MODEFLAG NQ 0 THEN
  981. BEGIN
  982. IF TERSCREENM[0] THEN
  983. BEGIN # IF REVERSION TO LINE MODE #
  984. TERSCREENM[0] = FALSE; # CLEAR FLAGS #
  985. IF NOT TERVDTBOOC[0] THEN
  986. BEGIN # IF BEGIN OUTPUT NEEDED #
  987. TERVDTBOOC[0] = TRUE;
  988. VDTBOO;
  989. END
  990. IF MODEFLAG EQ 1 THEN
  991. BEGIN # IF SCREEN IS TO BE CLEARED #
  992. VDTCLS; # CLEAR SCREEN #
  993. END
  994. ELSE
  995. BEGIN # POSITION CURSOR TO LAST LINE #
  996. VDTPOS(0,TERNUMLNES[0]);
  997. END
  998. FOR PLTCOUNT = 1 STEP 1 UNTIL PLTNUMENT[0] DO
  999. BEGIN # CLEAR SEQUENCE NUMBERS #
  1000. PLTENTRYNM[PLTCOUNT] = 0;
  1001. END
  1002. PLTNUMONSC[0] = 0; # NO PANELS ON SCREEN #
  1003. TERMESWRIT[0] = FALSE;
  1004. TERMESREAD[0] = FALSE;
  1005. VDTSTM(LINE,DUMMY); # SET LINE MODE #
  1006. *IF UNDEF,QTRM
  1007. VDTCLO(RECALL); # FLUSH OUTPUT WITH RECALL #
  1008. IF TERBLCKMDE[0] THEN TERVDTBOOC[0] = FALSE;
  1009. *ENDIF
  1010. END
  1011. TERACTPANL[0] = " "; # CLEAR ACTIVE PANEL NAME #
  1012. TERACTPLTI[0] = 0; # CLEAR PLT INDEX #
  1013. TERCNWRIOV[0] = FALSE; # DO NOT ALLOW OVERLAY WRITE #
  1014. VDTMSG$(MSGB,1,1); # BLANK B DISPLAY MESSAGE #
  1015. TERSHOWFLG[0] = FALSE;
  1016. TERREADFLG[0] = FALSE;
  1017. END
  1018.  
  1019. END # SFCLOS$ #
  1020. CONTROL EJECT;
  1021.  
  1022. PROC SFCSET$(CSET,CLENGTH,COFFSET);
  1023.  
  1024. # TITLE SFCSET$ - SET CHARACTER SET. #
  1025.  
  1026. BEGIN # SFCSET$ #
  1027.  
  1028. #
  1029. ** SFCSET$ - SET CHARACTER SET.
  1030. *
  1031. * THIS PROCEDURE SETS AND CLEARS THE GLOBAL FLAGS THAT INDICATE
  1032. * WHAT CHARACTER SET IS IN USE BY THE APPLICATION CALLING THE
  1033. * SCREEN FORMATTING OBJECT ROUTINES. IT INTERFACES TO COBOL AND
  1034. * FORTRAN APPLICATION PROGRAMS THROUGH A COMPASS INTERFACE MOD-
  1035. * ULE CALLED SFCSET.
  1036. *
  1037. * PROC SFCSET$(CSET,CLENGTH,COFFSET)
  1038. *
  1039. * ENTRY CSET = "DISPLAY", "ASCII", OR "ASCII8",
  1040. * IN DISPLAY CODE.
  1041. * CLENGTH = LENGTH IN SIX BIT CHARACTERS IN CHARSET.
  1042. * COFFSET = OFFSET INTO CHARSET.
  1043. *
  1044. * EXIT CORRECT CHARACTER SET FLAG SET, OTHERS CLEARED.
  1045. *
  1046. * USES TERASCFLAG, TERAS8FLAG.
  1047. *
  1048. * NOTES IF SFCSET$ IS CALLED WITH AN UNRECOGNIZABLE
  1049. * CHARACTER SET THEN THE DEFAULT CHARACTER SET
  1050. * (DISPLAY) WILL BE SET AND ALL OTHERS CLEARED.
  1051. * SFCSET$ ACCEPTS ONLY BLANK FILLED DISPLAY CODE
  1052. * STRINGS FOR THE CHARACTER SET.
  1053. #
  1054. ITEM CSET C(11); # CHAR. SET NAME IN DISPLAY CODE #
  1055. ITEM CLENGTH I; # LENGTH IN SIX BIT CHARACTERS #
  1056. ITEM COFFSET I; # OFFSET INTO CSET #
  1057.  
  1058. ITEM ASCII C(7) = "ASCII "; # ASCII (IN DISPLAY CODE ) #
  1059. ITEM ASCII8 C(7) = "ASCII8 "; # ASCII8 (IN DISPLAY CODE) #
  1060. ITEM SET C(7); # CHARACTER SET, LEFT JUSTIFIED #
  1061.  
  1062. IF CLENGTH LS 1 THEN CLENGTH = 7; # CRACK PARAMETER #
  1063. SET = C<COFFSET,CLENGTH>CSET;
  1064.  
  1065. IF SET EQ ASCII THEN
  1066. BEGIN # IF SIX TWELVE ASCII #
  1067. TERASCFLAG[0] = TRUE;
  1068. TERAS8FLAG[0] = FALSE;
  1069. END
  1070. ELSE
  1071. BEGIN
  1072. IF SET EQ ASCII8 THEN
  1073. BEGIN # IF TWELVE BIT ASCII #
  1074. TERASCFLAG[0] = FALSE;
  1075. TERAS8FLAG[0] = TRUE;
  1076. END
  1077. ELSE
  1078. BEGIN # SET DISPLAY CODE #
  1079. TERASCFLAG[0] = FALSE;
  1080. TERAS8FLAG[0] = FALSE;
  1081. END
  1082. END
  1083.  
  1084. END # SFCSET$ #
  1085. CONTROL EJECT;
  1086.  
  1087. PROC SFGETF$(VNAME,VLEN,VOS,STRG,SLEN,SOS,CSET,CLEN,COS,STAT);
  1088. BEGIN
  1089. #
  1090. ** SFGETF$ - GET FIELD CHARACTER STRING.
  1091. *
  1092. * SFGETF$ TRANSFERS CHARACTERS FROM A SPECIFIED PANEL FIELD TO
  1093. * A SPECIFIED STRING, USING *MOVEFLD*.
  1094. *
  1095. * PROC SFGETF$(VNAME,VLEN,VOS,STRG,SLEN,SOS,CSET,CLEN,COS,STAT)
  1096. *
  1097. * ENTRY VNAME = VARIABLE NAME OF FIELD.
  1098. * VLEN = LENGTH OF VARNAME PARAMETER.
  1099. * VOS = OFFSET OF VARNAME PARAMETER.
  1100. * STRG = VARIABLE FIELD STRING.
  1101. * SLEN = LENGTH OF STRING PARAMETER.
  1102. * SOS = OFFSET OF STRING PARAMETER.
  1103. * CSET = CHARACTER SET OF STRING (SEE SFCSET$).
  1104. * CLEN = LENGTH OF CSET PARAMETER.
  1105. * COS = OFFSET OF CSET PARAMETER.
  1106. *
  1107. * EXIT STAT GQ 0, NUMBER OF 6 BIT CHARACTERS MOVED.
  1108. * LS 0, VARIABLE NOT FOUND IN ACTIVE PANELS.
  1109. *
  1110. * CALLS MOVEFLD.
  1111. #
  1112.  
  1113. ITEM VNAME I; # VARIABLE NAME #
  1114. ITEM VLEN I; # LENGTH OF VARNAME PARAMETER #
  1115. ITEM VOS I; # OFFSET INTO VARNAME PARAMETER #
  1116. ITEM STRG I; # INSTRING PARAMETER #
  1117. ITEM SLEN I; # LENGTH OF INSTRING #
  1118. ITEM SOS I; # OFFSET INTO INSTRING #
  1119. ITEM CSET I; # CHARACTER SET #
  1120. ITEM CLEN I; # LENGTH OF CHARACTER SET #
  1121. ITEM COS I; # OFFSET INTO CHARACTER SET #
  1122. ITEM STAT I; # STATUS FIELD #
  1123.  
  1124.  
  1125. STAT = 0;
  1126. MOVEFLD(VNAME,VLEN,VOS,STRG,SLEN,SOS,CSET,CLEN,COS,STAT);
  1127. RETURN;
  1128.  
  1129. END # SFGETF$#
  1130. *IF DEF,QTRM
  1131. CONTROL EJECT;
  1132.  
  1133. PROC SFDQUE$(QNAME,QLEN,QOFF,BUFFER,RC,LENGTH);
  1134.  
  1135. # TITLE SFDQUE$ - DEQUEUE A PIECE OF DATA FOR THIS TERMINAL. #
  1136.  
  1137. BEGIN # SFDQUE$ #
  1138.  
  1139. #
  1140. ** SFDQUE$ - DEQUEUE A PIECE OF DATA FOR THIS TERMINAL.
  1141. *
  1142. * THIS PROCEDURE REMOVES *LENGTH* CHARACTERS FROM THE SPECIFIED
  1143. * QUEUE AND PLACES THE CHARACTERS INTO *BUFFER*. IT INTERFACES
  1144. * TO COBOL5 AND FTN5 APPLICATION PROGRAMS THROUGH A COMPASS
  1145. * INTERFACE CALLED SFDQUE.
  1146. *
  1147. * PROC SFDQUE$(QNAME,QLEN,QOFF,BUFFER,RC,LENGTH)
  1148. *
  1149. * ENTRY QNAME = QUEUE TO PLACE DATA INTO (GET OR PUT).
  1150. * QLEN = LENGTH OF QUEUE NAME.
  1151. * QOFF = OFFSET OF QUEUE NAME.
  1152. * LENGTH = BUFFER SIZE IN 12 BIT CHARACTERS.
  1153. *
  1154. * EXIT NIT$CTLC = COUNT OF CHARACTERS DEQUEUED.
  1155. * RC = 0, IF DATA DEQUEUED (NO ERROR).
  1156. * 1, IF MORE DATA AVAILABLE.
  1157. * 2, IF NO MESSAGES IN THE QUEUE.
  1158. * BUFFER = DEQUEUED DATA.
  1159. *
  1160. * CALLS CMMFRF.
  1161. #
  1162. ITEM QNAME C(7); # QUEUE NAME #
  1163. ITEM QLEN I; # QUEUE NAME LENGTH #
  1164. ITEM QOFF I; # QUEUE NAME OFFSET #
  1165. ARRAY BUFFER [0:0] P(1); # BUFFER #
  1166. BEGIN
  1167. ITEM B$WD0 U(00,00,60); # BUFFER WORD (INTEGER) #
  1168. END
  1169. ITEM RC I; # RETURN CODE #
  1170. ITEM LENGTH I; # BUFFER SIZE IN CHARACTERS #
  1171.  
  1172. ITEM BIT I; # BIT POSITION #
  1173. ITEM B$CURBIT I; # CURRENT BIT #
  1174. ITEM B$CURWORD I; # CURRENT WORD #
  1175. ITEM I I; # LOOP VARIABLE #
  1176. ITEM J I; # LOOP VARIABLE #
  1177. ITEM MAX$CHARS I; # MAXIMUM NUMBER OF CHARACTERS #
  1178. ITEM QUEUENAME C(7); # QUEUE NAME #
  1179. ITEM RCC I; # RETURN CODE #
  1180. ITEM WORD I; # BUFFER WORD #
  1181.  
  1182. B$CURBIT = 0; # POSITION TO START OF BUFFER #
  1183. B$CURWORD = 0;
  1184. P<Q$HEADER> = CHAIN;
  1185.  
  1186. IF QLEN LS 1 THEN QLEN = 7; # CRACK PARAMETER #
  1187. QUEUENAME = C<QOFF,QLEN>QNAME;
  1188.  
  1189. WHYLE P<Q$HEADER> NQ 0 DO
  1190. BEGIN # SEARCH FOR QUEUE FOR THIS ACN #
  1191. IF (( NIT$CON EQ Q$ACN ) AND
  1192. ( C<0,3>QNAME EQ C<0,3>Q$NAME )) THEN
  1193. IF NIT$CON EQ Q$ACN AND QUEUENAME EQ Q$NAME THEN
  1194. BEGIN # IF QUEUE IS FOUND #
  1195. P<Q$BUFFER> = P<Q$HEADER> + Q$HEADLEN;
  1196. FOR I = 1 STEP 1 UNTIL LENGTH DO
  1197. BEGIN # MOVE THIS USER-S DATA #
  1198. WORD = Q$OUTCHAR / 5;
  1199. BIT = (Q$OUTCHAR - (WORD * 5)) * 12;
  1200. B<B$CURBIT,12> B$WD0[B$CURWORD] = B<BIT,12>Q$WORD[WORD];
  1201. Q$OUTCHAR = Q$OUTCHAR + 1;
  1202. B$CURBIT = B$CURBIT + 12;
  1203. IF B$CURBIT GQ 60 THEN
  1204. BEGIN # IF COMPLETE WORD MOVED #
  1205. B$CURBIT = 0;
  1206. B$CURWORD = B$CURWORD + 1;
  1207. END
  1208.  
  1209. IF Q$OUTCHAR GR Q$INCHAR THEN
  1210. BEGIN # IF #
  1211. NIT$CTLC = I - 1;
  1212. RC = 0;
  1213. Q$INCHAR = 0;
  1214. Q$OUTCHAR = 0;
  1215. RCC = P<Q$HEADER>; # ADDRESS FOR CMM #
  1216. I = Q$BACK; # BACK POINTER #
  1217. J = Q$FORWARD; # FORWARD POINTER #
  1218. P<Q$HEADER> = I; # SET TO PREVIOUS PTR WORD #
  1219. Q$FORWARD = J; # AND SET TO NEXT PTR WORD #
  1220. IF J NQ 0 THEN
  1221. BEGIN # IF NEXT PTR WORD EXISTS #
  1222. P<Q$HEADER> = J; # SET PTR TO PREVIOUS PTR WORD #
  1223. Q$BACK = I;
  1224. END
  1225. CMMFRF (RCC); # RELEASE BUFFER #
  1226. RETURN; # RETURN #
  1227. END
  1228. END
  1229.  
  1230. RC = 1; # USER-S BUFFER IS FULL #
  1231. NIT$CTLC = LENGTH;
  1232. RETURN; # RETURN #
  1233. END
  1234. P<Q$HEADER> = Q$FORWARD;
  1235. END
  1236.  
  1237. RC = 2; # NOTHING TO DEQUEUE #
  1238.  
  1239. END # SFDQUE$ #
  1240. *ENDIF
  1241. CONTROL EJECT;
  1242.  
  1243. PROC SFGETI$(VARNAME,VLEN,VOFF,VALUE);
  1244.  
  1245. # TITLE SFGETI$ - GET INTEGER VALUE. #
  1246.  
  1247. BEGIN # SFGETI$ #
  1248.  
  1249. #
  1250. ** SFGETI$ - GET INTEGER VALUE.
  1251. *
  1252. * SFGETI$ RETURNS THE INTEGER NUMERIC VALUE OF THE FIELD
  1253. * SPECIFIED BY VARNAME AND ROWNUM.
  1254. *
  1255. * PROC SFGETI$(VARNAME,VLEN,VOFF,VALUE)
  1256. *
  1257. * ENTRY VARNAME = VARIABLE NAME OF FIELD.
  1258. * VLEN = LENGTH OF VARP.
  1259. * VOFF = OFFSET OF VARP.
  1260. *
  1261. * EXIT VALUE = INTEGER VALUE OF SPECIFIED FIELD.
  1262. *
  1263. * CALLS DATEVL, GFIELD, NCHECK.
  1264. #
  1265. ITEM VARNAME C(11); # VARIABLE NAME #
  1266. ITEM VLEN I; # LENGTH OF VARNAME PARAMETER #
  1267. ITEM VOFF I; # OFFSET INTO VARNAME PARAMETER #
  1268. ITEM VALUE I; # VALUE OF INPUT #
  1269.  
  1270. ITEM ALLBLANK B; # ALL BLANK CHARACTERS IN FIELD #
  1271. ITEM CURRENCY B; # TRUE IF DOLLAR SIGN INPUT #
  1272. ITEM ERRORVAL I = 0; # RETURNED IF ERROR IN FIELD #
  1273. ITEM EVALUE I; # EXPONENT VALUE #
  1274. ITEM FLDIND I; # FIELD ORDINAL #
  1275. ITEM FORMAT I; # FORMAT OF INPUT #
  1276. ITEM HOLDVALID B; # SAVE FLDVALID VALUE #
  1277. ITEM I I; # LOOP COUNTER #
  1278. ITEM IVALUE I; # INTEGER VALUE #
  1279. ITEM USEROW B = FALSE; # DO NOT USE TERCURSROW #
  1280. ITEM VNAME C(7); # VARIABLE NAME LEFT JUSTIFIED #
  1281.  
  1282. IF VLEN LS 1 THEN VLEN = 7; # CRACK PARAMETER #
  1283. VNAME = C<VOFF,VLEN>VARNAME;
  1284.  
  1285. GFIELD(VNAME,USEROW,FLDIND); # GET ASSOCIATED FIELD #
  1286. IF FLDIND EQ -1 THEN GOTO INTERROR; # FIELD NOT FOUND #
  1287.  
  1288. ALLBLANK = TRUE;
  1289. FOR I = 0 STEP 1 WHILE ALLBLANK AND I LQ FLDLENGTH[FLDIND] -1 DO
  1290. BEGIN # CHECK IF BLANK FIELD #
  1291. IF NEXTCHAR(FLDIND,I) NQ BLANK THEN ALLBLANK = FALSE;
  1292. END
  1293. IF ALLBLANK THEN
  1294. BEGIN # BLANK FIELD #
  1295. VALUE = 0;
  1296. RETURN;
  1297. END
  1298.  
  1299. HOLDVALID = FLDVALID[FLDIND]; # SAVE VALID FLAG #
  1300. FLDVALID[FLDIND] = TRUE;
  1301. IF VARPICTYPE[FLDVARORD[FLDIND]] EQ FORMTYPE"Y"
  1302. OR VARPICTYPE[FLDVARORD[FLDIND]] EQ FORMTYPE"M"
  1303. OR VARPICTYPE[FLDVARORD[FLDIND]] EQ FORMTYPE"D" THEN
  1304. BEGIN # DATE FORMAT FIELD #
  1305. FORMAT = VARPICTYPE[FLDVARORD[FLDIND]]; # SET FORMAT TYPE #
  1306. DATEVL(FLDIND,IVALUE); # GET VALUE #
  1307. END
  1308. ELSE
  1309. BEGIN # NUMERIC FIELD #
  1310. NCHECK(FLDIND,IVALUE,EVALUE,FORMAT,CURRENCY);
  1311. IF VARPICTYPE[FLDVARORD[FLDIND]] EQ FORMTYPE"$" THEN
  1312. BEGIN # WEIGHT CURRENCY INPUT #
  1313. IF EVALUE EQ 0 THEN IVALUE = IVALUE * 100;
  1314. ELSE IF EVALUE EQ -1 THEN IVALUE = IVALUE * 10;
  1315. END
  1316. ELSE
  1317. BEGIN # NOT CURRENCY #
  1318. IF EVALUE LS 0 THEN
  1319. BEGIN # TRUNCATE DECIMAL DIGITS #
  1320. FOR I = -1 STEP -1 UNTIL EVALUE DO IVALUE = IVALUE/10;
  1321. END
  1322. ELSE
  1323. BEGIN # RAISE TO POWER OF EXPONENT #
  1324. FOR I = 1 STEP 1 UNTIL EVALUE DO IVALUE = IVALUE*10;
  1325. END
  1326. END
  1327. END
  1328.  
  1329. IF NOT FLDVALID[FLDIND] OR FORMAT EQ FORMTYPE"BAD"THEN
  1330. BEGIN # ERRORS IN INPUT #
  1331. GOTO INTERROR;
  1332. END
  1333. FLDVALID[FLDIND] = HOLDVALID; # RESET VALID FLAG #
  1334. VALUE = IVALUE;
  1335. RETURN;
  1336.  
  1337. INTERROR: # CANNOT RETURN VALUE #
  1338.  
  1339. IF FLDIND NQ -1 THEN FLDVALID[FLDIND] = HOLDVALID;
  1340. VALUE = ERRORVAL;
  1341.  
  1342. END # SFGETI$ #
  1343. CONTROL EJECT;
  1344.  
  1345. PROC SFGETK(GENERIC,ORDINAL);
  1346.  
  1347. # TITLE SFGETK - GET FUNCTION KEY. #
  1348.  
  1349. BEGIN # SFGETK #
  1350.  
  1351. #
  1352. ** SFGETK - GET FUNCTION KEY.
  1353. *
  1354. * SFGETK RETURNS THE ORDINAL OF THE LAST FUNCTION KEY PROCESSED.
  1355. *
  1356. * PROC SFGETK(GENERIC,ORDINAL)
  1357. *
  1358. * ENTRY TERFUNCGEN = TRUE IF GENERIC FUNCTION KEY.
  1359. * TERFUNCORD = ORDINAL OF FUNCTION KEY.
  1360. *
  1361. * EXIT GENERIC = TRUE IF GENERIC FUNCTION KEY.
  1362. * ORDINAL = ORDINAL OF FUNCTION KEY.
  1363. #
  1364. ITEM GENERIC B; # GENERIC/APPLICATION KEY FLAG #
  1365. ITEM ORDINAL I; # FUNCTION KEY ORDINAL #
  1366.  
  1367. GENERIC = TERFUNCGEN[0]; # RETURN GENERIC FLAG #
  1368. ORDINAL = TERFUNCORD[0]; # RETURN FUNCTION ORDINAL #
  1369.  
  1370. END # SFGETK #
  1371. CONTROL EJECT;
  1372.  
  1373. PROC SFGETN$(MODEL,MLEN,MOFF);
  1374.  
  1375. # TITLE SFGETN$ - GET TERMINAL MODEL NAME. #
  1376.  
  1377. BEGIN # SFGETN$ #
  1378.  
  1379. #
  1380. ** SFGETN$ - GET TERMINAL MODEL NAME.
  1381. *
  1382. * SFGETN$ RETURNS THE TERMINAL MODEL NAME LEFT JUSTIFIED BLANK
  1383. * FILLED. IF MODEL NAME IS NOT FOUND, SPACES ARE RETURNED.
  1384. *
  1385. * PROC SFGETN$(MODEL,MLEN,MOFF)
  1386. *
  1387. * ENTRY MLEN = LENGTH OF MODEL NAME FIELD.
  1388. * MOFF = OFFSET OF MODEL NAME FIELD.
  1389. *
  1390. * EXIT MODEL = TERMINAL MODEL NAME.
  1391. *
  1392. * CALLS VDTITD.
  1393. #
  1394.  
  1395. BASED ARRAY TEMP [0:0];
  1396. BEGIN
  1397. ITEM STRING C(00,00,10); # MODEL NAME TEMPLATE #
  1398. END
  1399. ITEM MODEL C(6); # TERMINAL MODEL NAME #
  1400. ITEM MLEN I; # LENGTH OF MODEL PARAMETER #
  1401. ITEM MOFF I; # OFFSET INTO MODEL PARAMETER #
  1402. ITEM RETVAL C(6); # RETURNED VALUE #
  1403. ITEM OFFIND I; # OFFSET INDEX #
  1404. ITEM I I; # LOOP INDEX #
  1405.  
  1406. VDTITD(RETVAL); # GET MODEL NAME #
  1407. P<TEMP> = LOC(MODEL);
  1408. OFFIND = MOFF;
  1409. FOR I = 0 STEP 1 UNTIL MLEN - 1 DO
  1410. BEGIN # BLANK FILL MODEL NAME #
  1411. IF I GR 6 THEN # IF BEYOND POSSIBLE MODEL NAME #
  1412. C<OFFIND,1>STRING = " ";
  1413. ELSE
  1414. IF C<I,1>RETVAL EQ 0 THEN # IF BEYOND ACTUAL MODEL NAME #
  1415. C<OFFIND,1>STRING = " ";
  1416. ELSE
  1417. C<OFFIND,1>STRING = C<I,1>RETVAL;
  1418. OFFIND = OFFIND + 1;
  1419. IF (OFFIND GR 9) THEN
  1420. BEGIN # IF END OF CURRENT WORD #
  1421. OFFIND = 0;
  1422. P<TEMP> = P<TEMP> + 1;
  1423. END
  1424. END
  1425.  
  1426. END # SFGETN$ #
  1427. CONTROL EJECT;
  1428.  
  1429. PROC SFGETP$(VARNAME,VLEN,VOFF,OFFSET,ROWNUM);
  1430.  
  1431. # TITLE SFGETP$ - GET LAST CURSOR POSITION. #
  1432.  
  1433. BEGIN # SFGETP$ #
  1434.  
  1435. #
  1436. ** SFGETP$ - GET LAST CURSOR POSITION.
  1437. *
  1438. * SFGETP$ RETURNS VALUES THAT DEFINE THE LAST POSITION OF THE
  1439. * SCREEN CURSOR.
  1440. *
  1441. * PROC SFGETP$(VARNAME,VLEN,VOFF,OFFSET,ROWNUM)
  1442. *
  1443. * ENTRY VARNAME = LOCATION OF VARIABLE PARAMETER.
  1444. * VLEN = LENGTH OF VARNAME.
  1445. * VOFF = OFFSET OF VARNAME.
  1446. *
  1447. * EXIT VARNAME = VARIABLE NAME OF FIELD.
  1448. * OFFSET = OFFSET OF CURSOR IN FIELD.
  1449. * ROWNUM = ROW NUMBER OF FIELD.
  1450. *
  1451. * CALLS FFIELD.
  1452. #
  1453. ITEM VARNAME C(11); # VARIABLE NAME #
  1454. ITEM VLEN I; # LENGTH OF VARNAME PARAMETER #
  1455. ITEM VOFF I; # OFFSET INTO VARNAME PARAMETER #
  1456. ITEM OFFSET I; # OFFSET INTO FIELD #
  1457. ITEM ROWNUM I; # ROW NUMBER IN ARRAY #
  1458.  
  1459. ITEM FIELD I; # FUNCTION FIELD #
  1460. ITEM I I; # LOOP COUNTER #
  1461. ITEM OUTSEARCH B=TRUE; # INCLUDE OUTPUT ONLY FIELDS #
  1462. ITEM VARIND I; # VARIABLE ORDINAL OF FIELD #
  1463.  
  1464. IF VLEN LS 1 THEN VLEN = 7; # CRACK PARAMETER #
  1465. C<VOFF,VLEN>VARNAME = " ";
  1466.  
  1467. ROWNUM = 0; # FIND FIELD #
  1468. FFIELD(TERFUNCPOS[0],FIELD,OFFSET,OUTSEARCH);
  1469.  
  1470. IF VALIDFIELD THEN
  1471. BEGIN # IF FIELD FOUND #
  1472. OFFSET = OFFSET + 1;
  1473. VARIND = FLDVARORD[FIELD];
  1474. C<VOFF,VLEN>VARNAME = VARNME[VARIND];
  1475. IF VARARRORD[VARIND] NQ 0 THEN
  1476. BEGIN # IF ARRAY MEMBER #
  1477. ROWNUM = VARROWNUM[VARIND] + 1;
  1478. END
  1479. END
  1480.  
  1481. END # SFGETP$ #
  1482. CONTROL EJECT;
  1483.  
  1484. PROC SFGETR$(VARNAME,VLEN,VOFF,VALUE);
  1485.  
  1486. # TITLE SFGETR$ - GET REAL VALUE. #
  1487.  
  1488. BEGIN # SFGETR$ #
  1489.  
  1490. #
  1491. ** SFGETR$ - GET REAL VALUE.
  1492. *
  1493. * SFGETR$ RETURNS THE REAL NUMERIC VALUE OF THE FIELD
  1494. * SPECIFIED BY VARNAME.
  1495. *
  1496. * PROC SFGETR$(VARNAME,VLEN,VOFF,VALUE)
  1497. *
  1498. * ENTRY VARNAME = VARIABLE NAME OF FIELD.
  1499. * VLEN = LENGTH OF VARNAME.
  1500. * VOFF = OFFSET OF VARNAME.
  1501. *
  1502. * EXIT VALUE = REAL VALUE OF SPECIFIED FIELD.
  1503. *
  1504. * CALLS DATEVL, GFIELD, NCHECK.
  1505. #
  1506. ITEM VARNAME C(11); # VARIABLE NAME #
  1507. ITEM VLEN I; # LENGTH OF VARNAME PARAMETER #
  1508. ITEM VOFF I; # OFFSET INTO VARNAME PARAMETER #
  1509. ITEM VALUE R; # VALUE OF INPUT #
  1510.  
  1511. ITEM ALLBLANK B; # ALL CHARACTERS IN FIELD BLANK #
  1512. ITEM CURRENCY B; # TRUE IF DOLLAR SIGN INPUT #
  1513. ITEM ERRORVAL R = 0; # RETURNED IF ERROR IN FIELD #
  1514. ITEM EVALUE I; # EXPONENT VALUE #
  1515. ITEM FLDIND I; # FIELD ORDINAL #
  1516. ITEM FORMAT I; # FORMAT OF INPUT #
  1517. ITEM FPSTAT I; # GFP OVERFLOW STATUS #
  1518. ITEM HOLDVALID B; # HOLD FLDVALID VALUE #
  1519. ITEM I I; # LOOP COUNTER #
  1520. ITEM IVALUE I; # INTEGER VALUE #
  1521. ITEM USEROW B = FALSE; # DO NOT USE TERCURSROW #
  1522. ITEM VNAME C(7); # VARIABLE NAME LEFT JUSTIFIED #
  1523.  
  1524. IF VLEN LS 1 THEN VLEN = 7; # CRACK PARAMETER #
  1525. VNAME = C<VOFF,VLEN>VARNAME;
  1526.  
  1527. GFIELD(VNAME,USEROW,FLDIND); # GET ASSOCIATED FIELD #
  1528. IF FLDIND EQ -1 THEN GOTO REALERROR; # FIELD NOT FOUND #
  1529.  
  1530. ALLBLANK = TRUE;
  1531. FOR I = 0 STEP 1 WHILE ALLBLANK AND I LQ FLDLENGTH[FLDIND] -1 DO
  1532. BEGIN # CHECK IF BLANK FIELD #
  1533. IF NEXTCHAR(FLDIND,I) NQ BLANK THEN ALLBLANK = FALSE;
  1534. END
  1535. IF ALLBLANK THEN
  1536. BEGIN # BLANK FIELD #
  1537. VALUE = 0;
  1538. RETURN;
  1539. END
  1540.  
  1541. HOLDVALID = FLDVALID[FLDIND]; # SAVE FLDVALID #
  1542. FLDVALID[FLDIND] = TRUE;
  1543.  
  1544. IF VARPICTYPE[FLDVARORD[FLDIND]] EQ FORMTYPE"Y"
  1545. OR VARPICTYPE[FLDVARORD[FLDIND]] EQ FORMTYPE"M"
  1546. OR VARPICTYPE[FLDVARORD[FLDIND]] EQ FORMTYPE"D" THEN
  1547. BEGIN # IF DATE FORMAT #
  1548. DATEVL(FLDIND,IVALUE); # GET VALUE #
  1549. EVALUE = 0;
  1550. END
  1551. ELSE
  1552. BEGIN # GET NUMERIC VALUE #
  1553. NCHECK(FLDIND,IVALUE,EVALUE,FORMAT,CURRENCY);
  1554. END
  1555.  
  1556. IF NOT FLDVALID[FLDIND] OR FORMAT EQ FORMTYPE"BAD"THEN
  1557. BEGIN # ERRORS IN INPUT #
  1558. GOTO REALERROR;
  1559. END
  1560. FLDVALID[FLDIND] = HOLDVALID;
  1561.  
  1562. FPSTAT = GFP(IVALUE,EVALUE,VALUE); # GENERATE REAL VALUE #
  1563. IF FPSTAT EQ 0 THEN RETURN; # IF NO OVERFLOW ERROR #
  1564.  
  1565. REALERROR: # CANNOT RETURN VALUE #
  1566.  
  1567. IF FLDIND NQ -1 THEN FLDVALID[FLDIND] = HOLDVALID;
  1568. VALUE = ERRORVAL;
  1569.  
  1570. END # SFGETR$ #
  1571. *IF DEF,QTRM
  1572. CONTROL EJECT;
  1573.  
  1574. PROC SFMODE$(MODE,MODEL,MLEN,MOFF);
  1575.  
  1576. # TITLE SFMODE$ - QTRM MODE SWITCHING FUNCTION. #
  1577.  
  1578. BEGIN # SFMODE$ #
  1579.  
  1580. #
  1581. ** SFMODE$ - QTRM MODE SWITCHING FUNCTION.
  1582. *
  1583. * THIS PROCEDURE SWITCHES A TERMINAL TO AND FROM SCREEN MODE. IT
  1584. * INTERFACES TO COBOL5 AND FTN5 APPLICATION PROGRAMS THROUGH A
  1585. * COMPASS INTERFACE CALLED SFMODE.
  1586. *
  1587. * PROC SFMODE$(MODE,MODEL,MLEN,MOFF)
  1588. *
  1589. * ENTRY MODE = 0, IF REQUESTED MODE IS SCREEN.
  1590. * 1, IF REQUESTED MODE IS LINE.
  1591. * MODEL = TERMINAL MODEL NAME.
  1592. * MLEN = LENGTH OF MODEL NAME.
  1593. * MOFF = OFFSET OF MODEL NAME.
  1594. *
  1595. * EXIT THE NIT RETURN CODE FIELD IN THE NIT WILL BE SET TO 0 IF
  1596. * THE REQUEST WAS SUCCESSFUL, NON-ZERO IF NOT.
  1597. #
  1598. ITEM MODE I; # REQUESTED MODE #
  1599. ITEM MODEL C(7); # TERMINAL MODEL (OR 'NONE') #
  1600. ITEM MLEN I; # LENGTH OF MODEL NAME #
  1601. ITEM MOFF I; # OFFSET OF MODEL NAME #
  1602.  
  1603. ITEM I I; # SCRATCH VARIABLE #
  1604. ITEM MODELNAME C(7); # TERMINAL MODEL NAME #
  1605.  
  1606. IF MLEN LS 1 THEN MLEN = 7; # CRACK PARAMETER #
  1607. MODELNAME = C<MOFF,MLEN>MODEL;
  1608.  
  1609. IF NIT$STATE[NIT$CON] NQ 2 THEN
  1610. BEGIN # IF CMM BLOCKS TO CLEAR UP #
  1611. NIT$RC = NITRTC"OK";
  1612. IF NIT$PCT [NIT$CON] EQ 0 THEN RETURN;
  1613. P<PCT> = NIT$PCT [NIT$CON];
  1614. IF PCT$VRDATA NQ 0 THEN CMMFRF (PCT$VRDATA);
  1615. PCT$VRDATA = 0; # INSURE THIS IS DONE ONLY ONCE #
  1616. CMMFRF (NIT$PCT[NIT$CON]);
  1617. NIT$PCT[NIT$CON] = 0;
  1618. RETURN; # RETURN #
  1619. END
  1620.  
  1621. IF NIT$PCT[NIT$CON] EQ 0 THEN
  1622. BEGIN # IF CMM BLOCK NEEDED #
  1623. CMMALF (PCTSIZE,0,0,I); # GET A BLOCK FOR THE PCT #
  1624. NIT$PCT[NIT$CON] = I;
  1625. P<PCT> = I;
  1626. FOR I = 0 STEP 1 UNTIL PCTSIZE - 1 DO
  1627. BEGIN # ZERO THE ENTIRE PCT #
  1628. PCT$WD0[I] = 0;
  1629. END
  1630.  
  1631. FOR I = 0 STEP 1 UNTIL SFORMSIZE - 1 DO
  1632. BEGIN # INITIALIZE TERMSTAT AREA #
  1633. TERMSTATWD[I] = TERINITHLD[I];
  1634. END
  1635. FOR I = 0 STEP 1 UNTIL VTERMSIZE - 1 DO
  1636. BEGIN
  1637. COMVDT$WD0[I] = VDTINITHLD[I]; # INIT VDT AREAS #
  1638. END
  1639.  
  1640. TERMODNAME[0] = " ";
  1641. TERACTPANL[0] = " ";
  1642. TERACTPLTI[0] = 0;
  1643. TERFUNCPOS[0] = 0;
  1644. TERNUMCOLS[0] = 0;
  1645. TERNUMLNES[0] = 0;
  1646.  
  1647. P<PLTABLE> = LOC(PLT); # INITIALIZE THE NIT PLT AREA #
  1648. I = PLTNUMENT[0];
  1649. P<PLTABLE> = NIT$PCT[NIT$CON] + PLTOFFSET;
  1650. FOR I = 1 STEP 1 UNTIL 10 DO
  1651. BEGIN # ZERO PLT WORD #
  1652. PLTWORDONE[I] = 0;
  1653. PLTWORDTWO[I] = 0;
  1654. END
  1655. PLTENTRYNM[0] = 10;
  1656. IF MODELNAME NQ "NONE" THEN # SET MODEL #
  1657. NIT$TRNAM[NIT$CON] = MODELNAME;
  1658. IF MODELNAME EQ "NONE " THEN NIT$MODEL [NIT$CON] = 0;
  1659. ELSE IF MODELNAME EQ "721 " THEN NIT$MODEL [NIT$CON] = 2;
  1660. ELSE NIT$MODEL [NIT$CON] = 1;
  1661.  
  1662. TERQTRMSOL[0] = MODE NQ 1; # SAVE SCREEN/LINE MODE #
  1663. END
  1664.  
  1665. END # SFMODE$ #
  1666. CONTROL EJECT;
  1667.  
  1668. PROC SFNQUE$(QNAME,QLEN,QOFF,BUFFER,RC);
  1669.  
  1670. # TITLE SFNQUE$ - ENQUEUE A BLOCK FOR A TERMINAL (ACN). #
  1671.  
  1672. BEGIN # SFNQUE$ #
  1673.  
  1674. #
  1675. ** SFNQUE$ - ENQUEUE A BLOCK FOR A TERMINAL (ACN).
  1676. *
  1677. * THIS PROCEDURE ACCUMULATES DATA INTO A QUEUE FOR A SPECIFIED
  1678. * TERMINAL. VALID QUEUE NAMES ARE *GET* AND *PUT*. A BLOCK OF
  1679. * 1600 WORDS IS ALLOCATED FOR EACH QUEUE. EACH SFNQUE$ CALL ADDS
  1680. * DATA TO THE QUEUE WITH THE SPECIFIED QNAME AND TERMINAL NUMBER.
  1681. * IT INTERFACES TO COBOL5 AND FTN5 APPLICATION PROGRAMS THROUGH
  1682. * A COMPASS INTERFACE CALLED SFNQUE.
  1683. *
  1684. * PROC SFNQUE$(QNAME,QLEN,QOFF,BUFFER,RC)
  1685. *
  1686. * ENTRY QNAME = QUEUE TO PLACE DATA INTO (GET OR PUT).
  1687. * QLEN = LENGTH OF QUEUE NAME.
  1688. * QOFF = OFFSET OF QUEUE NAME.
  1689. * BUFFER = DATA TO ADD TO THE QUEUE.
  1690. * RC = RETURN CODE.
  1691. * NIT$CTLC = COUNT (IN 12 BIT CHARACTERS) IN BUFFER.
  1692. *
  1693. * EXIT RC = 0, IF DATA ENQUEUED (NO ERROR).
  1694. * 1, IF DATA NOT ENQUEUED.
  1695. *
  1696. * CALLS CMMALF.
  1697. #
  1698. ITEM QNAME C(7); # QUEUE TO PLACE DATA #
  1699. ITEM QLEN I; # LENGTH OF QUEUE NAME #
  1700. ITEM QOFF I; # OFFSET OF QUEUE NAME #
  1701. ITEM BUFFER U; # DATA TO ADD TO QUEUE #
  1702. ITEM RC I; # RETURN CODE #
  1703.  
  1704. BASED ARRAY B$BUFF [0:0] P(1); # BUFFER #
  1705. BEGIN
  1706. ITEM B$WD0 U(00,00,60); # BUFFER WORD (INTEGER) #
  1707. END
  1708.  
  1709. ITEM BIT I; # BIT POSITION #
  1710. ITEM B$CURBIT I; # CURRENT BIT #
  1711. ITEM B$CURWORD I; # CURRENT WORD #
  1712. ITEM ENTCT I = 0; # QTRM #
  1713. ITEM I I = 0; # LOOP VARIABLE #
  1714. ITEM QUEUENAME C(7); # QUEUE TO PLACE DATA #
  1715. ITEM RCC I; # RETURN CODE #
  1716. ITEM WORD I; # BUFFER WORD #
  1717.  
  1718. IF QLEN LS 1 THEN QLEN = 7; # LEFT JUSTIFY QUEUE NAME #
  1719. QUEUENAME = C<QOFF,QLEN>QNAME;
  1720.  
  1721. P<B$BUFF> = LOC(BUFFER);
  1722. B$CURBIT = 0; # START AT BEGINNING OF BUFFER #
  1723. B$CURWORD = 0;
  1724. ENTCT = ENTCT + 1;
  1725.  
  1726. SFNQUE1:
  1727.  
  1728. I = 0;
  1729. P<Q$HEADER> = CHAIN;
  1730. WHYLE P<Q$HEADER> NQ 0 DO
  1731. BEGIN # FIND QUEUE NAME FOR THIS ACN #
  1732. IF (( NIT$CON EQ Q$ACN ) AND
  1733. ( C<0,3>QNAME EQ C<0,3>Q$NAME )) THEN
  1734. IF NIT$CON EQ Q$ACN AND QUEUENAME EQ Q$NAME THEN
  1735. BEGIN # IF FOUND #
  1736. P<Q$BUFFER> = P<Q$HEADER> + Q$HEADLEN;
  1737. FOR I = 1 STEP 1 UNTIL NIT$CTLC DO
  1738. BEGIN # ADD DATA TO QUEUE #
  1739. WORD = Q$INCHAR / 5;
  1740. IF WORD GQ Q$SIZE THEN
  1741. BEGIN # IF BLOCK OVERFLOW #
  1742. RC = 1; # SET ERROR #
  1743. RETURN; # RETURN #
  1744. END
  1745. BIT = (Q$INCHAR - (WORD * 5)) * 12;
  1746. B<BIT,12>Q$WORD[WORD] = B<B$CURBIT,12>B$WD0[B$CURWORD];
  1747. Q$INCHAR = Q$INCHAR + 1;
  1748. B$CURBIT = B$CURBIT + 12;
  1749. IF B$CURBIT GQ 60 THEN
  1750. BEGIN # IF FULL WORD #
  1751. B$CURBIT = 0;
  1752. B$CURWORD = B$CURWORD + 1;
  1753. END
  1754. END
  1755. RC = 0; # CLEAR RETURN CODE #
  1756. RETURN; # RETURN #
  1757. END
  1758.  
  1759. I = P<Q$HEADER>; # QUEUE DOESN-T EXIST, CREATE IT #
  1760. P<Q$HEADER> = Q$FORWARD; # ADD BLOCK TO END OF CHAIN #
  1761. END
  1762.  
  1763. IF CHAIN EQ 0 THEN
  1764. BEGIN # IF NO CHAIN HEADER #
  1765. P<Q$HEADER> = LOC(CHAIN);
  1766. END
  1767. ELSE
  1768. BEGIN # CHAIN HEADER EXISTS #
  1769. P<Q$HEADER> = I;
  1770. END
  1771.  
  1772. CMMALF (Q$BLKSIZE,0,0,RCC);
  1773. Q$FORWARD = RCC;
  1774. I = P<Q$HEADER>;
  1775. P<Q$HEADER> = Q$FORWARD;
  1776. Q$WD0 = 0; # CLEAR THE ENTRY HEADER AREA #
  1777. Q$WD1 = 0;
  1778. Q$WD2 = 0;
  1779. Q$BACK = I; # SET THE BACKWARD POINTER #
  1780. Q$ACN = NIT$CON; # SET THE TERMINAL ACN #
  1781. Q$NAME = QUEUENAME; # SET QUEUE NAME #
  1782. Q$SIZE = Q$BLKSIZE - Q$HEADLEN;
  1783. Q$CHARSET = NIT$CH$SET; # DEFAULT IS 12 BIT ASCII #
  1784.  
  1785. GOTO SFNQUE1; # ADD THE DATA TO THE QUEUE #
  1786.  
  1787. END # SFNQUE$ #
  1788. *ENDIF
  1789. CONTROL EJECT;
  1790.  
  1791. PROC SFLUSH$;
  1792.  
  1793. # TITLE SFLUSH$ - FLUSH DATA ALREADY WRITTEN TO SCREEN #
  1794.  
  1795. BEGIN # SFLUSH$ #
  1796.  
  1797. #
  1798. ** SFLUSH$ - FLUSH DATA ALREADY WRITTEN TO SCREEN.
  1799. *
  1800. * THIS PROCEDURE FORCES DATA WHICH HAS ALREADY BEEN WRITTEN TO THE
  1801. * SCREEN BY MEANS OF *SFSWRI$* TO BE DISPLAYED UPON THE SCREEN, BY
  1802. * WRITING AN *EOR* TO THE SCREEN. NO PARAMETERS ARE REQUIRED.
  1803. *
  1804. * PROC SFLUSH$
  1805. *
  1806. * ENTRY NONE.
  1807. *
  1808. * EXIT PREVIOUSLY WRITTEN PANEL DATA FLUSHED TO SCREEN.
  1809. *
  1810. * CALLS VDTFOS.
  1811. *
  1812. * USES TERVDTBOOC.
  1813. *
  1814. #
  1815. *IF UNDEF,QTRM
  1816. ITEM RECALL I = 1; # RECALL PARAMETER FOR VDTFOS #
  1817.  
  1818. IF TERVDTBOOC[0] THEN
  1819. BEGIN # IF DATA IN BUFFER TO FLUSH #
  1820. IF NOT TERNOVDTEO[0] THEN VDTEOO;
  1821. TERVDTBOOC[0] = FALSE;
  1822. VDTFOS(RECALL); # FLUSH OUTPUT TO SCREEN, RECALL #
  1823. END
  1824. *ELSE
  1825.  
  1826. NIT$RC = NITRTC"OK"; # SET RETURN CODE #
  1827. *ENDIF
  1828.  
  1829. END # SFLUSH$ #
  1830. CONTROL EJECT;
  1831.  
  1832. PROC SFOPEN$(NAME,NLENGTH,NOFFSET,OPENSTAT);
  1833.  
  1834. # TITLE SFOPEN$ - OPEN PANEL. #
  1835.  
  1836. BEGIN # SFOPEN$ #
  1837.  
  1838. #
  1839. ** SFOPEN$ - OPEN PANEL.
  1840. *
  1841. * THIS PROCEDURE CHECKS (VIA VDTGSL/VDTITD) TO SEE IF THE TERMINAL
  1842. * IN USE IS SUPPORTED UNDER SCREEN FORMATTING (UNLESS THIS HAS
  1843. * ALREADY BEEN DONE BY A PREVIOUS CALL TO SFOPEN.) IF THE TERM-
  1844. * INAL IS SUPPORTED THEN *SFLOAD* IS CALLED TO LOAD THE PANEL
  1845. * VIA THE FAST DYNAMIC LOADER (EXCEPT FOR THOSE PANELS THAT ARE
  1846. * STATICALLY LOADED AND THUS ALWAYS PRESENT IN MEMORY) AND THE
  1847. * PANEL LOAD TABLE IS UPDATED IF THE LOAD WAS SUCCESSFUL. THE
  1848. * STATUS OF THE OPEN IS RETURNED TO THE CALLING APPLICATION IN
  1849. * ALL CASES INDICATING THAT THE OPEN WAS SUCCESSFUL OR AN ERROR
  1850. * CODE INDICATING WHY NOT. SFOPEN$ INTERFACES TO COBOL AND FOR-
  1851. * TRAN PROGRAMS THROUGH A COMPASS INTERFACE MODULE CALLED SFOPEN.
  1852. *
  1853. * PROC SFOPEN$(NAME,NLENGTH,NOFFSET,OPENSTAT)
  1854. *
  1855. * ENTRY NAME = NAME OF PANEL TO BE OPENED.
  1856. * NLENGTH = LENGTH IN SIX BIT CHARACTERS.
  1857. * NOFFSET = OFFSET INTO NAME.
  1858. *
  1859. * EXIT PANEL OPENED IF POSSIBLE, OPENSTAT SET REGARDLESS.
  1860. *
  1861. *IF UNDEF,QTRM
  1862. * CALLS SETSRN, SFLOAD, VDTITD, VDTGSL.
  1863. *ELSE
  1864. * CALLS SETFSF, SETSRN, SFLOAD, VDTITD.
  1865. *ENDIF
  1866. *
  1867. * NOTES OPENSTAT IS SET BY SFOPEN IN SOME CASES AND IS ALSO
  1868. * A PARAMETER ON THE CALL TO SFLOAD IN THOSE INSTANCES
  1869. * WHERE THE FAST DYNAMIC LOADER IS TO BE CALLED.
  1870. *
  1871. * OPENSTAT SIGNIFICANCE PROCEDURE
  1872. * .....................................................
  1873. * . 0 . NO ERROR . BOTH .
  1874. * . 1 . UNKNOWN PANEL NAME . SFLOAD .
  1875. * . 2 . INCORRECT CAPSULE FORMAT . SFLOAD .
  1876. * . 3 . PLT FULL (TOO MANY OPEN PANELS) . SFOPEN .
  1877. * . 4 . PANEL ALREADY OPEN . SFOPEN .
  1878. * . 5 . INTERNAL (FAST DYNAMIC LOADER) . SFLOAD .
  1879. * . 6 . NO SCREEN COMMAND ISSUED . SFOPEN .
  1880. * . 7 . UNSUPPORTED TERMINAL . SFOPEN .
  1881. * .....................................................
  1882. #
  1883. ITEM NAME C(11); # NAME OF PANEL TO OPEN #
  1884. ITEM NLENGTH I; # LENGTH IN SIX BIT CHARACTERS #
  1885. ITEM NOFFSET I; # OFFSET INTO NAME #
  1886. ITEM OPENSTAT I; # RETURNS STATUS TO APPLICATION #
  1887.  
  1888. ITEM MODELNAME C(7); # MODEL NAME FOR VDTITD CALL #
  1889. ITEM NAMEINDEX I; # INDEX OF PANEL IF FOUND #
  1890. ITEM PANELADDR I; # MEMORY ADDRESS OF PANEL #
  1891. ITEM PANELNAME C(7); # PANEL NAME, LEFT JUSTIFIED #
  1892. ITEM PLTINDEX I; # INDEX INTO PANEL LOAD TABLE #
  1893. ITEM SCREEN I = 1; # INDICATES SCREEN MODE TO VDT #
  1894. ITEM SCREENDIM I; # SCREEN DIMENSIONS FOR SETSRN #
  1895. *IF DEF,QTRM
  1896. ITEM QTPLTINDEX I; # INDEX INTO QTRM USERS PLT #
  1897. *ENDIF
  1898.  
  1899. OPENSTAT = OPENSTATUS"NOERROR"; # CLEAR OPEN STATUS #
  1900. IF TERMODNAME[0] EQ " " THEN
  1901. BEGIN # IF *TDU* TABLE NOT YET READ #
  1902. *IF UNDEF,QTRM
  1903. VDTGSL(DUMMY,OPENSTAT); # CHECK SYSTEM SCREEN/LINE #
  1904. *ELSE
  1905. OPENSTAT = NIT$MODEL[NIT$CON]; # GET SCREEN MODE #
  1906. MODELNAME = NIT$TRNAM[NIT$CON]; # GET MODEL NAME #
  1907. *ENDIF
  1908. IF OPENSTAT EQ 0 THEN
  1909. BEGIN # IF NO MODEL SPECIFIED #
  1910. OPENSTAT = OPENSTATUS"NOSCREEN"; # NONE SPECIFIED #
  1911. END
  1912. ELSE
  1913. BEGIN # MODEL SPECIFIED #
  1914. OPENSTAT = OPENSTATUS"NOERROR"; # CLEAR OPEN STATUS #
  1915. VDTITD(MODELNAME); # INITIALIZE *TDU* TABLE #
  1916. IF C<0,6>MODELNAME EQ " " THEN
  1917. BEGIN # IF TERMINAL UNDEFINED #
  1918. TERMODNAME[0] = " ";
  1919. OPENSTAT = OPENSTATUS"UNSPTERM";
  1920. END
  1921. ELSE
  1922. BEGIN # SUPPORTED TERMINAL #
  1923. TERMODNAME[0] = MODELNAME;
  1924. P<CORE>=0;
  1925. IF COREWORD[CSMR] GQ 0 THEN
  1926. BEGIN # IF 63 CHARACTER SET SYSTEM #
  1927. DC2A8[00] = O"0040"; # 00B = UNDEFINED #
  1928. DC2A8[51] = O"0072"; # 63B = COLON #
  1929. A82DC[37] = O"0055"; # PERCENT = UNDEFINED #
  1930. A82DC[58] = O"0063"; # COLON = 63B #
  1931. AS2A8[03] = O"0045"; # 7404B = PERCENT #
  1932. TERASC8ATD[0] = 37; # PERCENT = 7404B #
  1933. END
  1934. END
  1935. END
  1936. END
  1937.  
  1938. IF OPENSTAT EQ OPENSTATUS"NOERROR" THEN
  1939. BEGIN # IF TERMINAL CAN BE USED #
  1940. IF NOT TERSCREENM[0] THEN
  1941. BEGIN # IF NOT IN SCREEN MODE #
  1942. SCREENDIM = 1; # ASK FOR SMALLEST SCREEN SIZE #
  1943. SETSRN(SCREENDIM,SCREENDIM); # SET SCREEN MODE #
  1944. END
  1945. IF NLENGTH LS 1 THEN NLENGTH = 7; # LEFT JUSTIFY PANEL NAME #
  1946. PANELNAME = C<NOFFSET,NLENGTH>NAME;
  1947. *IF DEF,QTRM
  1948.  
  1949. # CHECK FOR PANEL IN THIS USERS PLT AREA #
  1950.  
  1951. P<PLTABLE> = NIT$PCT[NIT$CON] + PLTOFFSET;
  1952. PANELADDR = 0;
  1953. QTPLTINDEX = 0;
  1954. FOR PLTINDEX = 1 STEP 1 WHILE
  1955. PANELADDR EQ 0 AND PLTINDEX LQ PLTNUMENT[0] DO
  1956. BEGIN
  1957. IF PLTENAME[PLTINDEX] EQ PANELNAME THEN
  1958. BEGIN
  1959. PANELADDR = PLTADDR[PLTINDEX];
  1960. NAMEINDEX = PLTINDEX;
  1961. END
  1962. END
  1963. IF PANELADDR EQ 0 THEN
  1964. BEGIN # IF NOT IN USER PLT #
  1965. P<PLTABLE> = LOC(PLT); # CHECK GLOBAL PLT #
  1966. FOR PLTINDEX = 1 STEP 1 WHILE
  1967. PANELADDR EQ 0 AND PLTINDEX LQ PLTNUMENT[0] DO
  1968. BEGIN
  1969. IF PLTENAME[PLTINDEX] EQ PANELNAME THEN
  1970. BEGIN
  1971. PANELADDR = PLTADDR[PLTINDEX];
  1972. NAMEINDEX = PLTINDEX;
  1973. END
  1974. END
  1975. END
  1976. IF PANELADDR NQ 0 THEN
  1977. BEGIN # UPDATE USER PLT FROM GLOBAL #
  1978. PLTNUMQTRM[NAMEINDEX] = PLTNUMQTRM[NAMEINDEX] + 1;
  1979. P<PLTABLE> = NIT$PCT[NIT$CON] + PLTOFFSET;
  1980. PLTNUMENT[0] = PLTNUMENT[0] + 1;
  1981. NAMEINDEX = PLTNUMENT[0];
  1982. PLTENAME[NAMEINDEX] = PANELNAME;
  1983. PLTSLFLAG[NAMEINDEX] = FALSE;
  1984. PLTOPENFLG[NAMEINDEX] = TRUE;
  1985. PLTADDR[NAMEINDEX] = PANELADDR;
  1986. SETFSF(PANELADDR); # SET FIELD STATUS FLAGS #
  1987. RETURN;
  1988. END
  1989. *ENDIF
  1990. P<PLTABLE> = LOC(PLT); # REFERENCE PANEL LOAD TABLE #
  1991. PANELADDR = 0; # CHECK FOR PANEL NAME IN TABLE #
  1992. FOR PLTINDEX = 1 STEP 1 WHILE
  1993. PANELADDR EQ 0 AND PLTINDEX LQ PLTNUMENT[0] DO
  1994. BEGIN
  1995. IF PLTENAME[PLTINDEX] EQ PANELNAME THEN
  1996. BEGIN # IF PANEL NAME FOUND #
  1997. PANELADDR = PLTADDR[PLTINDEX]; # SET PANEL ADDRESS #
  1998. NAMEINDEX = PLTINDEX; # SET INDEX INTO PLT #
  1999. END
  2000. END
  2001. IF PANELADDR EQ 0 THEN
  2002. BEGIN # IF PANELNAME NOT IN PLT #
  2003. IF PLTNUMENT[0] GQ PLTENTRYNM[0] THEN
  2004. BEGIN # IF PANEL LOAD TABLE IS FULL #
  2005. OPENSTAT = OPENSTATUS"PLTFULL";
  2006. END
  2007. ELSE
  2008. BEGIN # LOAD VIA FAST DYNAMIC LOADER #
  2009. SFLOAD(PANELNAME,PANELADDR,OPENSTAT);
  2010. IF OPENSTAT EQ 0 THEN
  2011. BEGIN # IF LOADED WITHOUT ERROR #
  2012. GETADD(PANELNAME,PANELADDR,NAMEINDEX);
  2013. POSTWO(PANELADDR); # POSITION SFATTR ARRAYS #
  2014. END
  2015. *IF DEF,QTRM
  2016. PLTNUMQTRM[PLTINDEX] = PLTNUMQTRM[PLTINDEX] + 1; # USER COUNT #
  2017. P<PLTABLE> = NIT$PCT[NIT$CON] + PLTOFFSET;
  2018. PLTNUMENT[0] = PLTNUMENT[0] + 1;
  2019. NAMEINDEX = PLTNUMENT[0];
  2020. PLTENAME[NAMEINDEX] = PANELNAME;
  2021. PLTSLFLAG[NAMEINDEX] = FALSE;
  2022. PLTOPENFLG[NAMEINDEX] = TRUE;
  2023. PLTADDR[NAMEINDEX] = PANELADDR;
  2024. *ENDIF
  2025. END
  2026. END
  2027. ELSE
  2028. BEGIN # IF PANEL ALREADY IN PLT #
  2029. IF PLTOPENFLG[NAMEINDEX] THEN
  2030. BEGIN # IF PANEL IS ALREADY OPEN #
  2031. OPENSTAT = OPENSTATUS"PANELOPEN";
  2032. END
  2033. ELSE
  2034. BEGIN # OPEN STATICALLY LOADED PANEL #
  2035. PLTOPENFLG[NAMEINDEX] = TRUE; # SET PANEL OPEN #
  2036. *IF DEF,QTRM
  2037. SETFSF(PANELADDR); # SET FIELD STATUS FLAGS #
  2038. *ENDIF
  2039. END
  2040. POSTWO(PANELADDR); # POSITION SFATTR ARRAYS #
  2041. END
  2042. END
  2043.  
  2044. END # SFOPEN$ #
  2045. CONTROL EJECT;
  2046.  
  2047. PROC SFPOSR$(TABLENAME,TLEN,TOFF,ROWNUMBER);
  2048.  
  2049. # TITLE SFPOSR$ - POSITION TABLE ROW. #
  2050.  
  2051. BEGIN # SFPOSR$ #
  2052.  
  2053. #
  2054. ** SFPOSR$ - POSITION TABLE ROW.
  2055. *
  2056. * SFPOSR$ POSITIONS TABLENAME TO ROWNUMBER.
  2057. *
  2058. * PROC SFPOSR$(TABLENAME,TLEN,TOFF,ROWNUMBER)
  2059. *
  2060. * ENTRY TABLENAME = TABLE NAME.
  2061. * TLEN = LENGTH OF TABLENAME.
  2062. * TOFF = OFFSET OF TABLENAME.
  2063. * ROWNUMBER = ROW NUMBER.
  2064. *
  2065. * EXIT ARRCURROW[TABLENAME] = ROWNUMBER.
  2066. #
  2067. ITEM TABLENAME C(11); # TABLE NAME #
  2068. ITEM TLEN I; # LENGTH OF TABLENAME PARAMETER #
  2069. ITEM TOFF I; # OFFSET IN TABLENAME PARAMETER #
  2070. ITEM ROWNUMBER I; # ROW NUMBER IN ARRAY #
  2071.  
  2072. ITEM I I; # LOOP COUNTER #
  2073. ITEM NOTFOUND B; # TABLE NOT FOUND #
  2074. ITEM TNAME C(7); # TABLE NAME LEFT JUSTIFIED #
  2075.  
  2076. IF PANSTRARR[0] EQ 0 THEN RETURN; # IF NO TABLES IN PANEL #
  2077.  
  2078. IF TLEN LS 1 THEN TLEN = 7; # CRACK PARAMETER #
  2079. TNAME = C<TOFF,TLEN>TABLENAME;
  2080.  
  2081. NOTFOUND = TRUE;
  2082. FOR I = 0 STEP 1 WHILE ARRNUMVARS[I] NQ 0 AND NOTFOUND DO
  2083. BEGIN # SEARCH ARRAY LIST FOR TABLE #
  2084. IF ARRNAME[I] EQ TNAME THEN
  2085. BEGIN # IF TABLE NAME FOUND #
  2086. NOTFOUND = FALSE;
  2087. IF ROWNUMBER LS 1 OR ROWNUMBER GR ARRNUMROWS[I] THEN
  2088. BEGIN # IF ILLEGAL ROW NUMBER #
  2089. ARRCURROW[I] = 0;
  2090. END
  2091. ELSE ARRCURROW[I] = ROWNUMBER - 1;
  2092. END
  2093. END
  2094.  
  2095. END # SFPOSR$ #
  2096. CONTROL EJECT;
  2097.  
  2098. PROC SFSETF$(VNAME,VLEN,VOS,STRG,SLEN,SOS,CSET,CLEN,COS,STAT);
  2099. BEGIN
  2100. #
  2101. ** SFSETF$ - SET FIELD CHARACTER STRING.
  2102. *
  2103. * SFGETF$ TRANSFERS CHARACTERS TO A SPECIFIED PANEL FIELD FROM
  2104. * A SPECIFIED STRING, USING *MOVEFLD*.
  2105. *
  2106. * PROC SFGETF$(VNAME,VLEN,VOS,STRG,SLEN,SOS,CSET,CLEN,COS,STAT)
  2107. *
  2108. * ENTRY VNAME = VARIABLE NAME OF FIELD.
  2109. * VLEN = LENGTH OF VARNAME PARAMETER.
  2110. * VOS = OFFSET OF VARNAME PARAMETER.
  2111. * STRG = VARIABLE FIELD STRING.
  2112. * SLEN = LENGTH OF STRING PARAMETER.
  2113. * SOS = OFFSET OF STRING PARAMETER.
  2114. * CSET = CHARACTER SET OF STRING (SEE SFCSET$).
  2115. * CLEN = LENGTH OF CSET PARAMETER.
  2116. * COS = OFFSET OF CSET PARAMETER.
  2117. *
  2118. * EXIT STAT GQ 0, NUMBER OF 6 BIT CHARACTERS MOVED.
  2119. * LS 0, VARIABLE NOT FOUND IN ACTIVE PANELS.
  2120. *
  2121. * CALLS MOVEFLD.
  2122. #
  2123.  
  2124. ITEM VNAME I; # VARIABLE NAME #
  2125. ITEM VLEN I; # LENGTH OF VARNAME PARAMETER #
  2126. ITEM VOS I; # OFFSET INTO VARNAME PARAMETER #
  2127. ITEM STRG I; # INSTRING PARAMETER #
  2128. ITEM SLEN I; # LENGTH OF INSTRING #
  2129. ITEM SOS I; # OFFSET INTO INSTRING #
  2130. ITEM CSET I; # CHARACTER SET #
  2131. ITEM CLEN I; # LENGTH OF CHARACTER SET #
  2132. ITEM COS I; # OFFSET INTO CHARACTER SET #
  2133. ITEM STAT I; # STATUS FIELD #
  2134.  
  2135.  
  2136. STAT = 1; # INDICATE *SFSETF* #
  2137. MOVEFLD(VNAME,VLEN,VOS,STRG,SLEN,SOS,CSET,CLEN,COS,STAT);
  2138. RETURN;
  2139.  
  2140. END # SFSETF$#
  2141. *IF DEF,QTRM
  2142. CONTROL EJECT;
  2143.  
  2144. PROC SFQTRM$(NITADDR,BUFFER);
  2145.  
  2146. # TITLE SFQTRM$ - INTERFACE BETWEEN QTRM AND SFORM #
  2147.  
  2148. BEGIN # SFQTRM$ #
  2149.  
  2150. #
  2151. ** SFQTRM$ - INTERFACE BETWEEN QTRM AND SFORM.
  2152. *
  2153. * THIS PROCEDURE IS THE INTERFACE BETWEEN QTRM AND SFORM THAT
  2154. * IDENTIFIES THE QTRM NETWORK INFORMATION TABLE, DATA BUFFER,
  2155. * AND CURRENT TERMINAL TO SFORM. SFQTRM$ INTERFACES TO COBOL
  2156. * AND FORTRAN PROGRAMS THROUGH A COMPASS INTERFACE MODULE
  2157. * CALLED SFQTRM.
  2158. *
  2159. * PROC SFQTRM$(NITADDR,BUFFER)
  2160. *
  2161. * ENTRY NITADDR = ADDRESS OF QTRM USER-S QTRM NETWORK
  2162. * INFORMATION TABLE.
  2163. * BUFFER = ADDRESS OF BUFFER FOR THE SCREEN FORMATTING
  2164. * ROUTINES SFSREA AND SFSWRI TO USE. THE
  2165. *
  2166. * EXIT POINTERS TO BUFFER INITIALIZED.
  2167. #
  2168. ITEM NITADDR U; # ADDRESS OF THE USERS NIT #
  2169. ARRAY BUFFER [0:0] P(1);; # BUFFER #
  2170.  
  2171. ITEM CHARIND I = 0; # CHAR INDEX FOR FLAG MOVE #
  2172. ITEM CURRNT$ACN I = 0; # CURRENT ACN POINTER #
  2173. ITEM I I; # LOOP COUNTER #
  2174. ITEM HOLDADR U; # HOLDS BUFFER ADDRESS #
  2175. ITEM PANELNAME C(7); # PANEL NAME FOR ARRAY RESET #
  2176. ITEM PANELADDR I; # PANEL ADDR FOR ARRAY RESET #
  2177. ITEM VDATALEN I; # VARDATA LENGTH #
  2178. ITEM PLTINDEX I; # ACTIVE PANEL INDEX TO RESET #
  2179. ITEM WORDIND I = 0; # WORD INDEX FOR FLAG MOVE #
  2180.  
  2181. HOLDADR = LOC(BUFFER); # SAVE BUFFER ADDRESS #
  2182. P<NIT> = LOC(NITADDR); # SAVE NIT ADDRESS #
  2183. IF CURRNT$ACN EQ 0 THEN
  2184. BEGIN # IF FIRST CALL TO SFQTRM$ #
  2185. CURRNT$ACN = NIT$CON[0];
  2186. P<QTRM$BUFFER> = LOC(BUFFER);
  2187. FOR I = 0 STEP 1 UNTIL SFORMSIZE -1 DO
  2188. BEGIN # SAVE TERMSTAT DEFAULTS #
  2189. TERINITHLD[I] = TERMSTATWD[I];
  2190. END
  2191. FOR I = 0 STEP 1 UNTIL VTERMSIZE -1 DO
  2192. BEGIN # SAVE VDT AREA DEFAULTS #
  2193. VDTINITHLD[I] = COMVDT$WD0[I];
  2194. END
  2195. RETURN;
  2196. END
  2197.  
  2198. IF CURRNT$ACN NQ NIT$CON[0] THEN
  2199. BEGIN # IF NEW USER #
  2200. IF CURRNT$ACN NQ 0 AND NIT$PCT[CURRNT$ACN] NQ 0 THEN
  2201. BEGIN # IF THERE IS A CURRENT USER #
  2202. P<PCT> = NIT$PCT[CURRNT$ACN]; # SAVE PREVIOUS TERMINAL-S STATE #
  2203. TERFLDADDR = P<FLDLIST>; # SAVE FIELD LIST ADDRESS #
  2204. P<QTRM$BUFFER> = P<PCT> + SFORMOFFSET;
  2205. FOR I = 0 STEP 1 UNTIL SFORMSIZE -1 DO
  2206. BEGIN # MOVE SFORM DATA #
  2207. QTRM$WD0[I] = TERMSTATWD[I];
  2208. END
  2209. P<QTRM$BUFFER> = P<PCT> + VTERMOFFSET;
  2210. FOR I = 0 STEP 1 UNTIL VTERMSIZE - 1 DO
  2211. BEGIN # MOVE VIRTERM DATA #
  2212. QTRM$WD0[I] = COMVDT$WD0[I];
  2213. END
  2214. P<QTRM$BUFFER> = P<PCT> + FDAOFFSET;
  2215. IF TERFLDADDR[0] NQ 0 THEN
  2216. BEGIN # IF FIELD STATUS FLAGS EXIST #
  2217. FOR I = 0 STEP 1 WHILE FLDENTRY[I] NQ 0 DO
  2218. BEGIN # MOVE FIELD STATUS FLAGS #
  2219. WORDIND = I / 15;
  2220. CHARIND = I - 15*WORDIND;
  2221. B<CHARIND*4,4>QTRM$WD0[WORDIND] = FLDSTFLAGS[I];
  2222. END
  2223. END
  2224. P<QTRM$BUFFER> = P<PCT> + VDTAOFFSET;
  2225. PANELADDR = P<VDATA> - PANHEADLEN;
  2226. IF PANSTRFLD[0] NQ 0 THEN
  2227. BEGIN # IF FIELDS EXISTS #
  2228. VDATALEN = P<FLDLIST> - (PANELADDR + PANHEADLEN);
  2229. END
  2230. ELSE
  2231. BEGIN # NO FIELDS #
  2232. VDATALEN = P<VARLIST> - (PANELADDR + PANHEADLEN);
  2233. END
  2234. FOR I = 0 STEP 1 UNTIL VDATALEN -1 DO
  2235. BEGIN
  2236. QTRM$WD0[I] = VDATAU[I];
  2237. END
  2238. END
  2239. CURRNT$ACN = NIT$CON[0]; # LOAD ITEMS FOR NEW TERMINAL #
  2240. IF NIT$PCT[CURRNT$ACN] NQ 0 THEN
  2241. BEGIN # IF USER HAS A PCT #
  2242. P<PCT> = NIT$PCT[CURRNT$ACN];
  2243. P<PLTABLE> = NIT$PCT[CURRNT$ACN] + PLTOFFSET;
  2244. P<QTRM$BUFFER> = P<PCT> + SFORMOFFSET;
  2245. FOR I = 0 STEP 1 UNTIL SFORMSIZE - 1 DO
  2246. BEGIN # MOVE SFORM DATA #
  2247. TERMSTATWD[I] = QTRM$WD0[I];
  2248. END
  2249. P<FLDLIST> = TERFLDADDR; # FLDLIST ADDRESS #
  2250. P<QTRM$BUFFER> = P<PCT> + VTERMOFFSET;
  2251. FOR I = 0 STEP 1 UNTIL VTERMSIZE - 1 DO
  2252. BEGIN # MOVE VIRTERM DATA #
  2253. COMVDT$WD0[I] = QTRM$WD0[I];
  2254. END
  2255. IF TERACTPANL[0] NQ " " THEN
  2256. BEGIN # IF PANEL ACTIVE #
  2257. P<QTRM$BUFFER> = P<PCT> + FDAOFFSET;
  2258. IF TERFLDADDR[0] NQ 0 THEN
  2259. BEGIN # IF FIELD STATUS FLAGS EXIST #
  2260. FOR I = 0 STEP 1 WHILE FLDENTRY[I] NQ 0 DO
  2261. BEGIN # MOVE FIELD STATUS FLAGS #
  2262. WORDIND = I / 15;
  2263. CHARIND = I - 15*WORDIND;
  2264. FLDSTFLAGS[I] = B<CHARIND*4,4>QTRM$WD0[WORDIND];
  2265. END
  2266. END
  2267. PANELNAME = TERACTPANL[0]; # GET PANEL NAME #
  2268. GETADD(PANELNAME,PANELADDR,PLTINDEX);
  2269. POSARR(PANELADDR);
  2270. P<QTRM$BUFFER> = P<PCT> + VDTAOFFSET;
  2271. PANELADDR = P<VDATA> - PANHEADLEN;
  2272. IF PANSTRFLD[0] NQ 0 THEN
  2273. BEGIN
  2274. VDATALEN = P<FLDLIST> - (PANELADDR + PANHEADLEN);
  2275. END
  2276. ELSE
  2277. BEGIN
  2278. VDATALEN = P<VARLIST> - (PANELADDR + PANHEADLEN);
  2279. END
  2280. FOR I = 0 STEP 1 UNTIL VDATALEN -1 DO
  2281. BEGIN
  2282. VDATAU[I] = QTRM$WD0[I];
  2283. END
  2284. END
  2285. END
  2286. ELSE
  2287. BEGIN # NO PCT FOR THIS USER #
  2288. FOR I = 0 STEP 1 UNTIL SFORMSIZE -1 DO
  2289. BEGIN # INITIALIZE TERMSTAT #
  2290. TERMSTATWD[I] = TERINITHLD[I];
  2291. END
  2292. FOR I = 0 STEP 1 UNTIL VTERMSIZE -1 DO
  2293. BEGIN # INITIALIZE VDT AREA #
  2294. COMVDT$WD0[I] = VDTINITHLD[I];
  2295. END
  2296. TERMODNAME[0] = " ";
  2297. TERACTPANL[0] = " ";
  2298. TERACTPLTI[0] = 0;
  2299. TERFUNCPOS[0] = 0;
  2300. TERNUMCOLS[0] = 0;
  2301. TERNUMLNES[0] = 0;
  2302. END
  2303. P<QTRM$BUFFER> = HOLDADR;
  2304. END
  2305.  
  2306. END # SFQTRM$ #
  2307. *ENDIF
  2308. CONTROL EJECT;
  2309.  
  2310. PROC SFSETP$(VARNAME,VLEN,VOFF,OFFSET,ROWNUM);
  2311.  
  2312. # TITLE SFSETP$ - SET CURSOR POSITION. #
  2313.  
  2314. BEGIN # SFSETP$ #
  2315.  
  2316. #
  2317. ** SFSETP$ - SET CURSOR POSITION.
  2318. *
  2319. * SFSETP$ SPECIFIES WHAT FIELD THE CURSOR WILL
  2320. * BE POSITIONED AT FOR THE NEXT READ.
  2321. *
  2322. * PROC SFSETP$(VARNAME,VLEN,VOFF,OFFSET,ROWNUM)
  2323. *
  2324. * ENTRY VARNAME = VARIABLE NAME OF FIELD.
  2325. * VLEN = LENGTH OF VARP.
  2326. * VOFF = OFFSET OF VARP.
  2327. * OFFSET = OFFSET INTO SPECIFIED FIELD.
  2328. * ROWNUM = ROW NUMBER OF SPECIFIED FIELD.
  2329. *
  2330. * EXIT TERCURSVAR = VARIABLE NAME OF SPECIFIED FIELD.
  2331. * TERCURSROW = ROW NUMBER OF SPECIFIED FIELD.
  2332. * TERCURSOFF = OFFSET OF SPECIFIED FIELD.
  2333. * TERCURSSET = TRUE.
  2334. *
  2335. * USES TERCURSOFF, TERCURSROW, TERCURSSET, TERCURSVAR.
  2336. *
  2337. * NOTES ROUTINE READSF WILL SET THE ACTUAL CURSOR POSITION.
  2338. #
  2339. ITEM VARNAME C(11); # VARIABLE NAME #
  2340. ITEM VLEN I; # LENGTH OF VARNAME PARAMETER #
  2341. ITEM VOFF I; # OFFSET INTO VARNAME PARAMETER #
  2342. ITEM OFFSET I; # OFFSET INTO FIELD #
  2343. ITEM ROWNUM I; # ROW NUMBER IN ARRAY #
  2344.  
  2345. IF VLEN LS 1 THEN VLEN = 7; # CRACK PARAMETER #
  2346. TERCURSVAR[0] = C<VOFF,VLEN>VARNAME;
  2347.  
  2348. TERCURSSET[0] = TRUE; # SET GLOBAL VARIABLES #
  2349. IF OFFSET GR 0 THEN TERCURSOFF[0] = OFFSET - 1;
  2350. ELSE TERCURSOFF[0] = 0;
  2351. IF ROWNUM LS 1 THEN TERCURSROW[0] = 0;
  2352. ELSE TERCURSROW[0] = ROWNUM - 1;
  2353.  
  2354. END # SFSETP$ #
  2355. CONTROL EJECT;
  2356.  
  2357. PROC SFSREA$(PANELP,PANLEN,PANOFF,INSP,INSLEN,INSOFF);
  2358.  
  2359. # TITLE SFSREA$ - READ PANEL USING INSTRING. #
  2360.  
  2361. BEGIN # SFSREA$ #
  2362.  
  2363. #
  2364. ** SFSREA$ - READ PANEL USING INSTRING.
  2365. *
  2366. * SFSREA$ READS A PANEL AND PLACES THE INPUT IN
  2367. * INSTRING.
  2368. *
  2369. * PROC SFSREA$(PANELP,PANLEN,PANOFF,INSP,INSLEN,INSOFF)
  2370. *
  2371. * ENTRY PANELP = NAME OF PANEL TO READ.
  2372. * PANLEN = LENGTH OF PANELP.
  2373. * PANOFF = OFFSET OF PANELP.
  2374. * INSP = INSTRING TO RECEIVE DATA.
  2375. * INSLEN = LENGTH OF INSP.
  2376. * INSOFF = OFFSET OF INSP.
  2377. *
  2378. * EXIT INSP CONTAINS INPUT DATA.
  2379. *
  2380. * CALLS CPANEL, MOVEST, READSF.
  2381. *
  2382. * USES TERREADFLG.
  2383. #
  2384. ITEM PANELP C(11); # PANEL PARAMETER #
  2385. ITEM PANLEN I; # LENGTH OF PANEL PARAMETER #
  2386. ITEM PANOFF I; # OFFSET OF PANEL PARAMETER #
  2387. ITEM INSP I; # ADDRESS OF INSTRING #
  2388. ITEM INSLEN I; # LENGTH OF INSTRING #
  2389. ITEM INSOFF I; # OFFSET OF INSTRING #
  2390.  
  2391. ITEM PANEL C(7); # NAME OF INPUT PANEL #
  2392.  
  2393. *IF DEF,QTRM
  2394. NIT$RC = NITRTC"OK"; # SET STATUS OK #
  2395.  
  2396. *ENDIF
  2397. IF PANLEN LS 1 THEN PANLEN = 7; # CRACK PARAMETER #
  2398. PANEL = C<PANOFF,PANLEN>PANELP;
  2399.  
  2400. READSF(PANEL); # READ PANEL #
  2401. CPANEL; # REWRITE SCREEN AS NEEDED #
  2402.  
  2403. IF PANNUMBYTE[0] NQ 0 THEN
  2404. BEGIN # IF VARIABLES IN PANEL #
  2405. TERREADFLG[0] = TRUE;
  2406. MOVEST(LOC(INSP),INSOFF,INSLEN); # MOVE VARDATA TO INSTRING #
  2407. TERREADFLG[0] = FALSE;
  2408. END
  2409.  
  2410. END # SFSREA$ #
  2411. *IF UNDEF, QTRM
  2412. CONTROL EJECT;
  2413.  
  2414. PROC SFSSHO$(PANELP,PANLEN,PANOFF,OUTP,OLEN,OOFF,INSP,ILEN,IOFF);
  2415.  
  2416. # TITLE SFSSHO$ - SHOW PANEL USING INSTRING AND OUTSTRING. #
  2417.  
  2418. BEGIN # SFSSHO$ #
  2419.  
  2420. #
  2421. ** SFSSHO - SHOW PANEL USING INSTRING AND OUTSTRING.
  2422. *
  2423. * THIS PROCEDURE CALLS SFSWRI$ AND SFSREA$.
  2424. *
  2425. * PROC SFSSHO$(PANELP,PANLEN,PANOFF,OUTP,OLEN,OOFF,INSP,ILEN,IOFF)
  2426. *
  2427. * ENTRY PANELP = NAME OF PANEL TO READ.
  2428. * PANLEN = LENGTH OF PANELP.
  2429. * PANOFF = OFFSET OF PANELP.
  2430. * OUTP = OUTSTRING DISPLAY DATA.
  2431. * OLEN = LENGTH OF OUTP.
  2432. * OOFF = OFFSET OF OUTP.
  2433. * ILEN = LENGTH OF INSP.
  2434. * IOFF = OFFSET OF INSP.
  2435. *
  2436. * EXIT INSP = CONTAINS INPUT DATA.
  2437. *
  2438. * CALLS SFSREA$, SFSWRI$.
  2439. *
  2440. * USES TERSHOWFLG.
  2441. #
  2442. ITEM PANELP I; # NAME OF PANEL TO READ #
  2443. ITEM PANLEN I; # LENGTH OF PANELP #
  2444. ITEM PANOFF I; # OFFSET OF PANELP #
  2445. ITEM OUTP I; # OUTSTRING DISPLAY DATA #
  2446. ITEM OLEN I; # LENGTH OF OUTP #
  2447. ITEM OOFF I; # OFFSET OF OUTP #
  2448. ITEM INSP I; # INSTRING TO RECEIVE DATA #
  2449. ITEM ILEN I; # LENGTH OF INSP #
  2450. ITEM IOFF I; # OFFSET OF INSP #
  2451.  
  2452. TERSHOWFLG[0] = TRUE;
  2453. SFSWRI$(PANELP,PANLEN,PANOFF,OUTP,OLEN,OOFF); # WRITE PANEL #
  2454. SFSREA$(PANELP,PANLEN,PANOFF,INSP,ILEN,IOFF); # READ PANEL #
  2455. TERSHOWFLG[0] = FALSE;
  2456.  
  2457. END # SFSSHO$ #
  2458. *ENDIF
  2459. CONTROL EJECT;
  2460.  
  2461. PROC SFSWRI$(NAME,NLENGTH,NOFFSET,STRING,SLENGTH,SOFFSET);
  2462.  
  2463. # TITLE SFSWRI$ - SCREEN FORMAT STRING WRITE FUNCTION. #
  2464.  
  2465. BEGIN # SFSWRI$ #
  2466.  
  2467. #
  2468. ** SFSWRI$ - SCREEN FORMAT WRITE FUNCTION.
  2469. *
  2470. * THIS PROCEDURE WRITES THE SPECIFIED PANEL USING THE CONCATENATED
  2471. * VARIABLE DATA FOUND IN OUTSTRING (OR IN THE CASE OF AN ATTEMPTED
  2472. * READ BEFORE WRITE USING THE VARIABLE DATA ALREADY PRESENT IN THE
  2473. * VARDATA SECTION OF THE PANEL RECORD) AND THE CONSTANT DATA FOUND
  2474. * IN THE PANEL RECORD. IT INTERFACES TO COBOL AND FORTRAN APPLICA-
  2475. * TION PROGRAMS THROUGH A COMPASS INTERFACE MODULE CALLED SFSWRI.
  2476. *
  2477. * PROC SFSWRI$(NAME,NLENGTH,NOFFSET,STRING,SLENGTH,SOFFSET)
  2478. *
  2479. * ENTRY NAME = THE NAME OF THE PANEL TO BE WRITTEN.
  2480. * NLENGTH = LENGTH IN SIX BIT CHARACTERS.
  2481. * NOFFSET = OFFSET INTO NAME.
  2482. * STRING = CONTAINS THE CONCATENATED VARIABLE DATA.
  2483. * SLENGTH = LENGTH IN SIX BIT CHARACTERS.
  2484. * SOFFSET = OFFSET INTO STRING.
  2485. *
  2486. * EXIT PANEL WRITTEN TO SCREEN.
  2487. *
  2488. * CALLS GETADD, MOVEST, POSARR, WRIPAN.
  2489. *
  2490. * USES TERACTIVEP, TERACTPANI.
  2491. *
  2492. * NOTES IF TERREADFLG IS SET SFSWRI HAS BEEN CALLED BY SFSREA
  2493. * AND HENCE THERE IS NO OUTSTRING TO MOVE INTO VARDATA
  2494. * AND WHATEVER VARIABLE DATA IS PRESENTLY THERE WILL BE
  2495. * WRITTEN TO THE SCREEN.
  2496. #
  2497. ITEM NAME C(11); # NAME OF PANEL TO BE WRITTEN #
  2498. ITEM NLENGTH I; # LENGTH IN SIX BIT CHARACTERS #
  2499. ITEM NOFFSET I; # OFFSET INTO NAME #
  2500. ITEM STRING I; # OUTSTRING PARAMETER #
  2501. ITEM SLENGTH I; # LENGTH IN SIX BIT CHARACTERS #
  2502. ITEM SOFFSET I; # OFFSET INTO OUTSTRING #
  2503.  
  2504. ITEM PANELNAME C(7); # PANEL NAME, LEFT JUSTIFIED #
  2505. ITEM PANELADDR I; # ADDRESS OF PANEL RECORD #
  2506. ITEM PLTINDEX I; # PANEL LOAD TABLE INDEX #
  2507. ITEM STRINGADDR I; # ADDRESS OF OUTSTRING #
  2508.  
  2509. *IF DEF,QTRM
  2510. NIT$RC = NITRTC"OK"; # SET RETURN CODE #
  2511. TERMODNAME[0] = NIT$MODEL[NIT$CON]; # GET THE USERS MODEL FROM NIT #
  2512. *ENDIF
  2513. IF NLENGTH LS 1 THEN NLENGTH = 7; # CRACK PARAMETER #
  2514. PANELNAME = C<NOFFSET,NLENGTH>NAME; # LEFT JUSTIFY PANEL NAME #
  2515.  
  2516. IF PANELNAME NQ TERACTPANL[0] THEN
  2517. BEGIN # IF NOT THE ACTIVE PANEL #
  2518. TERACTPANL[0] = PANELNAME; # UPDATE ACTIVE PANEL NAME #
  2519. GETADD(PANELNAME,PANELADDR,PLTINDEX);
  2520. TERACTPLTI[0] = PLTINDEX;
  2521. POSARR(PANELADDR); # POSITION BASED ARRAYS #
  2522. END
  2523.  
  2524. IF PANNUMBYTE[0] NQ 0 AND NOT TERREADFLG[0] THEN
  2525. BEGIN # IF VARIABLE DATA PRESENT #
  2526. STRINGADDR = LOC(STRING); # ADDRESS OF OUTSTRING #
  2527. MOVEST(STRINGADDR,SOFFSET,SLENGTH); # MOVE OUTSTRING TO VARDATA #
  2528. END
  2529.  
  2530. IF NOT TERVDTBOOC[0] THEN
  2531. BEGIN # IF FIRST WRITE #
  2532. TERVDTBOOC[0] = TRUE;
  2533. VDTBOO; # BEGIN OUTPUT SEQUENCE #
  2534. END
  2535. WRIPAN; # WRITE PANEL #
  2536.  
  2537. END # SFSWRI$ #
  2538. CONTROL EJECT;
  2539.  
  2540. PROC BFIELD(FIELD,STARTCHAR,LASTDIRTY);
  2541.  
  2542. # TITLE BFIELD - BLANK FIELD IN VARDATA. #
  2543.  
  2544. BEGIN # BFIELD #
  2545.  
  2546. #
  2547. ** BFIELD - BLANK FIELD IN VARDATA.
  2548. *
  2549. * THIS PROCEDURE BLANK FILLS A FIELD IN VARDATA.
  2550. *
  2551. * PROC BFIELD(FIELD,STARTCHAR,LASTDIRTY)
  2552. *
  2553. * ENTRY FIELD = INDEX OF FIELD IN FLDLIST.
  2554. * STARTCHAR = POSITION TO START BLANK FILL.
  2555. *
  2556. * EXIT LASTDIRTY = LAST POSITION WITH PREVIOUS
  2557. * NON-BLANK CHARACTER.
  2558. #
  2559. ITEM FIELD I; # FIELD TO INITIALIZE #
  2560. ITEM STARTCHAR I; # STARTING CHARACTER POSITION #
  2561. ITEM LASTDIRTY I; # LAST NON-BLANK CHARACTER #
  2562.  
  2563. ITEM CHARNUM I; # CHARACTER POSITION IN VARDATA #
  2564. ITEM CHARIND I; # CHARACTER INDEX IN VARDATA #
  2565. ITEM I I; # LOOP COUNTER #
  2566. ITEM WORDIND I; # WORD INDEX IN VARDATA #
  2567.  
  2568. LASTDIRTY = -1;
  2569. CHARNUM = FLDVDTCORD[FIELD] + STARTCHAR;
  2570. WORDIND = CHARNUM / 5;
  2571. CHARIND = CHARNUM - (5 * WORDIND);
  2572.  
  2573. FOR I = STARTCHAR STEP 1 UNTIL FLDLENGTH[FIELD] -1 DO
  2574. BEGIN # BLANK FILL FIELD IN VDATA #
  2575. IF NEXTCHAR(FIELD,I) NQ BLANK THEN
  2576. BEGIN # NON-BLANK CHARACTER #
  2577. LASTDIRTY = I; # UPDATE LAST DIRTY CHARACTER #
  2578. END
  2579. B<CHARIND*12,12>VDATAU[WORDIND] = BLANK; # BLANK CHARACTER POS #
  2580. CHARIND = CHARIND + 1;
  2581. IF CHARIND EQ 5 THEN
  2582. BEGIN
  2583. CHARIND = 0;
  2584. WORDIND = WORDIND + 1;
  2585. END
  2586. END
  2587.  
  2588. END # BFIELD #
  2589. CONTROL EJECT;
  2590.  
  2591. PROC CLRLNS;
  2592.  
  2593. # TITLE CLRLNS - CLEAR LINES. #
  2594.  
  2595. BEGIN # CLRLNS #
  2596.  
  2597. #
  2598. ** CLRLNS - CLEAR LINES.
  2599. *
  2600. * THIS PROCEDURE CLEARS THE PROPER LINES BEFORE AN OVERLAY
  2601. * WRITE.
  2602. *
  2603. * PROC CLRLNS
  2604. *
  2605. * EXIT PROPER LINES CLEARED ON SCREEN.
  2606. *
  2607. * CALLS VDTCLL.
  2608. #
  2609. ITEM CURYCORD I; # CURRENT Y COORDINATE #
  2610. ITEM FLDINDEX I; # INDEX INTO FIELD LIST #
  2611.  
  2612. IF PANSTRFLD[0] EQ 0 THEN RETURN;
  2613.  
  2614. CURYCORD = -1; # NO CURRENT Y COORDINATE YET #
  2615. FOR FLDINDEX = 0 STEP 1 WHILE FLDENTRY[FLDINDEX] NQ 0 DO
  2616. BEGIN
  2617. IF FLDACTIVE[FLDINDEX] AND FLDYCORD[FLDINDEX] NQ CURYCORD THEN
  2618. BEGIN # IF ACTIVE FIELD ON NEW LINE #
  2619. CURYCORD = FLDYCORD[FLDINDEX]; # RESET CURRENT Y COORDINATE #
  2620. VDTCLL(0,CURYCORD); # CLEAR LINE #
  2621. END
  2622. END
  2623. IF TERNOTCHAR[0] THEN VDTCAA(0); # IF LINE OR PAGE TYPE ATTRS. #
  2624.  
  2625. END # CLRLNS #
  2626. CONTROL EJECT;
  2627.  
  2628. PROC CPANEL;
  2629.  
  2630. # TITLE CPANEL - CLEAN PANEL. #
  2631.  
  2632. BEGIN # CPANEL #
  2633.  
  2634. #
  2635. ** CPANEL - CLEAN PANEL.
  2636. *
  2637. * THIS PROCEDURE CHECKS FLAGS PERTAINING TO REWRITING THE
  2638. * SCREEN AND THEN CALLS THE APPROPRIATE PROCEDURES.
  2639. *
  2640. * PROC CPANEL
  2641. *
  2642. * ENTRY TERMESWRIT = TRUE, IF THE MESSAGE CONTAINS A MESSAGE.
  2643. * TERMESREAD = TRUE, IF THE MESSAGE AREA CAN BE CLEARED.
  2644. * TERREWFLDS = TRUE, IF ONE OR MORE FIELDS NEED REWRITING.
  2645. * TERREWSCRN = TRUE, IF THE ENTIRE SCREEN NEEDS REWRITING.
  2646. *
  2647. * EXIT TERMESREAD = FALSE.
  2648. * TERREWFLDS = FALSE.
  2649. * TERREWSCRN = FALSE.
  2650. *
  2651. * CALLS REWFLD, MCLEAN, VDTSAM, WRIALL.
  2652. *
  2653. * USES TERDONTCLR, TERMESREAD, TERNOREWRT, TERREWFLDS,
  2654. * TERREWSCRN.
  2655. #
  2656. ITEM I I; # LOOP COUNTER #
  2657.  
  2658. IF TERMESWRIT[0] AND TERMESREAD[0] AND NOT TERREWSCRN[0] THEN
  2659. BEGIN # CLEAR MESSAGE AREA #
  2660. MCLEAN(DUMMY,DUMMY); # CLEAN MESSAGE LINE #
  2661. IF NOT TERBLCKMDE[0] THEN
  2662. BEGIN
  2663. VDTSAM(0);
  2664. END
  2665. ELSE
  2666. BEGIN
  2667. VDTSAM(O"6001");
  2668. END
  2669. END
  2670.  
  2671. IF TERREWFLDS[0] OR TERREWSCRN[0] THEN
  2672. BEGIN # REWRITE FLAGGED FIELDS #
  2673. TERREADFLG[0] = TRUE;
  2674. TERDONTCLR[0] = TRUE; # DO NOT CLEAR REWRITE/ENTERED #
  2675. IF TERREWSCRN[0] THEN
  2676. BEGIN # FULL REWRITE OF SCREEN #
  2677. WRIALL;
  2678. TERREWSCRN[0] = FALSE;
  2679. END
  2680. ELSE # REWRITE FLAGGED FIELDS #
  2681. BEGIN
  2682. TERNOREWRT[0] = TRUE;
  2683. REWFLD; # REWRITE FIELDS #
  2684. TERNOREWRT[0] = FALSE;
  2685. END
  2686. TERDONTCLR[0] = FALSE;
  2687. TERREADFLG[0] = FALSE;
  2688. END
  2689.  
  2690. TERMESREAD[0] = FALSE;
  2691. TERREWFLDS[0] = FALSE;
  2692.  
  2693. END # CPANEL #
  2694. CONTROL EJECT;
  2695.  
  2696. PROC DATEVL(FLDIND,IVAL);
  2697.  
  2698. # TITLE DATEVL - DATE VALIDATION. #
  2699.  
  2700. BEGIN # DATEVL #
  2701.  
  2702. #
  2703. ** DATEVL - DATE VALIDATION.
  2704. *
  2705. * THIS PROCEDURE CHECKS THAT THE INPUT IS A VALID DATE.
  2706. *
  2707. * PROC DATEVL(FLDIND,IVAL)
  2708. *
  2709. * ENTRY FLDIND = INDEX OF CURRENT FIELD IN FLDLIST.
  2710. *
  2711. * EXIT IVAL = INTEGER VALUE OF INPUT.
  2712. * FLDVALID[FLDIND] = FALSE, IF INVALID INPUT.
  2713. *
  2714. * CALLS GETNUM, SKPBLK.
  2715. #
  2716. ITEM FLDIND I; # VARIABLE TO BE VALIDATED #
  2717. ITEM IVAL I; # INTEGER VALUE OF INPUT #
  2718.  
  2719. ITEM CHAR I; # INPUT CHARACTER #
  2720. ITEM CHARPOS I; # CHARACTER POSITION IN FIELD #
  2721. ITEM DATEIND I; # INDEX TO DATEARRAY #
  2722. ITEM DD I; # DAY #
  2723. ITEM DIGITS I; # NUMBER OF DIGITS IN SUBFIELD #
  2724. ITEM FVAL I; # SUBFIELD VALUE #
  2725. ITEM I I; # LOOP COUNTER #
  2726. ITEM INPIND I; # INDEX TO NEXT INPUT CHARACTER #
  2727. ITEM MM I; # MONTH #
  2728. ITEM TEMP1 I; # USED FOR LEAP YEAR CALCULATION #
  2729. ITEM VARIND I; # INDEX INTO VARLIST #
  2730. ITEM YY I; # YEAR #
  2731.  
  2732. ARRAY DATEARRAY[0:7] P(1);
  2733. BEGIN
  2734. ITEM DATECHAR U(00,00,60); # HOLDS INPUT CHARACTERS #
  2735. END
  2736.  
  2737. ARRAY DATEDELS[0:2] P(1);
  2738. BEGIN
  2739. ITEM DATEDEL U(00,00,60); # DATE DELIMETER #
  2740. END
  2741.  
  2742. ARRAY FIELDARRAY[0:2] P(1);
  2743. BEGIN
  2744. ITEM FIELD U(00,00,60); # HOLDS MONTH, DAY, YEAR FIELDS #
  2745. END
  2746.  
  2747. ARRAY MONTHS [0:12] P(1); # NUMBER OF DAYS IN EACH MONTH #
  2748. BEGIN # 0TH MONTH = LEAP YEAR FEBRUARY #
  2749. ITEM MONLENGTH U(00,00,60) =
  2750. [29,31,28,31,30,31,30,31,31,30,31,30,31];
  2751. END
  2752.  
  2753. SWITCH DATETYPE:FORMTYPE
  2754. YYMMDD : Y,
  2755. MMDDYY : M,
  2756. DDMMYY : D;
  2757.  
  2758. DATEIND = 0;
  2759. INPIND = 0;
  2760. CHARPOS = 0;
  2761.  
  2762. VARIND = FLDVARORD[FLDIND]; # SET INDEX TO VARLIST #
  2763. IVAL = 0;
  2764. SKPBLK(FLDIND,CHARPOS,CHAR);
  2765. IF CHARPOS GQ FLDLENGTH[FLDIND] THEN
  2766. BEGIN # BLANK FIELD #
  2767. FLDVALID[FLDIND] = FALSE;
  2768. RETURN;
  2769. END
  2770.  
  2771. FOR I = 0 STEP 1 UNTIL 2 DO
  2772. BEGIN
  2773. FVAL = 0;
  2774. GETNUM(FLDIND,CHARPOS,FVAL,DIGITS);
  2775. IF I NQ 2 THEN
  2776. BEGIN
  2777. CHAR = NEXTCHAR(FLDIND,CHARPOS);
  2778. DATEDEL[I] = CHAR;
  2779. END
  2780. ELSE CHARPOS = CHARPOS -1;
  2781. IF NOT(DIGITS EQ 1 OR DIGITS EQ 2) THEN
  2782. BEGIN
  2783. FLDVALID[FLDIND] = FALSE;
  2784. RETURN;
  2785. END
  2786. CHARPOS = CHARPOS + 1;
  2787. FIELD[I] = FVAL;
  2788. END
  2789.  
  2790. IF CHARPOS NQ FLDLENGTH[FLDIND] THEN
  2791. BEGIN # CHECK FOR EXTRA CHARACTERS #
  2792. SKPBLK(FLDIND,CHARPOS,CHAR);
  2793. IF CHARPOS LQ FLDLENGTH[FLDIND] - 1 THEN
  2794. BEGIN # NON-BLANK CHAR AFTER DATE #
  2795. FLDVALID[FLDIND] = FALSE;
  2796. RETURN;
  2797. END
  2798. END
  2799.  
  2800. IF DATEDEL[1] NQ DATEDEL[0] THEN
  2801. BEGIN
  2802. FLDVALID[FLDIND] = FALSE;
  2803. RETURN;
  2804. END
  2805. GOTO DATETYPE[VARPICTYPE[VARIND]];
  2806.  
  2807. MMDDYY: # SET MONTH, DAY, YEAR VALUES #
  2808.  
  2809. MM = FIELD[0];
  2810. DD = FIELD[1];
  2811. YY = FIELD[2];
  2812. GOTO CHECKDATE;
  2813.  
  2814. YYMMDD: # SET MONTH, DAY, YEAR VALUES #
  2815.  
  2816. YY = FIELD[0];
  2817. MM = FIELD[1];
  2818. DD = FIELD[2];
  2819. GOTO CHECKDATE;
  2820.  
  2821. DDMMYY: # SET MONTH, DAY, YEAR VALUES #
  2822.  
  2823. DD = FIELD[0];
  2824. MM = FIELD[1];
  2825. YY = FIELD[2];
  2826.  
  2827. CHECKDATE: # CHECK FOR VALID DATE VALUE #
  2828.  
  2829. IF MM GR 12 OR MM LS 1 THEN
  2830. BEGIN # INVALID MONTH #
  2831. FLDVALID[FLDIND] = FALSE;
  2832. RETURN;
  2833. END
  2834.  
  2835. IF MM EQ 2 THEN # CHECK IF LEAP YEAR FEBRUARY #
  2836. BEGIN
  2837. TEMP1 = YY / 4;
  2838. TEMP1 = YY - (4 * TEMP1);
  2839. IF TEMP1 EQ 0 THEN MM = 0;
  2840. END
  2841.  
  2842. IF DD GR MONLENGTH[MM] OR DD LS 1 THEN
  2843. BEGIN # INVALID DAY #
  2844. FLDVALID[FLDIND] = FALSE;
  2845. RETURN;
  2846. END
  2847.  
  2848. IF MM EQ 0 THEN MM = 2;
  2849. IVAL = YY*10000 + MM*100 + DD;
  2850.  
  2851. END # DATEVL #
  2852. CONTROL EJECT;
  2853.  
  2854. PROC ERRMSG(PANELNAME,PROCNAME,PROCMSG,FATAL);
  2855.  
  2856. # TITLE ERRMSG - ERROR MESSAGE PROCEDURE. #
  2857.  
  2858. BEGIN # ERRMSG #
  2859.  
  2860. #
  2861. ** ERRMSG - ERROR MESSAGE PROCEDURE.
  2862. *
  2863. * THIS PROCEDURE ISSUES A DAYFILE MESSAGE INDICATING WHICH
  2864. * PANEL CAUSED AN ERROR AND THE PROCEDURE THAT DETECTED IT.
  2865. * IT ALSO TERMINATES THE PROGRAM IF THE ERROR IS FATAL.
  2866. *
  2867. * PROC ERRMSG(PANELNAME,PROCNAME,PROCMSG,FATAL)
  2868. *
  2869. * ENTRY PANELNAME = THE NAME OF THE PANEL.
  2870. * PROCNAME = THE NAME OF THE EXTERNAL PROCEDURE
  2871. * THAT DETECTED THE ERROR.
  2872. * PROCMSG = THE ERROR MESSAGE.
  2873. * FATAL = TRUE IF THE ERROR IS FATAL, FALSE OTHERWISE.
  2874. *
  2875. * EXIT MESSAGE ISSUED TO DAYFILE, PROGRAM TERMINATED IF FATAL
  2876. * IS TRUE.
  2877. *
  2878. *IF UNDEF,QTRM
  2879. * CALLS VDTCLO, VDTCLS, VDTMSG$, VDTSTM.
  2880. *ELSE
  2881. *ENDIF
  2882. *
  2883. * USES TERACTIVEP, TERACTPANI, TERCNWRIOV, TERMESREAD,
  2884. * TERMESWRIT, TERSCREENM, TERSHOWFLG.
  2885. *
  2886. * NOTES THIS PROCEDURE IS CALLED BY SFCLOS WHEN A PANEL CANNOT BE
  2887. * CLOSED (INFORMATIVE MESSAGE ONLY), BY GETADD WHEN A READ,
  2888. * WRITE, OR SHOW OF A PANEL THAT IS NOT IN THE PANEL LOAD
  2889. * TABLE IS ATTEMPTED (INFORMATIVE MESSAGE AND TERMINATION
  2890. * OF PROGRAM), BY WRIPAN WHEN AN ATTEMPT IS MADE TO WRITE
  2891. * AN OVERLAY PANEL BEFORE A PRIMARY PANEL (INFORMATIVE
  2892. * MESSAGE AND TERMINATION OF PROGRAM) AND BY SFLOAD IF
  2893. * AN INTERNAL FAST DYNAMIC LOADER ERROR HAS OCCURRED
  2894. * (INFORMATIVE MESSAGE ONLY).
  2895. #
  2896. ITEM PANELNAME C(7); # PANEL NAME #
  2897. ITEM PROCNAME C(6); # PROCEDURE NAME #
  2898. ITEM PROCMSG C(20); # DAYFILE ERROR MESSAGE #
  2899. ITEM FATAL B; # PANEL NAME #
  2900.  
  2901. ITEM DAYFILE I = 0; # ISSUE MESSAGE TO DAYFILE #
  2902. ITEM DAYMESSAGE C(41) = " XXXXXX - PANEL ";
  2903. ITEM EMPTY I = O"00"; # OCTAL ZERO / COLON #
  2904. *IF UNDEF,QTRM
  2905. ITEM LINE I = 0; # INDICATES LINE MODE TO VDT #
  2906. ITEM NOMSG I = 0; # NO B-DISPLAY MESSAGE #
  2907. *ENDIF
  2908. ITEM NONAME C(25) = "NAME IS BLANK. "; # ERROR MSG. #
  2909. *IF UNDEF,QTRM
  2910. ITEM RECALL I = 1; # RECALL PARAMETER FOR VDTCLO #
  2911. *ENDIF
  2912. ITEM PANINDEX I; # INDEX INTO PANEL NAME #
  2913. ITEM PANLEN I; # LENGTH OF PANEL NAME #
  2914. *IF UNDEF,QTRM
  2915. ITEM PLTCOUNT I; # COUNTER TO CLEAR PLT #
  2916. *ENDIF
  2917. ITEM SPACE I = O"55"; # DISPLAY CODE BLANK #
  2918.  
  2919. C<1,6>DAYMESSAGE = PROCNAME; # PUT IN PROCEDURE NAME #
  2920.  
  2921. PANLEN = 0;
  2922. FOR PANINDEX = 0 STEP 1 UNTIL 6 DO
  2923. BEGIN # FIND PANEL NAME LENGTH #
  2924. IF C<PANINDEX,1>PANELNAME NQ SPACE
  2925. AND C<PANINDEX,1>PANELNAME NQ EMPTY THEN
  2926. BEGIN # IF NOT AT END OF PANEL NAME #
  2927. PANLEN = PANINDEX + 1;
  2928. END
  2929. END
  2930.  
  2931. IF PANLEN EQ 0 OR PANELNAME EQ 0 THEN
  2932. BEGIN # IF BLANK PANEL NAME #
  2933. C<16,25>DAYMESSAGE = NONAME; # OVER RIDE PROCEDURE MSG. #
  2934. END
  2935. ELSE
  2936. BEGIN # PUT IN NAME AND MESSAGE #
  2937. C<16,PANLEN>DAYMESSAGE = PANELNAME;
  2938. C<16+PANLEN,25-PANLEN>DAYMESSAGE = PROCMSG;
  2939. END
  2940.  
  2941. VDTMSG$(DAYMESSAGE,DAYFILE,1); # ISSUE DAYFILE MESSAGE #
  2942.  
  2943. IF FATAL THEN
  2944. BEGIN # IF FATAL ERROR #
  2945. *IF UNDEF,QTRM
  2946. IF TERSCREENM[0] THEN
  2947. BEGIN # IF IN SCREEN MODE #
  2948. IF NOT TERVDTBOOC[0] THEN
  2949. BEGIN # IF FIRST WRITE #
  2950. VDTBOO; # BEGIN OUTPUT SEQUENCE #
  2951. END
  2952. VDTCLS; # CLEAR SCREEN #
  2953. FOR PLTCOUNT = 1 STEP 1 UNTIL PLTNUMENT[0] DO
  2954. BEGIN # CLEAR SEQUENCE NUMBERS #
  2955. PLTENTRYNM[PLTCOUNT] = 0;
  2956. END
  2957. PLTNUMONSC[0] = 0; # NO PANELS ON SCREEN #
  2958. TERMESWRIT[0] = FALSE;
  2959. TERMESREAD[0] = FALSE;
  2960. VDTSTM(LINE,DUMMY); # SET LINE MODE #
  2961. IF NOT TERNOVDTEO[0] THEN VDTEOO;
  2962. TERVDTBOOC[0] = FALSE;
  2963. VDTCLO(RECALL); # FLUSH OUTPUT, RECALL #
  2964. END
  2965. TERACTPANL[0] = " "; # CLEAR ACTIVE PANEL NAME #
  2966. TERACTPLTI[0] = 0; # CLEAR PLT INDEX #
  2967. TERCNWRIOV[0] = FALSE; # DO NOT ALLOW OVERLAY WRITE #
  2968. VDTMSG$(NOMSG,1,1); # CLEAR B-DISPLAY #
  2969. TERSHOWFLG[0] = FALSE;
  2970. TERREADFLG[0] = FALSE;
  2971. ABORT; # ABORT THE PROGRAM #
  2972. *ELSE
  2973. ABORT; # ABORT THE USER #
  2974. *ENDIF
  2975. END
  2976.  
  2977. END # ERRMSG #
  2978. CONTROL EJECT;
  2979.  
  2980. PROC FFIELD(INPOS,FIELD,OFFSET,OUTFLAG);
  2981.  
  2982. # TITLE FFIELD - FIND INPUT FIELD. #
  2983.  
  2984. BEGIN # FFIELD #
  2985.  
  2986. #
  2987. ** FFIELD - FIND INPUT FIELD.
  2988. *
  2989. * THIS PROCEDURE FINDS THE ACTIVE INPUT FIELD ASSOCIATED WITH
  2990. * THE INPUT RECEIVED FROM SCREEN POSITION INPOS.
  2991. *
  2992. * PROC FFIELD(INPOS,FIELD,OFFSET)
  2993. *
  2994. * ENTRY INPOS = X/Y POSITION
  2995. * OUTFLAG = TRUE, INCLUDE ACTIVE OUTPUT ONLY
  2996. * FIELDS IN THE SEARCH.
  2997. *
  2998. * EXIT FIELD = FIELD ASSOCIATED WITH INPUT.
  2999. * = -1 IF NOT IN A FIELD.
  3000. * OFFSET = OFFSET OF INPUT INTO FIELD.
  3001. *
  3002. * NOTES FFIELD ASSUMES THAT FIELDS DO NOT SPAN LINES.
  3003. #
  3004. ITEM INPOS I; # X/Y POSITION #
  3005. ITEM FIELD I; # INDEX INTO FLDLIST #
  3006. ITEM OFFSET I; # OFFSET INTO FIELD #
  3007. ITEM OUTFLAG B; # INCLUDE OUT-ONLY FIELDS #
  3008.  
  3009. ITEM I I; # LOOP COUNTER #
  3010. ITEM NOTEND B; # NOT END OF SEARCH #
  3011.  
  3012. FIELD = -1; # NOT FOUND UNTIL PROVEN FOUND #
  3013. NOTEND = TRUE;
  3014. OFFSET = 0;
  3015.  
  3016. FOR I = 0 STEP 1 WHILE NOTEND
  3017. AND FLDENTRY[I] NQ 0 DO
  3018. BEGIN # FIND FIELD CHAR WAS ENTERED IN #
  3019. IF INPOS LS FLDPOS[I] AND FLDACTIVE[I] THEN NOTEND = FALSE;
  3020. ELSE
  3021. BEGIN
  3022. IF (FLDINPUTV[I] AND FLDACTIVE[I])
  3023. OR (FLDVARFLAG[I] AND OUTFLAG AND FLDACTIVE[I]) THEN
  3024. BEGIN
  3025. FIELD = I;
  3026. END
  3027. END
  3028. END
  3029.  
  3030. IF VALIDFIELD THEN
  3031. BEGIN # IF VALID FIELD FOUND #
  3032. OFFSET = INPOS - FLDPOS[FIELD];
  3033. IF OFFSET GQ FLDLENGTH[FIELD] THEN
  3034. BEGIN # INPUT BEYOND END OF FIELD #
  3035. OFFSET = 0;
  3036. FIELD = -1;
  3037. END
  3038. END
  3039.  
  3040. END # FFIELD #
  3041. CONTROL EJECT;
  3042.  
  3043. PROC FFIRST(FLDIND);
  3044.  
  3045. # TITLE FFIRST - FIND FIRST INPUT FIELD. #
  3046.  
  3047. BEGIN # FFIRST #
  3048.  
  3049. #
  3050. ** FFIRST - FIND FIRST INPUT FIELD.
  3051. *
  3052. * THIS PROCEDURE FINDS THE FIRST ACTIVE INPUT FIELD IN THE PANEL
  3053. * THAT DOES NOT HAVE A VALID ENTRY. IF ALL INPUT FIELDS ARE BOTH
  3054. * ENTERED AND VALID THEN THE FIRST ACTIVE INPUT FIELD IS RETURNED.
  3055. *
  3056. * PROC FFIRST(FLDIND)
  3057. *
  3058. * EXIT FLDIND = INDEX OF FIRST INPUT FIELD
  3059. * = -1, IF NO INPUT FIELD FOUND.
  3060. #
  3061. ITEM FLDIND I; # FIELD INDEX #
  3062.  
  3063. ITEM FIRST B; # STILL LOOKING FOR FIRST FIELD #
  3064. ITEM FOUND B; # FOUND AN UNENTERED INPUT FIELD #
  3065. ITEM I I; # LOOP COUNTER #
  3066.  
  3067. FLDIND = -1;
  3068. FIRST = TRUE;
  3069. FOUND = FALSE;
  3070.  
  3071. FOR I = 0 STEP 1 WHILE NOT FOUND AND FLDENTRY[I] NQ 0 DO
  3072. BEGIN # SEARCH FIELD LIST #
  3073. IF FLDINPUTV[I] AND NOT FOUND AND FLDACTIVE[I]
  3074. AND (NOT FLDENTERED[I] OR NOT FLDVALID[I]) THEN
  3075. BEGIN # FIRST AVAILABLE FIELD #
  3076. FIRST = FALSE;
  3077. FOUND = TRUE;
  3078. FLDIND = I;
  3079. END
  3080. ELSE IF FIRST AND FLDINPUTV[I] AND FLDACTIVE[I] THEN
  3081. BEGIN # FIRST INPUT FIELD #
  3082. FIRST = FALSE;
  3083. FLDIND = I;
  3084. END
  3085. END
  3086.  
  3087. END # FFIRST #
  3088. CONTROL EJECT;
  3089.  
  3090. PROC FMATCH(FLDIND,MATCHIND,MATCHCOUNT);
  3091.  
  3092. # TITLE FMATCH - FIND ENTRY IN MATCH LIST. #
  3093.  
  3094. BEGIN # FMATCH #
  3095.  
  3096. #
  3097. ** FMATCH - FIND ENTRY IN MATCH LIST.
  3098. *
  3099. * THIS PROCEDURE FINDS THE FIRST ENTRY IN THE VARIABLE MATCH LIST
  3100. * WHICH MATCHES THE ENTERED CHARACTERS COMPLETELY OR IN PART.
  3101. *
  3102. * PROC FMATCH(FLDIND,MATCHIND,MATCHCOUNT)
  3103. *
  3104. * ENTRY FLDIND = POINTER INTO FLDLIST OF CURRENT FIELD.
  3105. *
  3106. * EXIT MATCHIND = INDEX INTO MATCHLIST OF FIRST VALID MATCH.
  3107. * = -1 IF NO VALID MATCH FOUND.
  3108. * MATCHCOUNT = NUMBER OF VALID MATCHES FOUND.
  3109. * -1 IF EXACT (TO 10 CHARACTERS) MATCH FOUND.
  3110. #
  3111. ITEM FLDIND I; # INDEX OF FIELD IN FLDLIST #
  3112. ITEM MATCHIND I; # INDEX OF MATCH IN MATCHLIST #
  3113. ITEM MATCHCOUNT I; # NUMBER OF VALID MATCHES FOUND #
  3114.  
  3115. ITEM CHARPOS I; # INPUT CHAR POSITION IN FIELD #
  3116. ITEM EXACT B; # EXACT MATCH FOUND #
  3117. ITEM I I; # LOOP COUNTER #
  3118. ITEM INPCHAR I; # INPUT CHARACTER #
  3119. ITEM LASTCHARP I; # LAST INPUT CHARACTER POSITION #
  3120. ITEM MATCHCHAR I; # MATCH CHARACTER #
  3121. ITEM MATCHCI I; # CHAR INDEX OF MATCH CHARACTER #
  3122. ITEM MATCHED B; # INPUT MATCHED LIST ENTRY #
  3123. ITEM MATCHLEN I; # LENGTH OF MATCH STRING #
  3124. ITEM MATCHMAX I; # EXACT MATCH CHARACTER COUNT #
  3125. ITEM MATCHWDS I; # NUMBER OF WORDS TO HOLD FIELD #
  3126. ITEM MATCHWI I; # WORD INDEX OF MATCH CHARACTER #
  3127. ITEM STARTCHARP I; # FIRST INPUT CHARACTER POSITION #
  3128. ITEM VARIND I; # INDEX INTO VARLIST #
  3129.  
  3130. VARIND = FLDVARORD[FLDIND];
  3131. P<MATCHLIST> = LOC(RECWORDC[0]) + VARVALOS[VARIND];
  3132. MATCHCHAR = 0;
  3133.  
  3134. LASTCHARP = -1;
  3135. STARTCHARP = -1;
  3136.  
  3137. FOR I = 0 STEP 1 UNTIL FLDLENGTH[FLDIND] - 1 DO
  3138. BEGIN # LOOK FOR FIRST AND LAST CHAR #
  3139. IF NEXTCHAR(FLDIND,I) NQ BLANK THEN
  3140. BEGIN # NON-BLANK CHARACTER #
  3141. LASTCHARP = I;
  3142. IF STARTCHARP EQ -1 THEN STARTCHARP = I;
  3143. END
  3144. END
  3145.  
  3146. IF STARTCHARP EQ -1 THEN
  3147. BEGIN # NO CHARACTERS FOUND #
  3148. STARTCHARP = 0;
  3149. LASTCHARP = 0;
  3150. END
  3151. MATCHLEN = LASTCHARP - STARTCHARP + 1;
  3152. MATCHMAX = FLDLENGTH[FLDIND];
  3153. IF PANVERSION[0] EQ 0 THEN
  3154. BEGIN # IF MATCH ENTRIES ONLY 10 CHAR. #
  3155. IF MATCHMAX GR 10 THEN
  3156. BEGIN
  3157. MATCHMAX = 10;
  3158. IF MATCHLEN GR 10 THEN MATCHLEN = 10;
  3159. END
  3160. END
  3161. MATCHWDS = (MATCHMAX+9)/10; # WORDS PER MATCH ENTRY #
  3162. MATCHIND = -MATCHWDS; # DEFAULT INDEX IF NO MATCH #
  3163. MATCHCOUNT = 0;
  3164.  
  3165. FOR MATCHWI = 0 STEP MATCHWDS WHILE MATCHWORD[MATCHWI] NQ 0
  3166. AND MATCHCOUNT GQ 0 DO
  3167. BEGIN
  3168. MATCHED = TRUE;
  3169. CHARPOS = STARTCHARP;
  3170. FOR MATCHCI = 0 STEP 1 WHILE MATCHED AND MATCHCI LS MATCHLEN DO
  3171. BEGIN # CHECK CHARACTERS FOR MATCH #
  3172. B<48,12>MATCHCHAR = C<MATCHCI*2,2>MATCH[MATCHWI];
  3173. INPCHAR = NEXTCHAR(FLDIND,CHARPOS);
  3174. IF UPPER(MATCHCHAR) NQ UPPER(INPCHAR) THEN MATCHED = FALSE;
  3175. CHARPOS = CHARPOS + 1;
  3176. END
  3177. IF MATCHED THEN
  3178. BEGIN # FIRST (MATCHLEN) CHARS MATCH #
  3179. EXACT = TRUE;
  3180. FOR MATCHCI = MATCHLEN STEP 1 UNTIL MATCHMAX-1 DO
  3181. BEGIN # CHECK REST OF CHARS FOR BLANKS #
  3182. IF C<MATCHCI*2,2>MATCH[MATCHWI] NQ BLANK THEN EXACT = FALSE;
  3183. END
  3184. IF EXACT THEN
  3185. BEGIN # EXACT MATCH FOUND #
  3186. MATCHCOUNT = -1; # FLAG ENTRY FOUND #
  3187. MATCHIND = MATCHWI;
  3188. END
  3189. ELSE
  3190. BEGIN # PARTIAL MATCH FOUND #
  3191. MATCHCOUNT = MATCHCOUNT + 1;
  3192. IF MATCHCOUNT EQ 1 THEN MATCHIND = MATCHWI; # IF FIRST ONE #
  3193. END
  3194. END
  3195. END
  3196.  
  3197. END # FMATCH #
  3198. CONTROL EJECT;
  3199.  
  3200. PROC FUNKEY(INPOS,OFFSET,FUNTYPE,ORDINAL,FIELD);
  3201.  
  3202. # TITLE FUNKEY - PROCESS FUNCTION KEY ACTION. #
  3203.  
  3204. BEGIN # FUNKEY #
  3205.  
  3206. #
  3207. ** FUNKEY - PROCESS FUNCTION KEY ACTION.
  3208. *
  3209. * THIS PROCEDURE SEARCHES THE FUNCTION LIST TO FIND THE ACTION TO
  3210. * AKE FOR THE FUNCTION KEY, IF ANY. IT THEN TAKES THE DEFINED
  3211. * ACTION IF NO SOFT TABS ARE PENDING. IF SOFT TABS ARE PENDING
  3212. * THE FUNCTION IS IGNORED AND IF THE FUNCTION KEY DOES NOT HAVE
  3213. * A DEFINED ACTION THE SOFT TAB COUNTER WILL BE INCREMENTED. THE
  3214. * ONLY EXCEPTION IS A HELP REQUEST WHICH WILL SET HELP PENDING
  3215. * TO BE PROCESSED AFTER ALL SOFT TABS HAVE BEEN PROCESSED.
  3216. *
  3217. * PROC FUNKEY(INPOS,OFFSET,FUNTYPE,ORDINAL,FIELD)
  3218. *
  3219. * ENTRY INPOS = X/Y POSITION WHERE FUNCTION WAS ENTERED.
  3220. * OFFSET = OFFSET INTO FIELD WHERE FUNCTION WAS ENTERED.
  3221. * FUNTYPE = 24, GENERIC FUNCTION KEY.
  3222. * = 23, APPLICATION FUNCTION KEY.
  3223. * ORDINAL = FUNCTION KEY ORDINAL.
  3224. * FIELD = FIELD WHERE FIELD WAS ENTERED.
  3225. * TERSOFTTAB = COUNT OF CURRENT SOFT TABS PENDING.
  3226. *
  3227. * EXIT INPOS = NEW X/Y POSITION
  3228. * FIELD = NEW FIELD POSITION
  3229. * TERSOFTTAB = UPDATED SOFT TAB COUNT
  3230. * TERSOFTPOS = INPOS IF FIRST SOFT TAB CREATED
  3231. * TERABNTERM = TRUE, TERMINATE INPUT ABNORMALLY
  3232. * TERNRMTERM = TRUE, TERMINATE INPUT NORMALLY
  3233. *
  3234. * CALLS FMATCH, MMATCH, TABKEY.
  3235. *
  3236. * USES TERABNTERM, TERFUNCGEN, TERFUNCORD, TERFUNCPOS,
  3237. * TERHELPFLD, TERHELPREQ, TERNRMTERM, TERPENDHLP,
  3238. * TERSOFTPOS, TERSOFTTAB.
  3239. *
  3240. * NOTES FLDENTERED, FLDVALID, FLDREWRITE, TERREWFLDS AND VARDATA
  3241. * UPDATED IF MATCH ADVANCE OCCURRED. SWITCH ACTTYPE MUST
  3242. * PARALLEL PDU DEFINITION FOR FUNCTION KEY ACTIONS.
  3243. #
  3244. ITEM INPOS I; # X/Y POSITION OF CURSOR #
  3245. ITEM OFFSET I; # OFFSET INTO FIELD #
  3246. ITEM FUNTYPE I; # APPLICATION OR GENERIC #
  3247. ITEM ORDINAL I; # FUNCTION KEY ORDINAL #
  3248. ITEM FIELD I; # INDEX OF FIELD #
  3249.  
  3250. DEF FH #9#; # ORDINAL FOR HELP AS AN ACTION #
  3251. DEF FM #10#; # ORDINAL FOR MATCH ADVANCE #
  3252.  
  3253. ITEM ACTION I; # ORDINAL OF ACTION #
  3254. ITEM CHAR I; # 12-BIT CHARACTER #
  3255. ITEM I I; # LOOP COUNTER #
  3256. ITEM MATCHCOUNT I; # NUMBER OF VALID MATCHES #
  3257. ITEM MATCHIND I; # INDEX INTO MATCHLIST #
  3258. ITEM NOTDONE B; # FUNCTION LIST ENTRY NOT FOUND #
  3259. ITEM SCRPOS I; # SCRATCH POSITION FOR TABKEY #
  3260. ITEM VARIND I; # INDEX INTO VARLIST #
  3261.  
  3262. SWITCH ACTTYPE # TYPE OF ACTION TO TAKE #
  3263. TABSOFTLY, # PROCESS SOFT TAB #
  3264. NORMTOAPP, # RETURN NORMALLY TO APPLICATION #
  3265. NORMTONOS, # RETURN NORMALLY TO OPER. SYS. #
  3266. ABNORTOAPP, # RETURN ABNORMALLY TO APPL. #
  3267. ABNORTONOS, # RETURN ABNORMALLY TO OPER. SYS #
  3268. PAGEFORWARD, # PAGE TABLE FORWARD #
  3269. PAGEBAKWARD, # PAGE TABLE BACKWARD #
  3270. INSERTROW, # INSERT ROW IN TABLE #
  3271. DELETEROW, # DELETE ROW IN TABLE #
  3272. GIVEHELP, # PROVIDE HELP #
  3273. MATCHADV; # ADVANCE MATCH ENTRY #
  3274.  
  3275. # SAVE FUNCTION KEY ORDINAL AND KEY TYPE #
  3276.  
  3277. TERFUNCORD[0] = ORDINAL;
  3278. TERFUNCGEN[0] = FUNTYPE EQ SCREENST"GKEY";
  3279. TERFUNCPOS[0] = INPOS;
  3280.  
  3281. IF TERSOFTTAB[0] NQ 0 AND TERFUNCGEN[0]
  3282. AND ORDINAL EQ GENERICST"GNEXT" THEN
  3283. BEGIN # NEXT FOLLOWING SOFT TAB #
  3284. GOTO NOACTION;
  3285. END
  3286.  
  3287. IF PANSTRFUN[0] EQ 0 THEN
  3288. BEGIN # NO FUNCTION LIST #
  3289. IF TERFUNCGEN[0] AND ORDINAL EQ GENERICST"GSTOP" THEN
  3290. BEGIN # DEFAULT STOP ACTION #
  3291. IF TERSOFTTAB[0] EQ 0 THEN
  3292. BEGIN # IF NO SOFT TABS PENDING #
  3293. GOTO ABNORTOAPP;
  3294. END
  3295. ELSE
  3296. BEGIN # IF SOFT TABS PENDING #
  3297. GOTO NOACTION;
  3298. END
  3299. END
  3300. IF TERFUNCGEN[0] AND ORDINAL EQ GENERICST"GHELP" THEN
  3301. BEGIN # IF HELP REQUESTED #
  3302. GOTO GIVEHELP; # PROVIDE HELP #
  3303. END
  3304. GOTO NORMTOAPP; # TAKE DEFAULT ACTION #
  3305. END
  3306.  
  3307. NOTDONE = TRUE;
  3308. FOR I = 0 STEP 1 WHILE NOTDONE AND FUNWORD[I] NQ 0 DO
  3309. BEGIN # LOOK FOR ENTRY IN FUNLIST #
  3310. IF ((FUNGENERIC[I] AND TERFUNCGEN[0])
  3311. OR (NOT FUNGENERIC[I] AND NOT TERFUNCGEN[0]))
  3312. AND FUNNUMBER[I] EQ ORDINAL THEN
  3313. BEGIN # FOUND FUNLIST ENTRY #
  3314. NOTDONE = FALSE;
  3315. ACTION = FUNACT[I]; # ASSIGN DEFINED ACTION #
  3316. END
  3317. END
  3318.  
  3319. IF NOTDONE THEN
  3320. BEGIN # NOT IN LIST #
  3321. IF TERFUNCGEN[0] AND ORDINAL EQ GENERICST"GHELP" THEN
  3322. BEGIN
  3323. GOTO GIVEHELP;
  3324. END
  3325. ELSE GOTO TABSOFTLY; # PROCESS SOFT TAB #
  3326. END
  3327. IF TERFUNCGEN[0] AND ORDINAL EQ GENERICST"GHELP"
  3328. AND FIELD NQ -1 THEN
  3329. BEGIN # HELP KEY ENTERED IN A FIELD #
  3330. IF VARHSOS[FLDVARORD[FIELD]] NQ 0 THEN
  3331. BEGIN # HELP STRING DEFINED #
  3332. GOTO GIVEHELP; # GIVE HELP #
  3333. END
  3334. END
  3335. IF TERSOFTTAB[0] NQ 0 AND ACTION NQ FM AND ACTION NQ FH THEN
  3336. BEGIN # IF SOFT TABS PENDING #
  3337. GOTO NOACTION; # IGNORE UNLESS MATCH OR HELP #
  3338. END
  3339. ELSE
  3340. BEGIN # NO SOFT TABS PENDING #
  3341. GOTO ACTTYPE[ACTION]; # GO TO ASSIGNED ACTION #
  3342. END
  3343.  
  3344. PAGEFORWARD: # CURRENTLY A NO-OP #
  3345. PAGEBAKWARD: # CURRENTLY A NO-OP #
  3346. INSERTROW: # CURRENTLY A NO-OP #
  3347. DELETEROW: # CURRENTLY A NO-OP #
  3348.  
  3349. TERNRMTERM[0] = FALSE;
  3350. TERABNTERM[0] = FALSE;
  3351. RETURN;
  3352.  
  3353. TABSOFTLY: # PROCESS SOFT TAB #
  3354.  
  3355. IF TERSOFTTAB[0] EQ 0 THEN TERSOFTPOS[0] = INPOS;
  3356. TERSOFTTAB[0] = TERSOFTTAB[0] + 1; # INCREMENT TAB COUNT #
  3357.  
  3358. NOACTION: # NO ACTION TO OCCUR #
  3359.  
  3360. TERNRMTERM[0] = FALSE;
  3361. TERABNTERM[0] = FALSE;
  3362. RETURN;
  3363.  
  3364. NORMTOAPP: # NORMAL TERMINATION AND #
  3365. # RETURN TO APPLICATION #
  3366. TERNRMTERM[0] = TRUE;
  3367. TERABNTERM[0] = FALSE;
  3368. RETURN;
  3369.  
  3370. NORMTONOS: # NORMAL TERMINATION AND RETURN #
  3371. # TO OPERATING SYSTEM #
  3372. TERNRMTERM[0] = TRUE;
  3373. TERABNTERM[0] = FALSE;
  3374. RETURN;
  3375.  
  3376. ABNORTOAPP: # ABNORMAL TERMINATION AND #
  3377. # RETURN TO APPLICATION #
  3378. TERNRMTERM[0] = FALSE;
  3379. TERABNTERM[0] = TRUE;
  3380. RETURN;
  3381.  
  3382. ABNORTONOS: # ABNORMAL TERMINATION AND #
  3383. # RETURN TO OPERATING SYSTEM #
  3384. TERNRMTERM[0] = FALSE;
  3385. TERABNTERM[0] = TRUE;
  3386. RETURN;
  3387.  
  3388. GIVEHELP: # PROVIDE HELP #
  3389.  
  3390. IF TERSOFTTAB[0] NQ 0 THEN
  3391. BEGIN # IF SOFT TABS PENDING #
  3392. TERPENDHLP[0] = TRUE; # SET HELP PENDING FLAG #
  3393. END
  3394. ELSE
  3395. BEGIN # NO SOFT TABS PENDING #
  3396. IF FIELD EQ -1 THEN
  3397. BEGIN
  3398. TABKEY(SCREENST"FTAB",INPOS,FIELD,SCRPOS); # TAB TO NEXT FIELD #
  3399. IF FIELD EQ -1 THEN TABKEY(SCREENST"FTAB",SCRPOS,FIELD,SCRPOS);
  3400. TERHELPFLD[0] = FIELD;
  3401. FIELD = -1;
  3402. END
  3403. ELSE
  3404. BEGIN # GIVE HELP FOR THIS FIELD #
  3405. TERHELPFLD[0] = FIELD;
  3406. END
  3407. TERHELPREQ[0] = TRUE;
  3408. END
  3409. RETURN;
  3410.  
  3411. MATCHADV: # ADVANCE MATCH ENTRY #
  3412.  
  3413. IF TERSOFTTAB[0] NQ 0 OR NOT VALIDFIELD THEN GOTO TABSOFTLY;
  3414. IF FIELD EQ -1 THEN GOTO TABSOFTLY;
  3415. VARIND = FLDVARORD[FIELD];
  3416. IF (NOT VARVALM[VARIND]) OR (VARVALOS[VARIND] EQ 0)
  3417. THEN GOTO TABSOFTLY;
  3418. FMATCH(FIELD,MATCHIND,MATCHCOUNT);
  3419. IF PANVERSION[0] GR 0 THEN
  3420. BEGIN # IF ENTRIES CAN BE ANY LENGTH #
  3421. MATCHIND = MATCHIND + (FLDLENGTH[FIELD]+9)/10;
  3422. END
  3423. ELSE
  3424. BEGIN # IF ENTRIES ONLY 10 CHARACTERS #
  3425. MATCHIND = MATCHIND + 1;
  3426. END
  3427. IF MATCHWORD[MATCHIND] EQ 0 THEN MATCHIND = 0; # IF WRAPAROUND #
  3428. MMATCH(MATCHIND,FIELD); # MOVE MATCH ENTRY TO FIELD #
  3429. RETURN;
  3430.  
  3431. END # FUNKEY#
  3432. CONTROL EJECT;
  3433.  
  3434. PROC GETADD(PANELNAME,PANELADDR,PLTINDEX);
  3435.  
  3436. # TITLE GETADD - GETS PANEL ADDRESS. #
  3437.  
  3438. BEGIN # GETADD #
  3439.  
  3440. #
  3441. ** GETADD - GET ADDRESS.
  3442. *
  3443. * THIS PROCEDURE GETS THE MEMORY ADDRESS FOR THE SPECIFIED
  3444. * PANEL FROM THE PANEL LOAD TABLE. IF THE PANEL IS NOT IN
  3445. * THE PANEL LOAD TABLE OR HAS NOT BEEN OPENED FOR USE THEN
  3446. * A DAYFILE MESSAGE WILL BE ISSUED AND CONTROL WILL BE RE-
  3447. * TURNED TO THE OPERATING SYSTEM.
  3448. *
  3449. * PROC GETADD(PANELNAME,PANELADDR,PLTINDEX)
  3450. *
  3451. * ENTRY PANELNAME = THE NAME OF THE PANEL.
  3452. *
  3453. * EXIT PANELADDR = THE ADDRESS OF THE PANEL RECORD.
  3454. * TO O.S. IF THE ADDRESS IS NOT FOUND
  3455. * OR THE PANEL IS NOT OPEN.
  3456. * PLTINDEX = THE PANEL LOAD TABLE INDEX FOR THE PANEL.
  3457. *
  3458. * CALLS ERRMSG.
  3459. *
  3460. * NOTES IF THE PANEL IS NOT IN THE PANEL LOAD TABLE THEN
  3461. * THE APPLICATION HAS NOT OPENED THE PANEL FOR USE
  3462. * OR HAS IGNORED AN ERROR RETURN FROM SFOPEN AFTER
  3463. * ATTEMPTING TO DO SO. IF THE PANEL IS IN THE LOAD
  3464. * TABLE BUT NOT OPEN IT IS A STATICALLY LOADED PANEL
  3465. * THAT THE APPLICATION HAS NOT YET OPENED. IN EITHER
  3466. * CASE PROCEDURE ERRMSG IS CALLED TO ISSUE A DAYFILE
  3467. * MESSAGE AND RETURN CONTROL TO THE OPERATING SYSTEM.
  3468. #
  3469. ITEM PANELNAME C(7); # PANEL NAME #
  3470. ITEM PANELADDR I; # PANEL ADDRESS #
  3471. ITEM PLTINDEX I; # PANEL LOAD TABLE INDEX #
  3472.  
  3473. ITEM CHARINDEX I; # CHARACTER INDEX #
  3474. ITEM FATAL B = TRUE; # FATAL ERROR #
  3475. ITEM INDEX I; # INDEX INTO PANEL LOAD TABLE #
  3476. ITEM MSG C(25) = " NOT OPENED. "; # ERROR MSG. #
  3477. ITEM PNAME C(6); # PROCEDURE NAME #
  3478.  
  3479. PANELADDR = 0;
  3480. FOR INDEX = 1 STEP 1 WHILE PANELADDR EQ 0
  3481. AND INDEX LQ PLTNUMENT[0] DO
  3482. BEGIN # FIND SPECIFIED PANEL #
  3483. IF PLTENAME[INDEX] EQ PANELNAME
  3484. AND PLTOPENFLG[INDEX] THEN
  3485. BEGIN # IF SPECIFIED PANEL FOUND #
  3486. PANELADDR = PLTADDR[INDEX]; # RETURN ADDRESS #
  3487. PLTINDEX = INDEX;
  3488. RETURN;
  3489. END
  3490. END
  3491.  
  3492. IF TERSHOWFLG[0] THEN
  3493. BEGIN # IF SFSSHO CALL #
  3494. PNAME = "SFSSHO";
  3495. END
  3496. ELSE
  3497. BEGIN # IF SFSREA CALL #
  3498. IF TERREADFLG[0] THEN
  3499. BEGIN
  3500. PNAME = "SFSREA";
  3501. END
  3502. ELSE # SFSWRI CALL #
  3503. BEGIN
  3504. PNAME = "SFSWRI";
  3505. END
  3506. END
  3507. ERRMSG(PANELNAME,PNAME,MSG,FATAL); # ISSUE MESSAGE AND ABORT #
  3508.  
  3509. END # GETADD #
  3510. CONTROL EJECT;
  3511.  
  3512. PROC GETNUM(FLDIND,CHARPOS,VALUE,NUMDIG);
  3513.  
  3514. # TITLE GETNUM - GET NUMERIC VALUE OF SUBFIELD. #
  3515.  
  3516. BEGIN # GETNUM #
  3517.  
  3518. #
  3519. ** GETNUM - GET NUMERIC VALUE OF SUBFIELD.
  3520. *
  3521. * GETNUM GETS THE NUMERIC VALUE OF A SUBFIELD STARTING AT
  3522. * CHARPOS AND ENDING AT THE FIRST NON-NUMERIC INPUT OR AT
  3523. * THE END OF THE FIELD.
  3524. *
  3525. * PROC GETNUM(FLDIND,CHARPOS,VALUE,NUMDIG)
  3526. *
  3527. * ENTRY FLDIND = INDEX IN FLDLIST.
  3528. * CHARPOS = STARTING CHARACTER POSITION IN FIELD.
  3529. * VALUE = STARTING VALUE.
  3530. *
  3531. * EXIT CHARPOS = ENDING CHARACTER POSITION IN FIELD.
  3532. * VALUE = ENDING VALUE.
  3533. * NUMDIG = NUMBER OF DIGITS IN SUBFIELD.
  3534. #
  3535. ITEM FLDIND I; # INDEX IN FLDLIST #
  3536. ITEM CHARPOS I; # POSITION OF CHARACTER IN FIELD #
  3537. ITEM VALUE I; # NUMERIC VALUE OF SUBFIELD #
  3538. ITEM NUMDIG I; # NUMBER OF DIGITS IN SUBFIELD #
  3539.  
  3540. ITEM CHAR I; # INPUT CHARACTER #
  3541. ITEM SAMESUBFLD B; # STILL IN SAME SUBFIELD #
  3542.  
  3543. SAMESUBFLD = TRUE;
  3544. NUMDIG = 0;
  3545.  
  3546. WHYLE SAMESUBFLD AND CHARPOS LQ FLDLENGTH[FLDIND] -1 DO
  3547. BEGIN
  3548. CHAR = NEXTCHAR(FLDIND,CHARPOS);
  3549. IF CHAR GQ ZEROCH AND CHAR LQ NINECH THEN
  3550. BEGIN # IF CHARACTER IS NUMERIC #
  3551. VALUE = 10 * VALUE + (CHAR LXR ZEROCH);
  3552. NUMDIG = NUMDIG + 1;
  3553. CHARPOS = CHARPOS + 1;
  3554. END
  3555. ELSE
  3556. BEGIN # END OF SUBFIELD #
  3557. SAMESUBFLD = FALSE;
  3558. END
  3559. END
  3560.  
  3561. END # GETNUM #
  3562. CONTROL EJECT;
  3563.  
  3564. PROC GFIELD(VARNAME,USEROW,FLDIND);
  3565.  
  3566. # TITLE GFIELD - GET FIELD INDEX. #
  3567.  
  3568. BEGIN # GFIELD #
  3569.  
  3570. #
  3571. ** GFIELD - GET FIELD INDEX.
  3572. *
  3573. * THIS PROCEDURE GETS THE FIELD INDEX FOR THE VARIABLE VARNAME.
  3574. *
  3575. * PROC GFIELD(VARNAME,USEROW,FLDIND)
  3576. *
  3577. * ENTRY VARNAME = VARIABLE NAME OF FIELD.
  3578. * USEROW = TRUE, USE TERCURSROW.
  3579. * = FALSE, USE ARRCURROW.
  3580. *
  3581. * EXIT FLDIND = FIELD INDEX.
  3582. * = -1 IF NOT FOUND.
  3583. #
  3584. ITEM VARNAME C(7); # VARIABLE NAME OF FIELD #
  3585. ITEM USEROW B; # USE TERCURSROW #
  3586. ITEM FLDIND I; # POINTER TO FIELD LIST #
  3587.  
  3588. ITEM ARRAYORD I; # ARRAY ORDINAL #
  3589. ITEM FOUND B; # FIELD HAS BEEN FOUND #
  3590. ITEM I I; # LOOP COUNTER #
  3591. ITEM ROWNUMBER I; # ROW NUMBER #
  3592. ITEM VARIND I; # POINTER TO VARIABLE LIST #
  3593.  
  3594. FLDIND = -1;
  3595. FOUND = FALSE;
  3596.  
  3597. FOR I = 0 STEP 1 WHILE VARTYPE[I] NQ 0 AND NOT FOUND DO
  3598. BEGIN # LOOK FOR VARIABLE VARNAME #
  3599. IF VARNME[I] EQ VARNAME THEN
  3600. BEGIN # FOUND SPECIFIED VARIABLE #
  3601. FOUND = TRUE;
  3602. VARIND = I;
  3603. END
  3604. END
  3605.  
  3606. IF FOUND THEN
  3607. BEGIN
  3608. ARRAYORD = VARARRORD[VARIND];
  3609. IF ARRAYORD NQ 0 THEN
  3610. BEGIN # ARRAY MEMBER #
  3611. ROWNUMBER = 0;
  3612. IF USEROW THEN
  3613. BEGIN # USE TERCURSROW #
  3614. IF TERCURSSET[0] AND TERCURSROW[0] LS ARRNUMROWS[ARRAYORD-1] THEN
  3615. BEGIN # VALID ROW NUMBER #
  3616. ROWNUMBER = TERCURSROW[0];
  3617. END
  3618. END
  3619. ELSE
  3620. BEGIN # USE CURRENT ROW #
  3621. ROWNUMBER = ARRCURROW[ARRAYORD-1];
  3622. END
  3623. VARIND = VARIND + ARRNUMVARS[ARRAYORD-1]*ROWNUMBER;
  3624. END
  3625. FLDIND = VARFLDNUM[VARIND] - 1; # ADJUST PDU VALUE #
  3626. END
  3627.  
  3628. END # GFIELD #
  3629. CONTROL EJECT;
  3630.  
  3631. PROC IRANGE(FLDIND,VALUE,EVALUE);
  3632.  
  3633. # TITLE IRANGE - RANGE VALIDATION FOR INTEGER VARIABLES. #
  3634.  
  3635. BEGIN # IRANGE #
  3636.  
  3637. #
  3638. ** IRANGE - RANGE VALIDATION FOR INTEGER VARIABLES.
  3639. *
  3640. * THIS PROCEDURE VALIDATES THAT INPUT TO THE FIELD POINTED TO
  3641. * BY FLDIND IS WITHIN THE RANGE SPECIFIED IN THE PANEL RECORD.
  3642. *
  3643. * PROC IRANGE(FLDIND,VALUE,EVALUE)
  3644. *
  3645. * ENTRY FLDIND = INDEX OF CURRENT FIELD IN FLDLIST.
  3646. * VALUE = THE INTEGER VALUE OF THE INPUT.
  3647. * EVALUE = THE EXPONENT VALUE OF THE INPUT
  3648. *
  3649. * EXIT FLDVALID[FLDIND] = FALSE, IF INPUT IS INVALID.
  3650. #
  3651. ITEM FLDIND I; # INDEX OF VARIABLE TO VALIDATE #
  3652. ITEM VALUE I; # INTEGER VALUE OF INPUT #
  3653. ITEM EVALUE I; # EXPONENT VALUE OF INPUT #
  3654.  
  3655. ITEM MAXVAL I; # MAXIMUM ALLOWED VALUE #
  3656. ITEM MINVAL I; # MINIMUM ALLOWED VALUE #
  3657. ITEM OFFSET I; # OFFSET OF VALIDATION IN RECORD #
  3658. ITEM VARIND I; # INDEX INTO VARLIST #
  3659.  
  3660. VARIND = FLDVARORD[FLDIND];
  3661. OFFSET = VARVALOS[VARIND];
  3662. MINVAL = RECWORDU[OFFSET]; # MINIMUM VALID VALUE #
  3663. MAXVAL = RECWORDU[OFFSET + 1]; # MAXIMUM VALID VALUE #
  3664.  
  3665. IF VARPICTYPE[FLDVARORD[FLDIND]] EQ FORMTYPE"$" THEN
  3666. BEGIN # WEIGHT CURRENCY INPUT #
  3667. IF EVALUE EQ 0 THEN
  3668. BEGIN
  3669. VALUE = VALUE * 100;
  3670. END
  3671. ELSE
  3672. BEGIN
  3673. IF EVALUE EQ -1 THEN VALUE = VALUE * 10;
  3674. END
  3675. END
  3676.  
  3677. IF VALUE LS MINVAL OR VALUE GR MAXVAL THEN
  3678. BEGIN # IF VALUE OUTSIDE OF RANGE #
  3679. FLDVALID[FLDIND] = FALSE;
  3680. END
  3681.  
  3682. END # IRANGE #
  3683. CONTROL EJECT;
  3684.  
  3685. PROC MATCHV(FLDIND);
  3686.  
  3687. # TITLE MATCHV - MATCH VALIDATION. #
  3688.  
  3689. BEGIN # MATCHV #
  3690.  
  3691. #
  3692. ** MATCHV - MATCH VALIDATION.
  3693. *
  3694. * THIS PROCEDURE PERFORMS MATCH VALIDATION FOR THE VARIABLE
  3695. * USING THE MATCH LIST IN THE PANEL RECORD.
  3696. *
  3697. * PROC MATCHV(FLDIND)
  3698. *
  3699. * ENTRY FLDIND = POINTER INTO FLDLIST OF CURRENT FIELD.
  3700. *
  3701. * EXIT FLDVALID[FLDIND] = FALSE, IF INPUT IS INVALID.
  3702. *
  3703. * CALLS FMATCH, MMATCH.
  3704. #
  3705. ITEM FLDIND I; # INDEX OF FIELD IN FLDLIST #
  3706.  
  3707. ITEM MATCHIND I; # INDEX INTO MATCHLIST #
  3708. ITEM MATCHCOUNT I; # NUMBER OF VALID MATCHES #
  3709.  
  3710. IF VARVALOS[FLDVARORD[FLDIND]]
  3711. EQ 0 THEN RETURN; # IF NO VALIDATION REQUIRED #
  3712.  
  3713. FMATCH(FLDIND,MATCHIND,MATCHCOUNT); # FIND MATCH #
  3714.  
  3715. IF ABS(MATCHCOUNT) NQ 1 THEN
  3716. BEGIN # NO MATCH OR TOO MANY MATCHES #
  3717. FLDVALID[FLDIND] = FALSE;
  3718. END
  3719. ELSE
  3720. BEGIN # EXACT OR PARTIAL MATCH FOUND #
  3721. MMATCH(MATCHIND,FLDIND); # RETURN IDENTICAL MATCH VALUE #
  3722. END
  3723.  
  3724. END # MATCHV #
  3725. CONTROL EJECT;
  3726.  
  3727. PROC MCLEAN(MCOUNT,MSGFIT);
  3728.  
  3729. # TITLE MCLEAN - MESSAGE CLEAN. #
  3730.  
  3731. BEGIN # MCLEAN #
  3732.  
  3733. #
  3734. ** MCLEAN - MESSAGE CLEAN.
  3735. *
  3736. * THIS PROCEDURE CLEANS THE MESSAGE AREA.
  3737. *
  3738. * PROC MCLEAN(MCOUNT,MSGFIT)
  3739. *
  3740. * EXIT MCOUNT = THE LENGTH OF THE MESSAGE AREA.
  3741. * MSGFIT = TRUE, IF LONGEST MESSAGE WILL FIT.
  3742. *
  3743. * CALLS VDTCHR, VDTCLL, VDTPOS, VDTSAM.
  3744. *
  3745. * USES TERMESWRIT.
  3746. #
  3747. ITEM MCOUNT I; # LENGTH OF MESSAGE AREA #
  3748. ITEM MSGFIT B; # TRUNCATION FLAG #
  3749.  
  3750. ITEM I I; # LOOP VARIABLE #
  3751.  
  3752. IF PANMSGLEN[0] LS TERNUMCOLS[0] THEN
  3753. BEGIN # IF LONGEST MESSAGE FITS #
  3754. MSGFIT = TRUE;
  3755. MCOUNT = PANMSGLEN[0] -1;
  3756. IF MCOUNT LS 24 THEN MCOUNT = 24; # LONGEST SMF MESSAGE #
  3757. END
  3758. ELSE
  3759. BEGIN # USER HELP MAY NEED TRUNCATION #
  3760. MSGFIT = FALSE;
  3761. MCOUNT = TERNUMCOLS[0] - 1;
  3762. END
  3763.  
  3764. VDTSAM(ATTMASK[0]); # SET MESSAGE ATTRIBUTES #
  3765. IF TERTABPROT[0] THEN
  3766. BEGIN # IF TABS TO UNPROTECTED TRUE #
  3767. VDTPOS(0,0); # POSITION TO MESSAGE AREA #
  3768. FOR I = 0 STEP 1 UNTIL MCOUNT DO
  3769. BEGIN # BLANK OUT MESSAGE AREA #
  3770. VDTCHR(BLANK);
  3771. END
  3772. END
  3773. ELSE
  3774. BEGIN # NO PROTECT #
  3775. VDTCLL(0,0); # POSITION AND CLEAR LINE #
  3776. END
  3777.  
  3778. TERMESWRIT[0] = FALSE; # CLEAR MESSAGE WRITTEN FLAG #
  3779.  
  3780. END # MCLEAN #
  3781. CONTROL EJECT;
  3782.  
  3783. PROC MMATCH(MATCHIND,FIELD);
  3784.  
  3785. # TITLE MMATCH - MOVE MATCH VALUE INTO VARIABLE FIELD . #
  3786.  
  3787. BEGIN # MMATCH #
  3788.  
  3789. #
  3790. ** MMATCH - MOVE MATCH VALUE INTO VARIABLE FIELD.
  3791. *
  3792. * THIS PROCEDURE MOES THE MATCH VALUE INTO THE VARIABLE FIELD
  3793. * IN VARDATA.
  3794. *
  3795. * PROC MMATCH(MATCHIND,FIELD)
  3796. *
  3797. * ENTRY MATCHIND = INDEX INTO MATCHLIST FOR MATCH TO MOVE.
  3798. * FIELD = INDEX OF FIELD TO RECEIVE MATCH VALUE.
  3799. *
  3800. * EXIT FLDENTERED, FLDVALID AND FLDREWRITE FLAGS SET FOR
  3801. * VARIABLE, AS WELL AS TERREWFLDS, MATCH VALUE MOVED.
  3802. *
  3803. * CALLS WRIVCH.
  3804. *
  3805. * USES TERREWFLDS.
  3806. #
  3807. ITEM MATCHIND I; # INDEX INTO MATCHLIST #
  3808. ITEM MATCHLEN I; # MATCH ENTRY LENGTH #
  3809. ITEM FIELD I; # INDEX OF FIELD IN FLDLIST #
  3810.  
  3811. ITEM CHAR I; # 12-BIT CHARACTER #
  3812. ITEM I I; # CHARACTER INDEX #
  3813.  
  3814. MATCHLEN = FLDLENGTH[FIELD];
  3815. IF PANVERSION[0] EQ 0 THEN MATCHLEN = 10;
  3816. FOR I = 0 STEP 1 UNTIL FLDLENGTH[FIELD] - 1 DO
  3817. BEGIN # MOVE MATCH ENTRY TO FIELD #
  3818. IF I LS MATCHLEN THEN
  3819. BEGIN # IF NO BLANK FILL NEEDED #
  3820. CHAR = C<I*2,2>MATCH[MATCHIND];
  3821. END
  3822. ELSE
  3823. BEGIN # MORE THAN TEN CHARACTERS #
  3824. CHAR = BLANK;
  3825. END
  3826. WRIVCH(FIELD,I,CHAR); # WRITE CHARACTER INTO VARDATA #
  3827. END
  3828.  
  3829. TERREWFLDS[0] = TRUE; # SET REWRITE, ENTERED AND VALID #
  3830. FLDVALID[FIELD] = TRUE;
  3831. FLDENTERED[FIELD] = TRUE;
  3832. FLDREWRITE[FIELD] = TRUE;
  3833.  
  3834. END # MMATCH #
  3835. CONTROL EJECT;
  3836.  
  3837. PROC MOVEFLD(VNAME,VLEN,VOS,STRG,SLEN,SOS,CSET,CLEN,COS,IOSTAT);
  3838. BEGIN
  3839. #
  3840. ** MOVEFLD - MOVE FIELD.
  3841. *
  3842. * MOVEFLD TRANSFERS CHARACTERS TO/FROM A SPECIFIED PANEL FIELD
  3843. * FROM/TO A SPECIFIED STRING.
  3844. *
  3845. * PROC MOVEFLD(VNAME,VLEN,VOS,STRG,SLEN,SOS,CSET,CLEN,COS,IOSTAT)
  3846. *
  3847. * ENTRY VNAME = VARIABLE NAME OF FIELD.
  3848. * VLEN = LENGTH OF VARNAME PARAMETER.
  3849. * VOS = OFFSET OF VARNAME PARAMETER.
  3850. * STRG = VARIABLE FIELD STRING.
  3851. * SLEN = LENGTH OF STRING PARAMETER.
  3852. * SOS = OFFSET OF STRING PARAMETER.
  3853. * CSET = CHARACTER SET OF STRING (SEE SFCSET$).
  3854. * CLEN = LENGTH OF CSET PARAMETER.
  3855. * COS = OFFSET OF CSET PARAMETER.
  3856. * IOSTAT = 0, CALL WAS SFGETF.
  3857. * = 1, CALL WAS SFSETF.
  3858. *
  3859. * EXIT STRING MOVED, AND TRANSLATED IF NECESSARY.
  3860. * IOSTAT GQ 0, NUMBER OF 6 BIT CHARACTERS MOVED.
  3861. * LS 0, VARIABLE NOT FOUND IN ACTIVE PANELS.
  3862. #
  3863.  
  3864. ITEM VNAME C(11); # VARIABLE NAME #
  3865. ITEM VLEN I; # LENGTH OF VARNAME PARAMETER #
  3866. ITEM VOS I; # OFFSET INTO VARNAME PARAMETER #
  3867. ITEM STRG C(11); # INSTRING PARAMETER #
  3868. ITEM SLEN I; # LENGTH OF INSTRING #
  3869. ITEM SOS I; # OFFSET INTO INSTRING #
  3870. ITEM CSET C(11); # CHARACTER SET #
  3871. ITEM CLEN I; # LENGTH OF CHARACTER SET #
  3872. ITEM COS I; # OFFSET INTO CHARACTER SET #
  3873. ITEM IOSTAT I; # MOVE DIRECTION, STATUS RETURN #
  3874.  
  3875. ITEM ASCFLAG B; # CURRENT DEFAULT CHARACTER SET #
  3876. ITEM AS8FLAG B; # FLAGS #
  3877. ITEM CHARIND I; # VARDATA WORD CHARACTER INDEX #
  3878. ITEM CHARNUM I; # START OF FIELD IN VARDATA #
  3879. ITEM FLDIND I; # FIELD ORDINAL #
  3880. ITEM FLDLEN I; # FIELD LENGTH #
  3881. ITEM FROMCHAROS I; # SOURCE STRING OFFSET #
  3882. ITEM I I; # LOOP COUNTER #
  3883. ITEM TOCHAROS I; # DESTINATION STRING OFFSET #
  3884. ITEM USEROW B = FALSE; # DON-T USE CURSORROW #
  3885. ITEM VAR C(7); # VARIABLE NAME LEFT JUSTIFIED #
  3886. ITEM WORDIND I; # WORD INDEX INTO VARDATA #
  3887.  
  3888.  
  3889. IF VLEN LS 1 THEN VLEN = 7;
  3890. VAR = C<VOS,VLEN>VNAME;
  3891. GFIELD(VAR,USEROW,FLDIND); # GET ASSOCIATED FIELD #
  3892. IF FLDIND LS 0 THEN
  3893. BEGIN # IF FIELD NOT FOUND #
  3894. IOSTAT = -1;
  3895. RETURN;
  3896. END
  3897. ASCFLAG = TERASCFLAG[0]; # SAVE CURRENT CHARACTER SET #
  3898. AS8FLAG = TERAS8FLAG[0];
  3899. IF C<COS,1>CSET NQ " " THEN SFCSET$(CSET,CLEN,COS);
  3900. CHARNUM = FLDVDTCORD[FLDIND]; # START OF FIELD IN VARDATA #
  3901. WORDIND = CHARNUM/5; # WORD INDEX INTO VARDATA #
  3902. CHARIND = CHARNUM - (5 * WORDIND); # VARDATA WORD CHARACTER INDEX #
  3903. FLDLEN = FLDLENGTH[FLDIND];
  3904. IF IOSTAT EQ 0 THEN
  3905. BEGIN # IF MOVING VARDATA TO INSTRING #
  3906. P<FROMSTRING> = LOC(VDATAU[WORDIND]);
  3907. P<TOSTRING> = LOC(STRG);
  3908. TOCHAROS = SOS; # CHARACTER OFFSET / TO STRING #
  3909. FROMCHAROS = CHARIND*2; # CHARACTER OFFSET / VARDATA #
  3910. IF TERAS8FLAG[0] THEN
  3911. BEGIN # IF NO TRANSLATION REQUIRED #
  3912. IF SLEN LQ 0 THEN SLEN = FLDLEN * 2;
  3913. MVA8A8(FROMCHAROS,TOCHAROS,FLDLEN*2,SLEN,TRUE);
  3914. END
  3915. ELSE
  3916. BEGIN
  3917. IF TERASCFLAG[0] THEN
  3918. BEGIN # IF 6/12 ASCII #
  3919. MVA8AS(TOCHAROS,FROMCHAROS,SLEN,FLDLEN,TRUE);
  3920. END
  3921. ELSE
  3922. BEGIN # IF SIX BIT DISPLAY CODE #
  3923. MVA8DC(TOCHAROS,FROMCHAROS,SLEN,FLDLEN,TRUE);
  3924. END
  3925. END
  3926. END
  3927. ELSE
  3928. BEGIN # IF MOVING OUTSTRING TO VARDATA #
  3929. P<FROMSTRING> = LOC(STRG);
  3930. FROMCHAROS = SOS; # CHARACTER OFFSET / FROM STRING #
  3931. P<TOSTRING> = LOC(VDATAU[WORDIND]);
  3932. TOCHAROS = CHARIND * 2; # CHARACTER OFFSET / VARDATA #
  3933. IF TERAS8FLAG[0] THEN
  3934. BEGIN # IF NO TRANSLATION REQUIRED #
  3935. IF SLEN LQ 0 THEN SLEN = FLDLEN * 2;
  3936. MVA8A8(FROMCHAROS,TOCHAROS,SLEN,FLDLEN*2,TRUE);
  3937. END
  3938. ELSE
  3939. BEGIN
  3940. IF TERASCFLAG[0] THEN
  3941. BEGIN # IF 6/12 ASCII #
  3942. MVASA8(FROMCHAROS,TOCHAROS,SLEN,FLDLEN,TRUE);
  3943. END
  3944. ELSE
  3945. BEGIN # IF SIX BIT DISPLAY CODE #
  3946. MVDCA8(FROMCHAROS,TOCHAROS,SLEN,FLDLEN,TRUE);
  3947. END
  3948. END
  3949. FLDREWRITE[FLDIND] = TRUE;
  3950. TERREWFLDS[0] = FALSE; # REWRITE UPDATED FIELD #
  3951. REWFLD;
  3952. TERREWFLDS[0] = TRUE; # RESET FLAG TO DEFAULT #
  3953. END
  3954. TERASCFLAG[0] = ASCFLAG; # RESTORE INITIAL VALUES #
  3955. TERAS8FLAG[0] = AS8FLAG;
  3956. IOSTAT = SLEN;
  3957. RETURN;
  3958.  
  3959. END # MOVEFLD#
  3960. CONTROL EJECT;
  3961.  
  3962. PROC MOVEST(STRINGADDR,STRINGOS,SLENGTH);
  3963.  
  3964. # TITLE MOVEST - MOVE STRING. #
  3965.  
  3966. BEGIN # MOVEST #
  3967.  
  3968. #
  3969. ** MOVEST - MOVE STRING.
  3970. *
  3971. * THIS PROCEDURE POSITIONS THE BASED ARRAYS TOSTRING
  3972. * AND FROMSTRING AND THEN CALLS THE PROPER PROCEDURE
  3973. * TO DO THE ACTUAL TRANSLATION AND TO MOVE THE STRING
  3974. * FROM OUTSTRING TO VARDATA (IF A WRITE OPERATION IS
  3975. * STARTING) OR FROM VARDATA TO INSTRING (IF A READ
  3976. * OPERATION IS FINISHED).
  3977. *
  3978. * PROC MOVEST(STRINGADDR,STRINGOS,SLENGTH)
  3979. *
  3980. * ENTRY STRINGADDR = THE FIRST WORD ADDRESS OF INSTRING
  3981. * OR OUTSTRING (DEPENDING ON WHICH
  3982. * DIRECTION THE CHARACTER DATA IS
  3983. * BEING MOVED).
  3984. * STRINGOS = CHARACTER OFFSET (IN SIX BIT CHAR-
  3985. * CTERS) INTO EITHER INSTRING OR OUT-
  3986. * STRING (DEPENDING ON WHICH DIRECTION
  3987. * THE CHARACTER DATA IS BEING MOVED).
  3988. * SLENGTH = LENGTH IN SIX BIT CHARACTERS.
  3989. * TERREADFLG = TRUE, IF MOVING FROM VARDATA TO INSTRING
  3990. * DURING AN SFSREA CALL, FALSE IF MOVING
  3991. * FROM OUTSTRING TO VARDATA DURING AN SFS-
  3992. * WRI CALL.
  3993. *
  3994. * EXIT STRING MOVED, AND TRANSLATED IF NECESSARY.
  3995. *
  3996. * CALLS MVASA8, MVA8AS, MVA8A8, MVA8DC, MVDCA8.
  3997. #
  3998. ITEM STRINGADDR I; # ADDRESS OF IN/OUTSTRING #
  3999. ITEM STRINGOS I; # CHARACTER OFFSET INTO STRING #
  4000. ITEM SLENGTH I; # LENGTH IN SIX BIT CHARACTERS #
  4001.  
  4002. ITEM FROMCHAROS I; # CHARACTER OFFSET / FROM STRING #
  4003. ITEM TOCHAROS I; # CHARACTER OFFSET / TO STRING #
  4004.  
  4005. IF NOT TERREADFLG[0] THEN
  4006. BEGIN # IF MOVING OUTSTRING TO VARDATA #
  4007. P<FROMSTRING> = STRINGADDR; # POSITION FROM AND TO STRING #
  4008. P<TOSTRING> = LOC(VDATAU[0]);
  4009. FROMCHAROS = STRINGOS; # CHARACTER OFFSET / FROM STRING #
  4010. TOCHAROS = 0; # NO CHARACTER OFFSET / VARDATA #
  4011. IF TERAS8FLAG[0] THEN
  4012. BEGIN # IF NO TRANSLATION REQUIRED #
  4013. IF SLENGTH LQ 0 THEN SLENGTH = PANNUMBYTE[0] * 2;
  4014. MVA8A8(FROMCHAROS,TOCHAROS,SLENGTH,PANNUMBYTE[0]*2,FALSE);
  4015. END
  4016. ELSE
  4017. BEGIN
  4018. IF TERASCFLAG[0] THEN
  4019. BEGIN # IF SIX TWELVE ASCII #
  4020. MVASA8(FROMCHAROS,TOCHAROS,SLENGTH,PANNUMBYTE[0],FALSE);
  4021. END
  4022. ELSE
  4023. BEGIN # IF SIX BIT DISPLAY CODE #
  4024. MVDCA8(FROMCHAROS,TOCHAROS,SLENGTH,PANNUMBYTE[0],FALSE);
  4025. END
  4026. END
  4027. END
  4028. ELSE
  4029. BEGIN # IF MOVING VARDATA TO INSTRING #
  4030. P<FROMSTRING> = LOC(VDATAU[0]); # POSITION FROM AND TO STRING #
  4031. P<TOSTRING> = STRINGADDR;
  4032. TOCHAROS = STRINGOS; # CHARACTER OFFSET / TO STRING #
  4033. FROMCHAROS = 0; # NO CHARACTER OFFSET / VARDATA #
  4034. IF TERAS8FLAG[0] THEN
  4035. BEGIN # IF NO TRANSLATION REQUIRED #
  4036. IF SLENGTH LQ 0 THEN SLENGTH = PANNUMBYTE[0] * 2;
  4037. MVA8A8(FROMCHAROS,TOCHAROS,PANNUMBYTE[0]*2,SLENGTH,FALSE);
  4038. END
  4039. ELSE
  4040. BEGIN
  4041. IF TERASCFLAG[0] THEN
  4042. BEGIN # IF SIX TWELVE ASCII #
  4043. MVA8AS(TOCHAROS,FROMCHAROS,SLENGTH,PANNUMBYTE[0],FALSE);
  4044. END
  4045. ELSE
  4046. BEGIN # IF SIX BIT DISPLAY CODE #
  4047. MVA8DC(TOCHAROS,FROMCHAROS,SLENGTH,PANNUMBYTE[0],FALSE);
  4048. END
  4049. END
  4050. END
  4051.  
  4052. END # MOVEST #
  4053. CONTROL EJECT;
  4054.  
  4055. PROC MVA8A8(FROMCHAROS,TOCHAROS,FROMLENGTH,TOLENGTH,FILL);
  4056.  
  4057. # TITLE MVA8A8 - MOVE ASCII8 STRING. #
  4058.  
  4059. BEGIN # MVA8A8 #
  4060.  
  4061. #
  4062. ** MVA8A8 - MOVE ASCII8 STRING.
  4063. *
  4064. * THIS PROCEDURE MOVES THE ASCII8 CHARACTER DATA FROM OUTSTRING
  4065. * TO VARDATA BEFORE A WRITE, OR FROM VARDATA TO INSTRING AFTER
  4066. * A READ, USING THE BASED ARRAYS FROMSTRING AND TOSTRING. IF THE
  4067. * DESTINATION FIELD IS SHORTER THAN THE SOURCE FIELD, THE STRING
  4068. * WILL BE TRUNCATED. IF THE SOURCE FIELD IS SHORTER AND *FILL* IS
  4069. * *TRUE*, THE DESTINATION FIELD WILL BE BLANK FILLED.
  4070. *
  4071. * PROC MVA8A8(FROMCHAROS,TOCHAROS,FROMLENGTH,TOLENGTH,FILL)
  4072. *
  4073. * ENTRY BASED ARRAYS FROMSTRING AND TOSTRING POSITIONED.
  4074. * FROMCHAROS = THE CHARACTER OFFSET INTO FROMSTRING.
  4075. * TOCHAROS = THE CHARACTER OFFSET INTO TOSTRING.
  4076. * FROMLENGTH = LENGTH OF SOURCE FIELD.
  4077. * TOLENGTH = LENGTH OF DESTINATION FIELD.
  4078. * FILL = TRUE IF BLANK FILL REQUIRED.
  4079. *
  4080. * EXIT STRING MOVED.
  4081. *
  4082. * NOTE THE FIELD LENGTHS SPECIFY THE NUMBER OF SIX-BIT PARCELS
  4083. * RATHER THAN THE NUMBER OF TWELVE-BIT CHARACTERS.
  4084. #
  4085. ITEM FROMCHAROS I; # CHARACTER OFFSET / FROM STRING #
  4086. ITEM TOCHAROS I; # CHARACTER OFFSET / TO STRING #
  4087. ITEM FROMLENGTH I; # FROM STRING LENGTH #
  4088. ITEM TOLENGTH I; # TO STRING LENGTH #
  4089. ITEM FILL B; # TRUE IF BLANK FILL REQUIRED #
  4090.  
  4091. ITEM FROMINDEX I; # INDEX INTO FROMSTRING #
  4092. ITEM NUMCHARS I; # NUMBER OF PARCELS TO MOVE #
  4093. ITEM SPACE I = BLANK; # ASCII SPACE FOR BLANK FILL #
  4094. ITEM TOINDEX I; # INDEX INTO TOSTRING #
  4095.  
  4096. FROMINDEX = 0; # GET FIRST WORD FROM FROMSTRING #
  4097. TOINDEX = 0; # SET TOSTRING INDEX #
  4098. IF TOLENGTH LS FROMLENGTH THEN FROMLENGTH = TOLENGTH;
  4099. FOR NUMCHARS = 1 STEP 2 UNTIL FROMLENGTH DO
  4100. BEGIN # TRANSFER SIX BIT PARCELS #
  4101. C<TOCHAROS,2>TOSTRIU[TOINDEX] =
  4102. C<FROMCHAROS,2>FROMSTRIU[FROMINDEX];
  4103. FROMCHAROS = FROMCHAROS + 2; # INCREMENT FROMSTRING OFFSET #
  4104. IF FROMCHAROS EQ 10 THEN
  4105. BEGIN # IF FROMSTRING WORD IS EMPTY #
  4106. FROMCHAROS = 0; # RESET CHARACTER OFFSET #
  4107. FROMINDEX = FROMINDEX + 1; # UPDATE FROMSTRING WORD INDEX #
  4108. END
  4109. TOCHAROS = TOCHAROS + 2; # INCREMENT TOSTRING OFFSET #
  4110. IF TOCHAROS EQ 10 THEN
  4111. BEGIN # IF TOSTRING WORD IS FULL #
  4112. TOCHAROS = 0; # RESET CHARACTER OFFSET #
  4113. TOINDEX = TOINDEX + 1; # UPDATE TOSTRING WORD INDEX #
  4114. END
  4115. END
  4116. WHYLE FILL AND FROMLENGTH LS TOLENGTH DO
  4117. BEGIN
  4118. TOLENGTH = TOLENGTH - 2;
  4119. C<TOCHAROS,2>TOSTRIU[TOINDEX] = B<48,12>SPACE;
  4120. TOCHAROS = TOCHAROS + 2; # UPDATE TOSTRING OFFSET #
  4121. IF TOCHAROS EQ 10 THEN
  4122. BEGIN # IF TOSTRING WORD EXHAUSTED #
  4123. TOINDEX = TOINDEX + 2; # UPDATE TOSTRING WORD INDEX #
  4124. TOCHAROS = 0;
  4125. END
  4126. END
  4127.  
  4128. END # MVA8A8 #
  4129. CONTROL EJECT;
  4130.  
  4131. PROC MVASA8(STRINGOS,VAROS,SLENGTH,NUMVDCHARS,FILL);
  4132.  
  4133. # TITLE MVASA8 - MOVE AND TRANSLATE ASCII TO ASCII8. #
  4134.  
  4135. BEGIN # MVASA8 #
  4136.  
  4137. #
  4138. ** MVASA8 - MOVE AND TRANSLATE ASCII TO ASCII8.
  4139. *
  4140. * THIS PROCEDURE MOVES THE CHARACTER DATA FROM OUTSTRING TO
  4141. * VARDATA BEFORE A WRITE, USING THE BASED ARRAYS FROMSTRING
  4142. * AND TOSTRING, TRANSLATING FROM ASCII TO ASCII8.
  4143. *
  4144. * PROC MVASA8(STRINGOS,VAROS,SLENGTH,NUMVDCHARS,FILL)
  4145. *
  4146. * ENTRY BASED ARRAYS FROMSTRING AND TOSTRING POSITIONED.
  4147. * STRINGOS = THE CHARACTER OFFSET INTO OUTSTRING.
  4148. * VAROS = THE CHARACTER OFFSET INTO VARDATA.
  4149. * SLENGTH = OUTSTRING LENGTH IN SIX BIT CHARACTERS.
  4150. * NUMVDCHARS = NUMBER OF CHARACTERS IN VARDATA.
  4151. * FILL = TRUE IF BLANK FILL REQUIRED.
  4152. *
  4153. * EXIT STRING MOVED AND TRANSLATED.
  4154. *
  4155. * NOTE SLENGTH IS NOT NECESSARILY THE NUMBER OF CHARACTERS
  4156. * (SINCE THEY CAN BE EITHER SIX OR TWELVE BITS LONG) BUT
  4157. * RATHER THE NUMBER OF SIX BIT PARCELS IN OUTSTRING.
  4158. #
  4159. ITEM STRINGOS I; # CHARACTER OFFSET / OUTSTRING #
  4160. ITEM SLENGTH I; # LENGTH IN SIX BIT CHARACTERS #
  4161. ITEM VAROS I; # CHARACTER OFFSET / VARDATA #
  4162. ITEM NUMVDCHARS I; # NUMBER OF CHARS. IN VARDATA #
  4163. ITEM FILL B; # TRUE IF BLANK FILL REQUIRED #
  4164.  
  4165. ITEM ASCIICHR I; # HOLDS AN ASCII CHARACTER #
  4166. ITEM ASCII8CHR I; # HOLDS AN ASCII8 CHARACTER #
  4167. ITEM ESCAPECODE I; # ESCAPE CODE FOR 12 BIT CHARS. #
  4168. ITEM FROMCHAROS I; # CHARACTER OFFSET / FROMSTRING #
  4169. ITEM FROMINDEX I; # INDEX INTO FROMSTRING #
  4170. ITEM NUMOTCHARS I; # NUMBER OF CHARS. IN OUTSTRING #
  4171. ITEM SPACE I = BLANK; # ASCII SPACE FOR BLANK FILL #
  4172. ITEM TOCHAROS I; # CHARACTER OFFSET / TOSTRING #
  4173. ITEM TOINDEX I; # INDEX INTO TOSTRING #
  4174.  
  4175. FROMINDEX = 0; # GET FIRST WORD FROM FROMSTRING #
  4176. FROMCHAROS = STRINGOS; # CHARACTER OFFSET IN FROMSTRING #
  4177. TOINDEX = 0; # START AT BEGINNING OF VARDATA #
  4178. TOCHAROS = VAROS; # CHARACTER OFFSET IN VARDATA #
  4179. ESCAPECODE = 0; # CLEAR ESCAPE CODE #
  4180. IF SLENGTH GR NUMVDCHARS * 2 OR SLENGTH LQ 0 THEN
  4181. SLENGTH = NUMVDCHARS * 2; # IF LENGTH ADJUSTMENT NEEDED #
  4182. NUMOTCHARS = 0; # INITIALIZE LOOP #
  4183. WHYLE NUMOTCHARS LS SLENGTH AND NUMVDCHARS GR 0 DO
  4184. BEGIN # TRANSLATE CHARACTERS #
  4185. NUMOTCHARS = NUMOTCHARS + 1; # INCREMENT OUTSTRING COUNT #
  4186. ASCIICHR = B<6*FROMCHAROS,6>FROMSTRIU[FROMINDEX];
  4187. FROMCHAROS = FROMCHAROS + 1; # UPDATE FROMSTRING CHAR. OFFSET #
  4188. IF FROMCHAROS EQ 10 THEN
  4189. BEGIN # IF FROMSTRING WORD EXHAUSTED #
  4190. FROMINDEX = FROMINDEX + 1; # UPDATE FROMSTRING WORD INDEX #
  4191. FROMCHAROS = 0;
  4192. END
  4193. IF ESCAPECODE NQ 0 THEN
  4194. BEGIN # IF HALF WAY THROUGH TWELVE BIT #
  4195. IF ESCAPECODE EQ 62 THEN
  4196. BEGIN # IF LOWER CASE ALPHABETIC #
  4197. ASCII8CHR = ASCIICHR + 96;
  4198. END
  4199. ELSE
  4200. BEGIN # IF SPECIAL ASCII CHARACTER #
  4201. ASCII8CHR = AS2A8[ASCIICHR];
  4202. END
  4203. ESCAPECODE = 0; # CLEAR ESCAPE CODE #
  4204. END
  4205. ELSE
  4206. BEGIN # IF SIX BIT ASCII CHARACTER #
  4207. IF ASCIICHR NQ 60 AND ASCIICHR NQ 62 THEN
  4208. BEGIN # IF NOT ESCAPE CODE #
  4209. ASCII8CHR = DC2A8[ASCIICHR];
  4210. END
  4211. ELSE
  4212. BEGIN
  4213. ESCAPECODE = ASCIICHR; # SAVE ESCAPE CODE #
  4214. END
  4215. END
  4216. IF ESCAPECODE EQ 0 THEN
  4217. BEGIN # IF CHARACTER TO MOVE #
  4218. NUMVDCHARS = NUMVDCHARS - 1; # DECREMENT VARDATA COUNT #
  4219. B<6*TOCHAROS,12>TOSTRIU[TOINDEX] = ASCII8CHR;
  4220. TOCHAROS = TOCHAROS + 2; # UPDATE TOSTRING CHAR. OFFSET #
  4221. IF TOCHAROS EQ 10 THEN
  4222. BEGIN # IF TOSTRING WORD IS FULL #
  4223. TOINDEX = TOINDEX + 1; # UPDATE TOSTRING WORD INDEX #
  4224. TOCHAROS = 0; # RESET CHARACTER OFFSET #
  4225. END
  4226. END
  4227. END
  4228. WHYLE FILL AND NUMVDCHARS GR 0 DO
  4229. BEGIN
  4230. NUMVDCHARS = NUMVDCHARS - 1;
  4231. C<TOCHAROS,2>TOSTRIU[TOINDEX] = B<48,12>SPACE;
  4232. TOCHAROS = TOCHAROS + 2; # UPDATE TOSTRING OFFSET #
  4233. IF TOCHAROS EQ 10 THEN
  4234. BEGIN # IF TOSTRING WORD EXHAUSTED #
  4235. TOINDEX = TOINDEX + 1; # UPDATE TOSTRING WORD INDEX #
  4236. TOCHAROS = 0;
  4237. END
  4238. END
  4239.  
  4240. END # MVASA8 #
  4241. CONTROL EJECT;
  4242.  
  4243. PROC MVA8AS(STRINGOS,VAROS,SLENGTH,NUMVDCHARS,FILL);
  4244.  
  4245. # TITLE MVA8AS - MOVE AND TRANSLATE ASCII8 TO ASCII. #
  4246.  
  4247. BEGIN # MVA8AS #
  4248.  
  4249. #
  4250. ** MVA8AS - MOVE AND TRANSLATE ASCII8 TO ASCII.
  4251. *
  4252. * THIS PROCEDURE MOVES THE CHARACTER DATA FROM VARDATA TO
  4253. * INSTRING AFTER A READ, USING THE BASED ARRAYS FROMSTRING
  4254. * AND TOSTRING, TRANSLATING FROM ASCII8 TO ASCII.
  4255. *
  4256. * PROC MVA8AS(STRINGOS,VAROS,SLENGTH,NUMVDCHARS,FILL)
  4257. *
  4258. * ENTRY BASED ARRAYS FROMSTRING AND TOSTRING POSITIONED.
  4259. * STRINGOS = THE CHARACTER OFFSET INTO INSTRING.
  4260. * VAROS = THE CHARACTER OFFSET INTO VARDATA.
  4261. * SLENGTH = INSTRING LENGTH IN SIX BIT CHARACTERS.
  4262. * NUMVDCHARS = NUMBER OF CHARACTERS IN VARDATA.
  4263. * FILL = TRUE IF BLANK FILL REQUIRED.
  4264. *
  4265. * EXIT STRING MOVED AND TRANSLATED.
  4266. *
  4267. * NOTE SLENGTH IS NOT NECESSARILY THE NUMBER OF CHARACTERS
  4268. * (SINCE THEY CAN BE EITHER SIX OR TWELVE BITS LONG) BUT
  4269. * RATHER THE NUMBER OF SIX BIT PARCELS IN INSTRING.
  4270. #
  4271. ITEM STRINGOS I; # CHARACTER OFFSET / OUTSTRING #
  4272. ITEM SLENGTH I; # LENGTH IN SIX BIT CHARACTERS #
  4273. ITEM VAROS I; # CHARACTER OFFSET / VARDATA #
  4274. ITEM NUMVDCHARS I; # NUMBER OF CHARS. IN VARDATA #
  4275. ITEM FILL B; # TRUE IF BLANK FILL REQUIRED #
  4276.  
  4277. ITEM ASCIICHR I; # HOLDS AN ASCII CHARACTER #
  4278. ITEM ASCII8CHR I; # HOLDS AN ASCII8 CHARACTER #
  4279. ITEM ESCAPECODE I; # ESCAPE CODE #
  4280. ITEM FROMCHAROS I; # CHARACTER OFFSET / FROMSTRING #
  4281. ITEM FROMINDEX I; # INDEX INTO FROMSTRING #
  4282. ITEM NUMINCHARS I; # NUMBER OF CHARS. IN INSTRING #
  4283. ITEM TOCHAROS I; # CHARACTER OFFSET / TOSTRING #
  4284. ITEM TOINDEX I; # INDEX INTO TOSTRING #
  4285.  
  4286. FROMINDEX = 0; # GET FIRST WORD FROM FROMSTRING #
  4287. FROMCHAROS = VAROS; # CHARACTER OFFSET / VARDATA #
  4288. TOINDEX = 0;
  4289. TOCHAROS = STRINGOS; # CHARACTER OFFSET / INSTRING #
  4290. ESCAPECODE = 0; # CLEAR ESCAPE CODE #
  4291. IF SLENGTH LQ 0 THEN SLENGTH = NUMVDCHARS * 2;
  4292. NUMINCHARS = 0; # INITIALIZE LOOP #
  4293. WHYLE NUMINCHARS LS SLENGTH AND NUMVDCHARS GR 0 DO
  4294. BEGIN # TRANSLATE CHARACTERS #
  4295. ASCII8CHR = B<6*FROMCHAROS,12>FROMSTRIU[FROMINDEX];
  4296. NUMVDCHARS = NUMVDCHARS - 1; # DECREMENT VARDATA COUNT #
  4297. FROMCHAROS = FROMCHAROS + 2; # UPDATE FROMSTRING CHAR. OFFSET #
  4298. IF FROMCHAROS EQ 10 THEN
  4299. BEGIN # IF FROMSTRING WORD IS EMPTY #
  4300. FROMINDEX = FROMINDEX + 1; # UPDATE FROMSTRING WORD INDEX #
  4301. FROMCHAROS = 0; # RESET CHARACTER OFFSET #
  4302. END
  4303. IF ASCII8CHR GQ 97 THEN
  4304. BEGIN # IF LOWER CASE #
  4305. ESCAPECODE = 62;
  4306. ASCIICHR = ASCII8CHR - 96; # CONVERT TO UPPER CASE #
  4307. END
  4308. ELSE IF ASCII8CHR EQ TERASC8ATD[0] THEN
  4309. BEGIN # IF 64-COLON OR 63-PERCENT #
  4310. ESCAPECODE = 60; # SET ESCAPE CODE AND CHAR. #
  4311. ASCIICHR = 04;
  4312. END
  4313. ELSE IF ASCII8CHR EQ 64 THEN
  4314. BEGIN # IF AT SIGN #
  4315. ESCAPECODE = 60; # SET ESCAPE CODE AND CHAR. #
  4316. ASCIICHR = 01;
  4317. END
  4318. ELSE IF ASCII8CHR EQ 94 THEN
  4319. BEGIN # IF CIRCUMFLEX #
  4320. ESCAPECODE = 60; # SET ESCAPE CODE AND CHAR. #
  4321. ASCIICHR = 02;
  4322. END
  4323. ELSE IF ASCII8CHR EQ 96 THEN
  4324. BEGIN # IF REVERSE SLANT #
  4325. ESCAPECODE = 60; # SET ESCAPE CODE AND CHAR. #
  4326. ASCIICHR = 07;
  4327. END
  4328. IF ESCAPECODE NQ 0 THEN
  4329. BEGIN # IF TWELVE BIT CHARACTER #
  4330. IF NUMINCHARS LS SLENGTH-1 THEN
  4331. BEGIN # IF ROOM FOR ALL TWELVE BITS #
  4332. NUMINCHARS = NUMINCHARS + 1; # INCREMENT CHARACTER COUNT #
  4333. B<6*TOCHAROS,6>TOSTRIU[TOINDEX] = ESCAPECODE;
  4334. TOCHAROS = TOCHAROS + 1; # UPDATE TOSTRING CHAR. OFFSET #
  4335. IF TOCHAROS EQ 10 THEN
  4336. BEGIN # IF TOSTRING WORD IS FULL #
  4337. TOCHAROS = 0; # RESET CHARACTER OFFSET #
  4338. TOINDEX = TOINDEX + 1; # UPDATE TOSTRING WORD INDEX #
  4339. END
  4340. END
  4341. ESCAPECODE = 0; # CLEAR ESCAPE CODE #
  4342. END
  4343. ELSE
  4344. BEGIN
  4345. ASCIICHR = A82DC[ASCII8CHR]; # TRANSLATE CHARACTER #
  4346. END
  4347. IF ESCAPECODE EQ 0 THEN
  4348. BEGIN
  4349. NUMINCHARS = NUMINCHARS + 1; # INCREMENT CHARACTER COUNT #
  4350. B<6*TOCHAROS,6>TOSTRIU[TOINDEX] = ASCIICHR;
  4351. TOCHAROS = TOCHAROS + 1; # UPDATE TOSTRING CHAR. OFFSET #
  4352. IF TOCHAROS EQ 10 THEN
  4353. BEGIN # IF TOSTRING WORD IS FULL #
  4354. TOCHAROS = 0; # RESET CHARACTER OFFSET #
  4355. TOINDEX = TOINDEX + 1; # UPDATE TOSTRING WORD INDEX #
  4356. END
  4357. END
  4358. END
  4359. WHYLE FILL AND NUMINCHARS LS SLENGTH DO
  4360. BEGIN # IF BLANK FILL REQUIRED #
  4361. B<6*TOCHAROS,6>TOSTRIU[TOINDEX] = O"55";
  4362. SLENGTH = SLENGTH - 1; # DECREMENT CHARACTER COUNT #
  4363. TOCHAROS = TOCHAROS + 1; # UPDATE TOSTRING CHAR. OFFSET #
  4364. IF TOCHAROS EQ 10 THEN
  4365. BEGIN # IF TOSTRING WORD IS FULL #
  4366. TOCHAROS = 0; # RESET CHARACTER OFFSET #
  4367. TOINDEX = TOINDEX + 1; # UPDATE TOSTRING WORD INDEX #
  4368. END
  4369. END
  4370.  
  4371. END # MVA8AS #
  4372. CONTROL EJECT;
  4373.  
  4374. PROC MVA8DC(STRINGOS,VAROS,SLENGTH,NUMVDCHARS,FILL);
  4375.  
  4376. # TITLE MVA8DC - MOVE AND TRANSLATE ASCII8 TO DISPLAY CODE. #
  4377.  
  4378. BEGIN # MVA8DC #
  4379.  
  4380. #
  4381. ** MVA8DC - MOVE AND TRANSLATE ASCII8 TO DISPLAY CODE.
  4382. *
  4383. * THIS PROCEDURE MOVES THE CHARACTER DATA FROM VARDATA TO
  4384. * INSTRING AFTER A READ, USING THE BASED ARRAYS FROMSTRING
  4385. * AND TOSTRING, TRANSLATING FROM ASCII8 TO DISPLAY CODE.
  4386. *
  4387. * PROC MVA8DC(STRINGOS,VAROS,SLENGTH,NUMVDCHARS,FILL)
  4388. *
  4389. * ENTRY BASED ARRAYS FROMSTRING AND TOSTRING POSITIONED.
  4390. * STRINGOS = THE CHARACTER OFFSET INTO INSTRING.
  4391. * VAROS = THE CHARACTER OFFSET INTO VARDATA.
  4392. * SLENGTH = INSTRING LENGTH IN SIX BIT CHARACTERS.
  4393. * NUMVDCHARS = LENGTH OF FIELD OR PANEL STRING.
  4394. * FILL = TRUE IF BLANK FILL REQUIRED.
  4395. *
  4396. * EXIT STRING MOVED AND TRANSLATED.
  4397. *
  4398. * NOTES SINCE INSTRING IS DEFINED IN THE APPLICATION PROGRAM
  4399. * AND THUS DOES NOT NECESSARILY START ON A WORD BOUNDARY
  4400. * TOCHAROS IS SET TO STRINGOS BEFORE THE LOOP IS BEGUN.
  4401. #
  4402. ITEM STRINGOS I; # CHARACTER OFFSET / OUTSTRING #
  4403. ITEM SLENGTH I; # LENGTH IN SIX BIT CHARACTERS #
  4404. ITEM VAROS I; # VARIABLE CHARACTER OFFSET #
  4405. ITEM NUMVDCHARS I; # FIELD/PANEL STRING LENGTH #
  4406. ITEM FILL B; # TRUE IF BLANK FILL REQUIRED #
  4407.  
  4408. ITEM FROMCHAROS I; # CHARACTER OFFSET / FROMSTRING #
  4409. ITEM FROMINDEX I; # INDEX INTO FROMSTRING #
  4410. ITEM NUMCHARS I; # NUMBER OF CHARACTERS TO TRANS. #
  4411. ITEM TOCHAROS I; # CHARACTER OFFSET / TOSTRING #
  4412. ITEM TOINDEX I; # INDEX INTO TOSTRING #
  4413.  
  4414. FROMCHAROS = VAROS; # CHARACTER OFFSET / VARDATA #
  4415. FROMINDEX = 0; # GET FIRST WORD FROM VARDATA #
  4416. TOINDEX = 0;
  4417. TOCHAROS = STRINGOS; # CHARACTER OFFSET / INSTRING #
  4418. IF SLENGTH LQ 0 THEN SLENGTH = NUMVDCHARS;
  4419. IF SLENGTH LS NUMVDCHARS THEN NUMVDCHARS = SLENGTH;
  4420. NUMCHARS = 0; # INITIALIZE CHARACTER COUNT #
  4421. WHYLE NUMCHARS LS NUMVDCHARS DO
  4422. BEGIN # MOVE AND TRANSLATE CHARACTER #
  4423. NUMCHARS = NUMCHARS +1; # INCREMENT CHARACTER COUNT #
  4424. B<6*TOCHAROS,6>TOSTRIU[TOINDEX] =
  4425. A82DC[B<6*FROMCHAROS,12>FROMSTRIU[FROMINDEX]];
  4426. FROMCHAROS = FROMCHAROS + 2; # UPDATE FROMSTRING CHAR. OFFSET #
  4427. IF FROMCHAROS EQ 10 THEN
  4428. BEGIN # IF FROMSTRING WORD IS EMPTY #
  4429. FROMCHAROS = 0; # RESET CHARACTER OFFSET #
  4430. FROMINDEX = FROMINDEX + 1; # UPDATE FROMSTRING WORD INDEX #
  4431. END
  4432. TOCHAROS = TOCHAROS + 1; # UPDATE TOSTRING CHAR. OFFSET #
  4433. IF TOCHAROS EQ 10 THEN
  4434. BEGIN # IF TOSTRING WORD IS FULL #
  4435. TOCHAROS = 0; # RESET CHARACTER OFFSET #
  4436. TOINDEX = TOINDEX + 1; # UPDATE TOSTRING WORD INDEX #
  4437. END
  4438. END
  4439. WHYLE FILL AND NUMCHARS LS SLENGTH DO
  4440. BEGIN # IF BLANK FILL REQUIRED #
  4441. SLENGTH = SLENGTH - 1;
  4442. B<6*TOCHAROS,6>TOSTRIU[TOINDEX] = O"55";
  4443. TOCHAROS = TOCHAROS + 1; # UPDATE TOSTRING OFFSET #
  4444. IF TOCHAROS EQ 10 THEN
  4445. BEGIN # IF TOSTRING WORD IS FULL #
  4446. TOCHAROS = 0; # RESET CHARACTER OFFSET #
  4447. TOINDEX = TOINDEX + 1; # UPDATE TOSTRING WORD INDEX #
  4448. END
  4449. END
  4450.  
  4451. END # MVA8DC #
  4452. CONTROL EJECT;
  4453.  
  4454. PROC MVDCA8(STRINGOS,VAROS,SLENGTH,NUMVDCHARS,FILL);
  4455.  
  4456. # TITLE MVDCA8 - MOVE AND TRANSLATE DISPLAY CODE TO ASCII8. #
  4457.  
  4458. BEGIN # MVDCA8 #
  4459.  
  4460. #
  4461. ** MVDCA8 - MOVE AND TRANSLATE DISPLAY CODE TO ASCII8.
  4462. *
  4463. * THIS PROCEDURE MOVES THE CHARACTER DATA FROM OUTSTRING TO
  4464. * VARDATA BEFORE A WRITE, USING THE BASED ARRAYS FROMSTRING
  4465. * AND TOSTRING, TRANSLATING FROM DISPLAY CODE TO ASCII8.
  4466. *
  4467. * PROC MVDCA8(STRINGOS,VAROS,SLENGTH,NUMVDCHARS,FILL)
  4468. *
  4469. * ENTRY BASED ARRAYS FROMSTRING AND TOSTRING POSITIONED.
  4470. * STRINGOS = THE CHARACTER OFFSET INTO OUTSTRING.
  4471. * VAROS = THE CHARACTER OFFSET INTO VARDATA.
  4472. * SLENGTH = OUTSTRING LENGTH IN SIX BIT CHARACTERS.
  4473. * NUMVDCHARS = LENGTH OF FIELD OR PANEL STRING.
  4474. * FILL = TRUE IF BLANK FILL REQUIRED.
  4475. *
  4476. * EXIT STRING MOVED AND TRANSLATED.
  4477. *
  4478. * NOTES SINCE OUTSTRING IS DEFINED IN THE APPLICATION PROGRAM
  4479. * AND THUS DOES NOT NECESSARILY START ON A WORD BOUNDARY
  4480. * FROMCHAROS IS SET TO STRINGOS BEFORE THE LOOP IS BEGUN.
  4481. #
  4482. ITEM STRINGOS I; # CHARACTER OFFSET / OUTSTRING #
  4483. ITEM SLENGTH I; # LENGTH IN SIX BIT CHARACTERS #
  4484. ITEM VAROS I; # VARIABLE CHARACTER OFFSET #
  4485. ITEM NUMVDCHARS I; # FIELD/PANEL STRING LENGTH #
  4486. ITEM FILL B; # TRUE IF BLANK FILL REQUIRED #
  4487.  
  4488. ITEM FROMCHAROS I; # CHARACTER OFFSET / FROMSTRING #
  4489. ITEM FROMINDEX I; # INDEX INTO FROMSTRING #
  4490. ITEM NUMCHARS I; # NUMBER OF CHARACTERS TO TRANS. #
  4491. ITEM SPACE I = BLANK; # ASCII SPACE FOR BLANK FILL #
  4492. ITEM TOCHAROS I; # CHARACTER OFFSET / TOSTRING #
  4493. ITEM TOINDEX I; # INDEX INTO TOSTRING #
  4494.  
  4495. FROMCHAROS = STRINGOS; # CHARACTER OFFSET / OUTSTRING #
  4496. FROMINDEX = 0; # GET FIRST WORD FROM FROMSTRING #
  4497. TOINDEX = 0;
  4498. TOCHAROS = VAROS; # CHARACTER OFFSET / VARDATA #
  4499. IF SLENGTH GR NUMVDCHARS OR SLENGTH LQ 0 THEN
  4500. SLENGTH = NUMVDCHARS; # IF LENGTH ADJUSTMENT NEEDED #
  4501. FOR NUMCHARS = 1 STEP 1 UNTIL SLENGTH DO
  4502. BEGIN # TRANSLATE CHARACTERS #
  4503. B<6*TOCHAROS,12>TOSTRIU[TOINDEX] =
  4504. DC2A8[B<6*FROMCHAROS,6>FROMSTRIU[FROMINDEX]];
  4505. FROMCHAROS = FROMCHAROS + 1; # UPDATE FROMSTRING CHAR. OFFSET #
  4506. IF FROMCHAROS EQ 10 THEN
  4507. BEGIN # IF FROMSTRING WORD IS EMPTY #
  4508. FROMCHAROS = 0; # RESET CHARACTER OFFSET #
  4509. FROMINDEX = FROMINDEX + 1; # UPDATE FROMSTRING WORD INDEX #
  4510. END
  4511. TOCHAROS = TOCHAROS + 2; # UPDATE TOSTRING CHAR. OFFSET #
  4512. IF TOCHAROS EQ 10 THEN
  4513. BEGIN # IF TOSTRING WORD IS FULL #
  4514. TOCHAROS = 0; # RESET CHARACTER OFFSET #
  4515. TOINDEX = TOINDEX + 1; # UPDATE TOSTRING WORD INDEX #
  4516. END
  4517. END
  4518. WHYLE FILL AND SLENGTH LS NUMVDCHARS DO
  4519. BEGIN
  4520. NUMVDCHARS = NUMVDCHARS - 1;
  4521. B&lt;6*TOCHAROS,12>TOSTRIU[TOINDEX] = B<48,12>SPACE;
  4522. TOCHAROS = TOCHAROS + 2; # INCREMENT TOSTRING OFFSET #
  4523. IF TOCHAROS EQ 10 THEN
  4524. BEGIN # IF FROMSTRING WORD IS EMPTY #
  4525. TOCHAROS = 0; # RESET CHARACTER OFFSET #
  4526. TOINDEX = TOINDEX + 1; # UPDATE FROMSTRING WORD INDEX #
  4527. END
  4528. END
  4529.  
  4530. END # MVDCA8 #
  4531. CONTROL EJECT;
  4532.  
  4533. PROC NCHECK(FLDIND,IVAL,EVAL,INPUTTYPE,DOLLARSIGN);
  4534.  
  4535. # TITLE NCHECK - NUMERIC CHECK OF INPUT FIELD. #
  4536.  
  4537. BEGIN # NCHECK #
  4538.  
  4539. #
  4540. ** NCHECK - CHECK NUMERIC FIELD.
  4541. *
  4542. * THIS PROCEDURE CHECKS THAT THE INPUT FITS THE FORMAT SPECIFIED
  4543. * FOR THE FIELD AND CALULATES THE NUMERIC VALUE OF THE INPUT.
  4544. *
  4545. * PROC NCHECK(FLDIND,IVAL,EVAL,INPUTTYPE,DOLLARSIGN)
  4546. *
  4547. * ENTRY FLDIND = INDEX OF CURRENT FIELD IN FLDLIST.
  4548. *
  4549. * EXIT IVAL = INTEGER VALUE OF INPUT.
  4550. * EVAL = EXPONENT VALUE OF INPUT.
  4551. * INPUTTYPE = FORMAT TYPE OF INPUT.
  4552. * DOLLARSIGN = TRUE IF $ IN INPUT.
  4553. * FLDVALID[FLDIND] = FALSE, IF INVALID INPUT.
  4554. *
  4555. * CALLS GETNUM, SKPBLK.
  4556. #
  4557. ITEM FLDIND I; # INDEX IN FLDLIST #
  4558. ITEM IVAL I; # INTEGER VALUE #
  4559. ITEM EVAL I; # EXPONENT VALUE #
  4560. ITEM INPUTTYPE I; # FORMAT TYPE (9 N $ E BAD)#
  4561. ITEM DOLLARSIGN B; # $ IN INPUT #
  4562.  
  4563. ITEM CHAR I; # INPUT CHARACTER #
  4564. ITEM CHARPOS I; # CHARACTER POSITION IN FIELD #
  4565. ITEM COMMADEL I = O"0054"; # COMMA DELIMETER #
  4566. ITEM COMMATHERE B; # COMMA PRESENT FLAG #
  4567. ITEM DECIMALPT B; # DECIMAL POINT IN INPUT #
  4568. ITEM DIGITINT I; # NUMBER OF DIGITS IN INTEGER #
  4569. ITEM DIGITLIMIT I=17; # MAXIMUM DIGITS ALLOWED #
  4570. ITEM DIGITS I; # NUMBER OF DIGITS IN SUBFIELD #
  4571. ITEM DVAL I; # DECIMAL VALUE #
  4572. ITEM ESIGN I; # EXPONENT SIGN VALUE #
  4573. ITEM EXPONLIMIT I=322; # MAXIMUM EXPONENT ALLOWED #
  4574. ITEM I I; # LOOP COUNTER #
  4575. ITEM ISIGN I; # INTEGER SIGN VALUE #
  4576. ITEM PERIODDEL I = O"0056"; # PERIOD DELIMITER #
  4577. ITEM SOMEDIGITS B; # IF ANY NUMERIC INPUT #
  4578. ITEM TVAL I; # TEMPORARY VALUE #
  4579. ITEM VARIND I; # INDEX INTO VARLIST OF VARIABLE #
  4580.  
  4581. SOMEDIGITS = FALSE; # INITIAL VALUES #
  4582. COMMATHERE = FALSE;
  4583. DOLLARSIGN = FALSE;
  4584. DECIMALPT = FALSE;
  4585. VARIND = FLDVARORD[FLDIND];
  4586.  
  4587. CONTROL IFEQ EUROPEAN,1; # IF EUROPEAN CURRENCY FORMAT #
  4588. IF VARPICTYPE[VARIND] EQ FORMTYPE"$" THEN
  4589. BEGIN # CURRENCY FORMAT #
  4590. COMMADEL = PERIOD;
  4591. PERIODDEL = COMMA;
  4592. END
  4593. ELSE
  4594. BEGIN # NOT CURRENCY FORMAT #
  4595. COMMADEL = COMMA;
  4596. PERIODDEL = PERIOD;
  4597. END
  4598. CONTROL FI; # END EUROPEAN #
  4599.  
  4600. INPUTTYPE = FORMTYPE"BAD";
  4601. IVAL = 0;
  4602. DVAL = 0;
  4603. EVAL = 0;
  4604. TVAL = 0;
  4605. ISIGN = 1;
  4606. ESIGN = 1;
  4607. CHARPOS = 0;
  4608. DIGITINT = 0;
  4609.  
  4610. SKPBLK(FLDIND,CHARPOS,CHAR); # FIND START OF FIELD #
  4611.  
  4612. IF UPPER(CHAR) EQ CAPE THEN GOTO EXPSUBFLD; # START OF EXPONENT #
  4613.  
  4614. IF CHAR EQ DOLLAR THEN
  4615. BEGIN # CURRENCY INPUT #
  4616. DOLLARSIGN = TRUE;
  4617. INPUTTYPE = FORMTYPE"$";
  4618. CHARPOS = CHARPOS + 1;
  4619. END
  4620.  
  4621. IF CHAR EQ PLUS OR CHAR EQ MINUS THEN
  4622. BEGIN # SIGNED INPUT #
  4623. INPUTTYPE = FORMTYPE"N";
  4624. IF CHAR EQ MINUS THEN ISIGN = -1;
  4625. CHARPOS = CHARPOS + 1;
  4626. END
  4627.  
  4628. IF CHAR EQ PERIODDEL THEN GOTO DECSUBFLD; # START OF DECIMAL #
  4629.  
  4630. INTSUBFLD: # GET VALUE OF INTEGER SUBFIELD #
  4631.  
  4632. GETNUM(FLDIND,CHARPOS,IVAL,DIGITS);
  4633. DIGITINT = DIGITINT + DIGITS;
  4634. IF (COMMATHERE AND DIGITS NQ 3)
  4635. OR (DIGITINT GR DIGITLIMIT AND VARTYPE[VARIND] GR 1) THEN
  4636. BEGIN
  4637. INPUTTYPE = FORMTYPE"BAD";
  4638. RETURN;
  4639. END
  4640. IF DIGITS NQ 0 THEN SOMEDIGITS = TRUE;
  4641. IF NEXTCHAR(FLDIND,CHARPOS) EQ COMMADEL THEN
  4642. BEGIN # CURRENCY TYPE INPUT #
  4643. IF (NOT COMMATHERE AND DIGITS GR 3) OR DIGITS LS 1 THEN
  4644. BEGIN
  4645. INPUTTYPE = FORMTYPE"BAD";
  4646. RETURN;
  4647. END
  4648. DOLLARSIGN = TRUE;
  4649. COMMATHERE = TRUE;
  4650. IF CHARPOS GQ FLDLENGTH[FLDIND] - 1 THEN GOTO ENDOFFLD;
  4651. CHARPOS = CHARPOS + 1;
  4652. CHAR = NEXTCHAR(FLDIND,CHARPOS);
  4653. IF CHAR LS ZEROCH OR CHAR GR NINECH THEN
  4654. BEGIN # INVALID CHARACTER #
  4655. INPUTTYPE = FORMTYPE"BAD";
  4656. RETURN;
  4657. END
  4658. INPUTTYPE = FORMTYPE"$";
  4659. GOTO INTSUBFLD;
  4660. END
  4661. IVAL = ISIGN * IVAL;
  4662. IF CHARPOS GQ FLDLENGTH[FLDIND] THEN GOTO ENDOFFLD;
  4663. CHAR = NEXTCHAR(FLDIND,CHARPOS); # LOOK AT NEXT CHARACTER #
  4664. IF UPPER(CHAR) EQ CAPE THEN GOTO EXPSUBFLD; # START OF EXPONENT #
  4665. IF CHAR EQ PERIODDEL THEN GOTO DECSUBFLD; # START OF DECIMAL #
  4666. IF CHAR EQ MINUS OR CHAR EQ PLUS AND SOMEDIGITS THEN
  4667. BEGIN # START OF EXPONENT #
  4668. GOTO EXPSUBFLD;
  4669. END
  4670. IF CHAR EQ BLANK THEN GOTO ENDOFFLD; # END OF FIELD #
  4671. INPUTTYPE = FORMTYPE"BAD"; # BAD INPUT #
  4672. RETURN;
  4673.  
  4674. DECSUBFLD: # GET VALUE OF DECIMAL SUBFIELD #
  4675.  
  4676. DECIMALPT = TRUE;
  4677. INPUTTYPE = FORMTYPE"$";
  4678. CHARPOS = CHARPOS + 1;
  4679. IF CHARPOS GQ FLDLENGTH[FLDIND] THEN GOTO ENDOFFLD;
  4680. GETNUM(FLDIND,CHARPOS,DVAL,DIGITS);
  4681. DIGITINT = DIGITINT + DIGITS;
  4682. IF DIGITINT GR DIGITLIMIT AND VARTYPE[VARIND] GR 1 THEN
  4683. BEGIN # TOO MANY DIGITS ENTERED #
  4684. INPUTTYPE = FORMTYPE"BAD";
  4685. RETURN;
  4686. END
  4687. IF DIGITS NQ 0 THEN
  4688. BEGIN # SOME DECIMAL DIGITS ENTERED #
  4689. IF DIGITINT LQ DIGITLIMIT THEN
  4690. BEGIN
  4691. FOR I = 1 STEP 1 UNTIL DIGITS DO
  4692. BEGIN
  4693. IVAL = IVAL * 10;
  4694. END
  4695. IVAL = IVAL + DVAL*ISIGN;
  4696. END
  4697. SOMEDIGITS = TRUE;
  4698. END
  4699. EVAL = -DIGITS;
  4700. IF DIGITS GR 2 THEN INPUTTYPE = FORMTYPE"E";
  4701. IF CHARPOS GQ FLDLENGTH[FLDIND] THEN GOTO ENDOFFLD; # END OF FIELD #
  4702. CHAR = NEXTCHAR(FLDIND,CHARPOS);
  4703. IF CHAR EQ PLUS OR CHAR EQ MINUS
  4704. OR UPPER(CHAR) EQ CAPE THEN
  4705. BEGIN # START OF EXPONENT #
  4706. GOTO EXPSUBFLD;
  4707. END
  4708. IF CHAR EQ BLANK THEN GOTO ENDOFFLD; # END OF FIELD #
  4709. INPUTTYPE = FORMTYPE"BAD";
  4710. RETURN;
  4711.  
  4712. EXPSUBFLD: # GET VALUE OF EXPONENT SUBFIELD #
  4713.  
  4714. INPUTTYPE = FORMTYPE"E";
  4715. IF UPPER(CHAR) EQ CAPE THEN
  4716. BEGIN # SKIP E CHARACTER #
  4717. CHARPOS = CHARPOS + 1;
  4718. CHAR = NEXTCHAR(FLDIND,CHARPOS);
  4719. END
  4720. IF CHAR EQ MINUS THEN
  4721. BEGIN # NEGATIVE EXPONENT #
  4722. ESIGN = -1;
  4723. CHARPOS = CHARPOS + 1;
  4724. CHAR = NEXTCHAR(FLDIND,CHARPOS);
  4725. END
  4726. ELSE IF CHAR EQ PLUS THEN
  4727. BEGIN # POSITIVE EXPONENT #
  4728. CHARPOS = CHARPOS + 1;
  4729. CHAR = NEXTCHAR(FLDIND,CHARPOS);
  4730. END
  4731. GETNUM(FLDIND,CHARPOS,TVAL,DIGITS);
  4732. IF DIGITS EQ 0 OR DIGITS GR DIGITLIMIT THEN
  4733. BEGIN # TOO MANY OR NO DIGITS IN EXP #
  4734. INPUTTYPE = FORMTYPE"BAD";
  4735. RETURN;
  4736. END
  4737. EVAL = ESIGN * TVAL + EVAL;
  4738.  
  4739. ENDOFFLD: # END OF INPUT FIELD #
  4740.  
  4741. IF ABS(EVAL) + DIGITINT GR EXPONLIMIT THEN
  4742. BEGIN # INPUT NUMBER TOO LARGE #
  4743. INPUTTYPE = FORMTYPE"BAD";
  4744. RETURN;
  4745. END
  4746.  
  4747. IF (DOLLARSIGN AND (INPUTTYPE EQ FORMTYPE"E")) OR NOT SOMEDIGITS THEN
  4748. BEGIN # REAL INPUT WITH $ OR NO DIGITS #
  4749. INPUTTYPE = FORMTYPE"BAD";
  4750. RETURN;
  4751. END
  4752.  
  4753. IF SOMEDIGITS AND (FORMTYPE"NINE" GR INPUTTYPE) THEN
  4754. BEGIN # UNSIGNED INTEGER INPUT #
  4755. INPUTTYPE = FORMTYPE"NINE";
  4756. END
  4757.  
  4758. IF CHARPOS LQ FLDLENGTH[FLDIND] -1 THEN
  4759. BEGIN # CHECK FOR EXTRA CHARACTERS #
  4760. FOR I = CHARPOS STEP 1 UNTIL FLDLENGTH[FLDIND] -1 DO
  4761. BEGIN
  4762. IF NEXTCHAR(FLDIND,I) NQ BLANK THEN INPUTTYPE = FORMTYPE"BAD";
  4763. END
  4764. END
  4765.  
  4766. END # NCHECK #
  4767. CONTROL EJECT;
  4768.  
  4769. PROC PICVAL(FLDIND);
  4770.  
  4771. # TITLE PICVAL - PERFORM PICTURE VALIDATION. #
  4772.  
  4773. BEGIN # PICVAL #
  4774.  
  4775. #
  4776. ** PICVAL - PERFORM PICTURE VALIDATION.
  4777. *
  4778. * THIS PROCEDURE VALIDATES THAT INPUT TO THE VARIABLE POINTED TO
  4779. * BY FLDIND CONFORMS WITH THE PICTURE TYPE SPECIFIED IN VARLIST.
  4780. *
  4781. * PROC PICVAL(FLDIND)
  4782. *
  4783. * ENTRY FLDIND = FLDLIST INDEX FOR FIELD TO BE CHECKED.
  4784. *
  4785. * EXIT FLDVALID[FLDIND] = FALSE, IF INPUT IS INVALID.
  4786. *
  4787. * CALLS DATEVL, NCHECK.
  4788. #
  4789. ITEM FLDIND I; # INDEX OF VARIABLE TO VALIDATE #
  4790.  
  4791. ITEM DOLLARSIGN B; # $ IN INPUT #
  4792. ITEM EVAL I; # EXPONENT VALUE OF INPUT #
  4793. ITEM INPIND I; # INDEX OF CHARACTER IN INPUT #
  4794. ITEM INPTYPE I; # FORMAT TYPE OF INPUT #
  4795. ITEM IVAL I; # INTEGER VALUE OF INPUT #
  4796. ITEM NCHAR I; # NEXT CHARACTER IN VARDATA #
  4797. ITEM PTYPE I; # PICTURE TYPE #
  4798. ITEM VARIND I; # INDEX INTO VARLIST OF VARIABLE #
  4799.  
  4800. SWITCH PICTURTYPE # PICTURE TYPE SWITCH #
  4801. ,
  4802. PICX, # X PICTURE(DEFAULT) #
  4803. PICA, # ALPHA PICTURE #
  4804. PIC9, # INTEGER PICTURE #
  4805. PICN, # NUMERIC PICTURE #
  4806. PIC$, # DOLLAR PICTURE #
  4807. PICE, # REAL PICTURE #
  4808. PICY, # YYMMDD DATE PICTURE #
  4809. PICM, # MMDDYY DATE PICTURE #
  4810. PICD; # DDMMYY DATE PICTURE #
  4811.  
  4812. VARIND = FLDVARORD[FLDIND];
  4813. PTYPE = VARPICTYPE[VARIND] ;
  4814.  
  4815. GOTO PICTURTYPE[PTYPE];
  4816.  
  4817. PICX: # DISPLAYABLE CHARACTER TYPE #
  4818.  
  4819. RETURN;
  4820.  
  4821. PICA: # ALPHABETIC FORMAT #
  4822.  
  4823. FOR INPIND = 0 STEP 1 UNTIL FLDLENGTH[FLDIND] -1 DO
  4824. BEGIN
  4825. NCHAR = NEXTCHAR(FLDIND,INPIND);
  4826. IF NOT(NCHAR GQ CAPA AND NCHAR LQ CAPZ)
  4827. AND NOT(NCHAR GQ LOWA AND NCHAR LQ LOWZ)
  4828. AND NOT(NCHAR EQ BLANK) THEN
  4829. BEGIN # NOT ALPHABETIC INPUT #
  4830. FLDVALID[FLDIND] = FALSE;
  4831. END
  4832. END
  4833.  
  4834. RETURN;
  4835.  
  4836. PICY:
  4837. PICM:
  4838. PICD: # DATE FORMATS #
  4839.  
  4840. DATEVL(FLDIND,IVAL,EVAL);
  4841. RETURN;
  4842.  
  4843. PICE: # REAL FORMAT #
  4844. PIC9: # INTEGER FORMAT #
  4845. PICN: # SIGNED INTEGER FORMAT #
  4846. PIC$: # CURRENCY FORMAT #
  4847.  
  4848. NCHECK(FLDIND,IVAL,EVAL,INPTYPE,DOLLARSIGN);
  4849. IF (VARPICTYPE[VARIND] EQ FORMTYPE"E" AND DOLLARSIGN)
  4850. OR INPTYPE GR VARPICTYPE[VARIND] OR INPTYPE EQ FORMTYPE"BAD" THEN
  4851. BEGIN
  4852. FLDVALID[FLDIND] = FALSE;
  4853. END
  4854. RETURN;
  4855.  
  4856. END # PICVAL #
  4857. CONTROL EJECT;
  4858.  
  4859. PROC POSARR(PANELADDR);
  4860.  
  4861. # TITLE POSARR - POSITION PANEL RECORD BASED ARRAYS. #
  4862.  
  4863. BEGIN # POSARR #
  4864.  
  4865. #
  4866. ** POSARR - POSITION PANEL RECORD BASED ARRAYS.
  4867. *
  4868. * THIS PROCEDURE POSITIONS THE BASED ARRAYS THAT DESCRIBE THE
  4869. * FORMAT OF THE INFORMATION IN PANEL RECORD USING THE ADDRESS
  4870. * PASSED IN PANELADDR.
  4871. *
  4872. * PROC POSARR(PANELADDR)
  4873. *
  4874. * ENTRY PANELADDR = FWA OF THE PANEL RECORD IN MEMORY.
  4875. *
  4876. * EXIT ALL PANEL RECORD BASED ARRAYS POSITIONED.
  4877. #
  4878. ITEM PANELADDR I; # THE ADDRESS OF THE PANEL #
  4879.  
  4880. ITEM ZEROWORD I = 0; # DUMMY FIELD LIST #
  4881.  
  4882. P&lt;RECORD> = PANELADDR; # POSITION BASED ARRAYS #
  4883. P&lt;PANELHEADR> = PANELADDR;
  4884. P&lt;VDATA> = PANELADDR + PANHEADLEN;
  4885.  
  4886. IF PANSTRFLD[0] NQ 0 THEN
  4887. BEGIN # IF PANEL HAS FIELD LIST #
  4888. P&lt;FLDLIST> = PANELADDR + PANSTRFLD[0];
  4889. END
  4890. ELSE
  4891. BEGIN # NO FIELD LIST, ONLY BOXES #
  4892. P&lt;FLDLIST> = LOC(ZEROWORD);
  4893. END
  4894.  
  4895. P&lt;VARLIST> = PANELADDR + PANSTRVAR[0];
  4896. P&lt;FUNLIST> = PANELADDR + PANSTRFUN[0];
  4897. P&lt;ATTLIST> = PANELADDR + PANSTRATT[0];
  4898. P&lt;ARRLIST> = PANELADDR + PANSTRARR[0];
  4899. P&lt;BOXLIST> = PANELADDR + PANSTRBOX[0];
  4900.  
  4901. END # POSARR #
  4902. CONTROL EJECT;
  4903.  
  4904. PROC POSTWO(PANELADDR);
  4905.  
  4906. # TITLE POSTWO - POSITION PANEL RECORD BASED ARRAYS FOR SFATTR. #
  4907.  
  4908. BEGIN # POSTWO #
  4909.  
  4910. #
  4911. ** POSTWO - POSITION PANEL RECORD BASED ARRAYS FOR SFATTR.
  4912. *
  4913. * THIS PROCEDURE POSITIONS THE BASED ARRAYS THAT DESCRIBE THE
  4914. * FORMAT OF THE INFORMATION IN PANEL RECORD USING THE ADDRESS
  4915. * PASSED IN PANELADDR FOR USE BY SFATTR.
  4916. *
  4917. * PROC POSTWO(PANELADDR)
  4918. *
  4919. * ENTRY PANELADDR = FWA OF THE PANEL RECORD IN MEMORY.
  4920. *
  4921. * EXIT ALL PANEL RECORD BASED ARRAYS POSITIONED.
  4922. #
  4923. ITEM PANELADDR I; # THE ADDRESS OF THE PANEL #
  4924.  
  4925. ITEM ZEROWORD I = 0; # DUMMY FIELD LIST #
  4926.  
  4927. P&lt;PANEL2HEAD> = PANELADDR;
  4928.  
  4929. IF PAN2STRFLD[0] NQ 0 THEN
  4930. BEGIN # IF PANEL HAS FIELD LIST #
  4931. P&lt;FLD2LIST> = PANELADDR + PAN2STRFLD[0];
  4932. END
  4933. ELSE
  4934. BEGIN # NO FIELD LIST, ONLY BOXES #
  4935. P&lt;FLD2LIST> = LOC(ZEROWORD);
  4936. END
  4937.  
  4938. P&lt;VAR2LIST> = PANELADDR + PAN2STRVAR[0];
  4939. P&lt;ATT2LIST> = PANELADDR + PAN2STRATT[0];
  4940. P&lt;ARR2LIST> = PANELADDR + PAN2STRARR[0];
  4941.  
  4942. END # POSTWO #
  4943. CONTROL EJECT;
  4944.  
  4945. PROC PSTRNG(FLDIND,MESSNUM);
  4946.  
  4947. # TITLE PSTRNG - PRINT MESSAGE STRING. #
  4948.  
  4949. BEGIN # PSTRNG #
  4950.  
  4951. #
  4952. ** PSTRNG - PRINT MESSAGE STRING.
  4953. *
  4954. * THIS PROCEDURE CLEARS THE MESSAGE AREA AND PRINTS A USER OR
  4955. * SMF MESSAGE.
  4956. *
  4957. * PROC PSTRNG(FLDIND,MESSNUM)
  4958. *
  4959. * ENTRY FLDIND = INDEX OF FIELD FOR HELP STRING.
  4960. * MESSNUM = SWITCH VALUE FOR MESSAGE PROMPT.
  4961. *
  4962. * EXIT MESSAGE TRUNCATED IF NECESSARY AND WRITTEN.
  4963. *
  4964. * CALLS CPANEL, MCLEAN, VDTCHR, VDTPOS, VDTSAM, VDTSTR.
  4965. *
  4966. * USES TERHELPREQ, TERMESREAD, TERMESWRIT.
  4967. #
  4968. ITEM FLDIND I; # INDEX INTO FIELD LIST #
  4969. ITEM MESSNUM S:MESSSTAT; # SWITCH FOR MESSAGE PROMPT #
  4970.  
  4971. ITEM CINDEX I; # CHARACTER INDEX INTO MESSAGE #
  4972. ITEM I I; # LOOP VARIABLE #
  4973. ITEM MESCHR I; # HOLDS ONE CHARACTER OF MESSAGE #
  4974. ITEM MCOUNT I; # CHARACTER COUNT FOR MESSAGE #
  4975. ITEM MSGFIT B; # MESSAGE TRUNCATION FLAG #
  4976. ITEM VARIND I; # INDEX INTO VARLIST #
  4977. ITEM WINDEX I; # WORD INDEX INTO MESSAGE #
  4978.  
  4979. *IF UNDEF,QTRM
  4980. ARRAY CONMESS[0:3] P(1);
  4981. BEGIN # PLEASE CONFIRM #
  4982. ITEM CONMESSAGE U(00,00,60) = [
  4983. O"41204154414541414163",
  4984. O"41454040414341574156",
  4985. O"41464151416241550000"];
  4986. END
  4987.  
  4988. ARRAY CORMESS[0:3] P(1);
  4989. BEGIN # PLEASE CORRECT #
  4990. ITEM CORMESSAGE U(00,00,60) = [
  4991. O"41204154414541414163",
  4992. O"41454040414341574162",
  4993. O"41624145414341640000"];
  4994. END
  4995.  
  4996. ARRAY DEFMESS[0:2] P(1);
  4997. BEGIN # PLEASE ENTER #
  4998. ITEM DEFMESSAGE U(00,00,60) = [
  4999. O"41204154414541414163",
  5000. O"41454040414541564164",
  5001. O"41454162000000000000"];
  5002. END
  5003.  
  5004. ARRAY ERRMESS[0:4] P(1);
  5005. BEGIN # PLEASE REENTER INPUT #
  5006. ITEM ERRMESSAGE U(00,00,60) = [
  5007. O"41204154414541414163",
  5008. O"41454040416241454145",
  5009. O"41564164414541624040",
  5010. O"41514156416041654164",
  5011. O"00000000000000000000"];
  5012. END
  5013.  
  5014. ARRAY FUNMESS[0:5] P(1);
  5015. BEGIN # PLEASE PRESS FUNCTION KEY #
  5016. ITEM FUNMESSAGE U(00,00,60) = [
  5017. O"41204154414541414163",
  5018. O"41454040416041624145",
  5019. O"41634163404041464165",
  5020. O"41564143416441514157",
  5021. O"41564040415341454171",
  5022. O"00000000000000000000"];
  5023. END
  5024. *ELSE
  5025. ARRAY CONMESS[0:3] P(1);
  5026. BEGIN # PLEASE CONFIRM #
  5027. ITEM CONMESSAGE U(00,00,60) = [
  5028. O"40404040412041544145",
  5029. O"41414163414540404143",
  5030. O"41574156414641514162",
  5031. O"41550000000000000000"];
  5032. END
  5033.  
  5034. ARRAY CORMESS[0:3] P(1);
  5035. BEGIN # PLEASE CORRECT #
  5036. ITEM CORMESSAGE U(00,00,60) = [
  5037. O"40404040412041544145",
  5038. O"41414163414540404143",
  5039. O"41574162416241454143",
  5040. O"41640000000000000000"];
  5041. END
  5042.  
  5043. ARRAY DEFMESS[0:2] P(1);
  5044. BEGIN # PLEASE ENTER #
  5045. ITEM DEFMESSAGE U(00,00,60) = [
  5046. O"40404040412041544145",
  5047. O"41414163414540404145",
  5048. O"41564164414541620000"];
  5049. END
  5050.  
  5051. ARRAY ERRMESS[0:4] P(1);
  5052. BEGIN # PLEASE REENTER INPUT #
  5053. ITEM ERRMESSAGE U(00,00,60) = [
  5054. O"40404040412041544145",
  5055. O"41414163414540404162",
  5056. O"41454145415641644145",
  5057. O"41624040415141564160",
  5058. O"41654164000000000000"];
  5059. END
  5060.  
  5061. ARRAY FUNMESS[0:5] P(1);
  5062. BEGIN # PLEASE PRESS FUNCTION KEY #
  5063. ITEM FUNMESSAGE U(00,00,60) = [
  5064. O"40404040412041544145",
  5065. O"41414163414540404160",
  5066. O"41624145416341634040",
  5067. O"41464165415641434164",
  5068. O"41514157415640404153",
  5069. O"41454171000000000000"];
  5070. END
  5071. *ENDIF
  5072.  
  5073. BASED ARRAY MESSNAME [0:0] P(1); # MESSAGE STRING #
  5074. BEGIN
  5075. ITEM MESSWORD U(00,00,60); # MESSAGE WORD #
  5076. END
  5077.  
  5078. SWITCH JUMPCASE:MESSSTAT
  5079. JUMPHELP:HELP, # SMF OR USER HELP #
  5080. JUMPCONF:CONFIRM, # PLEASE CONFIRM #
  5081. JUMPRENT:REENTER; # PLEASE RENTER INPUT #
  5082.  
  5083. MCLEAN(MCOUNT,MSGFIT); # CLEAN MESSAGE AREA #
  5084.  
  5085. GOTO JUMPCASE[MESSNUM]; # ISSUE MESSAGE #
  5086.  
  5087. JUMPHELP: # PRINT HELP MESSAGE #
  5088.  
  5089. IF FLDIND NQ -1 THEN
  5090. BEGIN # IF INPUT FIELD #
  5091. VARIND = FLDVARORD[FLDIND];
  5092. IF VARHSOS[VARIND] NQ 0 THEN
  5093. BEGIN # IF USER HELP MESSAGE DEFINED #
  5094. P&lt;MESSNAME> = LOC(RECWORDU[0])+ VARHSOS[VARIND];
  5095. END
  5096. ELSE
  5097. BEGIN # NO USER HELP MESSAGE DEFINED #
  5098. MSGFIT = TRUE; # SMF MESSAGE WILL FIT #
  5099. IF NOT FLDENTERED[FLDIND] THEN
  5100. BEGIN # IF DATA NOT ENTERED IN FIELD #
  5101. P&lt;MESSNAME> = LOC(DEFMESSAGE[0]); # *PLEASE ENTER* #
  5102. END
  5103. ELSE
  5104. BEGIN # DATA ENTERED IN FIELD #
  5105. P&lt;MESSNAME> = LOC(CORMESSAGE[0]); # *PLEASE CORRECT* #
  5106. END
  5107. END
  5108. END
  5109. ELSE
  5110. BEGIN # NO INPUT FIELD #
  5111. MSGFIT = TRUE; # SMF MESSAGE WILL FIT #
  5112. P&lt;MESSNAME> = LOC(FUNMESSAGE[0]); # *PLEASE PRESS FUNCTION KEY* #
  5113. END
  5114. TERHELPREQ[0] = FALSE; # HELP REQUEST HONORED #
  5115. GOTO PRINTMSG;
  5116.  
  5117. JUMPRENT:
  5118.  
  5119. MSGFIT = TRUE; # SMF MESSAGE WILL FIT #
  5120. P&lt;MESSNAME> = LOC(ERRMESSAGE[0]); # *PLEASE REENTER INPUT* #
  5121. GOTO PRINTMSG;
  5122.  
  5123. JUMPCONF:
  5124.  
  5125. MSGFIT = TRUE; # SMF MESSAGE WILL FIT #
  5126. IF FLDIND NQ -1 THEN
  5127. BEGIN # IF INPUT FIELD #
  5128. P&lt;MESSNAME> = LOC(CONMESSAGE[0]); # *PLEASE CONFIRM* #
  5129. END
  5130. ELSE
  5131. BEGIN # NO INPUT FIELD #
  5132. P&lt;MESSNAME> = LOC(FUNMESSAGE[0]); # *PLEASE PRESS FUNCTION KEY* #
  5133. END
  5134.  
  5135. PRINTMSG: # PRINT MESSAGE #
  5136.  
  5137. VDTPOS(0,0); # POSITION TO MESSAGE LINE #
  5138. IF MSGFIT THEN
  5139. BEGIN # IF MESSAGE WILL FIT #
  5140. VDTSTR(MESSNAME); # PRINT ENTIRE MESSAGE #
  5141. END
  5142. ELSE
  5143. BEGIN # TRUNCATE AS NEEDED #
  5144. CONTROL IFEQ QTRMV,0; # IF NOT QTRM VARIANT #
  5145. CINDEX = 2; # SKIP 0007 BYTE #
  5146. CONTROL FI; # END OF IF NOT QTRM #
  5147. CONTROL IFEQ QTRMV,1; # IF QTRM VARIANT #
  5148. CINDEX = 0; # START AT BEGINNING OF LINE #
  5149. CONTROL FI; # END OF IF QTRM #
  5150. WINDEX = 0;
  5151. MESCHR = C&lt;CINDEX,2>MESSWORD[WINDEX];
  5152. FOR I = 0 STEP 1 WHILE MESCHR NQ 0 AND I LQ MCOUNT DO
  5153. BEGIN # WRITE MESSAGE #
  5154. VDTCHR(MESCHR);
  5155. CINDEX = CINDEX + 2;
  5156. IF CINDEX GQ 10 THEN
  5157. BEGIN # IF WORD EXHAUSTED #
  5158. CINDEX = 0; # RESET CHARACTER INDEX #
  5159. WINDEX = WINDEX + 1; # GET NEXT WORD #
  5160. END
  5161. MESCHR = C&lt;CINDEX,2>MESSWORD[WINDEX];
  5162. END
  5163. END
  5164.  
  5165. TERMESWRIT[0] = TRUE; # MESSAGE WRITTEN #
  5166. TERMESREAD[0] = FALSE; # MESSAGE NOT READ BY USER YET #
  5167.  
  5168. IF NOT TERBLCKMDE[0] THEN
  5169. BEGIN
  5170. VDTSAM(0);
  5171. END
  5172. ELSE
  5173. BEGIN
  5174. VDTSAM(O"6001");
  5175. END
  5176. CPANEL; # REWRITE SCREEN AS NEEDED #
  5177.  
  5178. END # PSTRNG #
  5179. CONTROL EJECT;
  5180.  
  5181. PROC READIN(FLDIND,COFFSET);
  5182.  
  5183. # TITLE READIN - READ INPUT FROM TERMINAL. #
  5184.  
  5185. BEGIN # READIN #
  5186.  
  5187. #
  5188. ** READIN - READ INPUT FROM TERMINAL.
  5189. *
  5190. * THIS PROCEDURE READS INPUT FROM THE TERMINAL AND STORES
  5191. * IT IN THE APPROPRIATE PLACE IN VARDATA.
  5192. *
  5193. * PROC READIN(FLDIND,COFFSET)
  5194. *
  5195. * ENTRY FLDIND = INDEX OF FIELD FOR STARTING CURSOR POSITION.
  5196. * COFFSET = CURSOR OFFSET IN FIELD.
  5197. *
  5198. * EXIT FLDIND = LAST FIELD ENTERED.
  5199. * VARDATA CONTAINS INPUT DATA.
  5200. *
  5201. * CALLS BFIELD, CPANEL, FFIELD, FUNKEY, PSTRNG, TABKEY, VDTBOI,
  5202. * VDTCOR, VDTEOO, VDTINP, VDTOUT, VDTPOS, WRIVCH.
  5203. *
  5204. * USES TERABNTERM, TERHELPFLD, TERHELPREQ, TERMESREAD,
  5205. * TERMISSINP, TERNRMTERM, TERPENDHLP, TERREWFLDS,
  5206. *IF UNDEF,QTRM
  5207. * TERREWSCRN, TERSOFTPOS, TERSOFTTAB.
  5208. *ELSE
  5209. * TERREWSCRN, TERSOFTPOS, TERSOFTTAB, TERWAITINP.
  5210. *ENDIF
  5211. #
  5212. ITEM FLDIND I; # INDEX OF FIELD IN FLDLIST #
  5213. ITEM COFFSET I; # CURSOR POSITION OFFSET #
  5214.  
  5215. ITEM CHAR I; # VDT INPUT CHARACTER #
  5216. ITEM FIELD I; # INDEX OF FIELD IN FLDLIST #
  5217. ITEM I I; # LOOP COUNTER #
  5218. ITEM INPOS U = 0; # LINE AND COLUMN OF INPUT #
  5219. ITEM INPUTERROR B; # ERROR IN INPUT #
  5220. ITEM INSEARCH B = FALSE; # DO NOT INCLUDE OUT-ONLY FIELDS #
  5221. ITEM LASTFIELD I; # LAST FIELD THAT RECEIVED INPUT #
  5222. ITEM LASTORD I; # PREVIOUS INPUT ORDINAL #
  5223. ITEM LASTPOS U = 0; # LAST X AND Y POSITION #
  5224. ITEM OFFSET I; # CHARACTER OFFSET WITHIN FIELD #
  5225. ITEM ORD I; # VDT INPUT ORDINAL #
  5226. ITEM SKIPINP B; # SKIP DATA TIL NEXT INPUT READ #
  5227. ITEM STARTFIELD I; # FIELD TO START SEARCH #
  5228. ITEM STARTPOS I; # X/Y POSITION TO START SEARCH #
  5229. ITEM XPOS I; # VDT INPUT COLUMN NUMBER #
  5230. ITEM YPOS I; # VDT INPUT LINE NUMBER #
  5231.  
  5232. SWITCH INPUTTYPE:SCREENST # VDT INPUT ORDINALS #
  5233. CONTINUE : CLRALL, # CLEAR ALL TABS - IGNORED #
  5234. CHARACTER : CHAR, # OVERSTRIKE CHARACTER #
  5235. INSERTCHAR : INSC, # INSERT CHARACTER #
  5236. DELETECHAR : DELC, # DELETE CHARACTER #
  5237. INSERTLINE : INSL, # INSERT LINE #
  5238. DELETELINE : DELL, # DELETE LINE #
  5239. CLEARPAGE : CLRPAG, # CLEAR PAGE #
  5240. CLEARPAGE : CLREOP, # CLEAR TO END OF PAGE #
  5241. CLEARPAGE : CLRUNP, # CLEAR UNPROTECTED #
  5242. CLEAREOL : CLREOL, # CLEAR TO END OF LINE #
  5243. CONTINUE : POS, # POSITION CURSOR #
  5244. HOMEKEY : HOME, # POSITION HOME #
  5245. CONTINUE : UP, # CURSOR UP #
  5246. CONTINUE : DOWN, # CURSOR DOWN #
  5247. LEFTKEY : LEFT, # CURSOR LEFT #
  5248. RIGHTKEY : RIGHT, # CURSOR RIGHT #
  5249. FORWARDTAB : FTAB, # TAB FORWARD #
  5250. BACKWRDTAB : BTAB, # TAB BACKWARD #
  5251. CONTINUE : RET, # RETURN #
  5252. ERASECHAR : ERAC, # ERASE CHARACTER #
  5253. ERASELINE : ERAL, # ERASE LINE #
  5254. ENDOFINPUT : EOI, # END OF INFORMATION #
  5255. CONTINUE : RESET, # RESET #
  5256. APPLICFUN : FKEY, # FUNCTION KEY #
  5257. GENERICFUN : GKEY, # GENERIC KEY #
  5258. BADINPUT : BAD, # BAD #
  5259. CONTINUE : NOOP, # NOOP #
  5260. CONTINUE : COORD, # COORDINATES #
  5261. CONTINUE : PROTECT, # PROTECT ALL #
  5262. NEWFIELD : STRTFLD, # START OF NEW FIELD #
  5263. CONTINUE : CLRTAB, # CLEAR TAB STOP - IGNORED #
  5264. CONTINUE : SETTAB; # SET TAB STOP - IGNORED #
  5265.  
  5266. INPOS = 0;
  5267. FIELD = FLDIND;
  5268. LASTFIELD = FLDIND;
  5269. INPUTERROR = FALSE;
  5270. TERHELPREQ[0] = FALSE;
  5271.  
  5272. *IF DEF,QTRM
  5273. IF TERWAITINP[0] THEN
  5274. BEGIN # IF INPUT RECEIVED #
  5275. TERWAITINP[0] = FALSE; # CLEAR FLAG #
  5276. GOTO DOREAD1; # CONTINUE #
  5277. END
  5278.  
  5279. *ENDIF
  5280. DOREAD: # READ INPUT FROM TERMINAL #
  5281.  
  5282. ORD = SCREENST"EOI"; # SET LAST ORDINAL TO EOI #
  5283. TERSOFTTAB[0] = 0; # NUMBER OF SOFT TABS PENDING #
  5284. SKIPINP = FALSE;
  5285. TERMISSINP[0] = FALSE;
  5286.  
  5287. IF INPUTERROR THEN
  5288. BEGIN # BAD INPUT #
  5289. PSTRNG(DUMMY,MESSSTAT"REENTER");
  5290. INPUTERROR = FALSE;
  5291. END
  5292. ELSE
  5293. BEGIN # NO INPUT ERROR #
  5294. IF TERHELPREQ[0] THEN
  5295. BEGIN # HELP REQUESTED FOR FIELD #
  5296. PSTRNG(TERHELPFLD[0],MESSSTAT"HELP");
  5297. FIELD = TERHELPFLD[0];
  5298. END
  5299. ELSE
  5300. BEGIN # NO HELP REQUESTED #
  5301. CPANEL; # REWRITE SCREEN AS NEEDED #
  5302. END
  5303. END
  5304.  
  5305. IF VALIDFIELD THEN
  5306. BEGIN # VALID FIELD #
  5307. XPOS = COFFSET + FLDXCORD[FIELD];
  5308. YPOS = FLDYCORD[FIELD];
  5309. END
  5310. ELSE
  5311. BEGIN # INVALID FIELD #
  5312. XPOS = 0;
  5313. YPOS = 0;
  5314. END
  5315. VDTPOS(XPOS,YPOS); # POSITION CURSOR #
  5316. VDTEOO;
  5317. *IF DEF,QTRM
  5318. TERWAITINP[0] = TRUE; # SET WAITING FOR INPUT #
  5319. NIT$RC = 23; # SET RETURN CODE #
  5320. RETURN; # RETURN #
  5321.  
  5322. DOREAD1: # CONTINUE AFTER QTRM INPUT #
  5323.  
  5324. *ENDIF
  5325. VDTBOI(LASTORD); # CHECK FOR TYPE AHEAD #
  5326. VDTBOO; # BEGIN OUTPUT SEQUENCE #
  5327. IF LASTORD NQ 0 THEN
  5328. BEGIN # TYPE AHEAD WAS ENTERED #
  5329. PSTRNG(FIELD,MESSSTAT"REENTER"); # PLEASE REENTER #
  5330. GOTO DOREAD;
  5331. END
  5332. COFFSET = 0; # OFFSET NO LONGER VALID #
  5333. TERMESREAD[0] = TRUE; # MESSAGE HAS BEEN SEEN BY USER #
  5334. TERNRMTERM[0] = FALSE;
  5335. TERABNTERM[0] = FALSE;
  5336.  
  5337. GETINP: # WHILE STILL LOOKING FOR INPUT #
  5338.  
  5339. YMASKOF TERPREVPOS = YPOS; # RETAIN PREVIOUS Y POSITION #
  5340. XMASKOF TERPREVPOS = XPOS; # RETAIN PREVIOUS X POSITION #
  5341. LASTORD = ORD; # RETAIN PREVIOUS ORDINAL #
  5342. VDTINP(ORD,XPOS,YPOS,CHAR,DUMMY); # GET INPUT FROM BUFFER #
  5343.  
  5344. SKIPREAD:
  5345.  
  5346. YMASKOF INPOS = YPOS;
  5347. XMASKOF INPOS = XPOS;
  5348. FFIELD(INPOS,FIELD,OFFSET,INSEARCH); # FIND INPUT FIELD #
  5349. IF VALIDFIELD THEN LASTFIELD = FIELD; # UPDATE LAST FIELD #
  5350.  
  5351. GOTO INPUTTYPE[ORD]; # PROCESS INPUT BY TYPE #
  5352.  
  5353. CHARACTER: # DISPLAYABLE CHARACTER INPUT #
  5354.  
  5355. IF (NOT SKIPINP) AND (TERSOFTTAB[0] EQ 0) THEN
  5356. BEGIN # PROCESS CHARACTER #
  5357. IF NOT VALIDFIELD THEN
  5358. BEGIN # CHAR NOT IN AN INPUT FIELD #
  5359. IF TERTABAUTO[0] AND NOT TERNOINVRS[0] THEN
  5360. BEGIN # IF AUTOMATIC TABBING #
  5361. TABKEY(SCREENST"FTAB",INPOS,FIELD,INPOS);
  5362. IF INPOS EQ 0 AND NOT TERTABHOME[0] THEN
  5363. BEGIN # IF TAB DOES NOT STOP AT HOME #
  5364. TABKEY(SCREENST"FTAB",INPOS,FIELD,INPOS);
  5365. END
  5366. OFFSET = 0; # CLEAR FIELD OFFSET #
  5367. LASTFIELD = FIELD; # UPDATE LAST VALID FIELD #
  5368. XPOS = XMASKOF INPOS; # RESET INTERNAL POSITION #
  5369. YPOS = YMASKOF INPOS;
  5370. VDTCOR(YPOS,XPOS);
  5371. END
  5372. END
  5373. IF VALIDFIELD THEN
  5374. BEGIN # CHAR IN AN INPUT FIELD #
  5375. WRIVCH(FIELD,OFFSET,CHAR); # WRITE CHARACTER INTO VARDATA #
  5376. FLDENTERED[FIELD] = TRUE;
  5377. FLDVALID[FIELD] = FALSE; # INVALID UNTIL PROVEN VALID #
  5378. IF NOT FLDOUTPUTV[FIELD] THEN
  5379. BEGIN # IF INPUT ONLY FIELD #
  5380. IF NOT TERGUARDMD[0] THEN
  5381. BEGIN # IF NO GUARD MODE AVAILABLE #
  5382. FLDREWRITE[FIELD] = TRUE; # SET REWRITE BIT FOR FIELD #
  5383. TERREWFLDS[0] = TRUE;
  5384. END
  5385. END
  5386. IF TERTABAUTO[0] THEN
  5387. BEGIN # IF AUTOMATIC TABBING #
  5388. IF OFFSET EQ FLDLENGTH[FIELD] - 1 THEN
  5389. BEGIN # IF AUTO-TAB TO NEXT FIELD #
  5390. TABKEY(SCREENST"FTAB",INPOS,FIELD,INPOS);
  5391. IF INPOS EQ 0 THEN
  5392. BEGIN # IF TABBING PAST LAST FIELD #
  5393. IF TERPTDWFPG[0] THEN
  5394. BEGIN # IF NO WRAP AROUND SCREEN #
  5395. TABKEY(SCREENST"BTAB",INPOS,FIELD,INPOS);
  5396. OFFSET = FLDLENGTH[FIELD] - 1;
  5397. INPOS = INPOS + OFFSET;
  5398. END
  5399. ELSE
  5400. BEGIN # WRAPPING TO FIRST FIELD #
  5401. IF NOT TERTABHOME[0] THEN
  5402. BEGIN # IF TAB DOES NOT STOP AT HOME #
  5403. TABKEY(SCREENST"FTAB",INPOS,FIELD,INPOS);
  5404. END
  5405. OFFSET = 0;
  5406. END
  5407. END
  5408. OFFSET = 0; # CLEAR FIELD OFFSET #
  5409. LASTFIELD = FIELD; # UPDATE LAST VALID FIELD #
  5410. INPOS = INPOS - 1; # RESET INTERNAL POSITION #
  5411. YPOS = YMASKOF INPOS;
  5412. XPOS = XMASKOF INPOS;
  5413. VDTCOR(YPOS,XPOS);
  5414. END
  5415. END
  5416. END
  5417. ELSE
  5418. BEGIN # CHAR NOT IN AN INPUT FIELD #
  5419. IF NOT TERTABAUTO[0] THEN
  5420. BEGIN # IF NEED TO REFRESH SCREEN #
  5421. RESTFLD (INPOS);
  5422. TERMISSINP[0] = TRUE; # ERROR CONDITION #
  5423. END
  5424.  
  5425. RESTFLD (INPOS);
  5426. END
  5427. END
  5428. ELSE
  5429. BEGIN # IGNORE CHARACTER #
  5430. IF VALIDFIELD AND NOT TERREWSCRN[0] THEN
  5431. BEGIN # IF NEED TO SET REWRITE BIT #
  5432. FLDREWRITE[FIELD] = TRUE;
  5433. TERREWFLDS[0] = TRUE;
  5434. END
  5435. ELSE
  5436. BEGIN # BAD CHARACTER IS NOT IN FIELD #
  5437. IF CHAR NQ BLANK AND NOT TERREWSCRN[0] THEN
  5438. BEGIN # IF NEED TO CLEAR ON SCREEN #
  5439. VDTPOS(XPOS,YPOS); # ERASE CHARACTER #
  5440. VDTOUT(BLANK);
  5441. END
  5442. END
  5443. END
  5444. GOTO GETINP; # CONTINUE LOOKING AT INPUT #
  5445.  
  5446. HOMEKEY: # HOME KEY WAS PRESSED #
  5447.  
  5448. IF TERTABAUTO[0] THEN
  5449. BEGIN # IF AUTOMATIC TABBING #
  5450. IF NOT TERNOINVRS[0] THEN
  5451. BEGIN # IF INPUT VARIABLES EXIST #
  5452. IF NOT TERTABHOME[0] THEN
  5453. BEGIN # CURSOR HAS MOVED TO FIELD #
  5454. TABKEY(SCREENST"FTAB",INPOS,FIELD,INPOS);
  5455. OFFSET = 0; # CLEAR FIELD OFFSET #
  5456. LASTFIELD = FIELD; # UPDATE LAST VALID FIELD #
  5457. YPOS = YMASKOF INPOS; # RESET INTERNAL POSITION #
  5458. XPOS = XMASKOF INPOS;
  5459. VDTCOR(YPOS,XPOS);
  5460. END
  5461. END
  5462. END
  5463. GOTO GETINP; # CONTINUE LOOKING AT INPUT #
  5464.  
  5465. LEFTKEY: # CURSOR LEFT #
  5466.  
  5467. IF TERTABAUTO[0] AND NOT TERTABHOME[0] THEN
  5468. BEGIN # IF AUTOMATIC TABBING #
  5469. IF NOT TERNOINVRS[0] AND NOT VALIDFIELD THEN
  5470. BEGIN # IF AUTO-TAB TO PREVIOUS FIELD #
  5471. LASTPOS = INPOS; # SAVE CURRENT POSITION #
  5472. TABKEY(SCREENST"BTAB",INPOS,FIELD,INPOS);
  5473. IF INPOS EQ 0 AND TERPTDWBPG[0] THEN
  5474. BEGIN # IF NO BACKWARD WRAP FROM HOME #
  5475. INPOS = LASTPOS; # RESTORE PREVIOUS POSITION #
  5476. GOTO GETINP; # CONTINUE LOOKING AT INPUT #
  5477. END
  5478. IF INPOS EQ 0 AND NOT TERTABHOME[0] THEN
  5479. BEGIN # IF TAB DOES NOT STOP AT HOME #
  5480. TABKEY(SCREENST"BTAB",INPOS,FIELD,INPOS);
  5481. END
  5482. OFFSET = FLDLENGTH[FIELD] - 1; # SET OFFSET TO END OF FIELD #
  5483. LASTFIELD = FIELD; # UPDATE LAST VALID FIELD #
  5484. INPOS = INPOS + OFFSET; # RESET INTERNAL POSITION #
  5485. YPOS = YMASKOF INPOS;
  5486. XPOS = XMASKOF INPOS;
  5487. VDTCOR(YPOS,XPOS);
  5488. END
  5489. END
  5490. GOTO GETINP; # CONTINUE LOOKING AT INPUT #
  5491.  
  5492. RIGHTKEY: # CURSOR RIGHT #
  5493.  
  5494. IF TERTABAUTO[0] AND NOT TERTABHOME[0] THEN
  5495. BEGIN # IF AUTOMATIC TABBING #
  5496. IF NOT TERNOINVRS[0] AND NOT VALIDFIELD THEN
  5497. BEGIN # IF AUTO-TAB TO NEXT FIELD #
  5498. TABKEY(SCREENST"FTAB",INPOS,FIELD,INPOS);
  5499. IF INPOS EQ 0 AND NOT TERTABHOME[0] THEN
  5500. BEGIN # IF TAB DOES NOT STOP AT HOME #
  5501. TABKEY(SCREENST"FTAB",INPOS,FIELD,INPOS);
  5502. END
  5503. OFFSET = 0; # CLEAR FIELD OFFSET #
  5504. LASTFIELD = FIELD; # UPDATE LAST VALID FIELD #
  5505. YPOS = YMASKOF INPOS; # RESET INTERNAL POSITION #
  5506. XPOS = XMASKOF INPOS;
  5507. VDTCOR(YPOS,XPOS);
  5508. END
  5509. END
  5510. GOTO GETINP; # CONTINUE LOOKING AT INPUT #
  5511.  
  5512. FORWARDTAB: # FORWARD TAB KEY PRESSED #
  5513.  
  5514. IF TERTABPROT[0] THEN
  5515. BEGIN # CAN TAB TO UNPROTECTED FIELD #
  5516. LASTPOS = INPOS; # SAVE POSITION #
  5517. TABKEY(ORD,INPOS,FIELD,INPOS);
  5518. IF INPOS EQ 0 THEN
  5519. BEGIN # IF LOGICALLY AT HOME #
  5520. IF NOT TERPTDWFPG[0] THEN
  5521. BEGIN # IF TAB CAN REALLY WRAP #
  5522. IF NOT TERTABHOME[0] THEN
  5523. BEGIN # IF TAB DOES NOT STOP AT HOME #
  5524. TABKEY(ORD,INPOS,FIELD,INPOS);
  5525. END
  5526. OFFSET = 0; # CLEAR FIELD OFFSET #
  5527. LASTFIELD = FIELD; # UPDATE LAST VALID FIELD #
  5528. END
  5529. ELSE
  5530. BEGIN # TAB DID NOT OCCUR ON SCREEN #
  5531. INPOS = LASTPOS;
  5532. END
  5533. END
  5534. YPOS = YMASKOF INPOS; # RESET INTERNAL POSITION #
  5535. XPOS = XMASKOF INPOS;
  5536. VDTCOR(YPOS,XPOS);
  5537. END
  5538. ELSE
  5539. BEGIN # SIMULATE WITH SOFT TAB #
  5540. IF TERSOFTTAB[0] EQ 0 THEN TERSOFTPOS[0] = INPOS;
  5541. TERSOFTTAB[0] = TERSOFTTAB[0] + 1;
  5542. END
  5543. GOTO GETINP; # CONTINUE LOOKING AT INPUT #
  5544.  
  5545. BACKWRDTAB: # BACK TAB KEY PRESSED #
  5546.  
  5547. IF TERTABPROT[0] THEN
  5548. BEGIN # CAN TAB TO UNPROTECTED FIELD #
  5549. LASTPOS = INPOS; # SAVE POSITION #
  5550. TABKEY(ORD,INPOS,FIELD,INPOS);
  5551. IF INPOS EQ 0 THEN
  5552. BEGIN # IF LOGICALLY AT HOME #
  5553. IF NOT TERPTDWBPG[0] THEN
  5554. BEGIN # IF TAB CAN REALLY WRAP #
  5555. IF NOT TERTABHOME[0] THEN
  5556. BEGIN # IF TAB DOES NOT STOP AT HOME #
  5557. TABKEY(ORD,INPOS,FIELD,INPOS);
  5558. END
  5559. OFFSET = 0; # CLEAR FIELD OFFSET #
  5560. LASTFIELD = FIELD; # UPDATE LAST VALID FIELD #
  5561. END
  5562. ELSE
  5563. BEGIN # TAB DID NOT OCCUR ON SCREEN #
  5564. INPOS = LASTPOS;
  5565. END
  5566. END
  5567. YPOS = YMASKOF INPOS; # RESET INTERNAL POSITION #
  5568. XPOS = XMASKOF INPOS;
  5569. VDTCOR(YPOS,XPOS);
  5570. END
  5571. ELSE
  5572. BEGIN # SIMULATE WITH SOFT TAB #
  5573. IF TERSOFTTAB[0] EQ 0 THEN TERSOFTPOS[0] = INPOS;
  5574. TERSOFTTAB[0] = TERSOFTTAB[0] - 1;
  5575. END
  5576. GOTO GETINP; # CONTINUE LOOKING AT INPUT #
  5577.  
  5578. CLEARPAGE: # CLEAR PAGE PRESSED #
  5579.  
  5580. TERREWSCRN[0] = TRUE; # COMPLETE REWRITE OF SCREEN #
  5581. TERREWFLDS[0] = TRUE;
  5582. SKIPINP = TRUE; # SKIP TO NEXT INPUT #
  5583. GOTO GETINP; # GET INPUT AGAIN #
  5584.  
  5585. CLEAREOL: # CLEAR TO END OF LINE PRESSED #
  5586.  
  5587. IF VALIDFIELD THEN
  5588. BEGIN # IF IN ACTIVE INPUT FIELD #
  5589. BFIELD(FIELD,OFFSET,DUMMY); # BLANK FIELD IN VARDATA #
  5590. FLDVALID[FIELD] = FALSE;
  5591. FLDENTERED[FIELD] = TRUE;
  5592. FLDREWRITE[FIELD] = TRUE;
  5593. TERREWFLDS[0] = TRUE;
  5594. END
  5595.  
  5596. REWRTLINE: # REWRITE REST OF FIELDS ON LINE #
  5597.  
  5598. STARTFIELD = FIELD + 1;
  5599. IF NOT TERTABPROT[0] OR TERCLEARSM[0] THEN
  5600. BEGIN # IF MORE THAN ONE CLEARED #
  5601. FOR I = STARTFIELD STEP 1 WHILE FLDENTRY[I] NQ 0
  5602. AND FLDYCORD[I] LQ YPOS DO
  5603. BEGIN # IF NOT PAST AFFECTED LINE #
  5604. IF FLDYCORD[I] EQ YPOS AND FLDACTIVE[I]
  5605. AND FLDXCORD[I]+FLDLENGTH[I] GQ XPOS THEN
  5606. BEGIN # IF ACTIVE FIELD ON SAME LINE #
  5607. IF FLDINPUTV[I] THEN
  5608. BEGIN # IF ACTIVE INPUT FIELD #
  5609. BFIELD(I,0,DUMMY); # BLANK FIELD IN VARDATA #
  5610. FLDVALID[I] = FALSE;
  5611. FLDENTERED[I] = TRUE;
  5612. END
  5613. FLDREWRITE[I] = TRUE;
  5614. TERREWFLDS[0] = TRUE;
  5615. END
  5616. END
  5617. END
  5618. GOTO GETINP; # CONTINUE LOOKING AT INPUT #
  5619.  
  5620.  
  5621. ERASELINE: # SHIFT ERASE PRESSED #
  5622.  
  5623. IF NOT TERTABPROT[0] THEN
  5624. BEGIN # IF NO PROTECT #
  5625. XPOS = 0;
  5626. XMASKOF INPOS = XPOS;
  5627. VDTCOR(YPOS,XPOS); # REPOSITION TO START OF LINE #
  5628. STARTFIELD = -1;
  5629. GOTO REWRTLINE; # REWRITE ALL FIELDS ON LINE #
  5630. END
  5631. FFIELD(TERPREVPOS,FIELD,OFFSET,INSEARCH);
  5632. IF FIELD GQ 0 THEN
  5633. BEGIN # FOUND FIELD #
  5634. BFIELD(FIELD,0,DUMMY); # BLANK FIELD IN VARDATA #
  5635. TERREWFLDS[0] = TRUE;
  5636. FLDREWRITE[FIELD] = TRUE;
  5637. FLDENTERED[FIELD] = TRUE;
  5638. FLDVALID[FIELD] = FALSE;
  5639. VDTCOR(FLDYCORD[FIELD],FLDXCORD[FIELD]); # RESET INTERNAL POS #
  5640. END
  5641. GOTO GETINP; # CONTINUE LOOKING AT INPUT #
  5642.  
  5643. ERASECHAR: # ERASE KEY PRESSED #
  5644.  
  5645. IF TERTABAUTO[0] THEN
  5646. BEGIN # IF AUTOMATIC TABBING #
  5647. IF NOT TERNOINVRS[0] AND NOT VALIDFIELD THEN
  5648. BEGIN # IF AUTO-TAB TO PREVIOUS FIELD #
  5649. TABKEY(SCREENST"BTAB",INPOS,FIELD,INPOS);
  5650. IF INPOS EQ 0 AND NOT TERTABHOME[0] THEN
  5651. BEGIN # IF TAB DOES NOT STOP AT HOME #
  5652. TABKEY(SCREENST"BTAB",INPOS,FIELD,INPOS);
  5653. END
  5654. OFFSET = FLDLENGTH[FIELD] - 1; # SET OFFSET TO END OF FIELD #
  5655. LASTFIELD = FIELD; # UPDATE LAST VALID FIELD #
  5656. INPOS = INPOS + OFFSET; # RESET INTERNAL POSITION #
  5657. YPOS = YMASKOF INPOS;
  5658. XPOS = XMASKOF INPOS;
  5659. VDTCOR(YPOS,XPOS);
  5660. END
  5661. END
  5662. IF VALIDFIELD THEN
  5663. BEGIN # IF VALID FIELD #
  5664. WRIVCH(FIELD,OFFSET,BLANK); # WRITE BLANK INTO VARDATA #
  5665. FLDENTERED[FIELD] = TRUE;
  5666. FLDVALID[FIELD] = FALSE; # INVALID UNTIL PROVEN VALID #
  5667. END
  5668. ELSE IF NOT TERTABAUTO[0] THEN
  5669. BEGIN
  5670. RESTFLD (INPOS);
  5671. END
  5672. GOTO GETINP; # CONTINUE LOOKING AT INPUT #
  5673.  
  5674. APPLICFUN:
  5675. GENERICFUN: # FUNCTION KEY PRESSED #
  5676.  
  5677. IF TERLEAVESM[0] NQ 0 THEN
  5678. BEGIN # IF FUNCTION KEY LEFT MARK #
  5679. IF VALIDFIELD THEN
  5680. BEGIN # IF IN INPUT FIELD #
  5681. FLDREWRITE[FIELD] = TRUE; # SET REWRITE BIT FOR FIELD #
  5682. TERREWFLDS[0] = TRUE;
  5683. END
  5684. ELSE
  5685. BEGIN # IF NOT IN INPUT FIELD #
  5686. RESTFLD (INPOS);
  5687. END
  5688. END
  5689. IF NOT SKIPINP THEN
  5690. BEGIN # PROCESS FUNCTION KEY #
  5691. FUNKEY(INPOS,OFFSET,ORD,CHAR,FIELD);
  5692. IF TERSOFTTAB[0] EQ 0 THEN
  5693. BEGIN # IF FUNCTION KEY NOT SOFT TAB #
  5694. SKIPINP = TRUE; # SKIP INPUT #
  5695. END
  5696. END
  5697. GOTO GETINP; # CONTINUE LOOKING AT INPUT #
  5698.  
  5699. INSERTLINE: # INSERT LINE PRESSED #
  5700. DELETELINE: # DELETE LINE PRESSED #
  5701. TERREWSCRN[0] = TRUE; # FORCE SCREEN REWRITE #
  5702. TERREWFLDS[0] = TRUE;
  5703. BADINPUT: # BAD INPUT RETURNED #
  5704.  
  5705. INPUTERROR = TRUE; # UNSUPPORTED KEY ENTERED #
  5706. GOTO GETINP; # CONTINUE LOOKING AT INPUT #
  5707.  
  5708. INSERTCHAR: # INSERT CHARACTER PRESSED #
  5709.  
  5710. IF VALIDFIELD THEN
  5711. BEGIN # SHIFT CHARACTERS IN VARDATA #
  5712. FOR I = FLDLENGTH[FIELD] - 1 STEP - 1 UNTIL OFFSET + 1 DO
  5713. BEGIN
  5714. DUMMY = NEXTCHAR(FIELD,I-1);
  5715. WRIVCH(FIELD,I,DUMMY); # WRITE CHARACTER INTO VARDATA #
  5716. END
  5717. WRIVCH(FIELD,OFFSET,CHAR); # WRITE CHARACTER INTO VARDATA #
  5718. FLDENTERED[FIELD] = TRUE;
  5719. FLDVALID[FIELD] = FALSE;
  5720. FLDREWRITE[FIELD] = TRUE;
  5721. TERREWFLDS[0] = TRUE;
  5722. END
  5723. IF NOT TERTABPROT[0] THEN
  5724. BEGIN
  5725. VDTCLL(XPOS,YPOS); # CLEAR THE REST OF THE LINE #
  5726. VDTPOS(XPOS,YPOS);
  5727. GOTO REWRTLINE; # REWRITE THE REST OF THE LINE #
  5728. END
  5729. GOTO GETINP; # CONTINUE LOOKING AT INPUT #
  5730.  
  5731. DELETECHAR: # DELETE CHARACTER PRESSED #
  5732.  
  5733. IF VALIDFIELD THEN
  5734. BEGIN # IF VALID FIELD #
  5735. FOR I = OFFSET STEP 1 UNTIL FLDLENGTH[FIELD] - 2 DO
  5736. BEGIN # SHIFT CHARACTERS IN VARDATA #
  5737. CHAR = NEXTCHAR(FIELD,I+1);
  5738. WRIVCH(FIELD,I,CHAR); # WRITE CHARACTER INTO VARDATA #
  5739. END
  5740. WRIVCH(FIELD,FLDLENGTH[FIELD]-1,BLANK); # BLANK LAST CHARACTER #
  5741. FLDENTERED[FIELD] = TRUE;
  5742. FLDVALID[FIELD] = FALSE;
  5743. FLDREWRITE[FIELD] = TRUE;
  5744. TERREWFLDS[0] = TRUE;
  5745. END
  5746. IF NOT TERTABPROT[0] THEN
  5747. BEGIN
  5748. VDTCLL(XPOS,YPOS); # CLEAR THE REST OF THE LINE #
  5749. VDTPOS(XPOS,YPOS);
  5750. GOTO REWRTLINE; # REWRITE THE REST OF THE LINE #
  5751. END
  5752. GOTO GETINP; # CONTINUE LOOKING AT INPUT #
  5753.  
  5754. NEWFIELD: # START OF NEW FIELD #
  5755.  
  5756. IF VALIDFIELD THEN
  5757. BEGIN # IF VALID INPUT FIELD #
  5758. VDTINP(ORD,XPOS,YPOS,CHAR,DUMMY);
  5759. FOR OFFSET = 0 STEP 1 WHILE ORD EQ SCREENST"CHAR" DO
  5760. BEGIN # WHILE INPUT IS CHARACTERS #
  5761. WRIVCH(FIELD,OFFSET,CHAR); # WRITE CHARACTER INTO VARDATA #
  5762. VDTINP(ORD,XPOS,YPOS,CHAR,DUMMY);
  5763. END
  5764. BFIELD(FIELD,OFFSET,DUMMY); # BLANK FILL FIELD #
  5765. FLDENTERED[FIELD] = TRUE; # FIELD ENTERED #
  5766. FLDVALID[FIELD] = FALSE; # INVALID UNTIL PROVEN VALID #
  5767. GOTO SKIPREAD; # CONTINUE #
  5768. END
  5769. ELSE
  5770. BEGIN # INVALID FIELD #
  5771. GOTO GETINP; # CONTINUE WITH INPUT #
  5772. END
  5773.  
  5774. CONTINUE: # IGNORABLE INPUT ENTERED #
  5775.  
  5776. GOTO GETINP; # CONTINUE LOOKING AT INPUT #
  5777.  
  5778. ENDOFINPUT: # END OF INPUT BUFFER #
  5779.  
  5780. IF NOT (SKIPINP OR INPUTERROR OR TERHELPREQ[0]) THEN
  5781. BEGIN # NEXT KEY WAS PRESSED #
  5782. FUNKEY(INPOS,OFFSET,SCREENST"GKEY",GENERICST"GNEXT",FIELD);
  5783. END
  5784. IF TERSOFTTAB[0] NQ 0 THEN
  5785. BEGIN # PERFORM SOFT TABS #
  5786. STARTPOS = TERSOFTPOS[0];
  5787. WHYLE TERSOFTTAB[0] NQ 0 DO
  5788. BEGIN # UNTIL DONE WITH SOFT TABS #
  5789. TABKEY(SCREENST"FTAB",STARTPOS,FIELD,STARTPOS);
  5790. TERSOFTTAB[0] = TERSOFTTAB[0] - 1;
  5791. IF FIELD EQ -1 THEN
  5792. BEGIN
  5793. TABKEY(SCREENST"FTAB",STARTPOS,FIELD,STARTPOS);
  5794. END
  5795. END
  5796. OFFSET = 0; # CLEAR FIELD OFFSET #
  5797. LASTFIELD = FIELD; # UPDATE LAST VALID FIELD #
  5798. YPOS = YMASKOF STARTPOS;
  5799. XPOS = XMASKOF STARTPOS;
  5800. VDTCOR(YPOS,XPOS);
  5801. IF TERPENDHLP[0] THEN
  5802. BEGIN # IF HELP PENDING #
  5803. TERPENDHLP[0] = FALSE; # CLEAR HELP PENDING #
  5804. TERHELPFLD[0] = FIELD; # SET FIELD REQUESTING HELP #
  5805. TERHELPREQ[0] = TRUE; # SET HELP REQUESTED FLAG#
  5806. END
  5807. END
  5808. IF TERABNTERM[0] OR TERNRMTERM[0] THEN
  5809. BEGIN # TERMINATION REQUESTED #
  5810. IF (TERNRMTERM[0] AND NOT (INPUTERROR OR TERHELPREQ[0])) OR
  5811. (TERABNTERM[0]) THEN
  5812. BEGIN
  5813. FLDIND = LASTFIELD;
  5814. CPANEL;
  5815. RETURN;
  5816. END
  5817. END
  5818. IF NOT VALIDFIELD THEN FIELD = LASTFIELD;
  5819. GOTO DOREAD; # READ INPUT AGAIN #
  5820.  
  5821. END # READIN #
  5822. CONTROL EJECT;
  5823.  
  5824. PROC READSF(PANEL);
  5825.  
  5826. # TITLE READSF - READ SCREEN FORMATTED PANEL. #
  5827.  
  5828. BEGIN # READSF #
  5829.  
  5830. #
  5831. ** READSF - READ SCREEN FORMATTED PANEL.
  5832. *
  5833. * READSF CHECKS THAT ALL INPUT TO THE PANEL IS VALID.
  5834. *
  5835. * PROC READSF(PANEL)
  5836. *
  5837. * ENTRY PANEL = NAME OF PANEL TO READ.
  5838. *
  5839. * EXIT VARDATA CONTAINS INPUT DATA.
  5840. *
  5841. * CALLS CPANEL, FFIRST, GFIELD, PSTRNG, READIN, SFSWRI$, VALIDF.
  5842. *
  5843. * USES TERABNTERM, TERCURSROW, TERCURSSET, TERCURSVAR,
  5844. * TERNRMTERM, TERREADFLG, TERREWFLDS,
  5845. *IF UNDEF,QTRM
  5846. * TERNOINVRS, TERREWSCRN.
  5847. *ELSE
  5848. * TERNOINVRS, TERREWSCRN, TERWAITINP.
  5849. *ENDIF
  5850. *
  5851. * NOTES IF PANEL IS NOT THE ACTIVE PANEL THEN SFSWRI$
  5852. * IS CALLED TO WRITE THE PANEL TO THE SCREEN.
  5853. #
  5854. ITEM PANEL C(7); # INPUT PANEL NAME #
  5855.  
  5856. ITEM CHARIND I; # CHARACTER OFFSET WITHIN FIELD #
  5857. ITEM CUROFF I; # INITIAL CURSOR OFFSET #
  5858. *IF DEF,QTRM
  5859. ITEM FATAL B = TRUE; # FATAL ERROR #
  5860. *ENDIF
  5861. ITEM FLDIND I; # POINTER INTO FIELD LIST #
  5862. ITEM INSP C(10); # DUMMY PARAMETER FOR SFSWRI$ #
  5863. ITEM LASTFIELD I; # LAST FIELD ENTERED #
  5864. ITEM LEN I = 7; # FIXED PANEL NAME LENGTH #
  5865. *IF DEF,QTRM
  5866. ITEM MSG C(43) = " PANEL MUST BE WRITTEN BEFORE READ IN QTRM.";
  5867. *ENDIF
  5868. ITEM OFF I = 0; # FIXED PANEL NAME OFFSET #
  5869. *IF DEF,QTRM
  5870. ITEM PNAME C(7) = "SFSREA "; # CALLING PROCEDURE #
  5871. *ENDIF
  5872. ITEM USEROW B = TRUE; # USE TERCURSROW #
  5873. ITEM VARIND I; # INDEX INTO VARLIST #
  5874. *IF,DEF,QTRM
  5875.  
  5876. IF TERWAITINP[0] THEN GOTO READFIELDS; # RESUME AFTER QTRM I/O #
  5877.  
  5878. *ENDIF
  5879.  
  5880. # INITIALIZE TERMINATION, REWRITE AND VARIABLE FLAGS #
  5881.  
  5882. TERABNTERM[0] = FALSE;
  5883. TERHELPREQ[0] = FALSE;
  5884. TERNOINVRS[0] = FALSE;
  5885. TERNRMTERM[0] = FALSE;
  5886. TERREWSCRN[0] = FALSE;
  5887.  
  5888. IF PANEL NQ TERACTPANL[0] THEN
  5889. BEGIN # IF NEW ACTIVE PANEL #
  5890. *IF UNDEF,QTRM
  5891. TERREADFLG[0] = TRUE; # WRITE PANEL BEFORE READ #
  5892. SFSWRI$(PANEL,LEN,OFF,INSP,LEN,OFF);
  5893. TERREADFLG[0] = FALSE;
  5894. *ELSE
  5895. ERRMSG(PANEL,PNAME,MSG,FATAL); # NO READ BEFORE WRITE IN QTRM #
  5896. *ENDIF
  5897. END
  5898.  
  5899. FLDIND = -1;
  5900.  
  5901. IF TERCURSSET[0] THEN
  5902. BEGIN # IF SFSETP$ HAS BEEN CALLED #
  5903. GFIELD(TERCURSVAR[0],USEROW,FLDIND);
  5904. END
  5905.  
  5906. IF (FLDIND NQ -1 AND FLDINPUTV[FLDIND]) AND FLDACTIVE[FLDIND] THEN
  5907. BEGIN # IF VALID FIELD #
  5908. IF TERCURSSET[0] AND TERCURSOFF[0] LQ FLDLENGTH[FLDIND] - 1 THEN
  5909. BEGIN # SFSETP$ SPECIFIED POSITION #
  5910. CUROFF = TERCURSOFF[0];
  5911. END
  5912. ELSE
  5913. BEGIN
  5914. CUROFF = 0; # CLEAR OFFSET #
  5915. END
  5916. END
  5917. ELSE
  5918. BEGIN # FIELD NOT FOUND #
  5919. FFIRST(FLDIND); # FIND FIRST INPUT FIELD #
  5920. IF FLDIND EQ -1 THEN
  5921. BEGIN # IF NO ACTIVE INPUT FIELDS #
  5922. TERNOINVRS[0] = TRUE; # NO INPUT VARIABLES #
  5923. END
  5924. CUROFF = 0;
  5925. END
  5926.  
  5927. TERCURSSET[0] = FALSE; # CLEAR SFSETP$ VARIABLES #
  5928. TERCURSVAR[0] = " ";
  5929. TERCURSROW[0] = 0;
  5930.  
  5931. READFIELDS: # READ INPUT FIELDS #
  5932.  
  5933. READIN(FLDIND,CUROFF); # READ INPUT FROM TERMINAL #
  5934. *IF DEF,QTRM
  5935.  
  5936. IF TERWAITINP[0] THEN RETURN; # IF WAITING FOR INPUT, RETURN #
  5937.  
  5938. *ENDIF
  5939. LASTFIELD = FLDIND;
  5940. CUROFF = 0;
  5941. FLDIND = 0; # CHECK ALL FIELDS #
  5942.  
  5943. IF TERABNTERM[0] THEN RETURN; # ABNORMAL TERMINATION #
  5944.  
  5945. IF TERNOINVRS[0] THEN GOTO CHEKMISSED; # NO FIELDS TO CHECK #
  5946.  
  5947. WHYLE FLDENTRY[FLDIND] NQ 0 DO
  5948. BEGIN # UNTIL FIELD LIST EXHAUSTED #
  5949. VARIND = FLDVARORD[FLDIND]; # CHECK FIELD VALIDATION #
  5950. IF FLDACTIVE[FLDIND] AND FLDINPUTV[FLDIND] THEN
  5951. BEGIN # IF ACTIVE INPUT FIELD #
  5952. IF TERBLCKMDE[0] THEN
  5953. BEGIN
  5954. FOR CHARIND = FLDLENGTH[FLDIND]-1 STEP -1 UNTIL 0 DO
  5955. BEGIN
  5956. IF NEXTCHAR(FLDIND,CHARIND) NQ O"137" THEN CHARIND = 0;
  5957. ELSE WRIVCH(FLDIND,CHARIND,O"40");
  5958. END
  5959. END
  5960. IF(FLDENTERED[FLDIND] OR VARMUSENTR[VARIND] OR
  5961. VARMUSCON[VARIND]) AND NOT FLDVALID[FLDIND] THEN
  5962. BEGIN # IF FIELD TO BE CHECKED #
  5963. VALIDF(FLDIND);
  5964. IF NOT FLDVALID[FLDIND] THEN
  5965. BEGIN # IF VALIDATION FAILED #
  5966. PSTRNG(FLDIND,MESSSTAT"HELP");
  5967. GOTO READFIELDS; # NOTIFY USER OF ERROR #
  5968. END
  5969. END
  5970. END
  5971. FLDIND = FLDIND + 1;
  5972. END
  5973.  
  5974. CHEKMISSED: # TERMINATE IF NO FIELD MISSED #
  5975.  
  5976. IF TERMISSINP[0] THEN
  5977. BEGIN # IF INPUT OUTSIDE OF FIELDS #
  5978. PSTRNG(LASTFIELD,MESSSTAT"CONFIRM");
  5979. FLDIND = LASTFIELD; # POSITION TO LAST FIELD ENTERED #
  5980. GOTO READFIELDS; # REQUEST CONFIRMATION OF INPUT #
  5981. END
  5982.  
  5983. TERREWFLDS[0] = FALSE;
  5984.  
  5985. END # READSF #
  5986. CONTROL EJECT;
  5987.  
  5988. PROC RESTFLD (INPOS);
  5989.  
  5990. # TITLE RESTFLD - RESTORE DESTROYED FIELD. #
  5991.  
  5992. BEGIN # RESTFLD #
  5993.  
  5994. #
  5995. ** RESTFLD - RESTORE DESTROYED FIELD.
  5996. *
  5997. * RESTFLD MARKS AN ACTIVE FIELD AT *INPOS* FOR REWRITING,
  5998. * OR WRITES A BLANK IF *INPOS* IS NOT IN AN ACTIVE FIELD.
  5999. *
  6000. * PROC RESTFLD (INPOS)
  6001. *
  6002. * ENTRY INPOS = POSITION ON SCREEN.
  6003. *
  6004. * EXIT *FLDREWRITE* FLAG SET OR BLANK WRITTEN TO SCREEN.
  6005. #
  6006. ITEM INPOS U;
  6007.  
  6008. ITEM FIELD I;
  6009. ITEM I I;
  6010.  
  6011. FIELD = -1;
  6012. FOR I = 0 STEP 1 WHILE FLDENTRY[I] NQ 0 AND FLDPOS[I] LS INPOS DO
  6013. BEGIN # SEARCH FOR ACTIVE FIELD #
  6014. IF FLDACTIVE[I] THEN FIELD = I;
  6015. END
  6016. IF VALIDFIELD AND INPOS - FLDPOS[FIELD] LS FLDLENGTH[FIELD] THEN
  6017. BEGIN # IF WITHIN THIS FIELD #
  6018. FLDREWRITE[FIELD] = TRUE;
  6019. TERREWFLDS[0] = TRUE;
  6020. END
  6021. ELSE
  6022. BEGIN # IF NOT IN ANY ACTIVE FIELD #
  6023. VDTPOS(XMASKOF INPOS,YMASKOF INPOS);
  6024. VDTOUT(BLANK);
  6025. END
  6026. END # RESTFLD #
  6027. CONTROL EJECT;
  6028.  
  6029. PROC REWFLD;
  6030.  
  6031. # TITLE REWFLD - REWRITE FIELDS. #
  6032.  
  6033. BEGIN # REWFLD #
  6034.  
  6035. #
  6036. ** REWFLD - REWRITE FIELDS.
  6037. *
  6038. * THIS PROCEDURE REWRITES FIELDS.
  6039. *
  6040. * PROC REWFLD
  6041. *
  6042. * ENTRY TERNOREWRT = FALSE, IF REWRITING ALL VARIABLES.
  6043. * = TRUE, IF HONORING FIELD LIST REWRITE FLAG.
  6044. *
  6045. * EXIT FIELDS REWRITTEN TO SCREEN.
  6046. *
  6047. * CALLS SETATR, VDTSAM, VDTSTR, WRIVAR.
  6048. #
  6049. ITEM FLDINDEX I; # INDEX INTO FIELD LIST #
  6050. ITEM VARINDEX I; # INDEX TO LAST VAR WRITTEN #
  6051. BASED ARRAY CONSTRING;; # PASSES ADDRESS TO VDTSTR #
  6052.  
  6053. VARINDEX = - 2; # NO VARIABLES WRITTEN YET #
  6054. TERCURVORD[0] = - 1; # NO CURRENT ATTRIBUTES YET #
  6055. TERPREVPOS[0] = - 1; # LAST ATTRIBUTE POSITION #
  6056. FOR FLDINDEX = 0 STEP 1 WHILE FLDENTRY[FLDINDEX] NQ 0 DO
  6057. BEGIN
  6058. IF FLDACTIVE[FLDINDEX] AND (FLDREWRITE[FLDINDEX] OR
  6059. ((NOT TERNOREWRT[0]) AND FLDVARFLAG[FLDINDEX])) OR
  6060. (TERATTRCHR[0] AND VARINDEX EQ FLDINDEX - 1) THEN
  6061. BEGIN # IF ACTIVE FIELD TO REWRITE #
  6062. SETATR(FLDINDEX); # SET FIELD ATTRIBUTES #
  6063. IF FLDVARFLAG[FLDINDEX] THEN # IF VARIABLE FIELD #
  6064. BEGIN
  6065. WRIVAR(FLDINDEX); # WRITE VARIABLE FIELD #
  6066. VARINDEX = FLDINDEX;
  6067. END
  6068. ELSE
  6069. BEGIN # WRITE CONSTANT FIELD #
  6070. P&lt;CONSTRING>=LOC(RECWORDC[FLDCONOS[FLDINDEX]]);
  6071. VDTSTR(CONSTRING);
  6072. FLDREWRITE[FLDINDEX] = FALSE; # CLEAR REWRITE FIELD FLAG #
  6073. END
  6074. IF TERTABPROT[0] THEN
  6075. BEGIN # IF PROTECTED TABBING #
  6076. IF TERATTRSET[0] THEN
  6077. BEGIN # RESET ATTRIBUTES BEFORE VDTPOS #
  6078. IF TERCURVORD[0] NQ 2 THEN
  6079. BEGIN # IF NOT PROTECTED OUTPUT #
  6080. TERCURVORD[0] = 2; # SET ORDINAL AND ISSUE IT #
  6081. VDTSAM(O"6001");
  6082. END
  6083. END
  6084. END
  6085. END
  6086. END
  6087. IF NOT TERBLCKMDE[0] THEN
  6088. BEGIN
  6089. VDTSAM(0);
  6090. END
  6091. ELSE
  6092. BEGIN
  6093. VDTSAM(O"6001");
  6094. END
  6095.  
  6096. END # REWFLD #
  6097. CONTROL EJECT;
  6098.  
  6099. PROC REALRANGE(FLDIND,IVALUE,EVALUE);
  6100.  
  6101. # TITLE RRANGE - RANGE VALIDATION FOR REAL VARIABLES. #
  6102.  
  6103. BEGIN # RRANGE #
  6104.  
  6105. #
  6106. ** REALRANGE - RANGE VALIDATION FOR REAL VARIABLES.
  6107. *
  6108. * THIS PROCEDURE VALIDATES THAT INPUT TO THE VARIABLE POINTED TO
  6109. * BY FLDIND IS WITHIN THE RANGE SPECIFIED IN THE PANEL RECORD.
  6110. *
  6111. * PROC REALRANGE(FLDIND,IVALUE,EVALUE)
  6112. *
  6113. * ENTRY FLDIND = INDEX OF CURRENT FIELD IN FLDLIST.
  6114. * IVALUE = THE INTEGER VALUE OF THE INPUT.
  6115. * EVALUE = THE EXPONENT VALUE OF THE INPUT.
  6116. *
  6117. * EXIT FLDVALID[FLDIND] = FALSE, IF INPUT IS INVALID.
  6118. #
  6119. ITEM FLDIND I; # INDEX OF VARIABLE TO VALIDATE #
  6120. ITEM IVALUE I; # INTEGER VALUE OF INPUT #
  6121. ITEM EVALUE I; # EXPONENT VALUE OF INPUT #
  6122.  
  6123. ITEM FPSTAT I; # GFP OVERFLOW STATUS #
  6124. ITEM MAXVAL R; # MAXIMUM ALLOWED VALUE #
  6125. ITEM MINVAL R; # MINIMUM ALLOWED VALUE #
  6126. ITEM OFFSET I; # OFFSET OF VALIDATION IN RECORD #
  6127. ITEM RVALUE R; # REAL VALUE OF INPUT #
  6128. ITEM VARIND I; # INDEX INTO VARLIST #
  6129.  
  6130. VARIND = FLDVARORD[FLDIND];
  6131. OFFSET = VARVALOS[VARIND];
  6132. MINVAL = RECWORDR[OFFSET];
  6133. MAXVAL = RECWORDR[OFFSET + 1];
  6134.  
  6135. FPSTAT = GFP(IVALUE,EVALUE,RVALUE); # GENERATE REAL VALUE #
  6136.  
  6137. IF FPSTAT EQ 0 THEN
  6138. BEGIN # IF NO ERROR IN REAL VALUE #
  6139. IF (RVALUE LS MINVAL) OR (RVALUE GR MAXVAL) THEN
  6140. BEGIN # IF VALUE OUTSIDE OF RANGE #
  6141. FLDVALID[FLDIND] = FALSE;
  6142. END
  6143. END
  6144. ELSE
  6145. BEGIN # ERROR IN REAL VALUE #
  6146. FLDVALID[FLDIND] = FALSE;
  6147. END
  6148.  
  6149. END # REALRANGE #
  6150. CONTROL EJECT;
  6151.  
  6152. PROC SETATR(FLDINDEX);
  6153.  
  6154. # TITLE SETATR - SET FIELD ATTRIBUTES. #
  6155.  
  6156. BEGIN # SETATR #
  6157.  
  6158. #
  6159. ** SETATR - SET FIELD ATTRIBUTES.
  6160. *
  6161. * THIS PROCEDURE SETS THE FIELD ATTRIBUTES FOR A GIVEN FIELD.
  6162. *
  6163. * PROC SETATR(FLDINDEX)
  6164. *
  6165. * ENTRY FLDINDEX = INDEX INTO FIELD TABLE
  6166. *
  6167. * CALLS VDTSAM, VDTSAP.
  6168. #
  6169. ITEM FLDINDEX I; # FIELD INDEX #
  6170.  
  6171. VDTSAP(TERPREVPOS[0],FLDXCORD[FLDINDEX],FLDYCORD[FLDINDEX]);
  6172. TERPREVPOS[0] = TERPREVPOS[0] + FLDLENGTH[FLDINDEX] + 1;
  6173. IF (FLDATTORD[FLDINDEX] NQ TERCURVORD[0])
  6174. OR TERBLCKMDE[0] OR TERATTRCHR[0] THEN
  6175. BEGIN # IF NEED TO SET ATTRIBUTES #
  6176. TERCURVORD[0] = FLDATTORD[FLDINDEX];
  6177. VDTSAM(ATTMASK[TERCURVORD[0]]);
  6178. END
  6179.  
  6180. END # SETATR #
  6181. *IF DEF,QTRM
  6182. CONTROL EJECT;
  6183.  
  6184. PROC SETFSF(PANELADDR);
  6185.  
  6186. # TITLE SETFSF - SET FIELD STATUS FLAGS FOR PANEL. #
  6187.  
  6188. BEGIN # SETFSF #
  6189.  
  6190. #
  6191. ** SETFSF - SET FIELD STATUS FLAGS FOR PANEL.
  6192. *
  6193. * THIS PROCEDURE GOES THROUGH THE FIELD LIST ENTRIES IN THE PANEL
  6194. * (FLDLIST)SETTING THE ENTERED, VALID, REWRITE AND ACTIVE FLAGS
  6195. * TO THEIR DEFAULT VALUE. THIS ASSURES THAT PANELS USED BY MORE
  6196. * THAN ONE USER WILL PRODUCE COMPLETE OUTPUT THE FIRST TIME THEY
  6197. * ARE WRITTEN TO THE SCREEN. THE ENTRY AND VALIDATION FIELDS
  6198. * ARE SET FALSE AND THE REWRITE AND ACTIVE FIELDS ARE SET TO TRUE.
  6199. * AT THIS TIME VARDATA IS ALSO RESET (TO ALL BLANKS).
  6200. *
  6201. * PROC SETFSF
  6202. *
  6203. * ENTRY PANELADDR = ADDRESS OF PANEL.
  6204. *
  6205. * EXIT FIELD STATUS FLAGS RESET TO DEFAULT VALUES.
  6206. * VARDATA BLANKED OUT.
  6207. #
  6208. ITEM PANELADDR I; # PANEL ADDRESS #
  6209.  
  6210. ITEM I I; # COUNTER #
  6211. ITEM VDATALEN I; # VARDATA LENGTH #
  6212.  
  6213. POSARR(PANELADDR); # POSITION BASED ARRAYS #
  6214.  
  6215. FOR I = 0 STEP 1 WHILE FLDENTRY[I] NQ 0 DO
  6216. BEGIN # FOR ENTIRE FIELD LIST #
  6217. FLDENTERED[I] = FALSE;
  6218. FLDVALID[I] = FALSE;
  6219. FLDREWRITE[I] = TRUE;
  6220. FLDACTIVE[I] = TRUE;
  6221. END
  6222.  
  6223. IF PANSTRFLD[0] NQ 0 THEN
  6224. BEGIN # IF FIELDS EXIST #
  6225. VDATALEN = P&lt;FLDLIST> - (PANELADDR + PANHEADLEN);
  6226. END
  6227. ELSE
  6228. BEGIN # NO FIELDS #
  6229. VDATALEN = P&lt;VARLIST> - (PANELADDR + PANHEADLEN);
  6230. END
  6231. # RESET VARDATA #
  6232. FOR I = 0 STEP 1 UNTIL VDATALEN - 1 DO
  6233. BEGIN # CLEAR VARDATA TO BLANKS #
  6234. VDATAU[I] = O"0040 0040 0040 0040 0040";
  6235. END
  6236.  
  6237. END # SETFSF #
  6238. *ENDIF
  6239. CONTROL EJECT;
  6240.  
  6241. PROC SETSRN(COLUMNS,LINES);
  6242.  
  6243. # TITLE SETSRN - SET SCREEN. #
  6244.  
  6245. BEGIN # SETSRN #
  6246.  
  6247. #
  6248. ** SETSRN - SET SCREEN.
  6249. *
  6250. * THIS PROCEDURE SETS THE TERMINAL INTO SCREEN MODE, USING LINES
  6251. * AND COLUMNS AS THE DESIRED SCREEN SIZE, AND UPDATES THE GLOBAL
  6252. * VARIABLES THAT HOLD THE ACTUAL NUMBER OF LINES AND COLUMNS AND
  6253. * THE TERMINAL ATTRIBUTE CHARACTERISTICS.
  6254. *
  6255. * PROC SETSRN(COLUMNS,LINES)
  6256. *
  6257. * ENTRY COLUMNS = THE NUMBER OF DESIRED COLUMNS.
  6258. * LINES = THE NUMBER OF DESIRED LINES.
  6259. *
  6260. * EXIT TERPROTECT = TRUE IF TERMINAL HAS PROTECT.
  6261. * TERGUARDMD = TRUE IF TERMINAL HAS GUARD MODE.
  6262. * TERTABHOME = TRUE IF HARD TAB GOES TO HOME.
  6263. * TERTABPROT = TRUE IF CAN TAB TO PROTECTED FIELDS.
  6264. * TERSIZECLR = TRUE IF RESET OF SIZE CLEARS SCREEN.
  6265. * TERTABAUTO = TRUE IF AUTOMATIC TABBING AVAILABLE.
  6266. * TERNUMCOLS = THE ACTUAL NUMBER OF COLUMNS.
  6267. * TERNUMLNES = THE ACTUAL NUMBER OF LINES.
  6268. * TERLEAVESM = FUNCTION KEY LEAVES MARK COUNT.
  6269. * TERSCREENM = TRUE.
  6270. *
  6271. *IF UNDEF,QTRM
  6272. * CALLS VDTGTD, VDTGTF, VDTOPN, VDTSTD, VDTSTM.
  6273. *ELSE
  6274. * CALLS VDTGTD, VDTGTF, VDTSTD, VDTSTM.
  6275. *ENDIF
  6276. *
  6277. * USES TERGUARDMD, TERLEAVESM, TERNUMCOLS, TERNUMLNES,
  6278. * TERPROTECT, TERSCREENM, TERSIZECLR, TERTABAUTO,
  6279. * TERTABHOME, TERTABPROT.
  6280. #
  6281. ITEM COLUMNS U; # DESIRED NUMBER OF COLUMNS #
  6282. ITEM LINES U; # DESIRED NUMBER OF LINES #
  6283.  
  6284. ITEM SCREEN I = 1; # INDICATES SCREEN MODE TO VDT #
  6285. ITEM ATTRWORD U; # TERMINAL ATTRIBUTES WORD #
  6286.  
  6287. *IF UNDEF,QTRM
  6288. VDTOPN; # OPEN TERMINAL #
  6289. *ENDIF
  6290. VDTSTM(SCREEN,DUMMY); # SET SCREEN MODE #
  6291. VDTSTD(COLUMNS,LINES); # SET SCREEN DIMENSIONS #
  6292. VDTGTD(COLUMNS,LINES); # GET ACTUAL VALUES #
  6293. TERNUMCOLS[0] = COLUMNS - 1; # SET INTERNAL VALUE #
  6294. TERNUMLNES[0] = LINES - 1; # SET INTERNAL VALUE #
  6295. FOR DUMMY = 2 STEP 1 UNTIL 4 DO
  6296. BEGIN
  6297. VDTGTF(ATTRWORD,DUMMY); # GET TERMINAL ATTRIBUTES #
  6298. TERMSTATWD[DUMMY] = ATTRWORD; # SAVE TERMINAL ATTRIBUTES #
  6299. END
  6300. TERSCREENM[0] = TRUE; # TERMINAL IS IN SCREEN MODE #
  6301.  
  6302. END # SETSRN #
  6303. CONTROL EJECT;
  6304.  
  6305. PROC SFLOAD(PANELNAME,PANELADDR,OPENSTAT);
  6306.  
  6307. # TITLE SFLOAD - LOAD PANEL. #
  6308.  
  6309. BEGIN # SFLOAD #
  6310.  
  6311. #
  6312. ** SFLOAD - LOAD PANEL.
  6313. *
  6314. * THIS PROCEDURE CALLS THE FAST DYNAMIC LOADER TO LOAD THE
  6315. * SPECIFIED PANEL AND ISSUES AN INFORMATIVE MESSAGE IF THE
  6316. * LOAD WAS UNSUCCESSFUL DUE TO AN INTERNAL F.D.L. ERROR.
  6317. *
  6318. * PROC SFLOAD(PANELNAME,PANELADDR,OPENSTAT)
  6319. *
  6320. * ENTRY PANELNAME = NAME OF PANEL TO BE LOADED.
  6321. *
  6322. * EXIT PANEL LOADED IF POSSIBLE, OPENSTAT SET, INFORMATIVE
  6323. * DAYFILE MESSAGE ISSUED IF NECESSARY.
  6324. *
  6325. * CALLS ERRMSG, LCP.
  6326. *
  6327. * NOTES OPENSTAT IS SET BY SFLOAD (AND RETURNED TO SFOPEN)
  6328. * IN THOSE INSTANCES WHERE THE FAST DYNAMIC LOADER
  6329. * IS CALLED.
  6330. *
  6331. * OPENSTAT SIGNIFICANCE PROCEDURE
  6332. * .....................................................
  6333. * . 0 . NO ERROR . BOTH .
  6334. * . 1 . UNKNOWN PANEL NAME . SFLOAD .
  6335. * . 2 . INCORRECT CAPSULE FORMAT . SFLOAD .
  6336. * . 3 . PLT FULL (TOO MANY OPEN PANELS) . SFOPEN .
  6337. * . 4 . PANEL ALREADY OPEN . SFOPEN .
  6338. * . 5 . INTERNAL (FAST DYNAMIC LOADER) . SFLOAD .
  6339. * . 6 . NO SCREEN COMMAND ISSUED . SFOPEN .
  6340. * . 7 . UNSUPPORTED TERMINAL . SFOPEN .
  6341. * .....................................................
  6342. #
  6343. ITEM PANELNAME C(7); # NAME OF PANEL TO LOAD #
  6344. ITEM PANELADDR I; # MEMORY ADDRESS OF PANEL #
  6345. ITEM OPENSTAT I; # RETURNS STATUS TO APPLICATION #
  6346.  
  6347. ITEM FATAL B = FALSE; # OPEN ERRORS ARE NOT FATAL #
  6348. ITEM FDLSTAT I; # RETURNS STATUS FROM LOADER #
  6349. ITEM MSG C(25); # DAYFILE ERROR MESSAGE #
  6350. ITEM PNAME C(6) = "SFOPEN"; # PROCEDURE NAME #
  6351.  
  6352. SWITCH LOADCASE # F.D.L. STATUS RETURN SWITCH #
  6353. NOERROR, # SUCCESSFUL LOAD #
  6354. BADLIBRARY, # BAD LIBRARY LIST #
  6355. BADGROUP, # BAD GROUP NAME #
  6356. UNKNOWNCAP, # UNKNOWN CAPSULE NAME #
  6357. BADFORMAT, # BAD CAPSULE FORMAT #
  6358. BADENTRY, # BAD PASSLOC/ENTRY FORMAT #
  6359. DUPLOAD, # CAPSULE ALREADY IN MEMORY #
  6360. CAPOVCAP; # CAPSULE/OVCAP CONFUSION #
  6361.  
  6362. LCP(PANELNAME,PANELADDR,FDLSTAT); # CALL FAST DYNAMIC LOADER #
  6363.  
  6364. #
  6365. * SIMULATED CASE STATEMENT FOR PROCESSING LOADER RETURN STATUS.
  6366. #
  6367.  
  6368. GOTO LOADCASE[FDLSTAT]; # PROCESS STATUS FROM LOADER #
  6369.  
  6370. NOERROR: # NO ERROR #
  6371. OPENSTAT = OPENSTATUS"NOERROR"; # UPDATE PANEL LOAD TABLE #
  6372. PLTNUMENT[0] = PLTNUMENT[0]+1;
  6373. PLTENAME[PLTNUMENT[0]]=PANELNAME;
  6374. PLTSLFLAG[PLTNUMENT[0]]=FALSE;
  6375. PLTOPENFLG[PLTNUMENT[0]]=TRUE;
  6376. PLTADDR[PLTNUMENT[0]]=PANELADDR;
  6377. GOTO ENDCASE;
  6378.  
  6379. BADLIBRARY: # BAD LIBRARY LIST #
  6380. OPENSTAT = OPENSTATUS"INTERNAL"; # ISSUE INFORMATIVE MESSAGE #
  6381. MSG = " BAD LIBRARY LIST. ";
  6382. ERRMSG(PANELNAME,PNAME,MSG,FATAL);
  6383. GOTO ENDCASE;
  6384.  
  6385. BADGROUP: # UNKNOWN GROUP NAME #
  6386. OPENSTAT = OPENSTATUS"INTERNAL"; # ISSUE INFORMATIVE MESSAGE #
  6387. MSG = " BAD GROUP NAME. ";
  6388. ERRMSG(PANELNAME,PNAME,MSG,FATAL);
  6389. GOTO ENDCASE;
  6390.  
  6391. UNKNOWNCAP: # UNKNOWN CAPSULE NAME #
  6392. OPENSTAT = OPENSTATUS"UNPANEL"; # UNKNOWN CAPSULE NAME #
  6393. GOTO ENDCASE;
  6394.  
  6395. BADFORMAT: # BAD CAPSULE FORMAT #
  6396. OPENSTAT = OPENSTATUS"INCAPFOR"; # BAD CAPSULE FORMAT #
  6397. GOTO ENDCASE;
  6398.  
  6399. BADENTRY: # BAD PASSLOC/ENTRY FORMAT #
  6400. OPENSTAT = OPENSTATUS"INTERNAL"; # ISSUE INFORMATIVE MESSAGE #
  6401. MSG = " BAD ENTRY FORMAT. ";
  6402. ERRMSG(PANELNAME,PNAME,MSG,FATAL);
  6403. GOTO ENDCASE;
  6404.  
  6405. DUPLOAD: # CAPSULE ALREADY IN MEMORY #
  6406. OPENSTAT = OPENSTATUS"INTERNAL"; # ISSUE INFORMATIVE MESSAGE #
  6407. MSG = " DUPLICATE LOAD. ";
  6408. ERRMSG(PANELNAME,PNAME,MSG,FATAL);
  6409. GOTO ENDCASE;
  6410.  
  6411. CAPOVCAP: # CAPSULE/OVCAP CONFUSION #
  6412. OPENSTAT = OPENSTATUS"INTERNAL"; # ISSUE INFORMATIVE MESSAGE #
  6413. MSG = " OVCAP CONFUSION. ";
  6414. ERRMSG(PANELNAME,PNAME,MSG,FATAL);
  6415.  
  6416. ENDCASE:
  6417.  
  6418. #
  6419. * END OF CASE STATEMENT FOR PROCESSING LOADER RETURN STATUS.
  6420. #
  6421.  
  6422. END # SFLOAD #
  6423. CONTROL EJECT;
  6424.  
  6425. PROC SKPBLK(FLDIND,CHARPOS,CHAR);
  6426.  
  6427. # TITLE SKPBLK - SKIP BLANKS. #
  6428.  
  6429. BEGIN # SKPBLK #
  6430.  
  6431. #
  6432. ** SKPBLK - SKIP BLANKS.
  6433. *
  6434. * THIS PROCEDURE SKIPS BLANKS IN A FIELD IN VARDATA AND RETURNS
  6435. * THE POSITION OF THE FIRST NON-BLANK CHARACTER.
  6436. *
  6437. * PROC SKPBLK(FLDIND,CHARPOS,CHAR)
  6438. *
  6439. * ENTRY FLDIND = INDEX OF FIELD IN FLDLIST.
  6440. * CHARPOS = STARTING CHARACTER POSITION IN FIELD.
  6441. *
  6442. * EXIT CHARPOS = POSTION OF FIRST NON-BLANK CHARACTER.
  6443. * CHAR = FIRST NON-BLANK CHARACTER.
  6444. #
  6445. ITEM FLDIND I; # INDEX OF FIELD IN FLDLIST #
  6446. ITEM CHARPOS I; # CHARACTER POSITION IN FIELD #
  6447. ITEM CHAR I; # INPUT CHARACTER #
  6448.  
  6449. ITEM BLANKCHAR B; # BLANK CHARACTER INPUT #
  6450.  
  6451. BLANKCHAR = TRUE;
  6452.  
  6453. WHYLE BLANKCHAR AND CHARPOS LQ FLDLENGTH[FLDIND] DO
  6454. BEGIN
  6455. CHAR = NEXTCHAR(FLDIND,CHARPOS);
  6456. IF CHAR NQ BLANK THEN
  6457. BEGIN # IF NOT BLANK CHARACTER #
  6458. BLANKCHAR = FALSE;
  6459. END
  6460. ELSE
  6461. BEGIN # BLANK CHARACTER #
  6462. CHARPOS = CHARPOS + 1;
  6463. END
  6464. END
  6465.  
  6466. END # SKPBLK #
  6467. CONTROL EJECT;
  6468.  
  6469. PROC TABKEY(ORDINAL,INPOS,NEWFIELD,OUTPOS);
  6470.  
  6471. # TITLE TABKEY - PROCESS TABKEY. #
  6472.  
  6473. BEGIN # TABKEY #
  6474.  
  6475. #
  6476. ** TABKEY - PROCESS TAB KEY.
  6477. *
  6478. * THIS PROCEDURE IS CALLED TO PROCESS TABS. IN THE CASE OF
  6479. * OF A HARD TAB ON A TERMINAL WITH PROTECT MODE VIRTERM HAS
  6480. * AN INCORRECT INTERNAL CURSOR POSITION WHICH WILL HAVE TO BE
  6481. * RESET. TABKEY DETERMINES THE CURSOR POSITION AND NOTIFIES
  6482. * VIRTEM THROUGH VDTCOR. FOR SOFT TABS (INCLUDING TAB KEYS
  6483. * ON TERMINALS WITHOUT PROTECT MODE) THE CURSOR POSITION IS
  6484. * INCORRECT BUT WILL BE FIXED THE NEXT TIME THAT PROCEDURE
  6485. * READIN DOES A VDTPOS.
  6486. *
  6487. * PROC TABKEY(ORDINAL,INPOS,FIELD,OUTPOS)
  6488. *
  6489. * ENTRY ORDINAL = FTAB, FORWARD TAB KEY
  6490. * = BTAB, BACKWARD TAB KEY
  6491. * INPOS = LINE AND COLUMN WHERE TAB KEY WAS PRESSED
  6492. *
  6493. * EXIT OUTPOS = NEW X/Y POSITION
  6494. * NEWFIELD = NEW FIELD POSITION
  6495. *
  6496. * NOTES CURSOR IS POSITIONED TO HOME IF TABBED BEYOND FIRST OR
  6497. * LAST INPUT FIELD.
  6498. #
  6499. ITEM ORDINAL I; # ORDINAL OF TAB KEY #
  6500. ITEM INPOS I; # LINE AND COLUMN WHERE PRESSED #
  6501. ITEM NEWFIELD I; # ORDINAL OF FIELD TABBED TO #
  6502. ITEM OUTPOS I; # NEW LINE AND COLUMN #
  6503.  
  6504. ITEM FIELDFOUND B; # FOUND FIELD TABBED TO #
  6505. ITEM I I; # LOOP COUNTER #
  6506. ITEM P I; # POINTER TO PREVIOUS FIELD #
  6507.  
  6508. P = -1;
  6509. NEWFIELD = -1;
  6510. FIELDFOUND = FALSE;
  6511.  
  6512. IF ORDINAL EQ SCREENST"FTAB" THEN
  6513. BEGIN # FORWARD TAB KEY PRESSED #
  6514. FOR I = 0 STEP 1 WHILE FLDENTRY[I] NQ 0
  6515. AND NOT FIELDFOUND DO
  6516. BEGIN # LOOK FOR NEXT INPUT FIELD #
  6517. IF FLDINPUTV[I] AND FLDACTIVE[I] THEN
  6518. BEGIN
  6519. IF INPOS LS FLDPOS[I]
  6520. AND (TERPTDWFLN[0] OR NOT (P GQ 0
  6521. AND FLDYCORD[P] EQ FLDYCORD[I]-1 AND FLDXCORD[I] EQ 0
  6522. AND FLDXCORD[P]+FLDLENGTH[P] EQ TERNUMCOLS[0]+1)) THEN
  6523. BEGIN # IF NEXT NON-CONTIGUOUS FIELD #
  6524. FIELDFOUND = TRUE;
  6525. NEWFIELD = I;
  6526. END
  6527. ELSE P = I;
  6528. END
  6529. END
  6530. END
  6531. ELSE
  6532. BEGIN # BACKWARD TAB KEY PRESSED #
  6533. IF INPOS EQ 0 THEN
  6534. BEGIN
  6535. XMASKOF INPOS = TERNUMCOLS[0];
  6536. YMASKOF INPOS = TERNUMLNES[0];
  6537. END
  6538. P = -1;
  6539. FOR I = 0 STEP 1 WHILE FLDENTRY[I] NQ 0 AND FLDPOS[I] LS INPOS DO
  6540. BEGIN # LOOK FOR NEXT INPUT FIELD #
  6541. IF FLDINPUTV[I] AND FLDACTIVE[I] THEN
  6542. BEGIN
  6543. IF TERPTDWBLN[0] OR NOT (P GQ 0
  6544. AND FLDYCORD[P] EQ FLDYCORD[I]-1 AND FLDXCORD[I] EQ 0
  6545. AND FLDXCORD[P]+FLDLENGTH[P] EQ TERNUMCOLS[0]+1) THEN
  6546. NEWFIELD = I; # IF FIELDS NOT CONTIGUOUS #
  6547. P = I;
  6548. END
  6549. END
  6550. END
  6551.  
  6552. IF NEWFIELD GQ 0 THEN
  6553. BEGIN # IF FIELD FOUND #
  6554. OUTPOS = FLDPOS[NEWFIELD];
  6555. END
  6556. ELSE
  6557. BEGIN # FIELD NOT FOUND #
  6558. OUTPOS = 0;
  6559. END
  6560.  
  6561. END # TABKEY #
  6562. CONTROL EJECT;
  6563.  
  6564. PROC VALIDF(FLDIND);
  6565.  
  6566. # TITLE VALIDF - VALIDATE FIELD. #
  6567.  
  6568. BEGIN # VALIDF #
  6569.  
  6570. #
  6571. ** VALIDF - VALIDATE FIELD.
  6572. *
  6573. * THIS PROCEDURE CALLS THE APPROPRIATE VALIDATION PROCEDURE
  6574. * AS WELL AS CONVERTING INTEGER AND REAL VARIABLE INPUT TO
  6575. * THE CORRECT NUMERIC VALUE.
  6576. *
  6577. * PROC VALIDF(FLDIND)
  6578. *
  6579. * ENTRY FLDIND = INDEX OF CURRENT FIELD IN FLDLIST.
  6580. *
  6581. * EXIT FLDVALID[FLDIND] = FALSE, IF NUMERIC INPUT IS INVALID.
  6582. *
  6583. * CALLS DATEVL, IRANGE, MATCHV, NCHECK, PICVAL, RRANGE.
  6584. #
  6585. ITEM FLDIND I; # INDEX OF FIELD #
  6586.  
  6587. ITEM ALLBLANK B; # ALL BLANKS IN FIELD #
  6588. ITEM DOLLARSIGN B; # $ IN INPUT #
  6589. ITEM EVAL I; # EXPONENT VALUE OF INPUT #
  6590. ITEM I I; # LOOP COUNTER #
  6591. ITEM INPTYPE I; # INPUT FORMAT TYPE #
  6592. ITEM IVAL I; # INTEGER VALUE OF INPUT #
  6593. ITEM NOTFULL B; # FIELD CONTAINS A BLANK #
  6594. ITEM STARRED B; # * ("DON-T KNOW") ENTERED #
  6595. ITEM VARIND I; # INDEX INTO VARLIST #
  6596.  
  6597. SWITCH VARITYPE # VARIABLE TYPE #
  6598. RESERV, # RESERVED #
  6599. CHARACVAR, # CHARACTER VARIABLE #
  6600. INTEGERVAR, # INTEGER VARIABLE #
  6601. REALVAR; # REAL VARIABLE #
  6602.  
  6603. VARIND = FLDVARORD[FLDIND];
  6604. FLDVALID[FLDIND] = TRUE; # TRUE UNTIL PROVEN FALSE #
  6605.  
  6606. IF VARMUSENTR[VARIND] AND NOT FLDENTERED[FLDIND] THEN
  6607. BEGIN # IF MUST ENTERED AND NOT #
  6608. FLDVALID[FLDIND] = FALSE; # PROVEN FALSE #
  6609. RETURN;
  6610. END
  6611.  
  6612. ALLBLANK = TRUE; # SET FLAGS AND CHECK CHARACTER #
  6613. STARRED = FALSE;
  6614. NOTFULL = FALSE;
  6615. IF NEXTCHAR(FLDIND,0) EQ ASTERISK AND NOT VARMUSKNOW[VARIND] THEN
  6616. BEGIN # IF ASTERISK AND NOT MUST KNOW #
  6617. STARRED = TRUE;
  6618. END
  6619. IF NEXTCHAR(FLDIND,0) NQ BLANK THEN
  6620. BEGIN # IF NOT A BLANK #
  6621. ALLBLANK = FALSE; # NOT ALL BLANKS #
  6622. END
  6623. ELSE
  6624. BEGIN # A BLANK #
  6625. NOTFULL = TRUE; # UNFULL #
  6626. END
  6627. FOR I = 1 STEP 1 WHILE I LQ FLDLENGTH[FLDIND] -1 DO
  6628. BEGIN # EXAMINE THE REST OF THE FIELD #
  6629. IF NEXTCHAR(FLDIND,I) NQ BLANK THEN
  6630. BEGIN # IF NOT A BLANK #
  6631. ALLBLANK = FALSE; # NOT ALL BLANKS #
  6632. STARRED = FALSE; # NOT STARRED #
  6633. END
  6634. ELSE
  6635. BEGIN # A BLANK #
  6636. NOTFULL = TRUE; # UNFULL #
  6637. END
  6638. END
  6639. IF STARRED THEN RETURN; # ASTERISK AND NOT *MUST KNOW* #
  6640. IF(VARMUSFILL[VARIND] AND FLDENTERED[FLDIND] AND
  6641. (NOTFULL AND NOT ALLBLANK)) OR (VARMUSCON[VARIND] AND ALLBLANK) THEN
  6642. BEGIN # IF MUST FILL AND NOT FULL OR #
  6643. FLDVALID[FLDIND] = FALSE; # MUST CONTAIN AND ALL BLANKS #
  6644. RETURN;
  6645. END
  6646. IF NOT VARMUSENTR[VARIND] AND ALLBLANK THEN RETURN;
  6647.  
  6648. GOTO VARITYPE[VARTYPE[VARIND]];
  6649.  
  6650. RESERV:
  6651. CHARACVAR: # VALIDATE CHARACTER VARIABLE #
  6652.  
  6653. IF VARVALM[VARIND] THEN MATCHV(FLDIND);
  6654. IF VARPICTYPE[VARIND] NQ 0 THEN PICVAL(FLDIND);
  6655. RETURN;
  6656.  
  6657. INTEGERVAR: # VALIDATE INTEGER VARIABLE #
  6658.  
  6659. IF VARPICTYPE[VARIND] GR FORMTYPE"E" THEN
  6660. BEGIN # DATE VALIDATION #
  6661. DATEVL(FLDIND,IVAL,EVAL);
  6662. END
  6663. ELSE
  6664. BEGIN
  6665. NCHECK(FLDIND,IVAL,EVAL,INPTYPE,DOLLARSIGN);
  6666. IF INPTYPE EQ FORMTYPE"BAD" OR INPTYPE GR VARPICTYPE[VARIND]
  6667. OR VARPICTYPE[VARIND] EQ FORMTYPE"E" AND DOLLARSIGN THEN
  6668. BEGIN
  6669. FLDVALID[FLDIND] = FALSE;
  6670. RETURN;
  6671. END
  6672. END
  6673. IF VARVALM[VARIND] THEN MATCHV(FLDIND);
  6674. IF VARVALR[VARIND] THEN IRANGE(FLDIND,IVAL,EVAL);
  6675. RETURN;
  6676.  
  6677. REALVAR: # VALIDATE REAL VARIABLE #
  6678.  
  6679. IF VARPICTYPE[VARIND] GR FORMTYPE"E" THEN
  6680. BEGIN
  6681. DATEVL(FLDIND,IVAL,EVAL);
  6682. END
  6683. ELSE
  6684. BEGIN
  6685. NCHECK(FLDIND,IVAL,EVAL,INPTYPE,DOLLARSIGN);
  6686. IF INPTYPE EQ FORMTYPE"BAD" OR INPTYPE GR VARPICTYPE[VARIND]
  6687. OR VARPICTYPE[VARIND] EQ FORMTYPE"E" AND DOLLARSIGN THEN
  6688. BEGIN
  6689. FLDVALID[FLDIND] = FALSE;
  6690. RETURN;
  6691. END
  6692. END
  6693. IF VARVALM[VARIND] THEN MATCHV(FLDIND);
  6694. IF VARVALR[VARIND] THEN REALRANGE(FLDIND,IVAL,EVAL);
  6695.  
  6696. END # VALIDF #
  6697. CONTROL EJECT;
  6698.  
  6699. PROC WRIALL;
  6700.  
  6701. # TITLE WRIALL - WRITE ALL PANELS. #
  6702.  
  6703. BEGIN # WRIALL #
  6704.  
  6705. #
  6706. ** WRIALL - WRITE ALL PANELS.
  6707. *
  6708. * THIS PROCEDURE REWRITES ALL PANELS THAT ARE ON THE SCREEN IN
  6709. * THE ORDER THAT THEY WERE WRITTEN.
  6710. *
  6711. * PROC WRIALL
  6712. *
  6713. * ENTRY TERACTPANL = THE NAME OF THE ACTIVE PANEL.
  6714. * PLTNUMONSC = THE NUMBER OF PANELS ON THE SCREEN.
  6715. *
  6716. * EXIT COMPLETE SCREEN REWRITTEN.
  6717. *
  6718. * CALLS CLRLNS, POSARR, REWFLD, VDTCAA, VDTCLS, VDTPRO, VDTSAM,
  6719. * WRIBOX, WRITES.
  6720. *
  6721. * NOTES THIS PROCEDURE IS CALLED BY READ IN THE CASE OF
  6722. * A CLEAR PAGE AND BY WRIPAN IF AN OVERLAY WRITE
  6723. * HAS CAUSED A SHIFT FROM 80 TO 132 COLUMN MODE.
  6724. * IF THE ACTIVE PANEL IS NOT THE LAST PANEL TO BE
  6725. * REWRITTEN THEN ITS VARIABLES WILL BE REWRITTEN
  6726. * ONCE MORE TO INSURE THAT THEY ARE CORRECT.
  6727. #
  6728. ITEM PANELADDR I; # PANEL ADDRESS #
  6729. ITEM PANELNAME C(7); # PANEL NAME #
  6730. ITEM PLTINDEX I; # PANEL LOAD TABLE INDEX #
  6731. ITEM NUMWRITTEN I; # NUMBER OF PANELS WRITTEN #
  6732.  
  6733. VDTCLS; # CLEAR SCREEN #
  6734. NUMWRITTEN = 0; # NO PANELS WRITTEN YET #
  6735.  
  6736. WHYLE NUMWRITTEN NQ PLTNUMONSC[0] DO
  6737. BEGIN
  6738. NUMWRITTEN = NUMWRITTEN + 1;
  6739. PLTINDEX = 1; # FIND CORRECT PANEL #
  6740. WHYLE PLTENTRYNM[PLTINDEX] NQ NUMWRITTEN DO
  6741. BEGIN
  6742. PLTINDEX = PLTINDEX + 1;
  6743. END
  6744. PANELNAME = PLTENAME[PLTINDEX]; # WRITE PANEL #
  6745. PANELADDR = PLTADDR[PLTINDEX];
  6746. IF PLTNUMONSC[0] NQ 1 THEN POSARR(PANELADDR);
  6747. IF NOT PANPRIPAN[0] THEN CLRLNS;
  6748. IF PANSTRFLD[0] NQ 0 THEN WRITES;
  6749. IF PANSTRBOX[0] NQ 0 THEN WRIBOX;
  6750. END
  6751.  
  6752. IF PANELNAME NQ TERACTPANL[0] THEN
  6753. BEGIN # IF NEED TO REWRITE VARIABLES #
  6754. PANELADDR = PLTADDR[TERACTPLTI[0]];
  6755. POSARR(PANELADDR);
  6756. IF PANPRIPAN[0] THEN
  6757. BEGIN # IF PRIMARY PANEL #
  6758. IF NOT TERPROCLRS[0] THEN VDTPRO(OUT"PROTECTALL");
  6759. IF PANNUMBYTE[0] NQ 0 THEN REWFLD;
  6760. END
  6761. ELSE
  6762. BEGIN # IF OVERLAY PANEL #
  6763. CLRLNS;
  6764. IF PANSTRFLD[0] NQ 0 THEN WRITES;
  6765. IF PANSTRBOX[0] NQ 0 THEN WRIBOX;
  6766. END
  6767. END
  6768.  
  6769. IF NOT TERBLCKMDE[0] THEN VDTSAM(0); ELSE VDTCAA(0);
  6770.  
  6771. END # WRIALL #
  6772. CONTROL EJECT;
  6773.  
  6774. PROC WRIBOX;
  6775.  
  6776. # TITLE WRIBOX - WRITE BOX. #
  6777.  
  6778. BEGIN # WRIBOX #
  6779.  
  6780. #
  6781. ** WRIBOX - WRITE BOX.
  6782. *
  6783. * THIS PROCEDURE WRITES THE BOXES DEFINED IN THE BOX LIST OF
  6784. * THE ACTIVE PANEL TO THE SCREEN.
  6785. *
  6786. * PROC WRIBOX
  6787. *
  6788. * CALLS VDTBOX, VDTDRW, VDTPOS, VDTPRO, VDTSAM.
  6789. *
  6790. * NOTES WRIBOX DOES CURSOR POSITIONING AND ATTRIBUTE SELECTION
  6791. * (WHICH INCLUDES SELECTION OF THE PROPER LINE WEIGHT
  6792. * FOR THE LINE DRAWING CHARACTER SET) AND DOES NOT DE-
  6793. * PEND ON THE CALLING PROCEDURE FOR THESE FUNCTIONS.
  6794. #
  6795. ITEM BOXINDEX I; # INDEX INTO THE BOX LIST #
  6796. ITEM CURWEIGHT I; # CURRENT LINE WEIGHT #
  6797. ITEM NUMCHARS I; # NUMBER OF CHARACTERS #
  6798.  
  6799. IF PANSTRFLD[0] EQ 0 AND NOT TERPROCLRS[0] THEN
  6800. BEGIN # IF NO FIELDS AND NO CLEAR #
  6801. VDTPRO(OUT"PROTECTALL"); # ISSUE GLOBAL PROTECT #
  6802. END
  6803.  
  6804. TERCURVORD[0] = -1; # NO CURRENT ATTRIBUTES YET #
  6805. CURWEIGHT = -1; # NO CURRENT LINE WEIGHT YET #
  6806.  
  6807. FOR BOXINDEX = 0 STEP 1 WHILE BOXWORD[BOXINDEX] NQ 0 DO
  6808. BEGIN # CHECK FOR ATTRIBUTE CHANGE #
  6809. IF BOXATTORD[BOXINDEX] NQ TERCURVORD[0] THEN
  6810. BEGIN # SET NEW ATTRIBUTES #
  6811. TERCURVORD[0] = BOXATTORD[BOXINDEX];
  6812. IF NOT TERATTRCHR[0] THEN VDTSAM(ATTMASK[TERCURVORD[0]]);
  6813. END
  6814. IF ATTLINEWT[TERCURVORD[0]] NQ CURWEIGHT THEN
  6815. BEGIN # SET NEW LINE WEIGHT #
  6816. CURWEIGHT = ATTLINEWT[TERCURVORD[0]];
  6817. VDTDRW(CURWEIGHT);
  6818. END
  6819. IF BOXREPEAT[BOXINDEX] GR 1 THEN
  6820. BEGIN # IF HORIZONTAL / VERTICAL LINE #
  6821. IF BOXCHAR[BOXINDEX] EQ 0 THEN
  6822. BEGIN # IF HORIZONTAL LINE #
  6823. IF BOXYCORD[BOXINDEX] LQ TERNUMLNES[0] THEN
  6824. BEGIN # IF LINE WITHIN LINE BOUNDARY #
  6825. VDTPOS(BOXXCORD[BOXINDEX],BOXYCORD[BOXINDEX]);
  6826. FOR NUMCHARS = 0 STEP 1 UNTIL BOXREPEAT[BOXINDEX]-1 DO
  6827. BEGIN # OUTPUT HORIZONTAL LINE #
  6828. IF BOXXCORD[BOXINDEX] + NUMCHARS LQ TERNUMCOLS[0] THEN
  6829. BEGIN # IF WITHIN COLUMN BOUNDARY #
  6830. VDTBOX(BOXCHAR[BOXINDEX]);
  6831. END
  6832. END
  6833. END
  6834. END
  6835. ELSE
  6836. BEGIN # IF VERTICAL LINE #
  6837. IF BOXXCORD[BOXINDEX] LQ TERNUMCOLS[0] THEN
  6838. BEGIN # IF LINE WITHIN COLUMN BOUNDARY #
  6839. FOR NUMCHARS = 0 STEP 1 UNTIL BOXREPEAT[BOXINDEX]-1 DO
  6840. BEGIN # OUTPUT VERTICAL LINE #
  6841. IF BOXYCORD[BOXINDEX] + NUMCHARS LQ TERNUMLNES[0]THEN
  6842. BEGIN # IF WITHIN LINE BOUNDARY #
  6843. VDTPOS(BOXXCORD[BOXINDEX],BOXYCORD[BOXINDEX]+NUMCHARS);
  6844. VDTBOX(BOXCHAR[BOXINDEX]);
  6845. END
  6846. END
  6847. END
  6848. END
  6849. END
  6850. ELSE
  6851. BEGIN # OUTPUT SINGLE BOX CHARACTER #
  6852. IF BOXYCORD[BOXINDEX] LQ TERNUMLNES[0]
  6853. AND BOXXCORD[BOXINDEX] LQ TERNUMCOLS[0] THEN
  6854. BEGIN # IF CHARACTER WITHIN BOUNDARIES #
  6855. VDTPOS(BOXXCORD[BOXINDEX],BOXYCORD[BOXINDEX]);
  6856. VDTBOX(BOXCHAR[BOXINDEX]);
  6857. END
  6858. END
  6859. END
  6860.  
  6861. VDTDRW(0); # TURN OFF LINE DRAWING #
  6862.  
  6863. END # WRIBOX #
  6864. CONTROL EJECT;
  6865.  
  6866. PROC WRIPAN;
  6867.  
  6868. # TITLE WRIPAN - WRITE PANEL. #
  6869.  
  6870. BEGIN # WRIPAN #
  6871.  
  6872. #
  6873. ** WRIPAN - WRITE PANEL.
  6874. *
  6875. * THIS PROCEDURE DETERMINES IF THE PANEL TO BE WRITTEN IS
  6876. * A PRIMARY OR AN OVERLAY PANEL, ASSURES THAT THE TERMINAL
  6877. * IS IN SCREEN MODE AND CALLS THE PROPER ROUTINES TO WRITE
  6878. * THE PANEL TO THE SCREEN.
  6879. *
  6880. * PROC WRIPAN
  6881. *
  6882. * ENTRY TERACTPANL = THE NAME OF THE PANEL TO BE WRITTEN.
  6883. * TERACTPLTI = THE CORRESPONDING PLT INDEX.
  6884. *
  6885. * EXIT PANEL WRITTEN TO SCREEN.
  6886. *
  6887. * CALLS REWFLD, SETSRN, WRIALL, WRIBOX, WRITES, VDTCAA, VDTCLS,
  6888. * VDTGTD, VDTPRO, VDTSAM, VDTSTD.
  6889. *
  6890. * NOTES IF AN ATTEMPT IS MADE TO WRITE AN OVERLAY PANEL
  6891. * WITHOUT A PREVIOUS PRIMARY PANEL BEING WRITTEN
  6892. * (I.E. THE TERMINAL IS IN LINE MODE) THEN A DAY-
  6893. * FILE MESSAGE WILL BE ISSUED AND THE PROGRAM WILL
  6894. * BE ABORTED.
  6895. #
  6896. ITEM FATAL B = TRUE; # FATAL ERROR #
  6897. ITEM HOLDCOLS I; # NUMBER OF REQUESTED COLUMNS #
  6898. ITEM HOLDLINES I; # NUMBER OF REQUESTED LINES #
  6899. ITEM MSG C(25) = " NOT PRIMARY. "; # ERROR MSG. #
  6900. ITEM PANELADDR I; # ADDRESS OF PANEL RECORD #
  6901. ITEM PLTCOUNT I; # COUNTER TO CLEAR PLT #
  6902. ITEM PNAME C(6) = "SFSWRI"; # PROCEDURE NAME #
  6903.  
  6904. IF PLTENTRYNM[TERACTPLTI[0]] NQ 0 THEN
  6905. BEGIN # IF PANEL IS ON SCREEN #
  6906. IF PANPRIPAN[0] THEN
  6907. BEGIN # IF PRIMARY ON SCREEN #
  6908. IF PLTNUMONSC[0] GR 1 AND NOT TERPROCLRS[0] THEN
  6909. BEGIN # IF MORE THAN 1 AND NO CLEAR #
  6910. VDTPRO(OUT"PROTECTALL"); # ISSUE GLOBAL PROTECT #
  6911. END
  6912. IF PANNUMBYTE[0] NQ 0 THEN REWFLD;
  6913. END
  6914. ELSE
  6915. BEGIN # IF OVERLAY ON SCREEN #
  6916. CLRLNS; # CLEAR NECESSARY LINES #
  6917. IF PANSTRFLD[0] NQ 0 THEN WRITES;
  6918. IF PANSTRBOX[0] NQ 0 THEN WRIBOX;
  6919. IF NOT TERBLCKMDE[0] THEN VDTSAM(0); ELSE VDTCAA(0);
  6920. FOR PLTCOUNT = 1 STEP 1 UNTIL PLTNUMENT[0] DO
  6921. BEGIN # UPDATE SEQUENCE NUMBERS #
  6922. IF PLTENTRYNM[PLTCOUNT] GR PLTENTRYNM[TERACTPLTI[0]] THEN
  6923. BEGIN
  6924. PLTENTRYNM[PLTCOUNT] = PLTENTRYNM[PLTCOUNT]-1;
  6925. END
  6926. END
  6927. PLTENTRYNM[TERACTPLTI[0]] = PLTNUMENT[0];
  6928. END
  6929. END
  6930. ELSE
  6931. BEGIN # IF PANEL NOT ON SCREEN #
  6932. HOLDCOLS = PANNUMCOLS[0]; # GET REQUESTED COLUMNS #
  6933. HOLDLINES = PANNUMLNES[0]; # GET REQUESTED LINES #
  6934. IF PANPRIPAN[0] THEN
  6935. BEGIN # IF PRIMARY NOT ON SCREEN #
  6936. IF NOT TERSCREENM[0] THEN
  6937. BEGIN # IF NOT IN SCREEN MODE #
  6938. SETSRN(HOLDCOLS,HOLDLINES); # SET SCREEN MODE #
  6939. END
  6940. ELSE
  6941. BEGIN
  6942. VDTSTD(HOLDCOLS,HOLDLINES); # SET SCREEN SIZE #
  6943. VDTGTD(HOLDCOLS,HOLDLINES); # GET ACTUAL VALUES #
  6944. TERNUMCOLS[0] = HOLDCOLS - 1; # SET INTERNAL VALUE #
  6945. TERNUMLNES[0] = HOLDLINES - 1; # SET INTERNAL VALUE #
  6946. END
  6947. VDTCLS;
  6948. TERCNWRIOV[0] = TRUE; # ALLOW OVERLAY WRITE #
  6949. FOR PLTCOUNT = 1 STEP 1 UNTIL PLTNUMENT[0] DO
  6950. BEGIN # CLEAR SEQUENCE NUMBERS #
  6951. PLTENTRYNM[PLTCOUNT] = 0;
  6952. END
  6953. PLTNUMONSC[0] = 1; # ONE PANEL ON SCREEN #
  6954. PLTENTRYNM[TERACTPLTI[0]] = 1;
  6955. TERMESWRIT[0] = FALSE;
  6956. TERMESREAD[0] = FALSE;
  6957. IF TERPROCLRS[0] THEN VDTPRO(OUT"PROTECTALL");
  6958. IF PANSTRFLD[0] NQ 0 THEN WRITES;
  6959. IF PANSTRBOX[0] NQ 0 THEN WRIBOX;
  6960. IF NOT TERBLCKMDE[0] THEN VDTSAM(0); ELSE VDTCAA(0);
  6961. END
  6962. ELSE
  6963. BEGIN # IF OVERLAY NOT ON SCREEN #
  6964. IF NOT TERCNWRIOV[0] THEN ERRMSG(TERACTPANL[0],PNAME,MSG,FATAL);
  6965. PLTNUMONSC[0] = PLTNUMONSC[0] + 1;
  6966. PLTENTRYNM[TERACTPLTI[0]] = PLTNUMONSC[0];
  6967. IF HOLDCOLS GR TERNUMCOLS[0] OR HOLDLINES GR TERNUMLNES[0] THEN
  6968. BEGIN
  6969. VDTSTD(HOLDCOLS,HOLDLINES); # SET SCREEN SIZE #
  6970. VDTGTD(HOLDCOLS,HOLDLINES); # GET ACTUAL VALUES #
  6971. IF HOLDCOLS NQ TERNUMCOLS[0] + 1 OR
  6972. HOLDLINES NQ TERNUMLNES[0] + 1 THEN
  6973. BEGIN # IF SCREEN SIZE CHANGED, RESET #
  6974. TERNUMCOLS[0] = HOLDCOLS - 1;
  6975. TERNUMLNES[0] = HOLDLINES - 1;
  6976. WRIALL; # WRITE ALL PANELS #
  6977. END
  6978. ELSE
  6979. BEGIN # NO CHANGE TO SCREEN SIZE #
  6980. CLRLNS; # CLEAR NECESSARY LINES #
  6981. IF PANSTRFLD[0] NQ 0 THEN WRITES;
  6982. IF PANSTRBOX[0] NQ 0 THEN WRIBOX;
  6983. IF NOT TERBLCKMDE[0] THEN VDTSAM(0); ELSE VDTCAA(0);
  6984. END
  6985. END
  6986. ELSE
  6987. BEGIN
  6988. CLRLNS; # CLEAR NECESSARY LINES #
  6989. IF PANSTRFLD[0] NQ 0 THEN WRITES;
  6990. IF PANSTRBOX[0] NQ 0 THEN WRIBOX;
  6991. IF NOT TERBLCKMDE[0] THEN VDTSAM(0); ELSE VDTCAA(0);
  6992. END
  6993. END
  6994. END
  6995.  
  6996. END # WRIPAN #
  6997. CONTROL EJECT;
  6998.  
  6999. PROC WRITES;
  7000.  
  7001. # TITLE WRITES - WRITE SCREEN. #
  7002.  
  7003. BEGIN # WRITES #
  7004.  
  7005. #
  7006. ** WRITES - WRITE SCREEN.
  7007. *
  7008. * THIS PROCEDURE WRITES THE PANEL TO THE SCREEN USING THE
  7009. * POSITIONING INFORMATION FOUND IN THE FIELD LIST AND THE
  7010. * DATA FOUND IN THE CONSTANT LIST AND VARIABLE DATA AREAS.
  7011. *
  7012. * PROC WRITES
  7013. *
  7014. * EXIT PANEL WRITTEN TO SCREEN.
  7015. *
  7016. * CALLS SETATR, VDTCAA, VDTPRO, VDTSAM, VDTSTR, WRIVAR.
  7017. #
  7018. ITEM FLDINDEX I; # INDEX INTO FIELD LIST #
  7019. BASED ARRAY CONSTRING;; # PASSES ADDRESS TO VDTSTR #
  7020.  
  7021. TERCURVORD[0] = -1; # NO CURRENT ATTRIBUTES YET #
  7022. TERPREVPOS[0] = -1; # LAST ATTRIBUTE POSITION #
  7023.  
  7024. IF NOT TERPROCLRS[0] THEN VDTPRO(OUT"PROTECTALL");
  7025.  
  7026. FOR FLDINDEX = 0 STEP 1 WHILE FLDENTRY[FLDINDEX] NQ 0 DO
  7027. BEGIN
  7028. IF FLDACTIVE[FLDINDEX] THEN
  7029. BEGIN
  7030. IF FLDXCORD[FLDINDEX] + FLDLENGTH[FLDINDEX] LQ TERNUMCOLS[0] + 1
  7031. AND FLDYCORD[FLDINDEX] LQ TERNUMLNES[0] THEN
  7032. BEGIN # IF FIELD ON SCREEN #
  7033. SETATR(FLDINDEX); # SET FIELD ATTRIBUTES #
  7034. IF FLDVARFLAG[FLDINDEX] THEN # IF VARIABLE FIELD #
  7035. BEGIN
  7036. WRIVAR(FLDINDEX); # WRITE VARIABLE FIELD #
  7037. END
  7038. ELSE
  7039. BEGIN # WRITE CONSTANT FIELD #
  7040. P&lt;CONSTRING>=LOC(RECWORDC[FLDCONOS[FLDINDEX]]);
  7041. VDTSTR(CONSTRING);
  7042. FLDREWRITE[FLDINDEX] = FALSE; # CLEAR REWRITE FIELD FLAG #
  7043. END
  7044. IF TERTABPROT[0] THEN
  7045. BEGIN # IF PROTECTED TABBING #
  7046. IF TERATTRSET[0] THEN
  7047. BEGIN # RESET ATTRIBUTES BEFORE VDTPOS #
  7048. IF TERCURVORD[0] NQ 2 THEN
  7049. BEGIN # IF NOT PROTECTED OUTPUT #
  7050. TERCURVORD[0] = 2; # SET ORDINAL AND ISSUE IT #
  7051. VDTSAM(O"6001");
  7052. END
  7053. END
  7054. END
  7055. END
  7056. ELSE
  7057. BEGIN # IF FIELD NOT ON SCREEN #
  7058. FLDACTIVE[FLDINDEX] = FALSE; # CLEAR ACTIVE FIELD FLAG #
  7059. FLDREWRITE[FLDINDEX] = FALSE; # CLEAR REWRITE FIELD FLAG #
  7060. END
  7061. END
  7062. END
  7063. IF NOT TERBLCKMDE[0] THEN VDTSAM(0); ELSE VDTSAM(O"6001");
  7064.  
  7065. END # WRITES #
  7066. CONTROL EJECT;
  7067.  
  7068. PROC WRIVAR(FLDINDEX);
  7069.  
  7070. # TITLE WRIVAR - WRITE VARIABLE. #
  7071.  
  7072. BEGIN # WRIVAR #
  7073.  
  7074. #
  7075. ** WRIVAR - WRITE VARIABLE.
  7076. *
  7077. * THIS PROCEDURE WRITES THE VARIABLE POINTED AT BY FLDINDEX
  7078. * TO THE SCREEN.
  7079. *
  7080. * PROC WRIVAR(FLDINDEX)
  7081. *
  7082. * ENTRY FLDINDEX = INDEX INTO THE FIELD LIST.
  7083. *
  7084. * EXIT VARIABLE WRITTEN TO SCREEN.
  7085. *
  7086. * NOTES CURSOR POSITIONING HAS BEEN DONE BY THE CALLING
  7087. * PROCEDURE AS WELL AS ATTRIBUTE SELECTION.
  7088. *
  7089. * CALLS VDTPSU.
  7090. #
  7091. ITEM FLDINDEX I; # INDEX INTO THE FIELD LIST #
  7092.  
  7093. ITEM CHARACTER I; # HOLDS ONE CHARACTER FOR VDTCHR #
  7094. ITEM CHARINDEX I; # CHARACTER OFFSET INTO VARDATA #
  7095. ITEM ENDCHAR I; # LOCATION OF LAST NON-BLANK #
  7096. ITEM NUMCHARS I; # NUMCHARS TO WRITE #
  7097. ITEM WORDINDEX I; # WORD OFFSET INTO VARDATA #
  7098.  
  7099. FLDREWRITE[FLDINDEX] = FALSE; # CLEAR REWRITE FIELD FLAG #
  7100.  
  7101. IF NOT TERDONTCLR[0] THEN
  7102. BEGIN # CLEAR READ FLAGS #
  7103. FLDENTERED[FLDINDEX] = FALSE;
  7104. FLDVALID[FLDINDEX] = FALSE;
  7105. END
  7106. ENDCHAR = 0;
  7107. IF FLDOUTPUTV[FLDINDEX] THEN
  7108. BEGIN # IF NOT INPUT ONLY VARIABLE #
  7109. CHARINDEX = FLDVDTCORD[FLDINDEX]+FLDLENGTH[FLDINDEX];
  7110. WORDINDEX = CHARINDEX / 5;
  7111. CHARINDEX = 2*(CHARINDEX - (WORDINDEX * 5));
  7112. FOR NUMCHARS = FLDLENGTH[FLDINDEX] STEP -1
  7113. WHILE NUMCHARS GR ENDCHAR DO
  7114. BEGIN # FIND LAST NON-BLANK CHARACTER #
  7115. IF CHARINDEX GR 0 THEN CHARINDEX = CHARINDEX - 2;
  7116. ELSE
  7117. BEGIN # IF AT END OF WORD #
  7118. CHARINDEX = 8;
  7119. WORDINDEX = WORDINDEX - 1; # UPDATE WORD INDEX #
  7120. END
  7121. CHARACTER = C&lt;CHARINDEX,2>VDATAC[WORDINDEX];
  7122. IF CHARACTER GR O"40" AND CHARACTER LQ O"176" THEN
  7123. ENDCHAR = NUMCHARS; # IF DISPLAYABLE NON-BLANK #
  7124. END
  7125. WORDINDEX = FLDVDTCORD[FLDINDEX] / 5;
  7126. CHARINDEX = 2*(FLDVDTCORD[FLDINDEX] - (WORDINDEX * 5));
  7127. FOR NUMCHARS = 1 STEP 1 UNTIL ENDCHAR DO
  7128. BEGIN # OUTPUT VARIABLE #
  7129. IF CHARINDEX EQ 10 THEN
  7130. BEGIN # UPDATE WORD INDEX #
  7131. CHARINDEX = 0;
  7132. WORDINDEX = WORDINDEX + 1;
  7133. END
  7134. CHARACTER = C&lt;CHARINDEX,2>VDATAC[WORDINDEX];
  7135. IF CHARACTER GR O"40"
  7136. AND CHARACTER LQ O"176" THEN
  7137. BEGIN # IF NON-BLANK AND DISPLAYABLE #
  7138. VDTCHR(CHARACTER); # OUTPUT CHARACTER #
  7139. END
  7140. ELSE
  7141. BEGIN # BLANK OR NONDISPLAYABLE #
  7142. VDTPSU; # PSEUDO UNDERLINE #
  7143. END
  7144. CHARINDEX = CHARINDEX + 2; # UPDATE CHARACTER INDEX #
  7145. END
  7146. END
  7147. FOR NUMCHARS = ENDCHAR+1 STEP 1 UNTIL FLDLENGTH[FLDINDEX] DO
  7148. BEGIN
  7149. IF TERBLCKMDE[0] AND FLDINPUTV[FLDINDEX] THEN
  7150. BEGIN
  7151. VDTCHR(O"137"); # SEND UNDERLINE TO SCREEN #
  7152. END
  7153. ELSE
  7154. BEGIN
  7155. VDTPSU;
  7156. END
  7157. END
  7158.  
  7159. END # WRIVAR #
  7160. CONTROL EJECT;
  7161.  
  7162. PROC WRIVCH(FIELD,OFFSET,CHAR);
  7163.  
  7164. # TITLE WRIVCH - WRITE CHARACTER INTO VARDATA. #
  7165.  
  7166. BEGIN # WRIVCH #
  7167.  
  7168. #
  7169. ** WRIVCH - WRITE CHARACTER INTO VARDATA.
  7170. *
  7171. * PROC WRIVCH(FIELD,OFFSET,CHAR)
  7172. *
  7173. * ENTRY FIELD = FIELD INDEX.
  7174. * OFFSET = CHARACTER POSITION IN FIELD.
  7175. * CHAR = CHARACTER INPUT.
  7176. *
  7177. * EXIT CHAR WRITTEN INTO VARDATA.
  7178. #
  7179. ITEM FIELD I; # INDEX OF CURRENT FIELD #
  7180. ITEM OFFSET I; # CHARACTER OFFSET INTO FIELD #
  7181. ITEM CHAR I; # CHARACTER TO PUT INTO VARDATA #
  7182.  
  7183. ITEM CHARIND I; # CHARACTER INDEX INTO VARDATA #
  7184. ITEM CHARPOS I; # CHARACTER POSITION IN VARDATA #
  7185. ITEM WORDIND I; # WORD INDEX INTO VARDATA #
  7186.  
  7187. CHARPOS = FLDVDTCORD[FIELD] + OFFSET;
  7188. WORDIND = CHARPOS/5;
  7189. CHARIND = CHARPOS - 5*WORDIND;
  7190. B&lt;CHARIND*12,12>VDATAU[WORDIND] = CHAR;
  7191.  
  7192. END # WRIVCH #
  7193.  
  7194. END # SFORM # TERM