Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

help on 'HELLO, WROLD' program.
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Wed Jan 05, 2011 12:58 pm    Post subject: help on 'HELLO, WROLD' program.
Reply with quote

I'm new to assembler, and when I run below assembler program,

Code:
 COMMAND INPUT ===>                                            SCROLL ===>
  Loc  Object Code    Addr1 Addr2  Stmt   Source Statement                 
                                      1          PRINT GEN                 
000000                00000 00018     2 BEGIN    CSECT                     
                 R:2  00000           3          USING BEGIN,R2           
000000 D209 A000 200C 00000 0000C     4          MVC   0(10,10),MESSAGE   
                                      5          WTO   MF=(E,(R10))       
000006 181A                           9+         LR    1,R10               
000008 0A23                          10+         SVC   35                 
                                     11          RETURN                   
00000A 07FE                          13+         BR    14                 
                                     14 *                                 
00000C                               15          DS    0F                 
00000C C8C5D3D3D66BE6D6              16 MESSAGE  DC    CL10'HELLO,WORLD!' 
                                     17 *                                 
000018                               18          LTORG                     
                                     19 *                                 
                      00000          20 R0       EQU   0                   


program abended with below message.
Code:
.IEA995I SYMPTOM DUMP OUTPUT                                         
.SYSTEM COMPLETION CODE=0C4  REASON CODE=00000004                     
. TIME=08.21.35  SEQ=56782  CPU=0000  ASID=00F5                       
. PSW AT TIME OF ERROR  078D0000   98A00FEE  ILC 6  INTC 04           
.   ACTIVE LOAD MODULE           ADDRESS=18A00FE8  OFFSET=00000006   
.   NAME=HELLO                                                       
.   DATA AT PSW  18A00FE8 - D209A000  200C181A  0A2307FE             
.   GR 0: FD000008   1: 00006FF8                                     
.      2: 00000040   3: 009D79D4                                     
.      4: 009D79B0   5: 009FF278                                     
.      6: 009BEFE0   7: FD000000                                     
.      8: 009FC130   9: 009D1CC8                                     
.      A: 00000000   B: 009FF278                                     
.      C: 843E7CEA   D: 00006F60                                     
.      E: 80FD9818   F: 98A00FE8                                     
. END OF SYMPTOM DUMP                                                 



this is an extremely simple program, would u please help to check where is wrong with the source code? thanks.
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Wed Jan 05, 2011 5:17 pm    Post subject:
Reply with quote

Code:
USING BEGIN,R2

where did you set up R2 to be the base register? This will cause a S0C4 if not done.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Wed Jan 05, 2011 9:36 pm    Post subject:
Reply with quote

Hello,

Code:
MESSAGE  DC    CL10'HELLO,WORLD!' 
Suggest you re-read all of the code to make sure there are no other discrepancies. . . When i saw this, it kinda jumped off the page and i stopped reading. . .
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Thu Jan 06, 2011 7:25 am    Post subject:
Reply with quote

Robert Sample wrote:
Code:
USING BEGIN,R2

where did you set up R2 to be the base register? This will cause a S0C4 if not done.

hi, Robert
Thanks for your kind reply.
But when I changed by code to below, the same abend code occurred.
Code:
         PRINT GEN                     
BEGIN    CSECT                         
         BASR  R3,0                   
         USING BEGIN,R3               
         MVC   0(10,10),MESSAGE       
         WTO   MF=(E,(R10))           
*        WTO   'HELLO,WORLD'           
         RETURN                       
*                                     
         DS    0F                     
MESSAGE  DC    CL10'HELLO,WORLD!'     
*                                     
         LTORG                         
*                                     
R0       EQU   0                       
R1       EQU   1   
R2       EQU   2       
R3       EQU   3       
R4       EQU   4       
R5       EQU   5       
R6       EQU   6       
R7       EQU   7       
R8       EQU   8       
R9       EQU   9       
R10      EQU   10       
R11      EQU   11       
R12      EQU   12       
R13      EQU   13       
R14      EQU   14       
R15      EQU   15       
*                       
         END                               
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Thu Jan 06, 2011 7:28 am    Post subject:
Reply with quote

dick scherrer wrote:
Hello,

Code:
MESSAGE  DC    CL10'HELLO,WORLD!' 
Suggest you re-read all of the code to make sure there are no other discrepancies. . . When i saw this, it kinda jumped off the page and i stopped reading. . .

hi, Dick,

Are you saying that the length should not be 10 bytes, right?

actually, I have noticed this, but the lengh should not be the problem.
When I change it to
Code:
MESSAGE  DC    CL20'HELLO,WORLD!' 

the same error...
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 961
Location: Richmond, Virginia

PostPosted: Thu Jan 06, 2011 7:36 am    Post subject:
Reply with quote

I think what Dick is saying (in a much nicer way than I) is that until you clean up the slop, especially slop you present to the world as your product, how seriously can you be taken as a computer programmer?

Have you looked closely at all more relevant details?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Thu Jan 06, 2011 8:24 am    Post subject:
Reply with quote

When your program executes this instruction:
Code:
MVC   0(10,10),MESSAGE 
exactly what have you done to ensure register 10 points to a memory location that your program is allowed to use? You can't just take existing addresses in registers and expect them to work -- that is how you get storage protection (S0C4) abends!

Furthermore, it is never too early to learn how to use the standard save area linkage since using the standard helps you understand dumps better. You should set up your save area linkage, no matter how small the program.

Your original post contains a nine-line Assembler program that has at least three MAJOR errors, two of which are guaranteed to cause S0C4 abends and one of which will cause your results to not be what you expect them to be.
Back to top
View user's profile Send private message
sandeep chopra

New User


Joined: 28 Aug 2008
Posts: 11
Location: Noida

PostPosted: Thu Jan 06, 2011 10:49 am    Post subject: Reply to: help on 'HELLO, WROLD' program.
Reply with quote

Either do:
BASR R3,0
BCTR R3,0
BCTR R3,0
USING BEGIN,R3

OR DO:
LR R3,R15
USING BEGIN,R3

GIVE BASING BY EITHER OF ABOVE 2 METHODS AND YOUR PROGRAM WILL WORK.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Thu Jan 06, 2011 10:50 am    Post subject:
Reply with quote

Hello,

IT done properly can be tedious. Assembler is more tedious - there is little between you and many different abends.

Long ago, when a new class of assembler students were beginning, their "Hello World" program was used to introduce standard linkage. Possibly one of the most critical disciplines that should "always" be used.

If your organization/system allows using assembler, there should be some standard code that is cloned to create a new program subroutine. The standard samples will (or should) have standard linkage code where the code is entered and where the code is exited. This is done differently from place to place, so you should use the method your system already uses.

You need to take the time to understand what these instructions actually accomplish. Once you thouroghly understand this, you will probably not consciously think about it, but you need the initial understanding.
Back to top
View user's profile Send private message
manikawnth

New User


Joined: 07 Feb 2007
Posts: 61
Location: Mumbai

PostPosted: Thu Jan 06, 2011 2:50 pm    Post subject: @dejunzhu
Reply with quote

have u observed the address in R10 at the time of Abend.
Its all 00000000000 and is protected area.

No one gives u a fancy address to use in ur work program....
BTW, Read WTO properly to differentiate its execute form and list form.

When u dont define the length of the MESSAGE then it will give erroneous results.
Code for u using R10:
Code:
BEGIN    CSECT                         
         BASR  R3,0                   
         USING BEGIN,R3               
         LA    R10,MESSAGE     
         WTO   MF=(E,(R10))           
*        WTO   'HELLO,WORLD'           
         RETURN                       
*                                     
         DS    0F                     
MESSAGE  DC    AL2(10)
         DC    CL10'HELLO,WORLD!'

But I request you, as everyone else, to read the standard linkage registers and the process to setup, save to and restore from the save area.
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Thu Jan 06, 2011 2:58 pm    Post subject:
Reply with quote

I have modified my program to below,
Code:
***************************** Top of Data ****
         PRINT GEN                           
BEGIN    CSECT                               
         SAVE  (14,12)                       
         BASR  R3,0                           
         USING BEGIN,R3                       
*        MVC   0(20,10),MESSAGE               
         LA    R10,MESSAGE                   
         WTO   MF=(E,(R10))                   
         RETURN (14,12)                       
         DS    0F                             
MESSAGE  DC    CL20'HELLO,WORLD!'             
*                                             
         LTORG                               
         YREGS                               
         END                                 
**************************** Bottom of Data **


but still got below error when it is executed.
Code:
IEA995I SYMPTOM DUMP OUTPUT                                                   
SYSTEM COMPLETION CODE=D23  REASON CODE=05010003                               
 TIME=10.25.54  SEQ=06773  CPU=0000  ASID=00E4                                 
 PSW AT TIME OF ERROR  070C1000   83B1387C  ILC 2  INTC 0D                     
   NO ACTIVE MODULE FOUND                                                     
   NAME=UNKNOWN                                                               
   DATA AT PSW  03B13876 - C49018F8  0A0DA7F4  00065810                       
   GR 0: 00011000   1: 84D23000                                               
      2: 00000003   3: 0000010E                                               
      4: 00000000   5: 00FF59B8                                               
      6: 00000000   7: 00000000                                               
      8: 05010003   9: 00000000                                               
      A: 7F4E62FE   B: 7F4E52FF                                               
      C: 03B1ED70   D: 7F4E4300                                               
      E: 00000311   F: 05010003                                               
 END OF SYMPTOM DUMP                                                           
IEF472I S1XCO61T STEP020 - COMPLETION CODE - SYSTEM=D23 USER=0000 REASON=0501003
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


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

PostPosted: Thu Jan 06, 2011 3:06 pm    Post subject:
Reply with quote

This :
Code:

         DS    0F                     
MESSAGE  DC    AL2(10)
         DC    CL10'HELLO,WORLD!'

is not the same like this :
Code:

         DS    0F                             
MESSAGE  DC    CL20'HELLO,WORLD!'
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Thu Jan 06, 2011 3:08 pm    Post subject:
Reply with quote

dick scherrer wrote:
Hello,

IT done properly can be tedious. Assembler is more tedious - there is little between you and many different abends.

Long ago, when a new class of assembler students were beginning, their "Hello World" program was used to introduce standard linkage. Possibly one of the most critical disciplines that should "always" be used.

If your organization/system allows using assembler, there should be some standard code that is cloned to create a new program subroutine. The standard samples will (or should) have standard linkage code where the code is entered and where the code is exited. This is done differently from place to place, so you should use the method your system already uses.

You need to take the time to understand what these instructions actually accomplish. Once you thouroghly understand this, you will probably not consciously think about it, but you need the initial understanding.


hi dick,

THanks for your suggestion, but our shorp is not using assembler program, I completely learn assembler by myself and out of interest.
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Thu Jan 06, 2011 3:10 pm    Post subject:
Reply with quote

PeterHolland wrote:
This :
Code:

         DS    0F                     
MESSAGE  DC    AL2(10)
         DC    CL10'HELLO,WORLD!'

is not the same like this :
Code:

         DS    0F                             
MESSAGE  DC    CL20'HELLO,WORLD!'


Thanks for your reply,
but the same error occurred to below source.
Code:
 ***************************** Top of Data *****
          PRINT GEN                             
 BEGIN    CSECT                                 
          SAVE  (14,12)                         
          BASR  R3,0                           
          USING BEGIN,R3                       
 *        MVC   0(20,10),MESSAGE               
          LA    R10,MESSAGE                     
          WTO   MF=(E,(R10))                   
          RETURN (14,12)                       
          DS    0F                             
 MESSAGE  DC    AL2(20)                         
          DC    CL20'HELLO,WORLD!'             
 *                                             
          LTORG                                 
          YREGS                                 
          END                                   
Back to top
View user's profile Send private message
manikawnth

New User


Joined: 07 Feb 2007
Posts: 61
Location: Mumbai

PostPosted: Thu Jan 06, 2011 3:14 pm    Post subject: @dejunzhu
Reply with quote

I am really sorry to misguide you. I should have checked it before i give it to you.

Code:
Code:
BEGIN    CSECT                         
         BASR  R3,0                   
         USING BEGIN,R3               
         LA    R10,MESSAGE     
         WTO   MF=(E,(R10))           
*        WTO   'HELLO,WORLD'           
         RETURN                       
*                                     
         DS    0F                     
MESSAGE  WTO  C'HELLO,WORLD!',MF=L
Back to top
View user's profile Send private message
manikawnth

New User


Joined: 07 Feb 2007
Posts: 61
Location: Mumbai

PostPosted: Thu Jan 06, 2011 3:19 pm    Post subject:
Reply with quote

U can try this too...

20 BYTES FOR HELLO WORLD, 2 BYTES FOR X'0000' AND 2 BYTES FOR AL2(24). TOTAL 24 BYTES.
Code:
 
MESSAGE  DS   0F
         DC    AL2(24)         
         DC    X'0000'                 
         DC    CL20'HELLO,WORLD!' 
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Jan 06, 2011 3:28 pm    Post subject: Reply to: help on 'HELLO, WROLD' program.
Reply with quote

to all of those who advised and approved of the use of
Code:
BEGIN    CSECT                                 
          SAVE  (14,12)                         
          BASR  R3,0                           
          USING BEGIN,R3               


did You care to look at the effin' POP for the BASR instruction description and use

from the abovesaid manual
Quote:
Other BALR and BASR Examples
The BALR or BASR instruction with the R2 field set to zero may be used to load a register for use as a base register. For example, in the assembler language, the two statements:
BALR 15,0
USING *,15
or
BASR 15,0
USING *,15
indicate that the address of the next sequential instruction following the BALR or BASR instruction will be placed in register 15, and that the assembler may use register 15 as a base register until otherwise instructed. (The USING statement is an “assembler instruction” and is thus not a part of the object pro- gram.)


if You cannot read, better meditate on a career shift icon_evil.gif
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


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

PostPosted: Thu Jan 06, 2011 3:31 pm    Post subject:
Reply with quote

Your message should look something like this :

Code:

MESSAGE  WTO  'HELLO,WORLD!',ROUTCDE=(1),DESC=(5),MF=L


The list form will set up the parameter list for the MF=E call, if you dont do
that you will have to define the parameter list yourself. And that is tricky
as you have seen.
Back to top
View user's profile Send private message
manikawnth

New User


Joined: 07 Feb 2007
Posts: 61
Location: Mumbai

PostPosted: Thu Jan 06, 2011 3:39 pm    Post subject: @enrico-sorichetti
Reply with quote

I cant stop laughing. Well said.
I am meditating on the SAVE macro.
PPl like me should POP out from mediocre brains and peep into POP.
Now i read it LR R3,R15 instead of BASR R3,0.

Really well caught.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Jan 06, 2011 8:48 pm    Post subject: Reply to: help on 'HELLO, WROLD' program.
Reply with quote

Quote:
PPl like me should POP out from mediocre brains and peep into POP.


everybody once in a while should look at the POP,
it usually will avoid gazillions of silly mistakes icon_biggrin.gif
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
Goto page 1, 2, 3  Next
Page 1 of 3

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts I can not compile my program PL1 V3.R... Miguel Fernandez PL/I & Assembler 13 Tue Dec 06, 2016 8:30 pm
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
No new posts A sample of exit program for exit XMN... lind sh CICS 2 Mon Oct 03, 2016 5:07 pm
No new posts Need points to tune IMS Checkpoint Pr... satish.ms10 IMS DB/DC 2 Fri Sep 30, 2016 4:12 pm
No new posts ISPF program to set SCRNAME prino TSO/ISPF 5 Fri Sep 30, 2016 2:18 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us