Can I pass system variables to my VISION:Results program?

Document ID : KB000022319
Last Modified Date : 14/02/2018
Show Technical Document Details

It is easy to pass system variable through to your program using DYLPARM which is documented on page 50 of the VISION:Results Reference Guide. 

What is not entirely clear from the manual is whether the passed string following UA will be evaluated, or just passed as a literal.
The following example using &SYSUID shows a system variable with the & prefix is, in fact, evaluated.

DYLPARM is 60 bytes long, so use WORKAREA to redefine a field with the desired length.
Move DYLPARM to that and utilize that work field as desired.

//*                                                                 
//*    DYLPARM passing system variables to a VISION:Results program    
//*                                                                 
//PASS     EXEC PGM=DYL280,REGION=0M,PARM='UA=&SYSUID'       
//STEPLIB  DD  DSN=YourVResults.LOADLIB,DISP=SHR          
//FILEIN   DD  DUMMY                                                
//SYS004   DD  UNIT=SYSDA,SPACE=(TRK,(5,5))                         
//SYS280R  DD  SYSOUT=*                                             
//SYSOUT   DD  SYSOUT=*                                             
//SYSPRINT DD  SYSOUT=*                                             
//SYSIN    DD  *                                                    
FILE FILEIN DUMMY                                                   
WORKAREA  TESTPARM 8                                               
  MOVE DYLPARM TO TESTPARM                                          
  LIST TESTPARM                                                     
STOP  
/*
    will generate the following output since JOEUSER is the userid:
 
           TESTPARM          
           JOEUSER

Note that in the report above TESTPARM is the column heading and JOEUSER is the detail line.

Further, you can also combine system variables and literals.
Just change the example above in the PARM value on the EXEC statement and the length of the WORKAREA field:

//PASS     EXEC PGM=DYL280,REGION=4M,PARM='UA=&SYSUID  < DISPLAY USERID'
 
WORKAREA  TESTPARM 25

to generate this as output:

                          TESTPARM        
                 JOEUSER   < DISPLAY USERID