C+ C NAME: C HOSdos2vms C PURPOSE: C Converts a binary Helios file create on Windows or C Linux to a VMS binary with the appropriate record length. C CATEGORY: C I/O: Helios photometers C CALLING SEQUENCE: program HOSdos2vms C INPUTS: C Binary Helios file C OUTPUTS: C VMS Binary Helios file C CALLS: C Say, AskChar, HOSInquire, bOpenFile C INCLUDE: include 'dirspec.h': C RESTRICTIONS: C The last block may contain a couple of trailing records of garbage. C No attempt is made to discard those. Probably the best way to fix this C would be to modify HOSInquire to return the number of records as an extra C argument. C PROCEDURE: C When a Helios photometer file created in DOS or Linux is moved to VMS, it C can only be opened as a VMS block file with a record length of 512 bytes C (128 words). The record length is determined by a call to HOSInquire. C Then the file is read and written back to disk in a binary file with C the appropriate record length. The resulting file should be readable C by any of the Helios programs on VMS. C MODIFICATION HISTORY: C DEC-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C- parameter (iblock = 128) character cSay*10 /'HOSdos2vms'/ character cFileIn *120 character cFileOut*120 character cInt2Str* 14 integer ib(iblock) ! Block-size input array integer ic(37) ! Max. output record length is 37 logical bOpenFile if (cOpSys .ne. OS__VMS) call Say(cSay,'E','Run','only on VMS') call AskChar('Input file$file' , cFileIn ) call HOSInquire(cFileIn, iRecl) call Say(cSay,'I','Record','length '//cInt2Str(iRecl)) call AskChar('Output file$file', cFileOut) iAct = OPN__READONLY+OPN__REOPEN+OPN__STOP+OPN__SEQUENTIAL if (bOpenFile(iAct, iu, cFileIn, iReclBlock)) then ! Sequential iAct = OPN__READONLY+OPN__REOPEN+OPN__STOP if (bOpenFile(iAct, ju, cFileOut, iRecl) then ! Direct ib0 = 0 ! # words processed in input array read (iu, iostat=iErr) ib ! Read one vms block ir = 0 ic0 = 0 ! # words processed in output array do while (iErr .eq. 0) icopy = min(iRecl-ic0,iblock-ib0) ! # words copied from output to input call ArrI4Copy(icopy,ib(ib0+1),ic(ic0+1)) ! Copy 'icopy' words ib0 = ib0+icopy ! Increment in- and output counters ic0 = ic0+icopy if (ic0 .eq. iRecl) then ! Output record complete ir = ir+1 ! Increment record counter write (ju,rec=ir) ic ! Write to output ic0 = 0 ! Re-initialize output counter end if if (ib0 .eq. iblock) then ! Current input block processed read (iu, iostat=iErr) ib ! Read next block ib0 = 0 ! Re-initialize input counter end if end do end if end if end