IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Calling C function from Cobol


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 8697
Location: Dubuque, Iowa, USA

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

If you haven't already read this, go to 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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Mon Apr 20, 2009 5:19 pm
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Mon Apr 20, 2009 5:25 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top