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 Usergroups Profile Log in to check your private messages Log in
 

 

Changing strings from unknown position

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Searchman

New User


Joined: 28 Dec 2006
Posts: 80
Location: France

PostPosted: Sat Sep 29, 2007 4:02 pm    Post subject: Changing strings from unknown position
Reply with quote

I want to replace a file name between () but the position of () may change
in input file

ex :
input file :
DELETE PDSE1.XXXXXX.DATA(TOTO)
DELETE PDS2.XXXXXX.DATA(TOTO2)
DELETE PDS2.XXXXXX.DATA(TOTOMORE)
......
output file :
DELETE PDSUNIQU.XXXXXX.DATA(TOTO)
DELETE PDSUNIQU.XXXXXX.DATA(TOTO2)
DELETE PDSUNIQU.XXXXXX.DATA(TOTOMORE)
......


I think It could be possible with "IFTHEN=(WHEN=..."
in ICETOOL (or other)

as
...
IFTHEN=(WHEN=(29,1,CH,EQ,C'(',and,34,1,CH,EQ,C')',
BUILD=(1,9:C'PDSUNIQU.XXXXXX.DAT(',30,4,c')')),
IFTHEN=(WHEN=(28,1,CH,EQ,C'(',and,34,1,CH,EQ,C')',
BUILD=(1,9:C'PDSUNIQU.XXXXXX.DAT(',29,5,c')'))
IFTHEN=(WHEN=(28,1,CH,EQ,C'(',and,37,1,CH,EQ,C')',
BUILD=(1,9:C'PDSUNIQU.XXXXXX.DAT(',29,8,c')'))
...

But, for all positions of "(" and positions of ")" in 70 columns the number of IFTHEN would be astronomic !

Is there a better solution to do that ?
Back to top
View user's profile Send private message

krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Sat Sep 29, 2007 4:20 pm    Post subject:
Reply with quote

Searchman
Look at the topic Find and extract values from different positions
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sat Sep 29, 2007 8:35 pm    Post subject:
Reply with quote

Quote:
Is there a better solution to do that ?


Yes, with DFSORT's PARSE function which has been available since April, 2006. Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  OPTION COPY
  INREC PARSE=(%01=(STARTAT=C'(',ENDAT=C')',FIXLEN=10)),
    BUILD=(C'  DELETE  PDSUNIQU.XXXXXX.DATA',
           %01,
           80:X)
/*


For complete details on DFSORT's PARSE function, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/
Back to top
View user's profile Send private message
Searchman

New User


Joined: 28 Dec 2006
Posts: 80
Location: France

PostPosted: Mon Oct 01, 2007 10:56 pm    Post subject: Reply to: Changing strings from unknown position
Reply with quote

Thank you for this idea ! I didn't know this option which is quite powerful
Back to top
View user's profile Send private message
Searchman

New User


Joined: 28 Dec 2006
Posts: 80
Location: France

PostPosted: Fri Oct 05, 2007 12:15 am    Post subject: Reply to: Changing strings from unknown position
Reply with quote

Now, I've got a problem because of the FIXLEN (=8) that can't be truncated
in fact, the parenthesis are not in the file this time

ex :
input file (member to delete starts at pos. 2, X* starts at pos. 11) :

Code:

 TODELET1 XXXXX YYYYYYYY
 TODELE   XXXXX YYYYYYYY
 TOD      XXXXX YYYYYYYY
......


output file :

Code:

DELETE PDSUNIQU.XXXXXX.DATA(TODELET1)
DELETE PDSUNIQU.XXXXXX.DATA(TODELE   )
DELETE PDSUNIQU.XXXXXX.DATA(TOD        )
......


and I want :

Code:

DELETE PDSUNIQU.XXXXXX.DATA(TODELET1)
DELETE PDSUNIQU.XXXXXX.DATA(TODELE)
DELETE PDSUNIQU.XXXXXX.DATA(TOD)
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Oct 05, 2007 1:17 am    Post subject:
Reply with quote

It's not clear if XXXXX represents a fixed value in position 11-15 or a value that can be different lengths. I'll assume it's a fixed value until you tell me otherwise. Given that assumption, you don't even need DFSORT's PARSE function for this - you just need DFSORT's SQZ function. Here's the DFSORT job to do what I think you want:

Code:

//S1    EXEC  PGM=ICEMAN                             
//SYSOUT    DD  SYSOUT=*                             
//SORTIN DD *                                       
 TODELET1 XXXXX YYYYYYYY                             
 TODELE   XXXXX YYYYYYYY                             
 TOD      XXXXX YYYYYYYY                             
//SORTOUT DD SYSOUT=*                               
//SYSIN    DD    *                                   
  OPTION COPY                                       
  INREC BUILD=(C'DELETE PDSUNIQU.',11,5,C'.DATA(',   
    2,9,SQZ=(SHIFT=LEFT,TRAIL=C')'))                 


SORTOUT will have:

Code:

DELETE PDSUNIQU.XXXXX.DATA(TODELET1) 
DELETE PDSUNIQU.XXXXX.DATA(TODELE)   
DELETE PDSUNIQU.XXXXX.DATA(TOD)       


If that's not what you need, then please do a better job of explaining what you do need. And please use code tags in your posts where appropriate.
Back to top
View user's profile Send private message
Searchman

New User


Joined: 28 Dec 2006
Posts: 80
Location: France

PostPosted: Fri Oct 05, 2007 2:54 am    Post subject: Reply to: Changing strings from unknown position
Reply with quote

Yes, I think it is exactly what I wanted. I'll run it tomorrow. I didn't know this SQZ option too.
Thank's again !

Sorry not to have use quotes...
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Oct 05, 2007 3:38 am    Post subject:
Reply with quote

Quote:
For complete details on DFSORT's PARSE function, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/


That doc I pointed you to earlier also contains details of the SQZ and JFY functions.

Quote:
Sorry not to have use quotes...


It's better to use the code tags for code rather than the quote tags.

Code:

     spaces are preserved with code tags


Quote:

spaces are not preserved with quote tags
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts changing z/os unicode conversion service meykh2014 All Other Mainframe Topics 0 Tue Jul 12, 2016 10:49 am
No new posts Problems in File-Aid / DB2 Spufi whil... amitc23 CLIST & REXX 6 Fri Feb 12, 2016 1:59 pm
No new posts ISREDIT - Position Cursor on the Comm... Tarique Anwer TSO/ISPF 5 Wed Feb 03, 2016 12:44 pm
No new posts Adjust Heading Position in Easytrieve thesumitk CA Products 4 Mon Dec 21, 2015 3:26 pm
No new posts Changing UID dynamically in ACF2 newroad CA Products 2 Sat Oct 31, 2015 1:17 am


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