Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

REXX Logic Issue

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: REXX Logic Issue
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    Post subject:
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    Post subject: Reply to: REXX Logic Issue
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts I want to retire TRX and use only Rex... Abhinav Sharma CLIST & REXX 4 Sat Jul 29, 2017 2:53 am
No new posts Iterative use of a REXX script causin... bryonyh CLIST & REXX 4 Fri Jul 28, 2017 12:52 pm
No new posts Passing data from REXX to C programme... chong.zhou CLIST & REXX 3 Wed Jul 26, 2017 9:11 pm
No new posts REXX to get the all datasets name parasmalik20 CLIST & REXX 5 Tue Jul 18, 2017 9:10 pm
No new posts How system know which REXX to excute? jackzhang75 CLIST & REXX 14 Thu Jul 06, 2017 1:09 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us