Re: [CMS-PIPELINES] IF testing characters

2022-11-28 Thread Kris Buelens
Thanks John for this education

Kris Buelens,
 --- VM/VSE consultant, Belgium ---
---


Op ma 28 nov. 2022 om 13:45 schreef John P. Hartmann :

> On 11/28/22 11:10, Kris Buelens wrote:
> > I repeat that #1 (or in France  £1) is a counter, so no spaces by
> > definition.
>
> This is no longer the case.
>
> Counters can now contain non-numeric strings as well as proper numbers.
> Perhaps #1 should be called a variable, just as Alain does.
>
> The initial value of a counter is nothing, which will be either the null
> string or zero, depending on to what the counter is coerced in an
> expression.
>
> set #1:=""
>
> causes the counter to contain a null string, which converts to 0 for
> numerics (perhaps it shouldn't).  This also applies when assigning a
> null value from a column range that is not present in the record.
>


Re: [CMS-PIPELINES] IF testing characters

2022-11-28 Thread John P. Hartmann

On 11/28/22 11:10, Kris Buelens wrote:

I repeat that #1 (or in France  £1) is a counter, so no spaces by
definition.


This is no longer the case.

Counters can now contain non-numeric strings as well as proper numbers. 
Perhaps #1 should be called a variable, just as Alain does.


The initial value of a counter is nothing, which will be either the null 
string or zero, depending on to what the counter is coerced in an 
expression.


   set #1:=""

causes the counter to contain a null string, which converts to 0 for 
numerics (perhaps it shouldn't).  This also applies when assigning a 
null value from a column range that is not present in the record.


Re: [CMS-PIPELINES] IF testing characters

2022-11-28 Thread John P. Hartmann

On 11/28/22 10:07, Alain Benvéniste wrote:

Yes John ^ is the good character.
There is something i still don’t understand :
If i code
If £1==a
and a is equal to b3339
b for blank, the if is not honored
If I use a
If space(£1)==space(a) it works.
It could mean that when i do a set £1:=a the blank is removed… ?

Resiliency Services on Z Mainframe
alain.benveni...@kyndryl.com



== is the exactly equal operator.  It operates on strings.  So

   (a == " 3339") and (a = 3339)

both evaluate to 1

In the numeric example, the string (a) is stripped of blanks and 
converted successfully to a number for numeric compare.


There are a number of quirks with string operands.

   literal  5|spec a: 1-* 1 if a==5 then ...
   PIPSPX1086E Improper operand for string expression.

It fails because numeric constants are rejected with a string operator 
(mea culpa).  However a string function does not reject a numeric constant:


   a==strip(5)

is processed OK with the result 0 because a has a leading blank, but 5 
does not.


Re: [CMS-PIPELINES] IF testing characters

2022-11-28 Thread Kris Buelens
I repeat that #1 (or in France  £1) is a counter, so no spaces by
definition.
I guess that space(#1) converts it to a string and so you can compare to
identifier "a", what is a string

Kris Buelens,
 --- VM/VSE consultant, Belgium ---
---


Op ma 28 nov. 2022 om 10:07 schreef Alain Benvéniste :

> Yes John ^ is the good character.
> There is something i still don’t understand :
> If i code
> If £1==a
> and a is equal to b3339
> b for blank, the if is not honored
> If I use a
> If space(£1)==space(a) it works.
> It could mean that when i do a set £1:=a the blank is removed… ?
>
> Resiliency Services on Z Mainframe
> alain.benveni...@kyndryl.com
>
> > Le 27 nov. 2022 à 14:59, John P. Hartmann  a écrit :
> >
> > On 11/27/22 13:51, a.benveni...@free.fr wrote:
> >> Sorry John to come back but,
> >
> > There is no /== operator in specs.
> >
> > For me, ^== works as the not exactly equal operator because my terminal
> > emulator maps ^ to not; perhaps it works for you too.  Otherwise you
> > need to find the not character on your terminal, or turn the expression
> > around to use ==.
> >
> > (/= is divide counter by the right-hand expression assignment operator;
> > it is not a binary logical operator.  See pp 737)
>


Re: [CMS-PIPELINES] IF testing characters

2022-11-28 Thread Alain Benvéniste
Yes John ^ is the good character.
There is something i still don’t understand :
If i code
If £1==a
and a is equal to b3339
b for blank, the if is not honored 
If I use a 
If space(£1)==space(a) it works. 
It could mean that when i do a set £1:=a the blank is removed… ?

Resiliency Services on Z Mainframe
alain.benveni...@kyndryl.com 

> Le 27 nov. 2022 à 14:59, John P. Hartmann  a écrit :
> 
> On 11/27/22 13:51, a.benveni...@free.fr wrote:
>> Sorry John to come back but,
> 
> There is no /== operator in specs.
> 
> For me, ^== works as the not exactly equal operator because my terminal
> emulator maps ^ to not; perhaps it works for you too.  Otherwise you
> need to find the not character on your terminal, or turn the expression
> around to use ==.
> 
> (/= is divide counter by the right-hand expression assignment operator;
> it is not a binary logical operator.  See pp 737)