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

SOC1 ABEND with Assembler Code.


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

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Fri Sep 17, 2010 5:20 pm
Reply with quote

Hi,

I have written a sample ASM program to read from a file and write the record into output file. It got compiled successfully but it is giving SOC1 abend at the time of execution.

Here is the code:
Code:

         PRINT NOGEN                                                   
         START 0                                                       
HELLO    CSECT                                                         
         USING *,12                                                   
         STM   14,12,12(13)                                           
         LR    12,15                                                   
         LA    15,SAVE                                                 
         ST    15,8(13)                                               
         ST    13,4(15)                                               
         LR    13,15                                                   
*                                                                     
         OPEN  (FILEA,INPUT)                                           
         OPEN  (FILEB,OUTPUT)                                         
LOOP     GET   FILEA,IREC                                             
         MVC   OTID,ITID                                               
         MVC   OTNAME,ITNAME                                           
         MVC   OTDEG,ITDEG                                             
         PUT   FILEB,OREC                                             
         B     LOOP                                                   
ATEND    CLOSE FILEA                                                   
         CLOSE FILEB                                                   
         RETURN                                                       
*                                                                     
         LTORG                                                         
*                                                                     
FILEA    DCB   DSORG=PS,MACRF=GM,EODAD=ATEND,DDNAME=FILEA             
FILEB    DCB   DSORG=PS,MACRF=PM,DDNAME=FILEB                         
*                                                                     
IREC     DS    0CL80                                                   
ITID     DS    CL5                                                     
ITNAME   DS    CL25                                                   
ITDEG    DS    CL15                                                   
         DS    CL35                                                   
*                                                                     
OREC     DS    0CL60                                                   
OTID     DS    CL5                                                     
         DC    CL3' '                                                 
OTNAME   DS    CL25                                                   
         DC    CL3' '                                                 
OTDEG    DS    CL15                                                   
         DC    CL9' '                                                 
*                                                                     
SAVE     DS    18A                                                     
         END   HELLO                                                   
                                                                       


Kindly let me know that Is this code correct?

Please let me know what are all other statements need to code.

Thanks you very much.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Sep 17, 2010 5:29 pm
Reply with quote

Psychic day was Tuesday this week.

How many times do we have to reply to people and ask them for the

OUTPUT

of the failed run and showing exactly what has happened.

Or do you expect someone to copy, assemble and link the code and try it for themselves.
Please have a think about providing usefull information before posting will you !!!
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: Fri Sep 17, 2010 6:07 pm
Reply with quote

At the very least, your program must be Assembled/Linked as AMODE/RMODE 24, because you're using DCB's.

After the CLOSE of both files, you're not restoring the caller's R13 from the 18-word savearea (L 13,4(,13)). Also, the RETURN Macro is incomplete, as it needs to specify RETURN (14,12),RC=(15). It's always a good idea (and it can't hurt) to set R15 to a value (such as F'0') and return it to the Caller. If the Caller is COBOL, then this would be the RETURN-CODE Special-Register. I think PL/I's counterpart is PLIRETC, but I'm not 100% certain.

I would advise you to use R3 instead of R12 as the base-register, because if the caller is Language Environment compliant, R12 always contains the address of the CEECAA and if you ever change the sub-program to be LE compliant, you'll need this address.

The ABEND information in SYSOUT should give you the address in the sub-program that caused the S0C1 (an invalid OP CODE), which is easy enough to find in the listing.

What could be happening is after the RETURN (which needs to be fixed), execution falls through and hits a DS/DC expansion in the DCB because an LTORG should not be generated (don't see any literals).

This is a sub-program, correct?

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

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Sep 17, 2010 6:08 pm
Reply with quote

Compiled with no errors only means: proper syntax was followed.

has nothing to do with logic or functional correctness of interrelated instructions.

saying that your program
Compiled with no errors
is telling us that you know little or nothing about computers.
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: Fri Sep 17, 2010 8:08 pm
Reply with quote

Quote:
I have written a sample ASM program to read from a file and write the record into output file. It got compiled successfully but it is giving SOC1 abend at the time of execution.

Unlike HLL's, who will inform you about potential errors, the Assembler is unforgiving and it assumes that you know what you're doing.

BTW, you Assemble an Assembler program, whereas, you Compile a COBOL program.

Bill
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 run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts ISAM and abend S03B JCL & VSAM 9
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts VSAM return code 23 - for a Random read COBOL Programming 4
Search our Forums:

Back to Top