Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Conditional Parsing

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
HameedAli

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Thu May 21, 2009 2:05 pm    Post subject: Conditional Parsing
Reply with quote

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
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10308
Location: italy

PostPosted: Thu May 21, 2009 2:17 pm    Post subject: Reply to: Conditional Parsing
Reply with quote

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
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 401
Location: Mumbai

PostPosted: Thu Jul 02, 2009 5:34 am    Post subject: Reply to: Conditional Parsing
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts INREC PARSING and dictionary items migusd SYNCSORT 6 Fri Jun 02, 2017 8:02 pm
No new posts Parsing and Listing a Subset of Recor... Charles Wolters IBM Tools 3 Fri Feb 05, 2016 10:39 pm
No new posts Parsing JCL SET var=value statements prino CLIST & REXX 0 Sat Dec 26, 2015 4:41 am
No new posts Help needed in Conditional statement ... vinu78 DB2 5 Tue Sep 15, 2015 10:14 am
No new posts XML PARSING mallik4u DB2 4 Thu Feb 26, 2015 9:27 pm

Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us