|
|
| Author |
Message |
HameedAli
New User
Joined: 16 Apr 2009 Posts: 75 Location: India
|
|
|
|
Hi!
In REXX, I have read the input dataset DDIN from JCL using the below
| Code: |
| "EXECIO * DISKR DDIN (STEM Input. FINIS " |
Assume I have read the following contents
| Code: |
step EXEC PGM=IKJEFT01
STEPLIB INCLUDE MEMBER (qqqqq)
SYSUDUMP DD SYSOUT=(,),OUTPUT=(*.STD1)
FILE1 DD DSN=qwerty.qwer.qwe1,DISP=SHR
FILE2 DD DSN=qwerty.qwer.qwe2(+1),
DCB=(RECFM=FB,LRECL=115,BUFNO=20),
DISP=(NEW,CATLG,DELETE),
UNIT=(SYSDA,25),SPACE=(CYL,(500,500),RLSE)
FILE3 DD DSN=qwerty.qwer.qwe3(0),DISP=SHR
FILE5 DD DISP=SHR,DSN=qwerty.qwer.qwe3(0)
FILE4 DD DISP=SHR,DSN=qwerty.qwer.qw4 |
The output I need is
| Code: |
qwerty.qwer.qwe1
qwerty.qwer.qwe2
qwerty.qwer.qwe3
qwerty.qwer.qwe5
qwerty.qwer.qwe4 |
How do I parse this in a simple manner? any builtins available? |
|
| Back to top |
|
 |
References
|
|
 |
enrico-sorichetti
Global Moderator
Joined: 14 Mar 2007 Posts: 5391 Location: italy
|
|
|
|
You will have to write the whole code
on the style
| Code: |
dsn.0 = 0
do i = 1 to stmt.0
buff = strip(stmt.i)
if pos("DSN=",buff) = 0 then iterate
start = pos("DSN=",buff) + 4
/* find the end of the dsname */
e1 = pos(" ",buff,start)
if e1 = 0 then e1 = length(buff) + 1
e2 = pos(",",buff,start)
if e2 = 0 then e2 = 9999
e3 = pos("(",buff,start)
if e3 = 0 then e3 = 9999
/* assuming that the statement is correct */
end = min(e1,e2,e3)
j = dsn.0 + 1
dsn.j = substr(buff,start,end-start)
dsn.0 = j
end
do j = 1 to dsn.0
say right(j,2) dsn.j
end
|
edited to correct a few glitches/errors |
|
| Back to top |
|
 |
MBabu
Active User
Joined: 03 Aug 2008 Posts: 397 Location: Mumbai
|
|
|
|
for each line, a couple of parse instructions will do it, or one parse with a translate along the lines of (not tested):
| Code: |
Parse value translate(input.n," ","(,") with . "DSN=" dsn .
if dsn <> "" then ... |
|
|
| Back to top |
|
 |
|
|
|