home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / bit / listserv / spiresl / 71 next >
Encoding:
Text File  |  1992-12-21  |  3.0 KB  |  75 lines

  1. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!paladin.american.edu!auvm!VTVM1.BITNET!USDGK
  3. Organization: Computing Center, Virginia Tech.
  4. Message-ID: <SPIRES-L%92122111185974@PUCC.PRINCETON.EDU>
  5. Newsgroups: bit.listserv.spires-l
  6. Date:         Mon, 21 Dec 1992 10:56:44 EST
  7. Sender:       SPIRES Conference List <SPIRES-L@PUCC.BITNET>
  8. From:         Greg Kroll <USDGK@VTVM1.BITNET>
  9. Subject:      detecting end-of-file with a line-by-line input format
  10. Lines: 63
  11.  
  12. I hope someone can help me out with this.  I have a line-by-line input
  13. format for which I am NOT able to detect when the end of the input data
  14. (file) is reached.  According to what I read the $ENDATA variable should
  15. be set (true=1) when the format executes a GETDATA after the last line
  16. of data has been read, a subsequent GETDATA would cause an S808 error.
  17. The problem is this format is NOT setting $ENDATA and somehow already
  18. knows it is at the end of the input file.  I need to test for this
  19. condition so I can do some processing before exiting the format.
  20. Here are the important (I hope) parts of the format.
  21.  
  22. ...
  23.  FRAME-ID = READ.MAIL;
  24.    DIRECTION = INPUT;
  25.    FRAME-DIM = 0,80;
  26.    USAGE = FULL;
  27.    LABEL;
  28. uproc = if $ftrace then * 'Executing first label group of format';
  29. ...
  30.  FORMAT-NAME = TESTMAIL;
  31.    ACCOUNTS = USDGK;
  32.    ALLOCATE = USDGK:CHIPMAIL;
  33.    FRAME-NAME = READ.MAIL;
  34.      FRAME-TYPE = DATA;
  35.  
  36. Trace of format execution:
  37.  
  38. ...
  39. ->
  40. input add
  41. * Format TESTMAIL
  42. * Format TESTMAIL
  43. Enter frame READ.MAIL                    <<== multiple records added
  44. Executing first label group of format
  45. ...                                      <<== last line of input file read
  46. Leave frame READ.MAIL; at label no. 19
  47. * Leave format
  48. - ADD  @Line       267   Key = 71        <<== adds last record to database
  49. * Format TESTMAIL                        <<== reenters format
  50. Enter frame READ.MAIL
  51.   * Leave format                         <<== never executes first label
  52. * Format TESTMAIL                        <<== group, simply exits format
  53. * Format TESTMAIL                        <<== no getdata executed
  54. * Leave format                           <<== $endata = 0
  55. ->
  56.  
  57.  
  58. As you can see when the format is reentered the last time it should try to
  59. read the input file, discover it is at the end-of-file, set the $endata
  60. flag, then exit according to a test of this condition in the format.
  61. None of this ever occurs, it simply enters the format the last time and
  62. exits.  How does it know it is at the end of the file?  Why are no label
  63. groups processed the last time though?
  64.  
  65. What I would like to do is reinitialize the variables in the local vgroup
  66. and issue a subsequent input add command.  I cannot do this from an initial
  67. frame since this is NOT a report format.  I can always reissue the SET FORMAT
  68. command to reinitialize the variables but I was trying NOT to do this,
  69. as sometime down the road I may forget and mess up the input add operation.
  70. If anyone can think of a better way to get the variables reinitialized
  71. I am open to suggestions.
  72.  
  73.  
  74. --Greg Kroll
  75.