Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Calling C function from Cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
arkabag

New User


Joined: 10 Apr 2009
Posts: 3
Location: India

PostPosted: Mon Apr 20, 2009 12:33 pm    Post subject: Calling C function from Cobol
Reply with quote

Hi,

I would like to call a C function from a cobol program. The passing parameter would be of the form:
Code:

01 WS-MOV-DATOS WITH LOWER-BOUNDS.
     03 WS-MOV-FUNCION                 PIC  9(02)      COMP.
     03 WS-MOV-SISTEMA                 PIC  9(04)      COMP.
     03 WS-MOV-PRODUCTO              PIC  9(04)      COMP.
     03 WS-TAB-CVEIMP                  OCCURS 5 TIMES.
          04 WS-MOV-CVETRAN             PIC  9(04)      COMP.
          04 WS-MOV-INDLEY                PIC  9(02)      COMP.
          04 WS-MOV-ESQCON              PIC  9(04)      COMP.
          04 WS-MOV-IMPORTE              PIC  9(14)V99   COMP.


The calling portion of code:
Code:

CALL "CARGAMOV1 IN L151-REGISTRA" USING WS-MOV-DATOS
         GIVING WS-S151-RESULT


How do I receive the passed parameters in C language and convert the binary-formatted cobol variables into displayable format in C?

Regards,
Arkayan
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7997
Location: Bellevue, IA

PostPosted: Mon Apr 20, 2009 5:00 pm    Post subject:
Reply with quote

If you haven't already read this, go to http://www.s390.ibm.com and find the book z/OS Language Environment Writing Interlanguage Communication Applications, SA22-7563. It will be found in the Language Environment bookshelf. Read this (particularly chapter 4 which is titled Communicating between C and COBOL) until your questions are answered -- or if something isn't clear, post your question after reading.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Mon Apr 20, 2009 5:19 pm    Post subject: Reply to: Calling C function from Cobol
Reply with quote

In an unrelated question to your post, what is LOWER-BOUNDS and CALL.... GIVING?

Neither of these are documented in any Enterprise COBOL manual.

Documentation for CALL.... RETURNING is present but there wasn't any reference (or equivalent) to LOWER-BOUNDS.

Regards,
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Mon Apr 20, 2009 5:25 pm    Post subject: Reply to: Calling C function from Cobol
Reply with quote

Another question.

Is there any reason field WS-MOV-IMPORTE is defined as a binary-dblword (8-Bytes). It's probably one of the worst (or the worst) definition possible for COBOL arithmetic (a/k/a a Dog with Fleas) icon_wink.gif

Unless you have unique business-related reasons to define it this way, I would re-considered making it PACKED-DECIMAL/COMP-3.

Regards,
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts Mainframe Interview Questions CICS,CO... akshathan Mainframe Interview Questions 6 Thu Feb 09, 2017 6:38 pm
No new posts Submit job from Cobol with input data abdulrafi COBOL Programming 4 Wed Feb 01, 2017 12:41 pm
No new posts Calling procedure with multiple entri... steve-myers PL/I & Assembler 5 Fri Jan 27, 2017 3:33 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us