Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8914247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:40:13+00:00 2026-06-15T04:40:13+00:00

I am trying to pass back a parameter from an external subroutine written in

  • 0

I am trying to pass back a parameter from an external subroutine written in assembler. The calling routine is in cobol, and the parameters to the external assembler routine look like this:

01  CALCSHRS-PARMS.
    05  CS-DEPOSIT-AMT      PIC 9(5)V99 COMP-3.
    05  CS-SHARE-PRC        PIC 9(3)V99 COMP-3.
    05  CS-SHARE-AMT        PIC 9(9)V99 COMP-3.

The call looks like this:

CALL 'CALCSHRS' USING CS-DEPOSIT-AMT
                      CS-SHARE-PRC
                      CS-SHARE-AMT.

The routine uses the CS-DEPOSIT-AMT and the CS-SHARE-PRC to calculate the CS-SHARE-AMT, which needs to get passed back. Here is the assembler routine:

CALCSHRS CSECT                                             
*                                                          
         PRINT NOGEN                                       
*                                                           
         STM   14,12,12(13)        SAVE ENTRY REGS         
         LR    12,15               SET BASE REG            
         USING CALCSHRS,12         ESTABLISH ADDRESSABILITY
*                                                          
         LA    14,SUBPSAVE         STANDARD                
         ST    13,4(,14)           SAVE                    
         ST    14,8(,14)           AREA                    
         LR    13,14               LINKAGE                 
*                                                          
         LM    2,4,0(1)            LOAD THE PARAMETERS                                                               
*                                                          
         ZAP   DEPOSITP,0(2,4)       GET THE DEPOSIT AMOUNT  
         ZAP   SHAREPCK,0(3,3)     GET THE SHARE PRICE     
*                                                          
         ZAP   SHARESP(9),DEPOSITP INITIALIZE SHARES       
*                                                          
         MP     SHARESP,=P'10000'     MULTIPLY BY 1000     
         DP     SHARESP,SHAREPCK     DIVIDE BY SHARE PRICE 
         ZAP    SHARESPR,SHARESP(6)  MOVE THE FIRST 5 BYTES
*                                                          
         SRP    SHARESPR(6),(64-1),5 SHIFT TO ROUND        
         SRP    SHARESPR(6),2,5      SHIFT AGAIN           
*                                                          
         MVC   0(6,4),SHARESPR     ME ATTEMPTING TO RETURN SHARESPR...                       
*                                                          
         L     13,4(,13)           STANDARD SAVE                    
         LM    14,12,12(13)        AREA LINKAGE                     
         SR    15,15               SET RETURN CODE TO 0             
         BR    14                                                   
*                                                                   
         LTORG                                                      
*                                                                   
SUBPSAVE DC    18F'0'                                               
*                                                                   
SHAREPCK DS    PL3                   SHARE PRICE PACKED             
DEPOSITP DS    PL5                   DEPOSIT IN PACKED DECIMAL      
SHARESP  DS    PL9                   SHARES  IN PACKED DECIMAL      
SHARESPR DS    PL6                   SHARES ROUNDED                 
*                                                                   
         END   CALCSHRS 

I just need to return SHARESPR and have it go in CS-SHARE-AMT back in my cobol program. Everything else works the way I want it to. Anyone know how I need to do that? Any help is much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T04:40:14+00:00Added an answer on June 15, 2026 at 4:40 am

    Turns out, you can pass the parameter back in the register with it’s address using ZAP. In my case, the CS-SHARE-AMT is in register 4, so this is how i pass back SHARESPR from my assembler code to my calling COBOL program:

    ZAP  0(6,4),SHARESPR(6)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to pass a parameter from AJAX back to my JSP page.
I'm trying to pass a parameter from php into my javascript function inside html.
I'm having a problem when trying to pass an array back to a COM
I'm an encryption novice trying to pass some values back and forth between systems.
im trying to pass two parameters to a function, i being an int value
I'm trying to pass a collection of parameters to a PHP page to be
I am trying to dynamically pass a double array from C# to some JavaScript
Pretty simple. trying to get XML back from Sharepoint site. Get blank white page...
I am trying to pass a parameter to my service, the code runs but
am trying to pass a parameter with a space in ksh via variables. Here

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.