View previous topic :: View next topic
Author
Message
Searchman New User Joined: 28 Dec 2006Posts: 80 Location: France
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
krisprems Active Member Joined: 27 Nov 2006Posts: 649 Location: India
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
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:
Use [URL] BBCode for External Links
Back to top
Searchman New User Joined: 28 Dec 2006Posts: 80 Location: France
Thank you for this idea ! I didn't know this option which is quite powerful
Back to top
Searchman New User Joined: 28 Dec 2006Posts: 80 Location: France
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
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
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
Searchman New User Joined: 28 Dec 2006Posts: 80 Location: France
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
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
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
Please enable JavaScript!