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 REXX cdoe to purge a JOB from spool a... Sulabh Agrawal CLIST & REXX 11 Thu Mar 09, 2017 11:36 am
No new posts Overriding PS data in rexx Shaheen Shaik CLIST & REXX 8 Fri Mar 03, 2017 5:08 pm
No new posts Need help in building a logic Benchwarmer All Other Mainframe Topics 4 Wed Feb 22, 2017 2:49 am
No new posts REXX compiled via RXTCOMP sergeyken CLIST & REXX 7 Tue Feb 07, 2017 9:41 pm
This topic is locked: you cannot edit posts or make replies. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm


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