Troubles in ASM



High Level Assembler(HLASM) for MVS & VM & VSE

Troubles in ASM

Postby cloud_strife » Fri Nov 07, 2008 5:53 am

Hi !

I have the code above , and it counts from one to 999.But i want to change it
to count from 1001 to 10001. Im started changing the initial value of SUM and its type
from " SUM DC P'01' " to " SUM DC H'1001' " it doesn't work! When i compile the code
i receive the abnormal error S0C7. Anyone can help me ?

Thanks,

c.s.

ADD      CSECT
ADD      AMODE 31
ADD      RMODE 24
*
*--------------------------------------------------------------------*
*                                                                    *
*        register equates                                            *
*                                                                    *
*--------------------------------------------------------------------*
*
R0       EQU   0                       register 0
R1       EQU   1                       register 1
R2       EQU   2                       register 2
R3       EQU   3                       register 3
R4       EQU   4                       register 4
R5       EQU   5                       register 5
R6       EQU   6                       register 6
R7       EQU   7                       register 7
R8       EQU   8                       register 8
R9       EQU   9                       register 9
R10      EQU   10                      register 10
R11      EQU   11                      register 11
BASEREG  EQU   12                      base register
SAVEREG  EQU   13                      save area register
RETREG   EQU   14                      caller's return address
ENTRYREG EQU   15                      entry address
RETCODE  EQU   15                      return code
         EJECT
*
*--------------------------------------------------------------------*
*                                                                    *
*        standard entry setup, save area chaining, establish         *
*        base register and addressibility                            *
*                                                                    *
*--------------------------------------------------------------------*
*
         USING ADD,ENTRYREG            establish addressibility
         B     SETUP                   branch around eyecatcher
         DC    CL8'ADD'                program name
         DC    CL8'&SYSDATE'           program assembled date
SETUP    STM   RETREG,BASEREG,12(SAVEREG)  save caller's registers
         BALR  BASEREG,R0              establish base register
         DROP  ENTRYREG                drop initial base register
         USING *,BASEREG               establish addressibilty
         LA    ENTRYREG,SAVEAREA       point to this program save area
         ST    SAVEREG,4(,ENTRYREG)    save address of caller's save
*                                          area
         ST    ENTRYREG,8(,SAVEREG)    save address of this program
*                                          save area
         LR    SAVEREG,ENTRYREG        point to this program savearea
         EJECT
*
*--------------------------------------------------------------------*
*                                                                    *
*        program body                                                *
*                                                                    *
*--------------------------------------------------------------------*
LOOPINIT DS    0H
         SR    R2,R2
         L     R2,COUNTER
*
LOOP     DS    0H
*
         ZAP   TOT,SUM
         ED    OUT,TOT
         MVC   LINE+1(77),STATLIN
         MVC   LINE+77(4),OUT
         BAL   R7,WRITELNE
         MVC   OUT,=X'40202020'
         AP    SUM,ONE
*
         BCT   2,LOOP
*
*
*--------------------------------------------------------------------*
*                                                                    *
*        standard exit -  restore caller's registers and             *
*        return to caller                                            *
*                                                                    *
*--------------------------------------------------------------------*
*
EXIT     DS    0H                      halfword boundary alignment
         L     SAVEREG,4(,SAVEREG)     restore caller's save area addr
         L     RETREG,12(,SAVEREG)     restore return address register
         LM    R0,BASEREG,20(SAVEREG)  restore all regs. except reg15
         BR    RETREG                  return to caller
         EJECT
*
WRITELNE DS    0H
*--------------------------------------------------------------------*
* Open output files, write record, wait for completion, close file   *
*--------------------------------------------------------------------*
         OPEN  (PRTLINE,OUTPUT)
         PUT   PRTLINE,LINE
         BAL   R8,WAITWRIT
         CLOSE (PRTLINE)
         BR    R7
*
WAITWRIT DS    0H
*--------------------------------------------------------------------*
* waits for the 100ths of seconds specifed in WAITINT                *
*--------------------------------------------------------------------*
         STIMER WAIT,BINTVL=WAITINT
         BR    R8
*--------------------------------------------------------------------*
*                                                                    *
*        storage and constant definitions.                           *
*        print output definition.                                    *
*                                                                    *
*--------------------------------------------------------------------*
*
STATLIN  DS    0CL77
              DC    C'THIS IS A TEST PROGRAM NUMBER #0001! '
              DC    C'THIS IS THE CONTENT OF YOUR TOT COUNTER '
*
LINE          DS    0CL81
                DC    C' '
                DS    CL80
PRTLINE  DCB   DSORG=PS,DDNAME=PRTLINE,MACRF=PM,                       X
               RECFM=FA,LRECL=81,BLKSIZE=81
SUM          DC    P'01'
ONE          DC    P'01'
TOT          DS    PL2
OUT          DC    X'40202020'
SAVEAREA DC    18F'-1'                 register save area
COUNTER  DC    F'999'
WAITINT   DC    F'10'                   Time to wait in 100ths second
       END   ADD
User avatar
cloud_strife
 
Posts: 5
Joined: Fri Nov 07, 2008 5:15 am
Has thanked: 0 time
Been thanked: 0 time

Re: Troubles in ASM

Postby dick scherrer » Fri Nov 07, 2008 6:55 am

Hello and welcome to the forum,

You can't simply change from a packed-decimal number to a half-word. . .

Suggest you intialize TOT to zero. Also, increase the size of all of the fields to accomodate the new values.

Suggest you not use STIMER - most places do not allow putting code "to sleep".
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Troubles in ASM

Postby cloud_strife » Fri Nov 07, 2008 7:09 am

Hi dick scherrer, thanks !

I tried to do that . Above , the part of the code that i changed.
SUM          DC    H'1001'
ONE          DC    H'01'
TOT          DS    H'0'
OUT          DC    X'40202020'
SAVEAREA DC    18F'-1'                 register save area
COUNTER  DC    F'9000'
WAITINT   DC    F'10'                   Time to wait in 100ths second


But the problem still happens...What i'm doing wrong ?

Thanks again,

c.s.
User avatar
cloud_strife
 
Posts: 5
Joined: Fri Nov 07, 2008 5:15 am
Has thanked: 0 time
Been thanked: 0 time

Re: Troubles in ASM

Postby dick scherrer » Fri Nov 07, 2008 7:17 am

Hello,

You need packed-decimal fields rather than binary fields. They are not interchangable and your code will need packed-decimal. It would be more straightforward to just use packed-decimal for this accumulation/presentation and not try to flip between binary and pd.

The size of the fields needs to be increased to accomodate the larger numbers. The length of the edit mask (OUT) needs to also be changed.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Troubles in ASM

Postby cloud_strife » Fri Nov 07, 2008 7:43 am

Hi again !
Sorry , i'm a little confused yet. :(
You mean do that :
SUM      DC    PL2'1001'
ONE      DC    PL2'0001'
TOT      DS    PL2
OUT      DC    X'4020202020'
SAVEAREA DC    18F'-1'                 register save area
COUNTER  DC    F'9000'
WAITINT  DC    F'10' 


Sorry , but I don't have experience with asm on z/os... yet :(

Thanks,

c.s.
User avatar
cloud_strife
 
Posts: 5
Joined: Fri Nov 07, 2008 5:15 am
Has thanked: 0 time
Been thanked: 0 time

Re: Troubles in ASM

Postby dick scherrer » Fri Nov 07, 2008 8:46 am

Hello,

I'd suggest PL3 for sum, one, and tot and X'402020202020' for out.

Make sure tot is initialized - the definition has no value.

Suggest you also spend some time in the manual and understand the different ways to define data rather than to continue to throw code at it. If it starts working and you don't understand why, it may cause you grief later.

Are you familiar with how data in different formats is stored? It will be to your advantage to understand these very well.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Troubles in ASM

Postby cloud_strife » Wed Nov 12, 2008 7:12 pm

Thks D.S. !
Your answer help me a lot!
I already download a good ebook about ASM on z/os!
Thks again !

Regards,

c.s.
User avatar
cloud_strife
 
Posts: 5
Joined: Fri Nov 07, 2008 5:15 am
Has thanked: 0 time
Been thanked: 0 time

Re: Troubles in ASM

Postby dick scherrer » Thu Nov 13, 2008 12:50 am

You're welcome - good luck :)

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to Assembler