Ahh, OK, that is not what I was envisioning. I don't have much problem with that at all, though I would question why you would need to use EXIT in cases where the return code is 0 (unlike the example you posted, which is understandable). The nightmare I was thinking of goes more like this: IF ((&DD = &DFSORTDD) && (&DSTYPE = 'TEMP')) THEN DO SET &STORCLAS = 'NONVIO' WRITE 'SC ('&STORCLAS') ' EXIT CODE(0) END IF ((&DD = &DFSORTDD) && (&DSTYPE NE 'TEMP')) THEN DO SET &STORCLAS = &DEF_STORCLAS WRITE 'SC ('&STORCLAS') ' EXIT CODE(0) END IF ((&USER = 'MMCDONA') && (&DSTYPE = 'TEMP')) THEN DO SET &STORCLAS = 'STD' WRITE 'SC ('&STORCLAS') ' EXIT CODE(0) END IF ((&DD NE &DFSORTDD) && (&DSTYPE = 'TEMP')) THEN DO SET &STORCLAS = 'SORT' WRITE 'SC ('&STORCLAS') ' EXIT CODE(0) END
>>> "Richards, Robert B." <[EMAIL PROTECTED]> 4/30/2008 12:59 PM >>> Scott, I do not find them cumbersome or hard to read. Quite the opposite. I also indent two spaces, line up Dos and ENDs (and they are on lines by themselves), and line up WHENs and OTHERWISEs. Almost 20 years ago, when I started writing ACS routines, I employed these stylistic tricks because they enabled *ME* to read and understand my coding better. Now, I do it out of habit, I'm sure. Still...I find the style very useful. See below (I hope it comes out readable): /*--------------------------------------------------------------------*/ /* CHECK TO SEE WHETHER THE STORCLAS PASSED TO THE ROUTINE IS A */ /* RESTRICTED STORCLAS AND IF THE USER IS AUTHORIZED TO SET IT. IF */ /* NOT, EXIT THE ROUTINE WITH A CONDITION CODE OF 8. */ /* */ /* LOGIC SEQUENCE - 2 */ /*--------------------------------------------------------------------*/ WHEN (&STORCLAS ¬='' && &STORCLAS = &RESTRICT && &USER ¬= &SPECUSR) DO WRITE 'THE STORAGE CLASS (' &STORCLAS ') THAT YOU' WRITE 'SPECIFIED IS RESTRICTED' EXIT CODE(8) END I have absolutely no issues with SELECT WHEN logic and try and avoid IF THEN ELSE statements in favor of SELECT WHEN in most cases. Bob -----Original Message----- From: IBM Mainframe Discussion List [mailto:[EMAIL PROTECTED] On Behalf Of Scott Rowe Sent: Wednesday, April 30, 2008 12:33 PM To: IBM-MAIN@BAMA.UA.EDU Subject: Re: SMS PUZZLE Bob, I really try to avoid the "DO-SET-EXIT-END loops" you speak of, I find them cumbersome and hard to read. I find that one large SELECT-WHEN-OTHERWISE-END provides a better structure for this, and since it avoids the numerous EXITs, it allow for such things as WRITE statements after the end of the SELECT group. I have seen many sites that use the style you refer to, and I have always wondered why people prefer that over the SELECT layout, I would be interested in hearing what issues you see in SELECT? Scott >>> "Richards, Robert B." <[EMAIL PROTECTED]> 4/30/2008 10:10 AM >>> Willie, Sorry for the delay in responding. Had several doctor appointments yesterday. Scott and Tom identified your immediate problem, but your routine still could use some improvement. As was pointed out, be consistent and use DO-SET-EXIT-END loops for *ALL* storage class assignments. Document your logic choices and decisions with better comments. There is an ELSE statement that is hanging out there by itself before the SELECT statement should not be there and is poor coding. The only reason it works is because the ACSENVIR test satisfies the ELSE condition more often than the IF condition, enabling the SELECT logic below it to execute. Remove the ELSE statement. Hope this helps. Bob Note that my email domain has changed from jo-annstores.com to joann.com. Please update your address book and other records to reflect this change. CONFIDENTIALITY/EMAIL NOTICE: The material in this transmission contains confidential and privileged information intended only for the addressee. If you are not the intended recipient, please be advised that you have received this material in error and that any forwarding, copying, printing, distribution, use or disclosure of the material is strictly prohibited. If you have received this material in error, please (i) do not read it, (ii) reply to the sender that you received the message in error, and (iii) erase or destroy the material. Emails are not secure and can be intercepted, amended, lost or destroyed, or contain viruses. You are deemed to have accepted these risks if you communicate with us by email. Thank you. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html Note that my email domain has changed from jo-annstores.com to joann.com. Please update your address book and other records to reflect this change. CONFIDENTIALITY/EMAIL NOTICE: The material in this transmission contains confidential and privileged information intended only for the addressee. If you are not the intended recipient, please be advised that you have received this material in error and that any forwarding, copying, printing, distribution, use or disclosure of the material is strictly prohibited. If you have received this material in error, please (i) do not read it, (ii) reply to the sender that you received the message in error, and (iii) erase or destroy the material. Emails are not secure and can be intercepted, amended, lost or destroyed, or contain viruses. You are deemed to have accepted these risks if you communicate with us by email. Thank you. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html