I am primarily a C developer, not a regular COBOL developer. I would like my COBOL program to have the same source on IBM-i as it does on z/OS.
My COBOL program calls a subroutine. On z/OS I do the call like this:
CALL
'PBFNInit' USING
BY VALUE NULL-POINTER,
On IBM i I have to call like this:
CALL PROCEDURE
'PBFNInit' USING
BY VALUE NULL-POINTER,
Is there some way I can dynamically tell the COBOL compiler which format of the CALL statement to use?
I was hoping for some kind of dynamic statement like the debug statement controlled by this
SOURCE-COMPUTER. IBM-3270 WITH DEBUGGING MODE.
If your compiler supports conditional compilation, you could define a constant with a compiler directive and then...
>>EVALUATE TRUE
>>WHEN DEFINED IBM-Z
CALL 'PBFNInit' USING
BY VALUE NULL-POINTER, [...]
>>WHEN DEFINED IBM-I
CALL PROCEDURE 'PBFNInit' USING
BY VALUE NULL-POINTER, [...]
>>WHEN OTHER
!non-sequiter, your facts do not coordinate
>>END-EVALUATE
UPDATE 1 per comment...
You could try combining this answer with that of @SimonSobisch, something like...
>>IF DEFINED IBM-I
REPLACE ==CALL== BY ==CALL PROCEDURE==.
>>END-IF
CALL 'PBFNInit' USING
BY VALUE NULL-POINTER, [...]
There is nothing currently in the documentation to indicate the text being conditionally compiled must be valid code. Maybe the authors felt this was implicit, or maybe it's a bug.