MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Calling Batch COBL program in PL/1 program macro-level CICS

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
chandanm
Beginner


Joined: 31 Aug 2004
Posts: 12
Topics: 9

PostPosted: Tue Aug 31, 2004 12:23 am    Post subject: Calling Batch COBL program in PL/1 program macro-level CICS Reply with quote

Hi all,
Could you let me know whether it is possible to call a Batch COBOL program through a PL/1 program containing macro-level CICS.
If so, what would be the DCL statement for the called program.
Also, please let me know the reason if it is not possible to call a Batch program.
I have been getting a 4038 ABEND when trying to do so.
Regards,
Chandan
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Tue Aug 31, 2004 5:50 am    Post subject: Reply with quote

chandanm,

Check this link which gives a detailed explanation of Communicating between COBOL and PL/I.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/CEEA4120/11.0?DT=20040115140447

simply you can try calling using pointers

PLI code:

Code:

pointer1=addr(area1)
pointer2=addr(area2)
call routine(pointer1, pointer2, variable1, variable2).


Cobol:
Code:

linkage section.
01 pointer1
01 area1
01 pointer2
01 area2
01 variable1
01 variable2

procedure division using pointer1,
                         pointer2,
                         variable1,
                         variable2.


   set address of area1 to pointer1
   set address of area2 to pointer2

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
chandanm
Beginner


Joined: 31 Aug 2004
Posts: 12
Topics: 9

PostPosted: Tue Aug 31, 2004 10:12 am    Post subject: Re: Call Batch COBL program in PL/1 program macro-level CICS Reply with quote

U have given me an examples using pointers. But are pointers supported in Batch COBOL programs?
Also, could you please let me know the PIC clauses for the pointer and area in COBOL.
I need pass to empty variable to the COBOL program, which will then calculate some values and pass it back to the PL/1 program.
The call statement that I am using is --
CALL routine (var1,var2);
I have declared the routine as
DCL routine ENTRY OPTIONS (COBOL,INTER);

In the Linkage section of COBOL program, I have declared two variables of same PIC clause as used in PL/1.

Am I on the right track? ... What else do I need to do?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Tue Aug 31, 2004 10:54 am    Post subject: Reply with quote

Chandanm,

Did you see the example from the previous link?

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/CEEA4120/11.8?SHELF=&DT=20040115140447&CASE=

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Tue Aug 31, 2004 11:34 am    Post subject: Reply with quote

Chandanm,

Quote:

I need pass to empty variable to the COBOL program, which will then calculate some values and pass it back to the PL/1 program.


I just coded this example to calculate the power of variable sent to the cobol program and the PLI program receives the result.

PLI source:
Code:

PLICBL: PROC OPTIONS(MAIN);                                   
 /**********************************************************/
 /* DECLARE ENTRY FOR THE CALL TO COBOL                    */
 /**********************************************************/
 DCL PL1CBSB EXTERNAL ENTRY(                                 
         /*1*/ FIXED DECIMAL(10,0),                           
         /*2*/ FIXED DECIMAL(10,0))                           
      OPTIONS(COBOL);                                         
/**********************************************************/ 
/* DECLARE PARAMETERS:                                    */ 
/**********************************************************/ 
DCL PLI_INVAR   FIXED DECIMAL(10,0) INIT(12);                 
DCL PLI_OUTVAR  FIXED DECIMAL(10,0) INIT(0);                 
                                                             
/**********************************************************/ 
/*  PROCESS STARTS HERE                                   */ 
/**********************************************************/ 
PUT SKIP LIST( '*******************************************');
PUT SKIP LIST( 'PL/I CALLING COBOL EXAMPLE IS NOW IN MOTION');
PUT SKIP LIST( '*******************************************');
PUT SKIP;                                                     
CALL PL1CBSB( PLI_INVAR,                                     
              PLI_OUTVAR);                                   
PUT SKIP LIST( '*******************************************');
PUT SKIP LIST( 'OUTPUT FROM COBOL IS:', PLI_OUTVAR);         
PUT SKIP LIST( 'PL/I CALLING COBOL SUBROUTINE EXAMPLE ENDED');
                                                             
END PLICBL;                                                   


COBOL source:

Code:

IDENTIFICATION DIVISION.                               
PROGRAM-ID.    PL1CBSB                                 
ENVIRONMENT DIVISION.                                   
DATA DIVISION.                                         
                                                       
WORKING-STORAGE SECTION.                               
                                                       
01 W-RESULT             PIC S9(10) COMP-3.             
                                                       
LINKAGE SECTION.                                       
                                                       
01   INPUT-VAR          PIC S9(10) COMP-3.             
01   OUTPUT-VAR         PIC S9(10) COMP-3.             
                                                       
                                                       
PROCEDURE DIVISION USING INPUT-VAR,                     
                         OUTPUT-VAR.                   
                                                       
    DISPLAY '***************************************'. 
    DISPLAY 'COBOL PROGRAM ENTERED FROM PL/I PROGRAM'. 
    DISPLAY '***************************************'. 
    DISPLAY '***************************************'. 
    DISPLAY ' INPUT-VAR  :' INPUT-VAR                   
    DISPLAY ' OUTPUT-VAR :' OUTPUT-VAR                 
    DISPLAY '***************************************'. 
                                                       
                                                       
    COMPUTE W-RESULT   = INPUT-VAR ** 2                 
    MOVE    W-RESULT   TO OUTPUT-VAR                   
                                                       
    DISPLAY ' OUTPUT-VAR ' W-RESULT                     
                                                       
    GOBACK.                                             
                                                       


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group