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

Abend S0C4 11 (Page Translation Exception), where is wrong?


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

New User


Joined: 13 Feb 2023
Posts: 7
Location: singapore

PostPosted: Mon Feb 13, 2023 8:54 am
Reply with quote

Hi all,

Sorry for this dumb question, I've been stuck for several days without any progress.

I am completely new to mainframe, and it took me about a week to setup Hercules etc. The zos version I used in Hercules is zos V1R5.

I then logged in TSO, my assembler code is as follows,

Code:

HELLO     CSECT
              USING HELLO,15
              SAVE   (14,12)
              OPEN   (SYSUT1)
              GET     SYSUT1,INBUF
              CLOSE  (SYSUT1)
              RETURN (14,12),RC=0
SYSUT1   DCB     DSORG=PS,MACRF=(GM),DDNAME=IN,RECFM=FB,      C
                              LRECL=80,BLKSIZE=3120
INBUF      DS      CL80
               END


This simple program just opens a file and reads in a record and then closes it.

I compile this program as follows (sorry that I am not comfortable with JCL and job submission, it's so troublesome, editing in TSO is also a lot of trouble and it's so hard to correct the errors).

In TSO, enter the following commands:

Code:

ALLOCATE F(SYSIN) DA(TEST01.ASM) SHR REUSE
ALLOCATE F(SYSLIB) DA(SYS1.MACLIB SYS1.MODGEN) SHR REUSE
ALLOCATE F(SYSPRINT) DA(*) REUSE

ALLOCATE DA(TEST01.OBJ) NEW TRACKS SPACE(3,3) BLKSIZE(80)LRECL(80) RECFM(F B) CATALOG REUSE

ALLOCATE F(SYSLIN) DA(TEST01.OBJ)

CALL *(ASMA90)

LINK TEST01.OBJ

ALLOCATE DA(TEST01.DATA) NEW DSORG(PS) LRECL(80) RECFM(F B) BLKSIZE(3120)

ALLOCATE F(SYSUT1) DA(TEST01.DATA)

CALL TEST01


The last line CALL TEST01 failed with S0C4 Reason code=11 error.

The program also seems to modify the attributes of SYSUT1 (TEST01.DATA) file (dataset).

If I LISTDS TEST01.DATA, it shows LRECL=80 AND BLKSIZE=3120, but if I run "CALL TEST01" several times (always fails), the attribute of TEST01.DATA changed, if I run LISTDS TEST01.DATA, it shows LRECL=3120 BLKSIZE=3120.

It seems that the program accesses into wrong bits of the files and even sometimes unintentionally modifies the file.

Can any one give me any hints what shall I do to figure out where's wrong?

Thanks a lot.
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Mon Feb 13, 2023 12:15 pm
Reply with quote

my guess is that the program has been linked as rmode 31. Try adding RMODE(24) to the LINK command.
Back to top
View user's profile Send private message
ryanh

New User


Joined: 13 Feb 2023
Posts: 7
Location: singapore

PostPosted: Mon Feb 13, 2023 1:39 pm
Reply with quote

Willy Jensen wrote:
my guess is that the program has been linked as rmode 31. Try adding RMODE(24) to the LINK command.


Sorry, I tried LINK TEST.OBJ AMODE(24) just now, and it didn't work.

Actually I think the DCB works fine. Because I tried the following program and it works and print out 'TEST(SYSUT1)'.

Code:

HELLO    CSECT
         USING HELLO,15
         SAVE (14,12)
         MVC WTO+13(6),SYSUT1+40
WTO      WTO 'TEST(      )'
         RETURN (14,12),RC=0
SYSUT1   DCB DSORG=PS,MACRF=(GM),DDNAME=SYSUT1,RECFM=FB,LRECL=80,          C
               BLKSIZE=3120
INBUF    DS CL80
         END


The problem is when I try to open SYSUT1, there will be various errors (The errors I encounted includes S0C4-11, S0C6-06 and S0C1-01).

The open statement alone will cause error (comment out all other GET/PUT and CLOSE).
Back to top
View user's profile Send private message
ryanh

New User


Joined: 13 Feb 2023
Posts: 7
Location: singapore

PostPosted: Mon Feb 13, 2023 2:15 pm
Reply with quote

I tried to change DDNAME from SYSUT1 to a shorter name IN (because I suspect DDNAME is max 5 bytes).

Now Open statement works fine, and the TEST01.DATA attribute will not be modifed by 'CALL TEST01' any more.

However, the GET IN,INBUF statement still causes abend S0C4-11, if comment out GET, the CLOSE statement still causes abend S0C1-01.

And if comment out GET and CLOSE, only OPEN and then return, the program returns successfully without errors.
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Mon Feb 13, 2023 2:32 pm
Reply with quote

DDname is max 8 bytes. Your program does not have a save area. Start by adding that. And it still must be linked as rmode(24). Your 2nd program does not do any I/O so is not relevant.
Back to top
View user's profile Send private message
ryanh

New User


Joined: 13 Feb 2023
Posts: 7
Location: singapore

PostPosted: Mon Feb 13, 2023 3:29 pm
Reply with quote

Willy Jensen wrote:
DDname is max 8 bytes. Your program does not have a save area. Start by adding that. And it still must be linked as rmode(24). Your 2nd program does not do any I/O so is not relevant.


Thanks a lot for the help. Now it's the update:

The following program Open (IN) only, and no GET, no CLOSE,
abend error S0C1-01

Code:

00010 HELLO    CSECT                                                           
00020          USING HELLO,15                                                 
00030          SAVE (14,12)                                                   
00040          ST 13,SAVE+4                                                   
00050          LR 12,13                                                       
00060          LA 13,SAVE                                                     
00070          ST 13,8(12)                                                     
00080          BC 15,START                                                     
00090 SAVE     DC 18F'0'                                                       
00100 END      DS 0H                                                           
00110          L 13,SAVE+4                                                     
00120          RETURN (14,12),RC=0                                             
00130 START    DS 0H                                                           
00140          OPEN (IN)                                                       
00150          BC 15,END                                                       
00160 IN       DCB DSORG=PS,DDNAME=IN,RECFM=FB,LRECL=80,BLKSIZE=3120,        C
00170                MACRF=(GM)                                               
00180 INBUF    DS CL100                                                       
00190          END                                                             
IKJ52500I END OF DATA       



The following program, Open works, No Get, but Close returns abend S0C1-01.

Code:

00010 HELLO    CSECT                                                           
00020          USING HELLO,15                                                 
00030          SAVE (14,12)                                                                                                   
00040          OPEN (IN)
00050          CLOSE (IN)               
00060          RETURN (14,12),RC=0                                                   
00070 IN       DCB DSORG=PS,DDNAME=IN,RECFM=FB,LRECL=80,BLKSIZE=3120,        C
00080                MACRF=(GM)                                               
00090 INBUF    DS CL100                                                       
00100          END                                                             
IKJ52500I END OF DATA       


The following program, Open works, Get returns abend S0C4-11

Code:

00010 HELLO    CSECT                                                           
00020          USING HELLO,15                                                 
00030          SAVE (14,12)                                                                                                   
00040          OPEN (IN)
00045          GET IN,INBUF
00050          CLOSE (IN)               
00060          RETURN (14,12),RC=0                                                   
00070 IN       DCB DSORG=PS,DDNAME=IN,RECFM=FB,LRECL=80,BLKSIZE=3120,        C
00080                MACRF=(GM)                                               
00090 INBUF    DS CL100                                                       
00100          END                                                             
IKJ52500I END OF DATA       
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 419
Location: Inside the SPEW (Southwest Ohio, USA)

PostPosted: Mon Feb 13, 2023 4:31 pm
Reply with quote

Try using a base register from 2 thru 11.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2012
Location: USA

PostPosted: Mon Feb 13, 2023 6:09 pm
Reply with quote

RTFM:

www.ibm.com/docs/en/zos/2.1.0?topic=services-register-use
Quote:
Note that the system uses ARs 0, 1, 14, and 15 as work registers for every service, regardless of whether the caller is in primary or AR address space control (ASC) mode. The system does not use ARs 2 through 13 for any service.
Back to top
View user's profile Send private message
ryanh

New User


Joined: 13 Feb 2023
Posts: 7
Location: singapore

PostPosted: Mon Feb 13, 2023 7:54 pm
Reply with quote

dneufarth wrote:
Try using a base register from 2 thru 11.


Thanks! It works finally.
Back to top
View user's profile Send private message
ryanh

New User


Joined: 13 Feb 2023
Posts: 7
Location: singapore

PostPosted: Mon Feb 13, 2023 7:55 pm
Reply with quote

sergeyken wrote:
RTFM:

www.ibm.com/docs/en/zos/2.1.0?topic=services-register-use
Quote:
Note that the system uses ARs 0, 1, 14, and 15 as work registers for every service, regardless of whether the caller is in primary or AR address space control (ASC) mode. The system does not use ARs 2 through 13 for any service.


Thanks. It works finally with the following code.
It seems to be register problem, though I still don't know why.


Code:

00010 HELLO    CSECT                                                           
00020          LR 2,15                                                         
00030          USING HELLO,2                                                   
00040          SAVE (14,12)                                                   
00050          ST 13,SAVE+4                                                   
00060          BC 15,START                                                     
00070 SAVE     DC 18F'0'                                                       
00080 END      DS 0H                                                           
00090          L 13,SAVE+4                                                     
00100          RETURN (14,12),RC=0                                             
00110 START    DS 0H                                                           
00120          OPEN (IN)                                                       
00130          GET IN,INBUF                                                   
00140          CLC INBUF(6),=C'AAABBB'                                         
00150          BE EQUAL                                                       
00160          WTO 'NOT EQUAL'                                                 
00170 EQUAL    WTO 'EQUAL'                                                     
00180          CLOSE (IN)                                                     
00190          BC 15,END                                                       
00200 IN       DCB DSORG=PS,DDNAME=IN,RECFM=FB,LRECL=80,BLKSIZE=3120,        C
00210                MACRF=(GM)                                               
00220 INBUF    DS CL100                                                       
00230          END                                                             
IKJ52500I END OF DATA   
Back to top
View user's profile Send private message
ryanh

New User


Joined: 13 Feb 2023
Posts: 7
Location: singapore

PostPosted: Mon Feb 13, 2023 8:04 pm
Reply with quote

Probably becauses OPEN changes register 15 and only restores on CLOSE? This will cause the current USING HELLO,15 fail?

I change USING HELLO,15 to USING HELLO,2 , and everything works fine then.
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Mon Feb 13, 2023 8:23 pm
Reply with quote

Great. Note that you will get 2 WTOs for an not equal situation as you don't jump around the 'EQUAL' WTO after the NOT EQUAL one. Also, BC 15,somewhere would look nicer (I think) if you use the extended mnemonics there too, i.e. B Start.
In general I would avoid BLKSIZE in DCBS, they override JCL and allocations, so might end up damaging your dataset, especially for an output DCB.
Keep up the good work.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2012
Location: USA

PostPosted: Mon Feb 13, 2023 9:09 pm
Reply with quote

ryanh wrote:
Probably becauses OPEN changes register 15 and only restores on CLOSE? This will cause the current USING HELLO,15 fail?

Not "probably" but "for sure".

This is one of the basic postulates for anyone who has ever started reading some docs on Assembler programming... icon_redface.gif
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 419
Location: Inside the SPEW (Southwest Ohio, USA)

PostPosted: Mon Feb 13, 2023 9:19 pm
Reply with quote

@ryanh,

As @sergeyken pointed out, registers 0,1,14,15 are best avoided whenever your code uses a macro (SAVE, DCB, WTO?) that IBM supplies and as base registers. The code in macros by convention may/probably utilize those registers. You must use them at times to follow IBM conventions.

FYI - I used them in very tight code blocks where I was certain execution was not interfacing with I/O and other calls to operating system services.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon Feb 13, 2023 9:42 pm
Reply with quote

see here for more quirks about register use

www.ibm.com/docs/en/zos/2.1.0?topic=registers-register-usage-by-machine-instructions
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon Feb 13, 2023 10:26 pm
Reply with quote

icon_redface.gif
sorry for the duplicate link
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


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

PostPosted: Tue Feb 14, 2023 8:23 pm
Reply with quote

I retired quite a while back, but I still enjoy perusing this excellent forum (although I am familiar with less and less of the tech details!).

It has been a pleasure reading this posting.

It is a model for exchanges between a new user and the expert community.

Good luck ryanh in your career.
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 ISAM and abend S03B JCL & VSAM 9
No new posts Check data with Exception Table DB2 0
No new posts WER999A - UNSUCCESSFUL SORT 8ED U Ab... SYNCSORT 5
No new posts the system or user abend SF0F R=NULL COBOL Programming 0
No new posts Need to get an DLI abend like U0200 IMS DB/DC 2
Search our Forums:

Back to Top