home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / os / vms / 13807 < prev    next >
Encoding:
Text File  |  1992-08-18  |  4.6 KB  |  150 lines

  1. Path: sparky!uunet!dtix!darwin.sura.net!Sirius.dfn.de!chx400!decus!b_sanderson
  2. From: b_sanderson@decus.ch (Bruce Sanderson ABB Process Automation)
  3. Newsgroups: comp.os.vms
  4. Subject: trouble reading a relative file (VAX C)
  5. Message-ID: <2309.2a91f7df@decus.ch>
  6. Date: 19 Aug 92 05:46:16 GMT
  7. Organization: DECUS (Switzerland)
  8. Lines: 140
  9.  
  10. C Problem
  11.  
  12. While reading a relative direct access file, the program cannot read 
  13. record number 25.
  14. Question: What is going on? What is wrong in the program?
  15.  
  16. Partial dump, FDL file, C program follow 
  17.  
  18. Dump of file $DISK2:[IFK.EXE]TEST.IND;2 on 19-AUG-1992 07:15:32.39
  19. File ID (2829,90,0)   End of file block 51 / Allocated 51
  20.  
  21. Record number 23 (00000017), 80 (0050) bytes
  22.  
  23.  20202020 20202020 20202020 20202020 20202020 20202020 20202020 20202020
  24.  20202020 20202020 20202020 20202020 20202020 20202020 20202020 20202020
  25.                                      20202020 20202020 20202020 20202020
  26.  
  27. Record number 24 (00000018), 80 (0050) bytes
  28.  
  29.  20202020 20202020 20202020 20202020 20202020 20202020 20202020 20202020
  30.  20202020 20202020 20202020 20202020 20202020 20202020 20202020 20202020
  31.                                      20202020 20202020 20202020 20202020
  32.  
  33. Record number 25 (00000019), 80 (0050) bytes
  34.  
  35.  20202020 20206E65 68636972 74737265 746E752F 74746566 20746669 72686353
  36.  20202020 20202020 20202020 20202020 20202020 20202020 20202020 20202020
  37.                                      32302020 20202020 20202020 20202020
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45. IDENT    "19-AUG-1992 07:09:37    VAX/VMS ANALYZE/RMS_FILE Utility"
  46.  
  47. SYSTEM
  48.     SOURCE                  VAX/VMS
  49.  
  50. FILE
  51.     ALLOCATION              51
  52.     BEST_TRY_CONTIGUOUS     yes
  53.     BUCKET_SIZE             1
  54.     CLUSTER_SIZE            3
  55.     CONTIGUOUS              no
  56.     EXTENSION               50
  57.     FILE_MONITORING         no
  58.     GLOBAL_BUFFER_COUNT     0
  59.     MAX_RECORD_NUMBER       2147483647
  60.     NAME                    "$DISK2:[IFK.EXE]TEST.IND;2"
  61.     ORGANIZATION            relative
  62.     OWNER                   [IHR,H24622]
  63.     PROTECTION              (system:RWED, owner:RWED, group:RWED, world:)
  64.  
  65. RECORD
  66.     BLOCK_SPAN              yes
  67.     CARRIAGE_CONTROL        fortran
  68.     FORMAT                  fixed
  69.     SIZE                    80
  70.  
  71.  
  72. /*-------------------------------------------*/
  73. /*           include section                 */
  74. /*-------------------------------------------*/
  75. #include <sys$library:rms.h>;
  76. #include <sys$library:stdio.h>;
  77.  
  78.  
  79. main()
  80. {
  81. /*--------------------------------------------------------------------------*/
  82.   struct FAB fab1;
  83.   struct RAB rab1;
  84.   char panelfile[17]="IFKSYS5:TEST.IND";
  85.   register stat;
  86.   int i;
  87.   char help_rec[80];
  88.                           /* default help panel filename */
  89.    int rec_numero;
  90.    int panel_nr;
  91.    panel_nr=1;
  92.    rec_numero = 24*(panel_nr - 1) + 1;
  93.  /* initialize fab1 & rab1 and open file */
  94.    fab1 = cc$rms_fab;
  95.    rab1 = cc$rms_rab;
  96.  
  97.    fab1.fab$l_fna = panelfile;
  98.    fab1.fab$b_fns = sizeof(panelfile)-1;
  99.    fab1.fab$b_org = FAB$C_REL; /* type of file */
  100.    fab1.fab$b_rfm = FAB$C_FIX;           /* fixed length records */
  101.    fab1.fab$b_fac = 0;                 /*  readonly */
  102.    fab1.fab$b_shr = FAB$M_GET;         /* shared readonly */
  103.  
  104.    rab1.rab$l_fab = &fab1;
  105.    rab1.rab$b_rac = RAB$C_KEY;         /* access through record number */
  106.    rab1.rab$l_kbf = &rec_numero;
  107.    rab1.rab$b_ksz = sizeof(rec_numero);
  108.    rab1.rab$l_ubf = &help_rec[0]; /* initialize fab & rab */
  109.    rab1.rab$w_usz = sizeof(helprec);
  110.    if (((stat = SYS$OPEN(&fab1)) & 1 ) != 1)
  111.    LIB$STOP(stat);
  112.    if (((stat = SYS$CONNECT(&rab1)) & 1 ) != 1)
  113.    LIB$STOP(stat);
  114.  
  115. /* read in 48 records from file */
  116.    for (i=0; i<48; i++)
  117.    {
  118.       if ((stat = SYS$GET(&rab1)) == RMS$_NORMAL)
  119.       {
  120. /* print the record */
  121.       printf("|%s|\n",help_rec) ;
  122.       rec_numero++;
  123.       }
  124.       else 
  125.          if (stat == RMS$_RNF )
  126.            {
  127.            printf ("\n record %d not found ",rec_numero);
  128.            }      
  129.       else if (stat == RMS$_KEY || stat == RMS$_MRN )
  130.       printf ("\n record number out of range ");
  131.       else
  132.       LIB$SIGNAL(rab1.rab$l_sts,rab1.rab$l_stv);
  133.    }
  134.       /* close file */
  135.       if (((stat = SYS$DISCONNECT(&rab1)) & 1 ) != 1)
  136.       LIB$STOP(stat);
  137.       if (((stat = SYS$CLOSE(&fab1)) & 1 ) != 1)
  138.       LIB$STOP(stat);
  139. }
  140.  
  141. -------------------------------------------------------------------------
  142.                               Bruce Sanderson
  143.   "Au pays des aveugles       ABB Process Automation AG
  144.   les borgnes sont rois"      Dept ITR
  145.                               5401 Baden Switzerland
  146.                               Internet: B_SANDERSON@DECUS.SWITCH.ARCOM.CH
  147.                               X25 02284791027260::SYSTEM
  148.                               Ph +41 56 76 88 93
  149.                               FAX +41 56 83 30 89 
  150.