Get value of variable based on reading the dataset member



TSO Programming, ISPF, SDF, SDSF and PDF, FTP, TCP/IP Concepts, SNA & SNA/IP etc...

Get value of variable based on reading the dataset member

Postby arya_starc » Wed Apr 08, 2020 6:30 pm

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.
arya_starc
 
Posts: 132
Joined: Mon Sep 21, 2015 1:39 pm
Has thanked: 5 times
Been thanked: 0 time

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

Postby NicC » Wed Apr 08, 2020 8:10 pm

What does your trace show?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3026
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

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

Postby willy jensen » Wed Apr 08, 2020 8:30 pm

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)"
willy jensen
 
Posts: 341
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 45 times

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

Postby Pedro » Sun Apr 12, 2020 9:55 am

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.
Pedro Vera
User avatar
Pedro
 
Posts: 632
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 45 times


Return to TSO & ISPF

 


  • Related topics
    Replies
    Views
    Last post