SUBROUTINE PCON C C Copy a global context table from a text file to the header C of a context image C C Richard Hook, March 1999 C IMPLICIT NONE INTEGER MAXEN,MAXIM,NEN,ID,MAXHCN,I1,I2 PARAMETER (MAXEN=20000,MAXIM=1000,MAXHCN=20) INTEGER A(MAXIM,MAXEN),ISTAT CHARACTER*80 CONTAB,IMAGE,CONNEW C Get the name of the context table CALL UCLGST('contab',CONTAB,ISTAT) C Get the name of the image to which the context is to be written CALL UCLGST('image',IMAGE,ISTAT) C Also prepare a name for a possible context table in the header CALL LENSTR(IMAGE,I1,I2) CONNEW=IMAGE(I1:I2)//'.CON' C Open the image with update access CALL UIMOPN(IMAGE,2,ID,ISTAT) IF(ISTAT.NE.0) THEN CALL UMSPUT('! Unable to open image file',1,0,ISTAT) GO TO 99 ENDIF C Read the context table from the text file CALL GTGLCO(CONTAB,A,MAXIM,MAXEN,NEN,ISTAT) IF(ISTAT.NE.0) THEN CALL UMSPUT('! Unable to read context table file', : 1,0,ISTAT) GO TO 88 ENDIF C Write the context to the image CALL PTCOIN(ID,CONNEW,MAXHCN,A,MAXIM,MAXEN,NEN,ISTAT) IF(ISTAT.NE.0) THEN CALL UMSPUT('! Unable to write context to header', : 1,0,ISTAT) ENDIF 88 CONTINUE C Close the image CALL UIMCLO(ID,ISTAT) 99 CONTINUE RETURN END