Page 1 of 1

Blank out symbolic variables from PROC

PostPosted: Thu Oct 02, 2008 9:39 am
by vinu78
//TSTA310 PROC ENVI2='ABC#UA.R2.ST09',
// SYSG='HLED',
// PLUS1='(+1)'
//TST2310E EXEC PGM=ICEGENER,COND=(0,NE)
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=&HLQAI..&DMC2..&SYSG..PCTRSAS.LOAD,DISP=SHR
//SYSUT2 DD DSN=&HLQAO..&DMC2..&SYSG..&PRC..PCTRSAS.COPY&PLUS1,
// DISP=(,CATLG,DELETE),
// SPACE=(TRK,(5,2),RLSE),
// DCB=(GDG,LRECL=80,BLKSIZE=0,RECFM=FB),
// UNIT=DISK
//SYSIN DD DUMMY
//*
My reqt is to blank out the symbolic variable HLED from the above PROC
My approach was to search for '=FLED' and then get the corresponding parm parameter (SYSG). Then do a search for &SYSG.. and blank out that.
But the problem is when we use the statement
FULLPARM = "&"||SYSG||".."
"ISREDIT C &FULLPARM '' ALL NX"

it is blanking out only periods (.) and not the literals. Could you plz help in this issue.

Code
BLANKRC = 0                                                         
"ISREDIT CURSOR = 1 1"                                               
"ISREDIT C '7D'X  '~' ALL"       /* converting inverted comma to tilde char for finding the variable within the inverted comma
DO WHILE (BLANKRC = 0)                                               
   "ISREDIT F '=~HLED~' FIRST"                                             
    BLANKRC = RC                                                     
    IF BLANKRC = 0 THEN                                               
       DO                                                             
        "ISREDIT (LINE) = LINENUM .ZCSR"                             
        "ISREDIT (BLNKLNE) = LINE .ZCSR"                             
         PARSE VAR BLNKLNE '//' BLNKLNES                             
         BLNKLNES = STRIP(BLNKLNES)                                 
         DO WHILE(BLNKLNES <> '')                                   
            PARSE VAR BLNKLNES BLNKLNE1 "=" BLNKLNE2 "~," BLNKLNES   
            IF BLNKLNE2 = '~HLED' THEN                               
               DO                                                   
                    FULLPARM = "&"||BLNKLNE1||"!!"             
                   "ISREDIT C &FULLPARM '' ALL NX"             
               END                                           
        END                                                 
       END                                                     
END           
"ISREDIT C '~' '7D'X ALL"                                           
RETURN 0                                 

Plz help me to blank out &SYSG..

Thanks
Vinu

Re: Blank out symbolic variables from PROC

PostPosted: Fri Oct 31, 2008 8:43 pm
by Gilles
There seems to be a problem when an & character is passed in the argument of the CHANGE command. I couldn't find how to make the CHANGE command accept it. But your code gave me the idea of trying to change the character string in hexadecimal instead. I tried in and it worked. I'm giving you just these few lines so you can adapt your macro if you so choose to use this technique. You convert your string to change in hexadecimal with the C2X function and run the CHANGE command with the result as the argument.

STRINGTOCHANGE = C2X('&SYSG..')
"ISREDIT C '"STRINGTOCHANGE"'X '' ALL"

Re: Blank out symbolic variables from PROC

PostPosted: Thu Nov 06, 2008 1:23 am
by vinu78
Thanks..That worked out.
Also we can change the & to some other character like tilde or ? and then do the operation.
For macros, the & is a special case