Page 1 of 1

Get value of variable based on reading the dataset member

PostPosted: Wed Apr 08, 2020 6:30 pm
by arya_starc
Hi Folks,

I am creating a Panel in which I am returning a value which is based on reading the dataset member.
Example:- In panel I am providing the dataset name and member and then system check the allocation of pds with member then in rexx program it will iterates from starting of program to end.
Then in rexx program I will increase the count of variable based on finding the particluar word in the member.
And at last I will display that count in my panel.

Now issue I am facing I am not getting the variable count value in ISPF panel.


)ATTR                                                                  
! TYPE(TEXT) INTENS(HIGH) CAPS(ON) PAD(NULLS) COLOR(GREEN) SKIP(ON)    
% TYPE (TEXT) INTENS (HIGH)                                            
+ TYPE (TEXT) INTENS (LOW) SKIP (ON)                                  
_ TYPE (INPUT) INTENS (HIGH) CAPS (ON) JUST(LEFT) COLOR(BLUE) PADC(_)  
# TYPE (INPUT) INTENS(LOW) CAPS(ON) PAD('_') COLOR(YELLOW)            
)BODY                                                                  
%COMMAND ===>_ZCMD                                                    
+ A ISPF PANEL 1 - TRAINING TO DISPLAY O/P IN PANEL          
+ ----------------------------------------------------------          
+                                                                      
+ %ENTER THE DATASET NAME ==> TEST.PDS.XXXX              
+                                                                      
+ %ENTER THE DATASET MEMBER IF EXISTING ==>_DSMEMB  +                  
+                                                                      
+ ! NUMBER OF TIMES SYNTAX PRESENT IS  : #NBR  +                          
+ +PRESS ENTER TO CONTINUE, PF3 TO EXIT +                              
+                                                          
+                                                        
+                                                        
)INIT                                                    
VGET(DSNAME,DSMEMB,NBR) PROFILE                          
)PROC                                                    
VPUT(DSNAME,DSMEMB,NBR) PROFILE                          
)END                                                                
 


Below is my rexx code

/* REXX */                                                        
ISPEXEC CONTROL DISPLAY REFRESH                                  
"ISPEXEC LIBDEF ISPPLIB DATASET ID ('KINVPCF.FDC.PDS.SASH')"      
"ISPEXEC VERASE (DSNAME,DSMEMB,NBR) PROFILE";                    
"ISPEXEC DISPLAY PANEL (P2)"                                      
"ISPEXEC VGET (DSNAME,DSMEMB,NBR) PROFILE";                      
/*                                                                
SAY DSNAME                                                        
*/                                                                
DSNAME = SBIC.PDS.PROD.ABEND.LOGGER                              
IF DSMEMB = "" THEN                                              
   MIG_FILE1 = DSNAME                                            
ELSE                                                              
   MIG_FILE1 = DSNAME"("DSMEMB")"                                
   CHKLIB = SYSDSN("'"MIG_FILE1"'")                              
   IF CHKLIB <> 'OK' THEN DO                                      
      SAY 'ERROR - ' DSN 'NOT FOUND'                              
      EXIT                                                        
   END                                                      
   M1 = 0                                                  
      "ALLOC FI(PDS1) DA('"MIG_FILE1"') SHR REUSE"          
      "EXECIO * DISKR PDS1 (STEM PROC1. FINIS"              
      "FREE FI(PDS1)"                                      
      DO K =1  TO PROC1.0                                  
         IF  POS('JOB NAME ',PROC1.K) <> 0 THEN DO          
                M1 = M1 + 1                                
         END                                                
      END                                                  
   SAY M1                                                  
      NBR = M1                                              
   "ISPEXEC DISPLAY PANEL (P2)"                            
EXIT
 


Please tell me where it is getting wrong.Thanks in advance.

Re: Get value of variable based on reading the dataset membe

PostPosted: Wed Apr 08, 2020 8:10 pm
by NicC
What does your trace show?

Re: Get value of variable based on reading the dataset membe

PostPosted: Wed Apr 08, 2020 8:30 pm
by willy jensen
your )INIT section contains this line:
VGET(DSNAME,DSMEMB,NBR) PROFILE
but you do not VPUT the NBR variable to the profile in your REXX prior to the display.
I strongly suggest that you remove the VGET in )INIT and VPUT in the )PROC section.

Other recommandations
- do not use PAD in the panel )ATTR, use HILITE(USCORE) instead.
- use TYPE(OUTPUT) for display fields, like the NBR.
- use Address ISPEXEC "DISPLAY PANEL (P2)" instead of "ISPEXEC DISPLAY PANEL (P2)"

Re: Get value of variable based on reading the dataset membe

PostPosted: Sun Apr 12, 2020 9:55 am
by Pedro
NUMBER OF TIMES SYNTAX PRESENT IS  : #NBR  +  


fyi. The number you are accumulating is the number of lines that contain the string. That is, you do not account for it occurring twice on the same line.