Hi,
i wrote the rexx pgm to get the Files used in shr mode in Proc PDS. But in the Proc the file is specified using symbolic variables, so the file name is coming as,
&PFX1..&MODE1..&R14..P.&UI.AC.TIMP
The symbolic variables are defined in the top of the PROC as
PFX1 = G19B,
MODE1= PI, AND ETC..,
Anybody have any idea about how to resolve these symbolic variables to get the file name. Basic idea is enough, i will code the exec part.
Thanks in advance.
Resolving Symbolic variables
Moderators: Veera, Moderator Group
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
I would build two stems to save the symbolics that are defined at the top of the proc
stem1. symbolic without the &
stem2. replacement value
I would parse each filename, as I indentified it, into a third stem - that I would reuse for each filename. I would parse your example as:
stem3.1 &PFX1
stem3.2 .
stem3.3 &MODE1
stem3.4 .
stem3.5 &R14
stem3.6 .
stem3.7 P
stem3.8 &UI
stem3.9 AC
stem3.10 TIMP
when you parse, insure that single '.' are dropped and double '..' are keep as '.' in its own occurance,
that way when you concat them after the subsitution,
you get a valid file name.
then
then concat stem3
stem1. symbolic without the &
stem2. replacement value
I would parse each filename, as I indentified it, into a third stem - that I would reuse for each filename. I would parse your example as:
stem3.1 &PFX1
stem3.2 .
stem3.3 &MODE1
stem3.4 .
stem3.5 &R14
stem3.6 .
stem3.7 P
stem3.8 &UI
stem3.9 AC
stem3.10 TIMP
when you parse, insure that single '.' are dropped and double '..' are keep as '.' in its own occurance,
that way when you concat them after the subsitution,
you get a valid file name.
then
Code: Select all
do loop stem3.0
if left(stem3.i,1) = "&" then
do loop stem1.0
if stem3.i = stem1.k then
stem3.i = stem2.k
end
end
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
this is a little hookie, not really a good PARSE rexxer, but this works:
Code: Select all
/* */
/* stemf. contains the parsed filename*/
/* stema. contains the symbolic variables with the & */
/* stemb. contains the replacement values*/
/* */
filename = '&PFX1..&MODE1..&R14..P.&UI.AC.TIMP'
stemf. = ''
/* */
/* 14 separate items may not be enough */
/* */
parse var filename stemf.1 '.' stemf.2 '.' stemf.3 '.' stemf.4 '.' stemf.5 '.' stemf.6 '.' stemf.7 '.' stemf.8 '.' stemf.9 '.' stemf.10 '.' stemf.11 '.' stemf.12 '.' stemf.13 '.' stemf.14
/* */
/* now go backward and drop the items that were not used */
/* until you find the first occurance that contains other than null string*/
/* */
/* between item 1 and the last, any null is really a '.' */
/* see below in the filename build routine */
/* */
stemf.0 = 14
do i = 14 to 1 by -1
if stemf.i > '' then leave
if stemf.i = '' then
stemf.0 = stemf.0 - 1
end
/* */
/* you are going to have to write your own routine to extract the */
/* symbolic variables and their replacement values yourself */
/* */
/* if you decide to build stema. without the &, the substitution will */
/* have to be a concatenation instead of a direct substitution */
/* */
stema.0 = 4
stema.1 = '&PFX1'
stema.2 = '&MODE1'
stema.3 = '&R14'
stema.4 = '&UI'
stemb.0 = 4
stemb.1 = 'ACCOUNT'
stemb.2 = 'TEST'
stemb.3 = 'REGIONA'
stemb.4 = '1'
/* */
/* now do the replacement*/
/* */
do i = 1 to stemf.0
if left(stemf.i,1) = '&' then
do k = 1 to stema.0
if stemf.i = stema.k then
stemf.i = stemb.k
end
end
/* */
/* rebuild the filename */
/* remember a null string is really a '.'*/
/* */
filename_bld = ''
do i = 1 to stemf.0
if stemf.i = '' then
filename_bld = filename_bld || '.'
else
filename_bld = filename_bld || stemf.i
end
say filename
say filename_bld
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
-
- Member
- Posts: 13
- Joined: Mon Oct 26, 2009 12:00 pm
-
- Member
- Posts: 2
- Joined: Fri Jun 25, 2010 9:47 pm
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page