next up previous contents
Next: Combining N-tuple Files Up: Defining Your Own N-tuples Previous: Programming DQFs   Contents

Copying N-tuple Files Between UNIX and VMS

N-tuple files are RZ files written in Exchange mode format so it is trivial to copy between VMS and UNIX. In either case use FTP and specify a BINARY transfer. When copying to a VMS system, after copying the file, you have to change the block size from the default of 512 to 4096 e.g.:-

set file/attribute=(lrl:4096) hbooksm.ntp

This command is not available on some older versions of VMS, in this case proceeds as follows:-

  1. Create the file CONVERT.FOR containing:-

          integer INPUT_SIZE,OUTPUT_SIZE
          parameter (INPUT_SIZE = 512, OUTPUT_SIZE = 4096)
          character*1  input_buffer(INPUT_SIZE) ,
         +             output_buffer(OUTPUT_SIZE)
          integer  nw_output , num_rec , iwd
     
          open( unit=10, file='input', form='FORMATTED',
         +      recordtype='FIXED' ,  recl=INPUT_SIZE, status='OLD')
          open( unit=11, file='output',form='FORMATTED',
         +      recordtype='FIXED' ,  recl=OUTPUT_SIZE,status='NEW')
     
          num_rec = 0
          do while ( .true. )
            nw_output = 0
            do while ( nw_output + INPUT_SIZE .le. OUTPUT_SIZE )
              read(10,90000,end=100) input_buffer
              num_rec = num_rec + 1
              do iwd = 1 , INPUT_SIZE
                nw_output = nw_output + 1
                output_buffer(nw_output) = input_buffer(iwd)
              enddo
            enddo
            write(11,90000) output_buffer
          enddo
     
    100   if (nw_output .gt. 0)
         +  write(11,90000) (output_buffer(iwd), iwd = 1, nw_output)
     
          close(unit=10)
          close(unit=11)
          print * , num_rec , INPUT_SIZE ,
         +                              '-byte records transferred'
     
          stop
     
    90000 format(999999a1)
     
          end
    

  2. Compile, link and run to convert the file:-

     
    $ fort convert
    $ link convert
    $ define/user input  unix_hbooksm.ntp
    $ define/user output vms_hbooksm.ntp
    $ run convert
    

If you have used a different record length e.g.:-

$hbk_lrecl 8191
you will need to adjust the record length in the above procedure accordingly.



sno Guest Acct 2009-09-09