You can easily do this using standard JCL
//COLINZP JOB 1,MSGCLASS=H
// JCLLIB ORDER=CBC.SCCNPRC
//DSECT EXEC PROC=EDCDSECT,
// INFILE=COLIN.C.SOURCE(ASMMAC2),
// OUTFILE=COLIN.C.H.VB(TESTASM),
// DPARM='EQU(BIT)'
//ASSEMBLE.SYSLIB DD
// DD DISP=SHR,DSN=HLA.SASMMAC1
//ASSEMBLE.SYSIN DD *
DUMMY DSECT
ABC DS 10F
END
//DSECT.EDCDSECT DD SYSOUT=*
/*
This produced in //DSECT.EDCDSECT
#pragma pack(packed)
struct dummy {
int abc[10];
};
#pragma pack(reset)
You can point //DSECT.EDCDSECT to where you want your header file stored.
The syntax of the DPARM is defined here.
The comment option
By default comments are produced. One comment was
short int adplasid; /* Address space identifier @P2C */
which went past column 75.
With NOCOMMENT it produced
short int adplasid;
and all the lines were less than 72 characters long.
With COMMENT(@) it ignores anything beyond the specified string
short int adplasid; /* Address space identifier */
But some lines were still longer than 75 characters.
Using the default COMMENT
This worked first time – ish. When I tried to use the generated header file, it failed with a syntax error, because comments had wrapped over line boundary. I had to edit the output and remove the comments causing the problem.
Having fixed the obvious comment wraps, I then found comments extended into columns 72-80.
This meant, as far as C was concerned, the comment was still open, so the field on the next line was taken as part of the comment, and I was getting messages like
CCN3022 "adplserv" is not a member of "struct abdpl".
I edited the file and fixed up these comments.
Plan b) was to specify the option NOCOMMENT and no comments are produced at all.
It could not find a macro…
The DSECT I was trying to generate referenced BIT0. My challenge was to find where this was defined!
- If you use ISPF 3.4 on SYS1.MACLIB you can use the command SRCHFOR BIT0 and it searches all the members for the specified value. Tab to the “Prompt” heading, and press enter. The members with the value will be at top of the list.
- You can use ISPF 2, and specify ‘SYS1.MACLIB(IEZ*)’ to display only a subset of the members – beginning with IEZ. Tab to the “prompt” heading, as above
- You can use ISPF 3.15 Extended Search-For Utility. Specify DS name ‘SYS1.MACLIB’, and * for all members. Specify your search argument and press enter. You get one file with every occurrence it found and the member name. This was the easiest way for looking for what wanted.
The definition I wanted was not in SYS1.MACLIB, but I found it in SYS1.AMODGEN.