Adding custom header and footer lines to an exported file generated using an export template

SOLVED

Hi,

In the past, I remember adding custom header lines to an export file when using export templates via specific script processing. I believe it was done using wrseq once the file was opened in the background by Sage to write to the export file. I no longer have this custom export code but I need to do another export with a custom header added and it keeps throwing a generic sequential file management error when I call the write command (ex: wrseq HEAD1,HEAD2,HEAD3 where each of those variable contains a header value). I even tried just doing wrseq '' as this did work in the past with the file I longer have.

example export needed (where ITM;CATEG;DESC would be the header line)

ITM;CATEG;DESC

HAM_SIG;PIG;SINGLE SLICE OF HAM

Has anyone got any code examples to achieve this or the correct action to use?

Current code:

$ACTION

Case ACTION
When "EXP_OUVRE" : Gosub EXP_OUVRE
Endcase

Return


$EXP_OUVRE
Gosub GEN_EXP_HEADER
Return


$GEN_EXP_HEADER
Gosub GEN_EXP_HEADER_ARR
wrseq HEAD_COL_ARR(0),HEAD_COL_ARR(1),HEAD_COL_ARR(2),HEAD_COL_ARR(3),HEAD_COL_ARR(4),
& HEAD_COL_ARR(5),HEAD_COL_ARR(6),HEAD_COL_ARR(7),HEAD_COL_ARR(8),HEAD_COL_ARR(9),
& HEAD_COL_ARR(10),HEAD_COL_ARR(11),HEAD_COL_ARR(12),HEAD_COL_ARR(13),HEAD_COL_ARR(14),
& HEAD_COL_ARR(15),HEAD_COL_ARR(16),HEAD_COL_ARR(17),HEAD_COL_ARR(18),HEAD_COL_ARR(19),
& HEAD_COL_ARR(20)
Return

Thanks,

Andrew

  • +1
    verified answer

    So I managed to figure it out. I figured the action used was correct and that I just needed to find the sequential file abbreviation code. Sure enough it was that  (sequential file abbreviation is [AEXP]).

    If you need to write a header to the export file

    $EXP_OUVRE
     wrseq "ITM;CATEG;DESC" Using [AEXP]
    Return

    If you need to write a footer to the export file

    $EXP_FERME
     wrseq "ITM;CATEG;DESC" Using [AEXP]
    Return