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

calling a cobol program from assembler


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
girishms

New User


Joined: 06 Jun 2008
Posts: 21
Location: chennai

PostPosted: Tue Jul 22, 2008 5:16 pm
Reply with quote

Hi,

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

Thanks,
Girish
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: Tue Jul 22, 2008 5:19 pm
Reply with quote

Statically (VCON) or Dynamically (ADCON)?

Batch or CICS?

Bill
Back to top
View user's profile Send private message
girishms

New User


Joined: 06 Jun 2008
Posts: 21
Location: chennai

PostPosted: Tue Jul 22, 2008 5:23 pm
Reply with quote

statically i want to call it and its Batch processing , not cics
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: Tue Jul 22, 2008 5:29 pm
Reply with quote

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

Bill
Back to top
View user's profile Send private message
girishms

New User


Joined: 06 Jun 2008
Posts: 21
Location: chennai

PostPosted: Tue Jul 22, 2008 5:32 pm
Reply with quote

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
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Tue Jul 22, 2008 6:33 pm
Reply with quote

@ 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
View user's profile Send private message
girishms

New User


Joined: 06 Jun 2008
Posts: 21
Location: chennai

PostPosted: Tue Jul 22, 2008 8:05 pm
Reply with quote

Thanks...
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: Tue Jul 22, 2008 8:14 pm
Reply with quote

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
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Tue Jul 22, 2008 8:18 pm
Reply with quote

Hi Robert !

Who did you mean ???
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: Tue Jul 22, 2008 8:21 pm
Reply with quote

UmeySan: actually, I was referring to the original question ... but it can apply as needed, of course!
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: Wed Jul 23, 2008 6:52 am
Reply with quote

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. icon_exclaim.gif

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. icon_wink.gif

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 icon_wink.gif

Just my .02 cents....

Bill
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: Wed Jul 23, 2008 7:18 am
Reply with quote

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

Apples and Oranges as they say.
or even Apples and Pomegranates?
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 -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
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
Search our Forums:

Back to Top