Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 8214
Location: Dubuque, Iowa, 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: 2504
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: 2504
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 KSDS and Index file in cobol deepak14450 COBOL Programming 9 Fri Dec 22, 2017 9:36 am
This topic is locked: you cannot edit posts or make replies. Cobol to fetch the content by using s... arunc55 COBOL Programming 4 Fri Nov 17, 2017 1:25 pm
No new posts Calling IKJEFT01 program from Rexx upendrasri CLIST & REXX 8 Wed Nov 15, 2017 4:27 pm
No new posts VBS and VB, COBOL syntax is the same ... natt.sut COBOL Programming 3 Sun Nov 12, 2017 6:36 am
No new posts COBOL - EXIT statement weird behavior anthony.pangestu COBOL Programming 0 Fri Oct 27, 2017 9:57 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us