To insert individual cards into a FitsChan, prior to reading them back as Objects for example, you should use the AST_PUTFITS routine. You can insert a card in front of the current one as follows:
CALL AST_PUTFITS( FITSCHAN, CARD, .FALSE., STATUS )
where the third argument of .FALSE. indicates that the current card should not be overwritten. Note that facilities are not provided by AST for formatting the card contents.
After inserting a card, the FitsChan's Card attribute points at the original Card, or at the end-of-file if the FitsChan was originally empty. Entering a sequence of cards is therefore straightforward. If CARDS is an array of character strings containing FITS header cards and NCARDS is the number of cards, then a loop such as the following will insert the cards in sequence into a FitsChan:
INTEGER NCARD
CHARACTER * ( 80 ) CARDS( NCARD )
...
DO 3 ICARD = 1, NCARD
CALL AST_PUTFITS( FITSCHAN, CARDS( ICARD ), .FALSE., STATUS )
3 CONTINUE
Note that AST_PUTFITS enforces the validity of a FitsChan by rejecting any cards which do not adhere to the FITS standard. If any such cards are detected, an error will result.
AST A Library for Handling World Coordinate Systems in Astronomy