IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

REXX Logic Issue


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Tue Aug 24, 2010 2:02 am
Reply with quote

I ran a trace of the following logic. I was looking for blank, blank, blank, SORT FIELDS=COPY in positions 1 through 19. REXX found blank SORT FIELD=COPY and called it a match. I know I can change the starting position and fix the issue, but when looking for 3 blanks and and some fixed characters, why would it match to a single blank, SORT FIELD=COPY followed by two other blanks? It just seems like it should be exact.

Code:

*-* IF SUBSTR(XXX.CTRI1,1,19)="   SORT FIELDS=COPY"   
>C>   "XXX.49"                                         
>V>   " SORT FIELDS=COPY                             "
       "                                               
>L>   "1"                                             
>L>   "19"                                             
>F>   " SORT FIELDS=COPY  "                           
>L>   "   SORT FIELDS=COPY"                           
>O>   "1"                                             
*-*  THEN                                             
*-*  DO                                               
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Tue Aug 24, 2010 2:53 am
Reply with quote

According to the Rexx Manual:

For all the other comparison operators, if both terms involved are numeric, a numeric comparison (in which leading zeros are ignored, and so forth—see “Numeric comparisons” on page 188) is effected. Otherwise, both terms are treated as character strings (leading and trailing blanks are ignored, and then the shorter string is padded with blanks on the right).

The strict comparison operators all have one of the characters defining the operator doubled. The ==, \==, /==, and ¬== operators test for an exact match between two strings. The two strings must be identical (character by character) and of the same length to be considered strictly equal.


So. . .to test for EXACT equality you have to double the = sign - i.e.

Code:
IF SUBSTR(XXX.CTRI1,1,19)=="   SORT FIELDS=COPY"
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Tue Aug 24, 2010 3:04 am
Reply with quote

Great info. Thanks for the reply.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
Search our Forums:

Back to Top