Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Cobol calling Assembler

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
dsivapradeep

New User


Joined: 06 Jul 2012
Posts: 43
Location: INDIA

PostPosted: Sun Jul 15, 2012 7:46 pm    Post subject: Cobol calling Assembler
Reply with quote

Hi all,

i called a simple assembler program that displays a message using cobol as
call 'ASMRCEIV'
end-call.

when i executed this cobol i'm getting the following error message in spool.

CEE3191E An attempt was made to initialize an AMODE24 application without using the ALL31(OFF) and STACK(,,BELOW) run-time options.

can somebody tell me what happened here? i'm not able to understand my mistake from this error message.
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7914
Location: Bellevue, IA

PostPosted: Sun Jul 15, 2012 8:47 pm    Post subject:
Reply with quote

The message is from Language Environment and indicates, most likely, that your ASMRCEIV program was compiled with AMODE 24 while your site LE run time options are not set to allow that. Try adding this to your execution JCL:
Code:
//CEEOPTS DD *
ALL31(OFF)
STACK(,,BELOW)
/*
or you could recompile your assembler program with AMODE 31.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Sun Jul 15, 2012 9:11 pm    Post subject: Reply to: Cobol calling Assembler
Reply with quote

Is there any particular reason the sub-program is AMODE 24? Does it contain DCB's (RMODE must be 24) or VSAM ACB access without specifying the "MODE=31" parm (default is 24)?

If neither of the above are present, the sub-program can be Assembled/Linked with AMODE 31/RMODE ANY. The default for IEWL (Linkage Editor) is AMODE 24/RMODE 24.

If DCB's are in the sub-program, then there's more to it than just an Assembly/Link as 31/ANY.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Mon Jul 16, 2012 12:53 am    Post subject: Reply to: Cobol calling Assembler
Reply with quote

Skeletal code example of below-the-line SYSIN usage/addressability in an Assembler sub-program, which had been Assembled/Linked as AMODE 31/RMODE ANY, using the AMODE/RMODE directives to override IEWL defaults. Register assignments are used as an example only -

Code:

SYSINWRK DSECT                         BELOW-THE-LINE DSECT (R10)
         USING *,R10                   INFORM ASSEMBLER
SYSINDCB DS    XL(SYSINDLN)            FOR 'SYSIN' 24-BIT DCB
SYSINOPN DS    XL(SYSINOLL)            FOR 'SYSIN' 24-BIT OPEN-LIST
SYSINCLO DS    XL(SYSINCLL)            FOR 'SYSIN' 24-BIT CLOSE-LIST
SUBPGM   CSECT                         BEGIN CSECT (R3)
         USING *,R3                    INFORM ASSEMBLER
         SAVE (14,12)                  SAVE REGISTERS
         LR    R3,R15                  CSECT ADDRESSABIITY
         L     R7,0(,R1)               PARMAREA ADDRESSABILITY
         MVC   0(23,R7),=CL23'SUBPGM HAS BEEN REACHED'
         LA    R0,SYSINGML             LOAD SYSIN 'GETMAIN' LGTH
         GETMAIN R,LV=(R0),LOC=24      GET 24-BIT STG
         LR    R10,R1                  LOAD DSECT-BASE
         MVC   SYSINDCB(SYSINDLN),SYSIN
         MVC   SYSINOPN(SYSINOLL),SYSINOL
         MVC   SYSINCLO(SYSINCLL),SYSINCL
         LA    R11,SYSINOPN            POINT TO 'OPEN' LIST
         OPEN  (SYSINDCB,(INPUT)),MF=(E,(R11))
CLOSYSIN EQU   *
         LA    R11,SYSINCLO            POINT TO 'CLOSE' LIST
         CLOSE (SYSINDCB),MF=(E,(R11)) CLOSE 'SYSIN'
         LA    R0,SYSINGML             RELOAD SYSIN 'GETMAIN' LGTH
         FREEMAIN R,LV=(R0),A=(R10)    FREE THE 24-BIT STG
         XR    R15,R15                 CLEAR R15
         RETURN (14,12),RC=(15)        RESTORE REGISTERS AND RETURN
*
SYSIN    DCB   DDNAME=SYSIN,MACRF=(GL),DSORG=PS,RECFM=FB,              X
               LRECL=80,BLKSIZE=80,DCBE=SYSIND
SYSIND   DCBE  RMODE31=BUFF,EODAD=CLOSYSIN
SYSINDLN EQU   *-SYSIN                 DCB-LGTH
SYSINOL  OPEN  (,),MF=L                OPEN-LIST
SYSINOLL EQU   *-SYSINOL               OPEN-LIST LGTH
SYSINCL  CLOSE (,),MF=L                CLOSE-LIST
SYSINCLL EQU   *-SYSINCL               CLOSE-LIST LGTH
SYSINGML EQU   *-SYSIN                 TOTAL GETMAIN-LGTH
*
         LTORG ,
*
         YREGS ,                       MVS REGISTER-MACRO
*
SUBPGM   AMODE 31                      SPECIFY AMODE OVERRIDE
SUBPGM   RMODE ANY                     SPECIFY RMODE OVERRIDE
*
         END   ,

HTH....
Back to top
View user's profile Send private message
dsivapradeep

New User


Joined: 06 Jul 2012
Posts: 43
Location: INDIA

PostPosted: Mon Jul 16, 2012 3:14 pm    Post subject: Re: Reply to: Cobol calling Assembler
Reply with quote

Bill O'Boyle wrote:
If neither of the above are present, the sub-program can be Assembled/Linked with AMODE 31/RMODE ANY. The default for IEWL (Linkage Editor) is AMODE 24/RMODE 24.


Thanks Bill, your suggestion helped me. My assembler program isn't using any DCB. so i changed to AMODE 31/RMODE ANY. Previously, i was trying this combination in the JCL that was used for compiling/Linkedit and getting the run-time error message during execution.
Now i wrote the 2 options in my Called Assembler Program and it worked.
Back to top
View user's profile Send private message
dsivapradeep

New User


Joined: 06 Jul 2012
Posts: 43
Location: INDIA

PostPosted: Wed Jul 18, 2012 10:49 am    Post subject: COBOL calling Assembler with parameters
Reply with quote

Hi
Now i'm stuck in new exception
Code:

CEE3204S The system detected a protection exception (System Completion Code=0C4)

I'm getting this exception when i calls my assembler using parameters.
Code:

CALL 'ASMRCEIV' USING WS-PARM-FOR-ASM
END-CALL                             

i declared WS-PARM-FOR-ASM in working-storage section.

I know that in assembler R1 has parameters address, but i think in my code i dint manipulate it properly so i'm getting this exception.
My assembler code is below:
Code:

ASMRCEIV START                                 
         STM   14,12,12(13)                     
         LR    12,15                           
         USING ASMRCEIV,12                     
         ST    13,SAVE+4                       
         LR    2,13                             
         LA    13,SAVE                         
         ST    13,8(2)                         
**  END OF STANDARD ENTRY ROUTINE               
         WTO   'IN ASMRCEIV PROGRAM'           
         L     5,0(1)                           
         USING PARMDATA,5                       
*        MVC   SAVE1,PARM1                     
*        WTO   TEXT=SAVELEN,ROUTCDE=(11)       
*        WTO   TEXT=SAVELEN,ROUTCDE=(11)       
**  STANDARD EXIT ROUTINE                       
END      L     13,SAVE+4                       
         LM    14,12,12(13)                     
         LA    15,0                             
ASMRCEIV AMODE 31                               
ASMRCEIV RMODE ANY                             
         BR    14                               
SAVE     DC    18F'0'                           
SAVELEN  DC    H'4'                             
SAVE1    DC    C'1234' 
PARMDATA DSECT         
PARM1    DS    CL5     
         END   ASMRCEIV


The message 'in asmreceiv program' is displaying SPOOL's JESYSMSG, but exception in SYSOUT.

Can someone help me in identifying mistakes of my code ?
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Wed Jul 18, 2012 11:30 am    Post subject:
Reply with quote

Code:
WTO   'IN ASMRCEIV PROGRAM'           


That destroys R1. So you have to save R1 before you execute macro's.
Back to top
View user's profile Send private message
dsivapradeep

New User


Joined: 06 Jul 2012
Posts: 43
Location: INDIA

PostPosted: Wed Jul 18, 2012 12:48 pm    Post subject:
Reply with quote

Thanks Peter,

I dint realize WTO is destroying R1. Saved R1 contents before WTO macro and its working now. icon_smile.gif
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Wed Jul 18, 2012 1:22 pm    Post subject:
Reply with quote

Most macro's use R1 to pass the address of their parameters to the OS.
To see what happens whit the registers consult the "Authorized Assembler Services Reference" manuals.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Wed Jul 18, 2012 6:13 pm    Post subject: Reply to: Cobol calling Assembler
Reply with quote

If you're using R0, R1, R14 or R15 prior to issuing an MVS Macro, save all four of these register's beforehand and then restore them afterwards.

As Peter has said, R1 will be destroyed, but just in case, saving the other three should be a consideration if you're unsure.

Example (one of many) using a QUADWORD (16-Bytes aligned), together with a Store Multiple and a Load Multiple -

Code:

QUADWORD DS     L                        16-BYTE REGISTER-SAVEAREA
*
                STM   R14,R1,QUADWORD    SAVE R14 THROUGH R1
*
*               ISSUE MVS MACRO HERE
*
                LM    R14,R1,QUADWORD    RESTORE R14 THROUGH R1
*

HTH....
Back to top
View user's profile Send private message
dsivapradeep

New User


Joined: 06 Jul 2012
Posts: 43
Location: INDIA

PostPosted: Thu Jul 19, 2012 7:46 pm    Post subject: Re: Reply to: Cobol calling Assembler
Reply with quote

Bill O'Boyle wrote:
Is there any particular reason the sub-program is AMODE 24? Does it contain DCB's (RMODE must be 24) or VSAM ACB access without specifying the "MODE=31" parm (default is 24)?

If DCB's are in the sub-program, then there's more to it than just an Assembly/Link as 31/ANY.


Hi Bill,

Now i used DCB in my Assembler while calling it from Cobol.
Before using DCB i executed in RMODE ANY condition it worked. But, when i added DCB's it showed a Protection Exception. So changed to RMODE 24 as you suggested and it executed without any exception.

Can you tell me the significance of RMODE 24 here?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7914
Location: Bellevue, IA

PostPosted: Thu Jul 19, 2012 8:13 pm    Post subject:
Reply with quote

Unless you use the DCBE extension to support 31-bit, assembler code with DCB is required to run in 24-bit mode.
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 -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am
No new posts Can sending 5 MB data between cobol p... Kevin Vaz CICS 12 Tue Oct 18, 2016 4:50 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us