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: 8057
Location: East Dubuque, Illinois, USA

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
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm
No new posts COBOL Programming Sandpit? jodrisco COBOL Programming 6 Wed Apr 12, 2017 3:47 am


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