Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] How do I loop through records?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] How do I loop through records?
 Login/Join
 
Guru
posted
Does mainframe FOCUS have the equivalent of a DO WHILE function? I need to cycle through records based on an a certain field to see if another field has a certain value. After I finish looping through these records, I want to produce a report that contians only one record from the records that can have multiple values.

Here is a piece of my code where I want ot be able to loop:

 
DEFINE FILE SWFILE                                     
AWARDYR  /A4 = EDIT(SW010,'9999');                     
YRCHECK  /A1 = EDIT('&AWDYR','$$$9');                  
TXGRANT1 /A5 = '8930' | YRCHECK;                       
TXGRANT2 /A5 = '8940' | YRCHECK;                       
TXGRANT3 /A5 = '8950' | YRCHECK;                       
TXGRANT4 /A5 = '8960' | YRCHECK;                       
TXGRANT  /A1 = IF SW025 EQ TXGRANT1 THEN 'Y' ELSE      
               IF SW025 EQ TXGRANT2 THEN 'Y' ELSE      
               IF SW025 EQ TXGRANT3 THEN 'Y' ELSE      
               IF SW025 EQ TXGRANT4 THEN 'Y' ELSE 'N'; 
END    

 


When I get to this point, I want to have only one record from the piece above.


  TABLE FILE SWFILE                        
PRINT                                    
-*   SW025    AS GRANT_CODE              
     TXGRANT  AS TX_GRANT                
     TXGRANT1 TXGRANT2 TXGRANT3 TXGRANT4 
     SW050    AS AWD_PERIOD              
     AWARDYR                             
BY   STU_ID                              
BY   SW050 NOPRINT                       
BY   SW025 NOPRINT                       
WHERE AWARDYR EQ '&AWDYR'                
ON    TABLE    HOLD AS 'S079E&INSTX'     
END                                      
-RUN 


In other words, once I cycle through, say Ralph's data, I want to end up with one record that contains the TX_GRANT code, whether that code be a 'Y' or 'N'. What's happening at present is that I am getting all of Ralph's records, those that have both a 'Y' and an ''N' and my client wants only one record for Ralph (or anyone, for that matter.)

Thank you so much in advance....looking forward to seeing what you have to say.

This message has been edited. Last edited by: webmeister,


Mainframe FOCUS 7.0
VM/CMS and MVS/TSO
 
Posts: 250 | Registered: January 14, 2008Report This Post
Expert
posted Hide Post
Sum would be the easiest way to provide one line, remembering that alphas summed show the last value encountered within your sort level(s). So you'll have to discuss with your user what they want in preference, the 'Y' or 'N' records and then sort accordingly. You might have to introduce an interim hold file stage depending upon what your user requests.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Master
posted Hide Post
There is a -REPEAT loop, check your developers manual for the syntax you want to use. SUM will give you one record per student. In looking at your code I think neither is going to give you what you really want. Currently changing PRINT to SUM will give you one record for every SW025 code within every SW050 for RALPH where the &AWDYR equals the AWARDYR. And each record will contain;
RALPH Y 89308 89408 89508 89608 2008


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
 
Posts: 755 | Location: TX | Registered: September 25, 2007Report This Post
Guru
posted Hide Post
Tony and Pat,

Thanks for replying to my plight! I think a good possibility is to use the SUM verb, and create two interim files, one that contains records with only the 'N' value and the other with only the 'Y' value and then use the OLD_NOT_NEW (or one of its variants to rejoin the two interim files in order to then continue with the rest of the process in my FOCEXEC.

I appreciate you both taking the time to reply... it helped me nicely.


Mainframe FOCUS 7.0
VM/CMS and MVS/TSO
 
Posts: 250 | Registered: January 14, 2008Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] How do I loop through records?

Copyright © 1996-2020 Information Builders