Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
cpuhawg

Active User

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

Posted: Tue Aug 24, 2010 2:02 am    Post subject: REXX Logic Issue

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

Ronald Burr

Active User

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

Posted: Tue Aug 24, 2010 2:53 am    Post subject:

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"
cpuhawg

Active User

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

 Posted: Tue Aug 24, 2010 3:04 am    Post subject: Reply to: REXX Logic Issue Great info. Thanks for the reply.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am Rexx to execute spool commands upendrasri CLIST & REXX 5 Wed Oct 04, 2017 6:54 am Rexx to execute spool commands upendrasri CLIST & REXX 47 Fri Sep 29, 2017 1:08 pm ejck thru rexx to multiple jobs insid... Susanta All Other Mainframe Topics 5 Tue Sep 19, 2017 1:39 pm Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us