Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
SOC4 in ASM program

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

New User


Joined: 05 Jan 2010
Posts: 1
Location: chennai

PostPosted: Tue Jan 05, 2010 10:29 pm    Post subject: SOC4 in ASM program
Reply with quote

I'm new to ASM. I've been trying to learn asm by myself and in one of my practice programs I keep getting s0c4 upon execution. I'm not able to pinpoint what's wrong. Could you please let me know where I'm going wrong?.

Code:

ASMPGM6  START 0
         SAVE  (14,12)
         BALR  12,0
         USING *,12
PARA1    EQU *
OUTREC   DS    0CL80
         OPEN  (OUTFILE,(OUTPUT))
         MVC   OUTREC,=C'HI'
         PUT   OUTFILE,OUTREC
         CLOSE (OUTFILE)
         RETURN (14,12),RC=0
OUTFILE  DCB   DSORG=PS,                                               X
               RECFM=FBA,                                              X
               MACRF=PM,                                               X
               BLKSIZE=800,                                            X
               LRECL=80,                                               X
               DDNAME=OUTP
         END


run job for the above program is as below
Code:
                                                             
//STEP1 EXEC  PGM=ASMPGM7                                         
//SYSPRINT DD SYSOUT=*                                             
//SYSOUT   DD SYSOUT=*                                             
//OUTP    DD DSN=E4912.OPT,                                       
//        DISP=(MOD,CATLG,),                                       
//        SPACE=(CYL,(1,1),RLSE),                                 
//        LRECL=80,RECFM=FBA,BLKSIZE=800


Rgds,
KV
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10373
Location: italy

PostPosted: Tue Jan 05, 2010 10:46 pm    Post subject: Reply to: SOC4 in ASM program
Reply with quote

Code:
OUTREC   DS    0CL80
         OPEN  (OUTFILE,(OUTPUT))
         MVC   OUTREC,=C'HI'


the quoted code will overlay the program with garbage!

read the pop for the MVC specifications!

it' s always a bad practice to have to working areas interspersed with the executables
also nothe that a DS 0<something> does not reserve any storage,
it sipèly define an address and a length
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 757
Location: Germany

PostPosted: Thu Jan 07, 2010 4:27 pm    Post subject:
Reply with quote

@ Gumby !

And please, read more about structured programming.
Do not code anything one after the other. Build structures. Use sections.
Code assembler as you would code cobol.
Back to top
View user's profile Send private message
Stu Thomas

New User


Joined: 06 Feb 2010
Posts: 5
Location: Canada

PostPosted: Wed Feb 10, 2010 8:03 pm    Post subject:
Reply with quote

OPEN and CLOSE do not need a save area, but PUT does. You need to provide a save area - that will solve your problem.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


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

PostPosted: Wed Feb 10, 2010 8:13 pm    Post subject:
Reply with quote

Stu Thomas wrote:
OPEN and CLOSE do not need a save area, but PUT does. You need to provide a save area - that will solve your problem.


Huh? And THAT said by a system programmer?
I did write enough assembler programs to know that you are
talking nonsense.
Back to top
View user's profile Send private message
Stu Thomas

New User


Joined: 06 Feb 2010
Posts: 5
Location: Canada

PostPosted: Wed Feb 10, 2010 8:15 pm    Post subject:
Reply with quote

Please explain your comment about "nonsense".
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


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

PostPosted: Wed Feb 10, 2010 8:17 pm    Post subject:
Reply with quote

LOL,

well PUT doesnt need a save area.
So what do you think your comments look like.
Back to top
View user's profile Send private message
Stu Thomas

New User


Joined: 06 Feb 2010
Posts: 5
Location: Canada

PostPosted: Wed Feb 10, 2010 8:34 pm    Post subject:
Reply with quote

PUT results in a BALR 14,15 to an Access Method. The first thing that the Access Method does is to store YOUR registers into the save area pointed to by Reg 13. Reg 13 currently points to the save area which was passed to your program by your caller. Therefore, the Access Method is writing into your caller's save area. Thus, the Access Method has overlaid your caller's save area. When you return to your caller at the end of your code, you have not restored your caller's registers - you've got the registers which were saved by the Access Method. The 0C4 results. This is a common problem, often seen when people do not understand when save areas are required. It is also common to see people providing save areas when they are not necessary, but this will not cause abends, just unnecessary instructions, and wasted time.
Do you need any further explanation?
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


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

PostPosted: Wed Feb 10, 2010 8:41 pm    Post subject:
Reply with quote

Of course not but what you commented looked like supplying a save area for any PUT.
But supplying a save area at the start of your programming is a required practice. I even think that the OPEN/CLOSE will use it.

So im sorry for mis interpreting your comment.
Hope there is no harm done.
Back to top
View user's profile Send private message
Stu Thomas

New User


Joined: 06 Feb 2010
Posts: 5
Location: Canada

PostPosted: Wed Feb 10, 2010 8:45 pm    Post subject:
Reply with quote

Sorry, but that is not correct. OPEN and CLOSE use the save area in the RB; they do not require that you provide a save area in your program. And, as I explained, "supplying a save area" is NOT a required practice.
Back to top
View user's profile Send private message
Stu Thomas

New User


Joined: 06 Feb 2010
Posts: 5
Location: Canada

PostPosted: Wed Feb 10, 2010 9:05 pm    Post subject:
Reply with quote

One more thing as I re-read your answer. Even though I did not state this, ALL PUTs need a save area.
Also, I accidently missed your apology. There's never any harm done since we are all trying to help each other. I'm not offended. And yes, I actually am a System Programmer, and I've been one since 1967, in the days of PCP. MFT and MVT. I learned assembler from the original Principles of Operation, and I know what a challenge understanding it can be. I'm glad to provide any assistance if it will help folks who are new to assembler to solve their difficulties.
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
No new posts The same REXX program doesnt work for... jackzhang75 CLIST & REXX 5 Wed Dec 06, 2017 2:51 am
No new posts Calling IKJEFT01 program from Rexx upendrasri CLIST & REXX 8 Wed Nov 15, 2017 4:27 pm
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts Accessing CICS tran with map from JCL... navdeepaggarwal CICS 5 Tue Oct 03, 2017 6:15 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us