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

Assembler S0C1 abend


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

Active User


Joined: 05 Feb 2007
Posts: 199
Location: Sri Lanka

PostPosted: Sat Aug 09, 2008 4:26 am
Reply with quote

Hi,

I am trying to run my first assembler program and it gives me S0C1 error. I will appreciate any help in fixing this. iTS ON A z10 machine with z/OS 01.09.00

The program is just one line of instruction as given below.

Code:
ADD2     CSECT         
         DC    F'4'     
         END   ADD2 


The compile-linked goes fine. I use the following parms,
compile PARM=(OBJECT,LIST(133)) for ASMA90
Link PARM='MAP,LET,LIST,XREF' for IEWL


The run JCl is given below for program TEST3

Code:
//STEP01   EXEC PGM=TEST3                           
//STEPLIB  DD DISP=SHR,DSN=xxxxxxx.DEV.LOAD         
//SYSPRINT DD SYSOUT=*                             
//SYSTSPRT DD SYSOUT=*                             
//SYSOUT   DD SYSOUT=*                             
//SYSUDUMP DD SYSOUT=*                             
//*                                       



Following is the error.

Code:
PSW AT TIME OF ERROR  078D0000   00007FFA  ILC 2  INTC 01                   
  ACTIVE LOAD MODULE           ADDRESS=00007FF8  OFFSET=00000002             
  NAME=TEST3                                                                 
  DATA AT PSW  00007FF4 - 00000000  00000004  00000000                       
  GR 0: FD000008   1: 00006FF8                                               
     2: 00000040   3: 00AD89D4                                               
     4: 00AD89B0   5: 00AFF5E8                                               
     6: 00ABFFE0   7: FD000000                                               
     8: 00AFCB18   9: 00AFF210                                               
     A: 00000000   B: 00AFF5E8                                               
     C: 87C8AB4A   D: 00006F60                                               
     E: 80FD9AD8   F: 00007FF8         



Surely I am missing something. Can someone help!

Thanks.
Back to top
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 400
Location: Mumbai

PostPosted: Sat Aug 09, 2008 4:46 am
Reply with quote

If you were a machine, what would you do when you ran '00000004'x ? What does the opcode 0000 do? (hint - there isn't one). What did you expect it to do?

I suspect you thought of this as a "program" that just declares some variables, but does nothing. Compilers generate runnable code and variables. In high level language where you just declare some variables, the compiler is still generating runnable code, but all that code does is return to the caller. For this case - the machine is simply trying to execute your data.
Back to top
View user's profile Send private message
wanderer

Active User


Joined: 05 Feb 2007
Posts: 199
Location: Sri Lanka

PostPosted: Sat Aug 09, 2008 5:06 am
Reply with quote

Thanks for responding!

I actually had a small program given below.

Code:
ADD2     CSECT                       
         L     1,16(,15)             
         L     2,20(,15)             
         AR    1,2                   
         ST    1,24(,15)             
         BCR   B'1111',14             
         DC    F'4'                   
         DC    F'6'                   
         DS    F                     
         END   ADD2


This one also compiles well but while running gives a cond code 4072 without any other error message or anything. Trying to have atleast a workable program I ended up removing all instructions except one, to simplify things(shown in my first post). As you mentioned probably that didn't help.

So why doesn't the above program run? Please bear with me if you find something silly.

Thanks.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Aug 09, 2008 9:01 am
Reply with quote

Hello,

What are you using for training material?

How did you choose that set of instructions to code? What did you intend this code to do? What you have posted is not really a program. . .

I suggest you buy a book for an introduction to assembler programming as well as the concepts of assembler. It is not something to "just pick up" randomly trying instructions.

Many years ago there was a very good Assembler Programming book by Kevin Mcquillen. It was sold here:
www.murach.com/books/mbal/index.htm
Murach still has an assembler book by Kevin, but is newer than the one i am familiar with. If you intend to learn assembler, the investment will be well worth it.
Back to top
View user's profile Send private message
wanderer

Active User


Joined: 05 Feb 2007
Posts: 199
Location: Sri Lanka

PostPosted: Sun Aug 10, 2008 4:24 am
Reply with quote

Dick,

I found the code from the following website.

www.bsp-gmbh.com/turnkey/assembler/

It is fairly good material but somehow I couldn't get the codes to run.

I had seen the book in Amazon but didn't know if it would be absolutely necessary. Let me see if I can get a copy of the book. Hopefully codes in the book will run. There is nothing like learning a new language with a 'Hello World' program first!

Thanks
icon_smile.gif
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Sun Aug 10, 2008 4:41 am
Reply with quote

If you know COBOL, the assembler listing of the gererated code is a good (if not so much best) clue of how to code an Assembler equivient to the COBOL code....
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Aug 11, 2008 8:01 am
Reply with quote

Hello,

Quote:
There is nothing like learning a new language with a 'Hello World' program first!
Well, a Hello World program may give one the experience of getting "something" to compile/assemble successfully.

In assembler, it falls far short of having actually learned anything about using the language. . . In assembler, following "standard linkage conventions" is one of the most important parts of writing assembler.

Neither bit of posted code would be Hello World code. . .

I suggest you look for something that provides some foundation rather than just trying op-codes to see what happens.
Back to top
View user's profile Send private message
Martin Truebner

New User


Joined: 10 Aug 2008
Posts: 1
Location: Germany

PostPosted: Mon Aug 11, 2008 10:34 am
Reply with quote

Wanderer,

You are doing good - program does what you coded.
Go back to original sample (which was probably only an illustration of a stmt).
It has ingredients a program needs (forget the linkage conventions for a second), but not all ;-) .

It starts with loading something to a register- then another register then adds them then stores it and then returns to address in R14.

If you add before returning a SLR 15,15 or SR 15,15 or XR 15,15 or LA 15,0 or ... there are a few other ways to clear R15... your program will run with a zero as return-code.

As the codefragment is only an illustration it lacks some of the vital feature or all programs that are not imbeded into other programs: It does not have any code to accept input or to show output. Thats why you get no output (other than the return-code).
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Mon Aug 11, 2008 8:28 pm
Reply with quote

HI Wanderer !

As your Assembler program allways runs as a subprogramm of the system or another programm, you have to take care of the registers at the beginning and at the end of your programm. First you have to store the registers of the system/calling programm, then at end, you have to restore them. It's allways the same. Between that, you could insert your
testing examples. Having strictly adhered theese "standard linkage conventions", Dick mentioned, will make it more easier to concentrate on your own errors in your own piece of code.

Regards, UmeySan


Example:

MDL00910 CSECT
ENTRY MDL00910
MDL00910_BEGIN DS 0H
STM R14,R12,12(R13) ...STORE REGS IN CALLERS SAVE
LR R9,R15 ...LOAD R9 ADRESS CALLERS R15
USING MDL00910_BEGIN,R9 ...AND USE IT AS BASE-REG
SPACE
LA R15,MDL00910_SAVEAREA ...LOAD OWN PGM-SAVEAREA
ST R15,8(R13) ...STORE IN CALLERS SAVE-AREA
ST R13,4(R15) ...STORE IN OWN SAV-EAREA
LR R13,R15 ...POINT R13 TO OWN SAVE-AREA
SPACE
B MDL00910_START
MDL00910_START DS 0H

...insert your statements here

MDL00910_STOPP DS 0H
B MDL00910_ENDE
SPACE
MDL00910_ENDE DS 0H PROGRAMM-ENDE
L R13,MDL00910_SAVEAREA+4 ...LOAD SAVE-AREA
LM R14,R12,12(R13) ...RELOAD ALL THE REGS
SR R15,R15 ...CLEAR REGISTER-15
BR R14 ...GET OUT OF HERE
EJECT
Back to top
View user's profile Send private message
wanderer

Active User


Joined: 05 Feb 2007
Posts: 199
Location: Sri Lanka

PostPosted: Mon Aug 11, 2008 11:31 pm
Reply with quote

Thank you everyone for the response!

Martin,

I added the SR 15,15 before returning and it gave RC 0. That was fantastic!

UmeySan,

Thanks for the code. I will try out the code example you have given.

Dick and everybody, I understand that running a tiny little program doesn't really get me anywhere significant but since I am learning it alone, a tiny bit of successful code makes me feel that I am doing some progress even if its a baby step and keeps interest high. And Dick, I have ordered the book as I really need a good foundation.

Thank you all,
Cheers!
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Aug 11, 2008 11:38 pm
Reply with quote

You're welcome icon_smile.gif

Baby steps can be a good thing. . . And having something "work" surely makes one want more.

As you proceed, post back here when there are questions or mysterious happenings.

Someone will be here.

d
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 ISAM and abend S03B JCL & VSAM 10
No new posts Build dataset list with properties us... PL/I & Assembler 4
No new posts Finding Assembler programs PL/I & Assembler 5
No new posts Abend S0C4 11 (Page Translation Excep... PL/I & Assembler 16
No new posts How Can I Recall a Migrated Data Set ... PL/I & Assembler 3
Search our Forums:

Back to Top