SVC search 
Author Message
 SVC search

I'm trying to write an assembler sub-routine that will a) take a        
supplied completion code from a COBOL calling program and b) end the job
step with that completion code WITHOUT abending and without returning to
the calling program.  Below is the current source which does all I've  
mentioned but unfortunately abends.  I've tried branching to reg 14 from
the calling program but without success.  I don't have access to the 370
Princ.Oper. and am wondering if there is an SVC I could use (SVC 13    
causes an abend) that would simply return control back to the system
when the subroutine
ends??                                                        
RETCODE  CSECT                                                          
***      L     14,12(13)        R14 FROM CALLING COBOL PROGRAM          
         SAVE  (14,12)                                                  
         BALR  12,0                                                    
         USING *,12                                                    
         L     4,0(1)           retrieve half word from cobol          
         LH    4,0(4)                                                  
         B     CONT             this is simply for alignment            
         DS    1H                                                      
CONT     STH   4,ABEND+2        overlay the code in the abend macro    
ABEND    ABEND 100                                                      
         END



Sun, 12 Sep 1999 03:00:00 GMT  
 SVC search

Quote:

>I'm trying to write an assembler sub-routine that will a) take a        
>supplied completion code from a COBOL calling program and b) end the job
>step with that completion code WITHOUT abending and without returning to
>the calling program.  Below is the current source which does all I've  
>mentioned but unfortunately abends.  I've tried branching to reg 14 from
>the calling program but without success.  I don't have access to the 370
>Princ.Oper. and am wondering if there is an SVC I could use (SVC 13    
>causes an abend) that would simply return control back to the system
>when the subroutine
>ends??            

First, you have a terminology problem.  A "completion code" *is* an
ABEND code.  What you want is a "condition code" or return code (not
to be confused with the condition code defined by the hardware).

The SVC number you want is 3.  When the system invokes the job step
program, R14 points to an SVC 3 instruction.  But SVC 3 is not
documented as an interface, and they could easily change its working
any time.  (For all I know it may have been changed in recent versions
of MVS).  So if you don't want to ABEND, you need to branch to where
R14 was pointing when the *first* program in the job step was called.
But then you may have another problem: what if that program opened
datasets or acquired other resources that need to be cleaned up ?  The
system will do some of this cleanup silently for you, but in other
cases it will invoke ABEND to do so.  If you don't know what the
program(s) executed before your routine gets control have done, then
you may be in trouble.

Now what's wrong with ABEND in this situation ?  This is just the sort
of thing it's useful for.  Use COND=EVEN or ONLY in your JCL to
control events after you issue your ABEND.

Quote:
>RETCODE  CSECT                                                          
>***      L     14,12(13)        R14 FROM CALLING COBOL PROGRAM          
>         SAVE  (14,12)                                                  
>         BALR  12,0                                                    
>         USING *,12                                                    
>         L     4,0(1)           retrieve half word from cobol          
>         LH    4,0(4)                                                  

Argh - this is very risky!  What you need is a CNOP.
Quote:
>         B     CONT             this is simply for alignment            
>         DS    1H                                                      
>CONT     STH   4,ABEND+2        overlay the code in the abend macro    
>ABEND    ABEND 100                                                      

But what you really need is simply
          ABEND (4)

Quote:
>         END

But then if you are issuing ABEND, why are you surprised that your
program ABENDs ?

Tony Harminc



Sun, 19 Sep 1999 03:00:00 GMT  
 SVC search


Quote:
>I'm trying to write an assembler sub-routine that will a) take a        
>supplied completion code from a COBOL calling program and b) end the job
>step with that completion code WITHOUT abending and without returning to
>the calling program.  Below is the current source which does all I've  
>mentioned but unfortunately abends.  I've tried branching to reg 14 from
>the calling program but without success.  I don't have access to the 370
>Princ.Oper. and am wondering if there is an SVC I could use (SVC 13    
>causes an abend) that would simply return control back to the system
>when the subroutine
>ends??                                                        
>RETCODE  CSECT                                                          
>***      L     14,12(13)        R14 FROM CALLING COBOL PROGRAM          
>         SAVE  (14,12)                                                  
>         BALR  12,0                                                    
>         USING *,12                                                    
>         L     4,0(1)           retrieve half word from cobol          
>         LH    4,0(4)                                                  
>         B     CONT             this is simply for alignment            
>         DS    1H                                                      
>CONT     STH   4,ABEND+2        overlay the code in the abend macro    
>ABEND    ABEND 100                                                      
>         END

You want SVC 3, not 13.

POP is the wrong manual, you want whatever they renamed Supervisor
Services and Macros to.  IBM might have the MVS Library on the
Internet.

If not, the CD set was shipped to your datacenter with MVS.  Ask the
systems programmers for last year's set.  It's 4 or 6 CDs, they have
lots of them.  If you're a big shop, they may have it on a CD server.

Cory Hamasaki      http://www.kiyoinc.com
HHResearch Co.     OS/2 Webstore & Newsletter
REDWOOD        



Sun, 19 Sep 1999 03:00:00 GMT  
 SVC search

Builder of software archeology tools and other strange programs to help survive in a legacy based world.



Mon, 20 Sep 1999 03:00:00 GMT  
 SVC search

Quote:


> >I'm trying to write an assembler sub-routine that will a) take a
> >supplied completion code from a COBOL calling program and b) end the job
> >step with that completion code WITHOUT abending and without returning to
> >the calling program.  Below is the current source which does all I've
> >mentioned but unfortunately abends.  I've tried branching to reg 14 from
> >the calling program but without success.  I don't have access to the 370
> >Princ.Oper. and am wondering if there is an SVC I could use (SVC 13
> >causes an abend) that would simply return control back to the system
> >when the subroutine
> >ends??

> First, you have a terminology problem.  A "completion code" *is* an
> ABEND code.  What you want is a "condition code" or return code (not
> to be confused with the condition code defined by the hardware).

> The SVC number you want is 3.  When the system invokes the job step
> program, R14 points to an SVC 3 instruction.  But SVC 3 is not
> documented as an interface, and they could easily change its working
> any time.  (For all I know it may have been changed in recent versions
> of MVS).  So if you don't want to ABEND, you need to branch to where
> R14 was pointing when the *first* program in the job step was called.
> But then you may have another problem: what if that program opened
> datasets or acquired other resources that need to be cleaned up ?  The
> system will do some of this cleanup silently for you, but in other
> cases it will invoke ABEND to do so.  If you don't know what the
> program(s) executed before your routine gets control have done, then
> you may be in trouble.

> Now what's wrong with ABEND in this situation ?  This is just the sort
> of thing it's useful for.  Use COND=EVEN or ONLY in your JCL to
> control events after you issue your ABEND.

> >RETCODE  CSECT
> >***      L     14,12(13)        R14 FROM CALLING COBOL PROGRAM
> >         SAVE  (14,12)
> >         BALR  12,0
> >         USING *,12
> >         L     4,0(1)           retrieve half word from cobol
> >         LH    4,0(4)
> Argh - this is very risky!  What you need is a CNOP.
> >         B     CONT             this is simply for alignment
> >         DS    1H
> >CONT     STH   4,ABEND+2        overlay the code in the abend macro
> >ABEND    ABEND 100
> But what you really need is simply
>           ABEND (4)
> >         END

> But then if you are issuing ABEND, why are you surprised that your
> program ABENDs ?

> Tony Harminc

First, thanks for the clarification on terminology, I'll sleep easier
tonight  
with this
knowledge.                                                          
I used SVC 3 and the subroutine works perfectly, thanks for that
info.        
The programmer requesting this sub-routine had a need to perform
different    
portions of a job stream dependent on different cond codes, the on/off
options
of an abend would have been
insufficient.                                      
Believe it or not, I wasn't suprised when the abend occured after the
abend    
macro was invoked, this was merely a first step to override the
condition code/
completion
code.                                                              
Thanks for your time and
interest....


Mon, 20 Sep 1999 03:00:00 GMT  
 SVC search

Quote:
>The programmer requesting this sub-routine had a need to perform different    
>portions of a job stream dependent on different cond codes, the on/off options
>of an abend would have been insufficient.                                      
>Believe it or not, I wasn't suprised when the abend occured after the abend    
>macro was invoked, this was merely a first step to override the condition code/
>completion code.                                                              
>Thanks for your time and
>interest....

If you are ESA 4.3 or later, you can use much more sophiticated abend
checking in JCL using the //  IF  construct.  You can check for
specific abend codes for instance.  I can't remember the syntax
offhand, but it's well covered in JCL Reference.
Regards,   Steve Smith.


Mon, 20 Sep 1999 03:00:00 GMT  
 SVC search

Sorry about the apparent blank posting in this thread.  My newmangler seems to have done this several times of late.

RETURN-CODE special register has been available in IBM MVS (even MVT) COBOL's for a long time.  This will allow you to set the return code out of the "top" COBOL program in the current run-unit.

One can of course exit from any COBOL program in the run-unit by doing a STOP RUN..... so if one really wants to exit all COBOL stuff, with a specified return code (Reg 15) you can simply...

  MOVE nnnn TO RETURN-CODE
  STOP RUN.
Rex Widmer
Builder of software archeology tools and other strange programs to help survive in a legacy based world.



Tue, 21 Sep 1999 03:00:00 GMT  
 SVC search



[Posted and mailed]

:>I'm trying to write an assembler sub-routine that will a) take a        
:>supplied completion code from a COBOL calling program and b) end the job
:>step with that completion code WITHOUT abending and without returning to
:>the calling program.  Below is the current source which does all I've  
:>mentioned but unfortunately abends.  I've tried branching to reg 14 from
:>the calling program but without success.  I don't have access to the 370
:>Princ.Oper. and am wondering if there is an SVC I could use (SVC 13    
:>causes an abend) that would simply return control back to the system
:>when the subroutine
:>ends??    

The following will work if you are at the jobstep task level and the no
program in the path was invoked via a dynamic call, i.e., LINK.

:>RETCODE  CSECT                                                          
:>***      L     14,12(13)        R14 FROM CALLING COBOL PROGRAM          
:>         SAVE  (14,12)                                                  
:>         BALR  12,0                                                    
:>         USING *,12                                                    
:>         L     4,0(1)           retrieve half word from cobol          
*:>        LH    4,0(4)

           LH    15,0(,4)
           SVC   3

*:>        B     CONT             this is simply for alignment            
*:>        DS    1H                                                      
*:>CONT    STH   4,ABEND+2        overlay the code in the abend macro    
*:>ABEND   ABEND 100                                                      
:>         END

But note that no cleanup (if required) by the calling process will be
performed.

If the routine is called by a lower level task there is nothing a problem
state caller can do. If called by a lower level RB you can try to muck with
the callers registers by setting values in the save area but this approach is
quite risky.

What is the purpose of this exercise?

--


Director, Dissen Software, Bar & Grill - Israel



Wed, 22 Sep 1999 03:00:00 GMT  
 SVC search

Quote:

> >The programmer requesting this sub-routine had a need to perform different
> >portions of a job stream dependent on different cond codes, the on/off options
> >of an abend would have been insufficient.
> >Believe it or not, I wasn't suprised when the abend occured after the abend
> >macro was invoked, this was merely a first step to override the condition code/
> >completion code.
> >Thanks for your time and
> >interest....

> If you are ESA 4.3 or later, you can use much more sophiticated abend
> checking in JCL using the //  IF  construct.  You can check for
> specific abend codes for instance.  I can't remember the syntax
> offhand, but it's well covered in JCL Reference.
> Regards,   Steve Smith.

Original problem was how to generate the requisite cond code, not how to
check it..
Thanks for your time though....


Fri, 24 Sep 1999 03:00:00 GMT  
 SVC search

Quote:

> Sorry about the apparent blank posting in this thread.  My newmangler seems to have done this several times of late.

> RETURN-CODE special register has been available in IBM MVS (even MVT) COBOL's for a long time.  This will allow you to set the return code out of the "top" COBOL program in the current run-unit.

> One can of course exit from any COBOL program in the run-unit by doing a STOP RUN..... so if one really wants to exit all COBOL stuff, with a specified return code (Reg 15) you can simply...

>   MOVE nnnn TO RETURN-CODE
>   STOP RUN.
> Rex Widmer
> Builder of software archeology tools and other strange programs to help survive in a legacy based world.

D ===>                                                  SCROLL ===> CSR  
 We've inherited a software package originally written for DOS/VSE      
 (which I know very little about).  Our mandate is to support this      
 package for both the original OS and for MVS/ESA by using the same
COBOL
 source as much as possible.  Differences are accommodated by use of    
 called modules unique to each environment.  One of our group is working
 with a COBOL batch program that calls a routine RETCODE (which we don't
 have source for).  Judging from the context in which this call appears,
 it looks like RETCODE was set up to simply return a condition code to  
 the OS and end without returning back to the calling program.  Assump-  
 tions drawn from this indicate that a DOS/VSE batch COBOL program can't
 return a user-defined condition code to the operating system.  In order
 to keep the same COBOL source for both OS's, I had to set up the MVS    
 version of RETCODE..                                                    
 My first attempt was by doing exactly as you described with the COBOL  
 stop-run but this returned a condition code of zeroes!!  Use of SVC 3  
 with reg 15 works fine.....


Fri, 24 Sep 1999 03:00:00 GMT  
 SVC search

Quote:



> [Posted and mailed]

> :>I'm trying to write an assembler sub-routine that will a) take a
> :>supplied completion code from a COBOL calling program and b) end the job
> :>step with that completion code WITHOUT abending and without returning to
> :>the calling program.  Below is the current source which does all I've
> :>mentioned but unfortunately abends.  I've tried branching to reg 14 from
> :>the calling program but without success.  I don't have access to the 370
> :>Princ.Oper. and am wondering if there is an SVC I could use (SVC 13
> :>causes an abend) that would simply return control back to the system
> :>when the subroutine
> :>ends??

> The following will work if you are at the jobstep task level and the no
> program in the path was invoked via a dynamic call, i.e., LINK.

> :>RETCODE  CSECT
> :>***      L     14,12(13)        R14 FROM CALLING COBOL PROGRAM
> :>         SAVE  (14,12)
> :>         BALR  12,0
> :>         USING *,12
> :>         L     4,0(1)           retrieve half word from cobol
> *:>        LH    4,0(4)

>            LH    15,0(,4)
>            SVC   3

> *:>        B     CONT             this is simply for alignment
> *:>        DS    1H
> *:>CONT    STH   4,ABEND+2        overlay the code in the abend macro
> *:>ABEND   ABEND 100
> :>         END

> But note that no cleanup (if required) by the calling process will be
> performed.

> If the routine is called by a lower level task there is nothing a problem
> state caller can do. If called by a lower level RB you can try to muck with
> the callers registers by setting values in the save area but this approach is
> quite risky.

> What is the purpose of this exercise?

> --


> Director, Dissen Software, Bar & Grill - Israel

Please see my response posted to rwidmer above......


Fri, 24 Sep 1999 03:00:00 GMT  
 SVC search


Quote:

>You want SVC 3, not 13.

Wait a minute, Cory! You *can* use SVC 13 for *normal*
end-of task, like this:

         LH    1,0(,1)              PICK UP RETURN CODE
         O     1,=X'08,000000'      TASK TERMINATION  
         SVC   13                   INVOKE R/TM

As far as I know, this is only used by EXIT processing (the
SVC 3 routine) when it detects that it has been invoked for
the last PRB in a task.  The X'08' bit in R1's first byte is
the "magic bit" that tells the Recovery/Termination Manager
(R/TM) that it should perform normal task completion
processing.

As for SVC 3, various components of MVS use it to exit a PRB
or IRB, often by branching to CVTEXIT, an SVC 3 instruction
conveniently located in the CVT.  By the way, if you ever
wondered where R14 points to when "the system" invokes a
program via LINK, SYNCH, ATTACH or XCTL, wonder no more: R14
*always* points to the same place, and this place is
CVTEXIT.  Incidentally, SVC 3 is defined in the Debugging
Handbook as "EXIT macro".  I've never seen an EXIT macro
anywhere in the MVS code, SVC 3 was always hard-coded.  I've
never seen an EXIT macro in PVTMACS either.

As far as COBOL is concerned, Rex Widmer is plain right: why
not use STOP RUN?



Fri, 24 Sep 1999 03:00:00 GMT  
 SVC search

Given the constraint of keeping the routine the same in both environments, I  
suggest the dfollowing experiment.  Create a subroutine that sets the return  
code desired in register 15 and returns to the main program which will then  
issue the STOP RUN.  I believe that will pass the correct return code (it  
used to do that but I haven't tried it recently.  The other thing to try is  
having the MVS version of RETCODE consist of MOVE passed-value to RETURN-CODE  
STOP RUN.  As I recall my manuals that also should work because STOP RUN is  
supposed to return to the operating system and with the newer COBOLs I  
believe that it is also supposed to properly terminate any callers.

Quote:


> > Sorry about the apparent blank posting in this thread.  My newmangler  

seems to have done this several times of late.
Quote:

> > RETURN-CODE special register has been available in IBM MVS (even MVT)  

COBOL's for a long time.  This will allow you to set the return code out of  
the "top" COBOL program in the current run-unit.
Quote:

> > One can of course exit from any COBOL program in the run-unit by doing a  

STOP RUN..... so if one really wants to exit all COBOL stuff, with a  
specified return code (Reg 15) you can simply...
Quote:

> >   MOVE nnnn TO RETURN-CODE
> >   STOP RUN.
> > Rex Widmer
> > Builder of software archeology tools and other strange programs to help  

survive in a legacy based world.

Quote:
> D ===>                                                  SCROLL ===> CSR  
>  We've inherited a software package originally written for DOS/VSE        
>  (which I know very little about).  Our mandate is to support this        
>  package for both the original OS and for MVS/ESA by using the same
> COBOL
>  source as much as possible.  Differences are accommodated by use of      
>  called modules unique to each environment.  One of our group is working  
>  with a COBOL batch program that calls a routine RETCODE (which we don't  
>  have source for).  Judging from the context in which this call appears,  
>  it looks like RETCODE was set up to simply return a condition code to    
>  the OS and end without returning back to the calling program.  Assump-  
>  tions drawn from this indicate that a DOS/VSE batch COBOL program can't  
>  return a user-defined condition code to the operating system.  In order  
>  to keep the same COBOL source for both OS's, I had to set up the MVS    
>  version of RETCODE..                                                    
>  My first attempt was by doing exactly as you described with the COBOL    
>  stop-run but this returned a condition code of zeroes!!  Use of SVC 3    
>  with reg 15 works fine.....

Clark F. Morris, Jr.
CFM Technical Programming Services
Bridgetown, Nova Scotia, Canada




Sat, 25 Sep 1999 03:00:00 GMT  
 
 [ 13 post ] 

 Relevant Pages 

1. What's my SVC number?

2. SVC 99 and SMS

3. help on svc screening !!!!

4. Location of SVC documentation

5. SVC 3 (EXIT macro)

6. SVC 51 restrictions

7. SVC 11 (includes code snippet)

8. Question on SVC 11

9. Help: User written SVC !!!

10. SVC 34

11. SVC 202 under CMS

12. Dynamic allocation (SVC 99) COBOL routines.

 

 
Powered by phpBB® Forum Software