IBM MAINFRAME HELP & SUPPORT FORUMS
Technical Forums for IBM Mainframe Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7&11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
 

calling a cobol program from assembler

THIS IS AN ARCHIVE FORUM: CLICK HERE TO GO TO THE ORIGINAL TOPIC

 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> PL/I & ASSEMBLER
View previous topic :: View next topic  
Author Message
girishms



Joined: 06 Jun 2008
Posts: 22
Location: chennai

Posted: Tue Jul 22, 2008 5:16 pm    Post subject: calling a cobol program from assembler  

Hi,

Can anybody tell me how to call a cobol program from assembler program ??

Thanks,
Girish
Back to top  
Bill O'Boyle



Joined: 14 Jan 2008
Posts: 333
Location: Orlando, FL, USA

Posted: Tue Jul 22, 2008 5:19 pm    Post subject: Re: calling a cobol program from assembler  

Statically (VCON) or Dynamically (ADCON)?

Batch or CICS?

Bill
Back to top  
girishms



Joined: 06 Jun 2008
Posts: 22
Location: chennai

Posted: Tue Jul 22, 2008 5:23 pm    Post subject: calling a cobol program from assembler  

statically i want to call it and its Batch processing , not cics
Back to top  
Bill O'Boyle



Joined: 14 Jan 2008
Posts: 333
Location: Orlando, FL, USA

Posted: Tue Jul 22, 2008 5:29 pm    Post subject: Re: calling a cobol program from assembler  

How many individual parms are you passing to the COBOL program?

Bill
Back to top  
girishms



Joined: 06 Jun 2008
Posts: 22
Location: chennai

Posted: Tue Jul 22, 2008 5:32 pm    Post subject:  

HI ,

I dont have any idea about it rite now . but wat i want to test is that an assembler program should call a cobol program with some parameters to be passed to it .

thanks,
Girish
Back to top  
UmeySan



Joined: 22 Aug 2006
Posts: 624
Location: Germany

Posted: Tue Jul 22, 2008 6:33 pm    Post subject:  

@ girishms !

So ok, here's a little example. Pgm MDL90500 /Assembler is calling Pgm 50330 / Cobol and passing a ParameterList.

First EntryPoint is loaded. Only once. Then Parameters are prepared.
Then Programm is called. Afterwards rc is che

IF (MDL50330_ADRS,Z,MDL50330_ADRS,OC)
THEN C='PROGRAMM NOCH NICHT GELADEN'
LOAD EP=MDL50330
ST R0,MDL50330_ADRS ...store adress
EIF

MVC MDL50330§FUC,=H'000' ...Serve a parameter-Field
MVC MDL50330§MNR,=H'2600' ...Serve a parameter-Field


SR R5,R5 ...length of parm
LA R5,MDL50330§UEND-MDL50330§UANF ...end - start = length
ST R5,MDL50330§LENG

SR R5,R5
LA R5,MDL50330§UANF ...PARM-START-ADRESSE
ST R5,MDL50330§PADR ...ADR PARM-LEISTE


STM R0,R15,CHCKVEPA_WORK ...Save all register

L R15,MDL50330_ADRS ...R15=PROGRAMM ENTRYPOINT
LA R1,MDL50330§PADR ...R01=ADRESSE of PARM ADRESSE

CHGAMODE 31,R14 ...CHANGE MODE
BASSM R14,R15 ...CALL THE COBOL ABOVE
CHGAMODE 24,R14 ...CHANGE MODE

LM R0,R15,CHCKVEPA_WORK ...reload all register


IF MDL50330§RTX+04(04),EQ,=C'NEIN',CLC
THEN C=Check ReturnCodes or whatever is needed'
MVI ERROR,ON
EIF




MDL50330_ADRS DC 1A(0) ...entrypoint of sub-pgm
MDL50330§PADR DC 1A(0) ...adr of parm (MDL50330§UANF)
MDL50330§LENG DC 1F'0' ...length of parm (UEND-UANF)

MDL50330§UANF DS 0C ...start parameters

MDL50330§FUC DC HL002'0'
MDL50330§LEN DC HL002'0'
MDL50330§UMG DC CL004' '
MDL50330§FEH DC CL001' '
MDL50330§MOD DC CL008'40'
MDL50330§MNR DC XL002'00'
MDL50330§RCD DC XL002'00'
MDL50330§ROD DS CL008' '
MDL50330§RNR DC XL002'00'
MDL50330§RTX DC CL060' '

MDL50330§UEND DS 0F ...end parameters
Back to top  
girishms



Joined: 06 Jun 2008
Posts: 22
Location: chennai

Posted: Tue Jul 22, 2008 8:05 pm    Post subject:  

Thanks...
Back to top  
Robert Sample



Joined: 06 Jun 2008
Posts: 891
Location: Atlanta, GA

Posted: Tue Jul 22, 2008 8:14 pm    Post subject:  

If you're serious about this, reference the manual for your version of z/OS: Quote: z/OS

Language Environment
Writing Interlanguage
Communication Applications

Document Number SA22-7563
Back to top  
UmeySan



Joined: 22 Aug 2006
Posts: 624
Location: Germany

Posted: Tue Jul 22, 2008 8:18 pm    Post subject:  

Hi Robert !

Who did you mean ???
Back to top  
Robert Sample



Joined: 06 Jun 2008
Posts: 891
Location: Atlanta, GA

Posted: Tue Jul 22, 2008 8:21 pm    Post subject:  

UmeySan: actually, I was referring to the original question ... but it can apply as needed, of course!
Back to top  
Bill O'Boyle



Joined: 14 Jan 2008
Posts: 333
Location: Orlando, FL, USA

Posted: Wed Jul 23, 2008 6:52 am    Post subject: Re: calling a cobol program from assembler  

Robert,

I think you've hit the main problem and I'm assuming that girishms
is dealing with the following scenario -

Non-LE compliant Assembler Calling LE-compliant COBOL.

Apples and Oranges as they say. :!:

At the very least, the Assembler Caller (if not LE-compliant) needs to establish an LE-Environment first via CEEPIPI or the shop needs to bite the bullet and make the calling-program completely LE-compliant.

IMHO, LE-compliant (or non LE-compliant) COBOL calling non-LE compliant Assembler is generally the rule with some of these Assembler programs having been around for (dare say) longer than the age of some of our members. :wink:

Unless the Assembler program needs to call LE Service routines, the program can remain as-is, except, don't corrupt R12, because it contains the LE-compliant HLL "CAA" (Common Anchor Area). I usually ward-off anyone with -

Code:
         CEECAA                    LE 'COMMON ANCHOR AREA' DSECT         
         USING CEECAA,R12          R12 IS 'OFF LIMITS'                   

even though I don't address any of the labels and use R3 as a CSECT Base.

Seems to work :wink:

Just my .02 cents....

Bill
Back to top  
Robert Sample



Joined: 06 Jun 2008
Posts: 891
Location: Atlanta, GA

Posted: Wed Jul 23, 2008 7:18 am    Post subject:  

Quote: Non-LE compliant Assembler Calling LE-compliant COBOL.

Apples and Oranges as they say. or even Apples and Pomegranates?
Back to top  
 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> PL/I & ASSEMBLER
Page 1 of 1
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM