Posted: Tue Aug 29, 2006 3:22 pm Post subject: Assembler Program giving S0C7 help needed
Hai All,
I am getting S0C7 in an Assembler Program which is simply reading numbers from an input file and displaying the SUM in the output.Please help me out.
Code:
ADD CSECT
STM 14,12,12(13)
BALR 12,0
USING *,12
ST 13,SAVE+4
LA 13,SAVE
OPEN (TRANS,(INPUT)) OPEN INPUT FILE
OPEN (PRINTER,(OUTPUT)) OPEN OUTPUT FILE
GET TRANS,CARD READ DATA FROM THE INPUT FILE
LA 9,10 INITIALIZE THE COUNTER
* FOR BCT INSTRUCTION
XR 6,6 INITIALIZE REGISTER 6
LA 3,INT
***********************************************************************
* THIS LOOP IS USED FOR ADDING OF NUMBERS 10 TIMES *
***********************************************************************
LOOP MVC Z,0(3)
PACK BCD,Z
CVB 5,BCD
AR 6,5
LA 3,2(3)
WTO 'INSIDE LOOP',ROUTCDE=11
BCT 9,LOOP CHECKS IF R9 IS ZERO
WTO 'OUTSIDE LOOP',ROUTCDE=11
CVD 6,BCD
UNPK SUM,BCD
OI SUM+9,X'F0'
PUT PRINTER,LINE WRITES THE TOTAL TO A FILE
WTO 'BEFORE CLOSE',ROUTCDE=11
EOJ CLOSE (PRINTER)
CLOSE (TRANS)
WTO 'AFTER CLOSE',ROUTCDE=11
L 13,SAVE+4
LM 14,12,12(13)
BR 14 RETURN THE PROGRAM TO CALLING
* PROGRAM
CARD DS 0CL80 LENGTH OF THE INPUT FILE
INT DS CL02 INPUT DATA
INTB DC CL78' ' BLANKS
*
LINE DS 0CL132
DC CL05' '
DC CL15'THE TOTAL IS: '
SUM DS CL10' '
DC CL101' '
BCD DS D
Z DS CL2
*
TRANS DCB DSORG=PS,MACRF=(GM),DDNAME=SYSIN,EODAD=EOJ, X
RECFM=FB,LRECL=80
PRINTER DCB DSORG=PS,MACRF=(PM),DDNAME=SYSPRINT,RECFM=FB, X
LRECL=132
SAVE DS 18F
END
RUN JCL AND INPUT
Code:
//STEP010 EXEC PGM=PGMNAME PROGRAM NAME
//STEPLIB DD DSN=SHEKAR.ASM.LOADLIB,DISP=SHR LOAD MODULE
//SYSIN DD DSN=SHEKAR.ASM.INPUT,DISP=SHR INPUT FILE
//SYSPRINT DD SYSOUT=* OUTPUT OF JCL
//SYSOUT DD SYSOUT=* SYSOUT
//
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
01
02
03
04
05
06
07
08
09
10
ERROR MESSAGES
Code:
INSIDE LOOP
IEA995I SYMPTOM DUMP OUTPUT
SYSTEM COMPLETION CODE=0C7 REASON CODE=00000000
TIME=10.15.37 SEQ=16828 CPU=0000 ASID=0029
PSW AT TIME OF ERROR 078D2000 00007D58 ILC 4 INTC 07
ACTIVE LOAD MODULE ADDRESS=00007D08 OFFSET=00000050
NAME=PGMNAME
DATA AT PSW 00007D52 - C1E24F50 C1DA1A65 41330002
GR 0: 00002878 1: 0003D6F4
2: 00000040 3: 00007E12
4: 005D3CB0 5: 00000001
6: 00000001 7: FD000000
8: 005ECB98 9: 00000009
A: 00000000 B: 005EC920
C: 40007D0E D: 00007FB4
E: 50007D3E F: 00000000
END OF SYMPTOM DUMP
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Aug 29, 2006 4:08 pm Post subject:
Hmmm... a quick perusal shows me that you have 10 input records each with a 2-digit ZD value in positions 1-2, but you are only reading the first input record and looking for ten consecutive values in it. So the PACK/CVB is invalid for the second value of 2 blanks.
You either need to change your code to read each record and process its first two bytes, or change SYSIN to have one record with ten valid 2-byte ZD values. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Great.I just changed my Input File like below and i am able to get the desired output correctly but i am getting COND CODE 3336 .Can you tell me what does this code indicate ?
Joined: 02 Dec 2002 Posts: 415 Topics: 6 Location: Hove, England
Posted: Wed Aug 30, 2006 8:45 am Post subject:
Shekar,
The return code from an assembler program is taken from the last part of register 15. Since you have reloaded register 15 from your save area, it will contain the start address of your program. You need to change your exit code to something like:
Code:
LM 14,12,12(13)
SR 15,15
BR 14
_________________ The day you stop learning the dinosaur becomes extinct
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum