1

so in RPGLE, I use the following source members to create my *module procedures, that I can then compile into a *SRVPGM...

  • binder source - exportable procedures that the *srvpgm can reference
  • module source - the actual group of procedures with *nomain
  • prototype source - a best practice to define the procedure pi's to be copied into calling *pgms

How is this typically done in COBOL?

no real examples in my google search on how this is achieved.

jmarkmurphy
  • 11,030
  • 31
  • 59
corei
  • 21
  • 1
  • Please take some time to edit your question, and a) add more detail, b) build sentences, c) post examples, especially things you refer to in you (sparse) text. – phunsoft Apr 10 '23 at 09:18
  • I have no idea what you're asking for. Binder Source applies to any ILE language...RPG, COBOL, C/C++ or even CL. Nor does binder source have any direct ties to RPG prototype source. I'd suggest re-reading the [ILE Concepts](https://www.ibm.com/docs/en/i/7.4?topic=languages-ile-concepts) and [ILE COBOL Programmer's Guide](https://www.ibm.com/docs/en/i/7.4?topic=cobol-ile-programmers-guide). – Charles Apr 10 '23 at 13:46
  • If this is only about ILE COBOL then please edit the question to note that. Otherwise `ENTRY` would be the COBOL way to do that. – Simon Sobisch Apr 11 '23 at 13:06

1 Answers1

2

Binder source is the same for any language.

It's not possible to have an ILE COBOL module with more than one exported procedure.

You can code more than one program in your COBOL source, but when you use CRTCBLMOD, it will create a separate module for each one.

If I do CRTCBLMOD MYLIB/MULTIPLE1 from this code:

   PROCESS  OPTIONS.           
   IDENTIFICATION DIVISION.    
   PROGRAM-ID. MULTIPLE1.      
   PROCEDURE DIVISION.         
   PAR1.                       
       DISPLAY "In multiple1". 
   END PROGRAM MULTIPLE1.      
                               
   IDENTIFICATION DIVISION.    
   PROGRAM-ID. MULTIPLE2.      
   PROCEDURE DIVISION.         
   PAR1.                       
       DISPLAY "In multiple2". 
   END PROGRAM MULTIPLE2. 

It creates two modules:

Module MULTIPLE1 created in library MYLIB on 04/10/23 at 19:34:22. 
Module MULTIPLE2 created in library MYLIB on 04/10/23 at 19:34:22.

Module MULTIPLE1 exports procedure MULTIPLE1 and module MULTIPLE2 exports procedure MULTIPLE2.

Barbara Morris
  • 3,195
  • 8
  • 10
  • Barbara, this is exactly what I was wanting to know and understand. thank you! – corei Apr 11 '23 at 12:08
  • Barbara... if I use this same template but make it SQLCBLLE and try to do EXEC SQL in each of the PAR1's... I get compilation errors on the second EXEC SQL... do you know why? STMT * 40 MSGID: LNC1326 SEVERITY: 30 SEQNBR: 013109 Message . . . . : 'SQL-00004' not defined name. Statement or clause ignored. – corei Apr 12 '23 at 12:38
  • Sorry, I don't know enough about COBOL or the SQL precompiler to know the answer. To me, it seems very strange to create more than one module from a single source file. It seems much simpler to put the code for each module into a separate source file. – Barbara Morris Apr 12 '23 at 16:37