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

help on 'HELLO, WROLD' program.


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
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
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: 8700
Location: Dubuque, Iowa, USA

PostPosted: Wed Jan 05, 2011 5:17 pm
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

Moderator Emeritus


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

PostPosted: Wed Jan 05, 2011 9:36 pm
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
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
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

Senior Member


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

PostPosted: Thu Jan 06, 2011 7:36 am
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: 8700
Location: Dubuque, Iowa, USA

PostPosted: Thu Jan 06, 2011 8:24 am
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
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

Moderator Emeritus


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

PostPosted: Thu Jan 06, 2011 10:50 am
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
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
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: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Jan 06, 2011 3:06 pm
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
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
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
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Thu Jan 06, 2011 3:28 pm
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: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Jan 06, 2011 3:31 pm
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Thu Jan 06, 2011 8:48 pm
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
sandeep chopra

New User


Joined: 28 Aug 2008
Posts: 11
Location: Noida

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

Hi Dezunzhu,


1. your first try
PRINT GEN
BEGIN CSECT
USING BEGIN,R2
MVC 0(10,10),MESSAGE

problem is that you are giving R2 as base but you do not know that address it has. You can try by giving:
PRINT GEN
BEGIN CSECT
LR R2,R15
USING BEGIN,R2
MVC 0(10,10),MESSAGE
R15 has program address when you call from jcl.


2. your 2nd try:
PRINT GEN
BEGIN CSECT
BASR R3,0
USING BEGIN,R3
MVC 0(10,10),MESSAGE

problem is that you are loading address of inst MVC in register R3 and giving basing from BEGIN or BASR.
Try:

BEGIN CSECT
BASR R3,0
BCTR,R3,0
BCTR R3,0
USING BEGIN,R3
MVC 0(10,10),MESSAGE


Please try this and i think it can help.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Thu Jan 06, 2011 10:18 pm
Reply with quote

sandeep chopra, what address is in register 10 when your MVC instruction gets executed?
Code:
BEGIN CSECT
BASR R3,0
BCTR,R3,0
BCTR R3,0
USING BEGIN,R3
MVC 0(10,10),MESSAGE
And where did that address come from?
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:26 pm
Reply with quote

Sorry Robert. I do not need to mention MVC instruction. I was just mentioning the error in basing. It is having the error in basing which i explained. It might have any other error.
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1205
Location: Dublin, Ireland

PostPosted: Fri Jan 07, 2011 1:02 am
Reply with quote

Apart from you not following linkage conventions, the following raises a question about your Assemble/link process...
Code:
PSW AT TIME OF ERROR  070C1000   83B1387C  ILC 2  INTC 0D

which looks like you are in AMODE(31) but your code does not seem to have AMODE/RMODE statements, so you should be running AMODE(24)? Also, where's the END statement?

Garry
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 Jan 07, 2011 3:49 am
Reply with quote

An alternative that works. I'm sticking with the old (as in prehistoric) message-length max of 69 (let's keep it clean) as it works as advertised as well as utilizes the WTO "TEXT" option.

Code:

         PRINT GEN                     ACTIVATE MACRO EXPANSION
BEGIN    CSECT
         SAVE (14,12)                  SAVE REGISTERS
         BASR  R3,0                    R3 IS BASE-REGISTER
         USING *,R3                    INFORM ASSEMBLER
         LA    R15,REGSAVE             POINT TO OUR SAVEAREA
         XC    0(REGSAVEL,R15),0(R15)  ENSURE X'00'S
         ST    R13,4(,R15)             BACKWARD-CHAIN
         ST    R15,8(,R13)             FORWARD-CHAIN
         LR    R13,R15                 POINT TO OUR SAVEAREA
         LA    R10,WTOMSGA             POINT TO MESSAGE-AREA
         PRINT NOGEN                   SUPPRESS MACRO-EXPANSION
         WTO   TEXT=(R10),ROUTCDE=(11) ISSUE 'WTO' TO 'JESMSGLG'
         PRINT GEN                     ACTIVATE MACRO EXPANSION
         L     R13,4(,R13)             RESTORE CALLERS R13
         RETURN (14,12),RC=(15)        RESTORE AND RETURN
         DS    0F                      ENSURE ALIGNMENT
REGSAVE  EQU   *                       REGISTER-SAVEAREA
         DS    18F                     18-WORDS
REGSAVEL EQU   *-REGSAVE               RSA OVERALL-LGTH
WTOMSGA  DS    0CL71                   WTO MESSAGE-AREA
         DC    AL2(L'WTOMSGA-2)        WTO MESSAGE-AREA LGTH (HWORD)
         DC    CL(L'WTOMSGA-2)'HELLO WORLD'
         LTORG ,
         YREGS ,                       REGISTER-EQUATE MACRO
BEGIN    AMODE 31
BEGIN    RMODE ANY
         END   ,

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 Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Error to invoke MPP program through B... IMS DB/DC 3
No new posts Using API Gateway from CICS program CICS 0
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
Search our Forums:

Back to Top