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: Fri Jan 07, 2011 8:50 am
Reply with quote

Thanks, guys, sincerely for your kind reply. they are of very help to me.

manikawnth wrote:
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.


Would u please kindly tell me what does below two words mean? they cannot be find out from dictionary...

PPI
POP

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

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Fri Jan 07, 2011 9:01 am
Reply with quote

Thanks to your help,I have run the first program smoothly.
but abended to another simple program....
I have debug it for a long time, but.... things are always frustrating...
Code:
BEGIN    CSECT                                                         
         SAVE  (14,12)                                                 
         BASR  R15,0                                                   
         USING *,R15                                                   
         OPEN  (TEACHERS,(INPUT))      OPEN INPUT FILE                 
LOOP     GET   TEACHERS,IREC           READ A SINGLE TEACHER RECORD     
         B     LOOP                    REPEAT                           
ATEND    CLOSE TEACHERS                                                 
         RETURN (14,12),RC=(15)                                         
TEACHERS DCB   LRECL=80,DSORG=PS,RECFM=FB,MACRF=(GM),                  X
               DDNAME=TEACHER,                                         X
               EODAD=ATEND                                             
         LTORG                                                         
         YREGS                                                         
IREC     DS    CL80                                                     
BEGIN    AMODE 31         
BEGIN    RMODE ANY   
         END                                                       

below is the dump list:
Code:
 Command ===>                                                 
.IEA995I SYMPTOM DUMP OUTPUT                                 
.SYSTEM COMPLETION CODE=0C4  REASON CODE=00000011             
. TIME=04.27.40  SEQ=15024  CPU=0000  ASID=011F               
. PSW AT TIME OF ERROR  070C2000   95FEE300  ILC 4  INTC 11   
.   NO ACTIVE MODULE FOUND                                   
.   NAME=UNKNOWN                                             
.   DATA AT PSW  15FEE2FA - 700018C8  1F22BF27  C0011299     
.   GR 0: 00000001_FD000008   1: 00000000_98A00F1C           
.      2: 00000000_00000000   3: 00000000_80FD97C8           
.      4: 00000000_009D1B00   5: 00000000_009FD368           
.      6: 00000000_95FEE170   7: 00000000_00FC8E80           
.      8: 00000000_00A00F1C   9: 00000000_00FEE900           
.      A: 00000000_16646000   B: 00000000_165EB178           
.      C: 00000000_00A00F1C   D: 00000000_009D1B00           
.      E: 00000000_80FEE900   F: 00000000_15F004E0           
. END OF SYMPTOM DUMP                                         
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: Fri Jan 07, 2011 9:43 am
Reply with quote

Hello,

Quote:
PPI
POP
You made a copy error it should be PPL (not PPI).

PPL is chatroom slang for "people".

POP is short for Principles of Operation (the mainframe "bible" - also sometimes referred to as "Princ of Ops. Here is a table of contents link:
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DZ9ZR003/CONTENTS
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: Fri Jan 07, 2011 9:48 am
Reply with quote

Hello,

Suggest you try with the method Bill provided (use the same code in the same order and pay attention to the registers used - yours should be like Bill's as there is no need to be "creative" . . . .

Once you have a working module, suggest you thoroughly understand every line of code (Bill's comments provide this) and then clone this for each new task.
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Fri Jan 07, 2011 10:26 am
Reply with quote

Garry Carroll wrote:
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

Hi, Garry,
May I ask, how do you judge it's AMODE(31) from PSW?
I searched PSW within <ESA390 Principles of Operation>, but cannot find an exhausitive description for PSW.

Would you please tell me how to determine if it's AMODE(31) or AMODE(24)?
Thanks in advance.
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Fri Jan 07, 2011 10:32 am
Reply with quote

dick scherrer wrote:
Hello,

Suggest you try with the method Bill provided (use the same code in the same order and pay attention to the registers used - yours should be like Bill's as there is no need to be "creative" . . . .

Once you have a working module, suggest you thoroughly understand every line of code (Bill's comments provide this) and then clone this for each new task.

Yes, I have tried the program that Bill provided, it works well. Thanks.
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Fri Jan 07, 2011 10:48 am
Reply with quote

dejunzhu wrote:
Garry Carroll wrote:
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

Hi, Garry,
May I ask, how do you judge it's AMODE(31) from PSW?
I searched PSW within <ESA390 Principles of Operation>, but cannot find an exhausitive description for PSW.

Would you please tell me how to determine if it's AMODE(31) or AMODE(24)?
Thanks in advance.


I have found it from<z/Architecture reference summary>

Please ignore this post. THanks and sorry for bringing you inconvenience.
Back to top
View user's profile Send private message
manikawnth

New User


Joined: 07 Feb 2007
Posts: 61
Location: Mumbai

PostPosted: Fri Jan 07, 2011 11:27 am
Reply with quote

Quote:
May I ask, how do you judge it's AMODE(31) from PSW?


The address of next sequential instruction in PSW is 83B1387C
and the most significant nibble is 8. Since the most significant bit is turned to 1, the amode is 31.
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 5:56 pm
Reply with quote

Regarding the second program, note the following -

* BASR needs to be BALR (I'll explain)
* Use R3 as your base-register
* AMODE and RMODE must be 24
* Add a label to your RETURN Macro

The reason you need to use BALR (can be used for both below and above the line) is because the program must be AMODE 24 / RMODE 24. The BASR instruction is strictly for above-the-line.

You're using a DCB, which is inherently below-the-line.

Below-the-line limits addressability of any register as an AL3 (maximum 16777215 / X'007FFFFF').

After the OPEN, issue a LTR R15,R15 for success / failure. Issue BNZ (Open was a failure) to RETURN Macro label, naming the label (for example) as RTN2CLLR.

Never use R0, R1, R14 or R15 as a base-register as they are used in Assembler Macro's.

Don't tie-up R2 as it is used in TRT instructions (along with R1).

Unless you know what you're doing, outside of savearea usage, don't use R13, period.

Use the Register Save Area (REGSAVE) technique in the WTO program posted earlier.

Optionally, in the DCB, substitute LRECL=80 with LRECL=L'IREC.

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

New User


Joined: 28 Aug 2008
Posts: 11
Location: Noida

PostPosted: Fri Jan 07, 2011 7:14 pm
Reply with quote

Hi dejunzhu,

Bill pointed out the right thing. In most of the macro call r15 gets corrupted. Change ur base register.
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: Fri Jan 07, 2011 10:32 pm
Reply with quote

dddddd
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Mon Jan 10, 2011 7:22 am
Reply with quote

Bill O'Boyle wrote:
Regarding the second program, note the following -

* BASR needs to be BALR (I'll explain)
* Use R3 as your base-register
* AMODE and RMODE must be 24
* Add a label to your RETURN Macro

The reason you need to use BALR (can be used for both below and above the line) is because the program must be AMODE 24 / RMODE 24. The BASR instruction is strictly for above-the-line.

You're using a DCB, which is inherently below-the-line.

Below-the-line limits addressability of any register as an AL3 (maximum 16777215 / X'007FFFFF').

After the OPEN, issue a LTR R15,R15 for success / failure. Issue BNZ (Open was a failure) to RETURN Macro label, naming the label (for example) as RTN2CLLR.

Never use R0, R1, R14 or R15 as a base-register as they are used in Assembler Macro's.

Don't tie-up R2 as it is used in TRT instructions (along with R1).

Unless you know what you're doing, outside of savearea usage, don't use R13, period.

Use the Register Save Area (REGSAVE) technique in the WTO program posted earlier.

Optionally, in the DCB, substitute LRECL=80 with LRECL=L'IREC.

Bill

Thank you very much, BIll.
I have modified source code like below:
Code:
BEGIN    CSECT                                                       
         SAVE  (14,12)                                               
         BALR  R3,0                                                   
         USING *,R3                                                   
         OPEN  (TEACHERS,(INPUT))      OPEN INPUT FILE               
         LTR   R15,R15                                               
         BNZ   RTN2CLLR                                                   
LOOP     GET   TEACHERS,IREC           READ A SINGLE TEACHER RECORD   
         B     LOOP                    REPEAT                         
ATEND    CLOSE TEACHERS                                               
RTN2CLLR      RETURN (14,12),RC=(15)                                       
TEACHERS DCB   LRECL=L'IREC,DSORG=PS,RECFM=FB,MACRF=(GM),             
               DDNAME=TEACHER,                                       
               EODAD=ATEND                                           
         LTORG                                                       
         YREGS
IREC     DS    CL80   
BEGIN    AMODE 24     
BEGIN    RMODE 24     
         END                                                                 

but the program still abended with S0C4:
Quote:
.IEA995I SYMPTOM DUMP OUTPUT
.SYSTEM COMPLETION CODE=0C4 REASON CODE=00000011
. TIME=02.46.09 SEQ=38987 CPU=0000 ASID=0174
. PSW AT TIME OF ERROR 070C2000 95FEE300 ILC 4 INTC 11
. NO ACTIVE MODULE FOUND
. NAME=UNKNOWN
. DATA AT PSW 15FEE2FA - 700018C8 1F22BF27 C0011299
. GR 0: 00000001_FD000008 1: 00000000_98A00F1C
. 2: 00000000_00000000 3: 00000000_80FD97C8
. 4: 00000000_009D1B00 5: 00000000_009FD938
. 6: 00000000_95FEE170 7: 00000000_00F6AD00
. 8: 00000000_00A00F1C 9: 00000000_00FEE900
. A: 00000000_16646000 B: 00000000_165EB178
. C: 00000000_00A00F1C D: 00000000_009D1B00
. E: 00000000_80FEE900 F: 00000002_15F004E0
. END OF SYMPTOM DUMP


Would you please kindly advise? Thanks.
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Mon Jan 10, 2011 7:46 am
Reply with quote

Sorry, please ignore the previous post by me...

From the PSW, I found that the program bind option was still AMODE(31),RMODE(any),

After I change the bind option to AMODE(24),RMODE(24), the program successfully executed.

Thanks!
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: Mon Jan 10, 2011 8:55 am
Reply with quote

Glad you found the mistake and the program is working.

But, you need to get into the habit of defining/using a Register Save Area, like the one used in the WTO program.

It's standard practice for all Assembler programmers when writing Batch/Assembler programs, regardless whether it's a Main or Sub program.

CICS/Assembler is different, but that's another subject, for another time.... icon_wink.gif

Good Luck,

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

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Mon Jan 10, 2011 10:05 am
Reply with quote

Bill O'Boyle wrote:
But, you need to get into the habit of defining/using a Register Save Area, like the one used in the WTO program.

It's standard practice for all Assembler programmers when writing Batch/Assembler programs, regardless whether it's a Main or Sub program.


Thanks for your suggestion, Bill.
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: Mon Jan 10, 2011 10:10 am
Reply with quote

Hello,

Quote:
Thanks for your suggestion, Bill.
You need to consider this as much stronger than a suggeston.

If you refuse to use standard linkage for every assembler module you will cause yourself (and probably others) a great amount of trouble. . .
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Mon Jan 10, 2011 2:29 pm
Reply with quote

So, the final edition should be like below:
Code:
BEGIN    CSECT                                                       
         SAVE  (14,12)                                               
         BALR  R3,0                                                   
         USING *,R3   
         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                                                 
         OPEN  (TEACHERS,(INPUT))      OPEN INPUT FILE               
         LTR   R15,R15                                               
         BNZ   RTN2CLLR                                                   
LOOP     GET   TEACHERS,IREC           READ A SINGLE TEACHER RECORD   
         B     LOOP                    REPEAT                         
ATEND    CLOSE TEACHERS                 
         L     R13,4(,R13)             RESTORE CALLERS R13                               
RTN2CLLR      RETURN (14,12),RC=(15)
         DS    0F                      ENSURE ALIGNMENT
REGSAVE  EQU   *                       REGISTER-SAVEAREA
         DS    18F                     18-WORDS
REGSAVEL EQU   *-REGSAVE               RSA OVERALL-LGTH
                                       
TEACHERS DCB   LRECL=L'IREC,DSORG=PS,RECFM=FB,MACRF=(GM),             
               DDNAME=TEACHER,                                       
               EODAD=ATEND                                           
         LTORG                                                       
         YREGS
IREC     DS    CL80   
BEGIN    AMODE 24     
BEGIN    RMODE 24     
         END 
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


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

PostPosted: Mon Jan 10, 2011 2:37 pm
Reply with quote

I wouldn't use R15 when setting up SAVEAREA and your RTN2CLLR label should be on the L R13,4(R13) 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: Mon Jan 10, 2011 6:26 pm
Reply with quote

Garry,

At this point in the program, R15 is considered a work-register (it's prior to the OPEN) and so, it can be used as such.

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

Senior Member


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

PostPosted: Mon Jan 10, 2011 6:32 pm
Reply with quote

Bill,
Accepted, but I would still prefer to avoid using R15.
Garry.
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Mon Jan 10, 2011 6:33 pm
Reply with quote

Garry Carroll wrote:
RTN2CLLR label should be on the L R13,4(R13) statement.

Garry.


Yes, correct...
I find myself so careless sometimes...
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 Previous  1, 2

 


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