IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Conditional Parsing


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu May 21, 2009 2:17 pm
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: 400
Location: Mumbai

PostPosted: Thu Jul 02, 2009 5:34 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Parsing Large JSON file using COBOL COBOL Programming 4
No new posts parsing variable length/position data... DFSORT/ICETOOL 5
No new posts Conditional EATTR in MFS ? IMS DB/DC 0
No new posts Conditional replace values in output ... DFSORT/ICETOOL 3
No new posts parsing with startat and endbefr SYNCSORT 10
Search our Forums:

Back to Top