One PL1 program is failing due to infinite looping. It seems like the max range is not set properly. What will happen if x has junk values in the below code? program will abend (S0C7) when value moved to x or infinite loop?
x = <value returned from another module>;
Do i = 1 to x WHILE(a = b);
...
end;
what will happen if max range of loop is junk?
-
- Posts: 16
- Joined: Mon Jan 31, 2011 12:26 pm
- Skillset: beginner
- Referer: friend
what will happen if max range of loop is junk?
Thanks,
John
John
- Akatsukami
- Global moderator
- Posts: 1058
- Joined: Sat Oct 16, 2010 2:31 am
- Skillset: Rexx, JCL, DB2/SQL, TSO/ISPF, PL/I
- Referer: ibmmainframes
- Location: Bloomington, IL
- Contact:
Re: what will happen if max range of loop is junk?
A S0C1 or S0C4 abends (translated to oncodes 8091 or 8094) are likely; the program may overwrite code with data (causing a S0C1) or address storage not belonging to the enclave. Other S0Cx abends are possible, including S0C7 (I once got a S0C6), but are considerably less likely than S0C1/4.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
- prino
- Posts: 641
- Joined: Wed Mar 11, 2009 12:22 am
- Skillset: PL/I - CICS - DB2 - IDMS - REXX - JCL, most in excess of three decades
- Referer: Google
- Location: Vilnius, Lithuania
- Contact:
Re: what will happen if max range of loop is junk?
apjohn1986 wrote:One PL1 program is failing due to infinite looping. It seems like the max range is not set properly. What will happen if x has junk values in the below code? program will abend (S0C7) when value moved to x or infinite loop?
x = <value returned from another module>;
Do i = 1 to x WHILE(a = b);
...
end;
Give the declares of i and x, without those there is no way of telling what would happen. And for what it's worth infinite, loops can only occur if i
- is declared as PIC 'whatever' (And if you use PIC variables in loops you deserve what you get
), or
- you modify i inside the loop (and then you also deserve what you get
)
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
robert.ah.prins @ the.17+Gb.Google thingy
-
- Posts: 16
- Joined: Mon Jan 31, 2011 12:26 pm
- Skillset: beginner
- Referer: friend
Re: what will happen if max range of loop is junk?
i is bin(15) and x is fixed bin(31)
There is no increment of i inside loop
There is no increment of i inside loop
Thanks,
John
John
- prino
- Posts: 641
- Joined: Wed Mar 11, 2009 12:22 am
- Skillset: PL/I - CICS - DB2 - IDMS - REXX - JCL, most in excess of three decades
- Referer: Google
- Location: Vilnius, Lithuania
- Contact:
Re: what will happen if max range of loop is junk?
apjohn1986 wrote:i is bin(15) and x is fixed bin(31)
Sigh...
And you still don't realize what's wrong...
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
robert.ah.prins @ the.17+Gb.Google thingy
-
- Posts: 16
- Joined: Mon Jan 31, 2011 12:26 pm
- Skillset: beginner
- Referer: friend
Re: what will happen if max range of loop is junk?
What's wrong?
This is working fine if value from sub module is valid. question is what if that's junk
This is working fine if value from sub module is valid. question is what if that's junk
Thanks,
John
John
- Akatsukami
- Global moderator
- Posts: 1058
- Joined: Sat Oct 16, 2010 2:31 am
- Skillset: Rexx, JCL, DB2/SQL, TSO/ISPF, PL/I
- Referer: ibmmainframes
- Location: Bloomington, IL
- Contact:
Re: what will happen if max range of loop is junk?
What will happen if the value of x is greater than 32,767?
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
-
- Posts: 16
- Joined: Mon Jan 31, 2011 12:26 pm
- Skillset: beginner
- Referer: friend
Re: what will happen if max range of loop is junk?
Yeah got the point.
But there is a correction in my previous statement. x is bin(15) only, the field assign value to it is fixed bin(31)
But there is a correction in my previous statement. x is bin(15) only, the field assign value to it is fixed bin(31)
Thanks,
John
John
- Akatsukami
- Global moderator
- Posts: 1058
- Joined: Sat Oct 16, 2010 2:31 am
- Skillset: Rexx, JCL, DB2/SQL, TSO/ISPF, PL/I
- Referer: ibmmainframes
- Location: Bloomington, IL
- Contact:
Re: what will happen if max range of loop is junk?
So then the first two bytes of the transmitting field will be truncated, yes? Of course the truncated value will be valid -- every bit pattern in a 2s-complement binary variable is a valid number -- but it will be incorrect. However, since the value is valid, there will be no problem with the DO loop.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
-
- Similar Topics
- Replies
- Views
- Last post
-
- 9
- 3438
-
by samb01
View the latest post
Thu Oct 14, 2021 1:29 pm