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).
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?
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.
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
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.
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
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.
Joined: 27 Apr 2005 Posts: 420 Location: Inside the SPEW (Southwest Ohio, USA)
@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.