PROGRAM CBA C C This program converts any type of file into an ASCII file which can C be transmitted to the VAX by means of the DECUS TALK program. C It converts a single 512-byte block into 12 C 57-byte ASCII records with LIST carriage control. C C BYTE FILEO(40,1),FILEI(40,1) !Filename storage. INTEGER INREC2(257) !Input buffer for a task image BYTE BINREC(513),PAGE(512) !record. EQUIVALENCE(PAGE(1),INREC2(1),BINREC(1))! BYTE OUTREC(171,4) !Four output buffers. BYTE OUT12(684) !Change to 12 output records. EQUIVALENCE(OUTREC(1),OUT12(1)) ! INTEGER CHKSUM ! C C Declarations for DLIB subroutines. C INTEGER FCHAR,HUCHA !H.UCHA DATA FCHAR /-3/ !Read file characteristics code. BYTE FDBIN(128) !File INTEGER IFDBIN(64) !Description EQUIVALENCE (IFDBIN(1),FDBIN(1))!Block BYTE IN(2) ! INTEGER SIZEI4(2) EQUIVALENCE(SIZEI4(1),SIZEI,FDBIN(11)) ! COMMON /MYFDB/ FDBIN ! COMMON /VABORT/ IABORT ! COMMON /PAGES/ PAGE ! C CALL CBAINI(FDBIN) !Miscellaneous initialization. C 10 CALL CBALIN(FILEO,FILEI) !Get file names from command line C !or exit if EOF. C Open files. C IN(1)=1 !FA.RD read only. IN(2)=1 !FD.RWM Block mode. C CALL OFNB(FDBIN,IN,1,FILEI,IERR)!Open task image file. IF(IERR .LE. 0)CALL FDBERR(FDBIN,3HCBA) !Report any errors. IERR=0 !Clear error flag. OPEN(UNIT=2,TYPE='NEW',RECORDSIZE=57,CARRIAGECONTROL='LIST', 1 NAME=FILEO(1,1),ERR=70) !Open ASCII file. IF(IERR .NE. 0) GO TO 70 C HUCHA=0 !Clear user file attributes. CALL FQIO(FDBIN(67),3,FCHAR,1,HUCHA,IDSW) !Get user attributes. C !Write record I/O info to output. WRITE(2,20,ERR=70)(IFDBIN(I),I=1,7),HUCHA,SIZEI4 20 FORMAT(10I6) !to ASCII file. C C Convert to ASCII, looping until EOF is read on input file. C IBLK=1 !Point to 1st block. 30 CALL DABRD(FDBIN,PAGE,512,IBLK,NBT,IER) !Read a block IF(IER .EQ. 0)GO TO 60 !END=60 IF(IER .LT. 0)CALL FDBERR(FDBIN,3HCBA) !Report any errors. CALL CHKCBA(PAGE,CHKSUM) ! INREC2(257)=0 !Pad with null word. CALL TREC(BINREC,OUTREC) !Convert it to ASCII. WRITE(2,40,ERR=70)OUT12 !Write 12 records. 40 FORMAT(11(57A1/),57A1) ! WRITE(2,50,ERR=70)NBT,CHKSUM !Write number of bytes transferred, 50 FORMAT(2I6) !checksum for record. IBLK=IBLK+1 !Point to next block. GO TO 30 !Go back for another one C C End-of-file processing. C 60 CALL CLOS(FDBIN) !Close all CLOSE(UNIT=2) !files and GO TO 10 !look for another command line. C 70 CALL FTNERR(3HCBA) !Report errors from LUN 2. CALL EXIT END