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 GDG gen check using REXX raghuraman123 CLIST & REXX 6 Wed Apr 18, 2018 9:18 pm CICS-MQ connection setup issue kaushikv CICS 3 Wed Mar 21, 2018 8:10 pm Need Help!!CEE library issue while br... kaushikv CICS 9 Fri Mar 09, 2018 6:06 pm How to control Panel Attributes throu... rsshanmugam CLIST & REXX 3 Mon Feb 26, 2018 9:51 pm Find a string in PS file opened in br... mukkas CLIST & REXX 3 Sat Feb 24, 2018 2:15 pm

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