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
 

 

print out the correct info in LOOP?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
jackzhang75

Active User


Joined: 09 Jun 2014
Posts: 106
Location: windsor

PostPosted: Wed Dec 23, 2015 10:39 pm    Post subject: print out the correct info in LOOP?
Reply with quote

I got the following code to print out data set name that meet the condition, if not ,it will print out "NOT FOUND' . Because of the loop ,everytime it not meet the condition, it will print one "NOT FOUND". eg, if A=4 , all four date set are not meet the condition , it print :

Code:
NOT FOUND
NOT FOUND
NOT FOUND
NOT FOUND


if thrid one meet the condition , it print
Code:
NOT FOUND                             
NOT FOUND                             
CPM.GCICS.BATCH.DB2SUMM.BKUP.G4300V00
NOT FOUND   


How to correct this code to print only one "NOT FOUND" when condition not meet and only date set name when it meet the condition?

Thank you !

Code :

Code:
WHEN FOUND='DEC' THEN DO                 
  DAY= INPUT_DAY+335   /* CHECK FOR DAY */
    DO L=1 TO A                           
     SELECT                               
      WHEN DEC.L /='' & DS_D.L= DAY THEN 
           SAY DEC.L                     
      WHEN DEC.L /='' & INPUT_DAY=0 THEN 
           SAY DEC.L                     
      OTHERWISE                           
           SAY 'NOT FOUND'               
     END                                 
    END                                   
 END                                     
Back to top
View user's profile Send private message

RahulG31

Active User


Joined: 20 Dec 2014
Posts: 331
Location: USA

PostPosted: Wed Dec 23, 2015 10:59 pm    Post subject: Reply to: print out the correct info in LOOP?
Reply with quote

I think it should be simple enough. Just use an indicator (FILE_FOUND)
Code:
WHEN FOUND='DEC' THEN DO                 
   DAY= INPUT_DAY+335   /* CHECK FOR DAY */
     FILE_FOUND = 'N'
     DO L=1 TO A                           
      SELECT                               
       WHEN DEC.L /='' & DS_D.L= DAY THEN
          DO
            FILE_FOUND = 'Y' 
            SAY DEC.L   
          END                 
       WHEN DEC.L /='' & INPUT_DAY=0 THEN 
          DO   
            FILE_FOUND = 'Y'
            SAY DEC.L
          END                     
       OTHERWISE                                     
      END                                 
     END
     IF FILE_FOUND = 'N'
     THEN DO
          SAY 'NOT FOUND'
     END                                   
  END           
Back to top
View user's profile Send private message
jackzhang75

Active User


Joined: 09 Jun 2014
Posts: 106
Location: windsor

PostPosted: Wed Dec 23, 2015 11:29 pm    Post subject:
Reply with quote

Thank you ! I should think about this
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Thu Dec 24, 2015 12:10 am    Post subject:
Reply with quote

Is that what you expect? just to print only 1 'NOT FOUND' if A=p?
p= any number
Code:
WHEN FOUND='DEC' THEN DO                 
   DAY= INPUT_DAY+335   /* CHECK FOR DAY */
     n = 1
     m= 0
     DO L=1 TO A                           
      SELECT                               
       WHEN DEC.L /='' & DS_D.L= DAY THEN 
            SAY DEC.L                     
       WHEN DEC.L /='' & INPUT_DAY=0 THEN 
            SAY DEC.L                     
       OTHERWISE   
            m = n+1
            if m=2                         
            SAY 'NOT FOUND'           
            end               
      END                                 
     END                                   
  END 
RahulG31, in your case (if I get him correctly), it will still print 'NOT FOUND' 4 times if none of the dataset condition is meet when say A= 4.
Also, check if you can club (DS_D.L= DAY or INPUT_DAY=0) & DEC.L /='' together instead of two separate hence simple if else will do instead of select when.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 331
Location: USA

PostPosted: Thu Dec 24, 2015 12:14 am    Post subject: Reply to: print out the correct info in LOOP?
Reply with quote

No. The following condition is outside the DO loop, so only 1 'NOT FOUND':
Code:
     IF FILE_FOUND = 'N'
      THEN DO
           SAY 'NOT FOUND'
      END

There will be multiple File Names that will be printed (if multiple are found) but if none is found then only one 'NOT FOUND'.

.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Thu Dec 24, 2015 12:17 am    Post subject:
Reply with quote

so if A=4 and first 3 are FILE_FOUND = N and last one is FILE_FOUND ='Y' then it will never print 'NOT FOUND' or I am mistaken?
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 331
Location: USA

PostPosted: Thu Dec 24, 2015 12:20 am    Post subject: Reply to: print out the correct info in LOOP?
Reply with quote

Yes, that's what it should be.
Quote:
How to correct this code to print only one "NOT FOUND" when condition not meet

Quote:
and only date set name when it meet the condition?

I believe, print 'NOT FOUND' when none is found and If even a single one is found then print the file name and then No need to print 'NOT FOUND'.

.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Thu Dec 24, 2015 12:27 am    Post subject:
Reply with quote

if what you believe is true then it should work otherwise he have another choice.
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 IMS Database backup info ashek15 IMS DB/DC 14 Wed Nov 16, 2016 5:29 am
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm
No new posts save SAY var loop. italo_pm CLIST & REXX 3 Sun Sep 04, 2016 3:06 am
No new posts Utility to extract dsn info from conc... Lynne Schuler PL/I & Assembler 11 Tue Jan 26, 2016 6:36 am
No new posts Using different values for Skeleton d... venksiv CLIST & REXX 8 Thu Sep 03, 2015 5:28 pm


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