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
 

 

[Solved]Removing certain character from each record.

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

New User


Joined: 07 Jul 2005
Posts: 51

PostPosted: Tue Dec 06, 2005 7:48 pm    Post subject: Removing certain character from each record.
Reply with quote

Hi,

This is my problem :

Expanation:
I want to remove the character '$' from each line of file1.
But while doing so there should be any space introduced( instead of '$')

file1:

Code:

aaaa  bbbbb$$$$$$xxxxx   xx$$$$
bbb  bbbb$$$$$$$$$ccccc    cccccc$$


Outfile:

Code:

aaaa  bbbbbxxxxx   xx
bbb  bbbbccccc    cccccc


Please guide me to some solution.
Thanks in advance.
Back to top
View user's profile Send private message

priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Tue Dec 06, 2005 8:14 pm    Post subject: Re: Removing certain character from each record.
Reply with quote

Give this command at command line in EDIT MODE....C $ '' ALL ...

Regards,

Priyesh.
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Tue Dec 06, 2005 8:16 pm    Post subject: Re: Removing certain character from each record.
Reply with quote

The command above will delete all the occurrences of $ from the file....

If you want to insert an SPACE in place of $... give this..C $ ' ' ALL..

Regards,

Priyesh.
Back to top
View user's profile Send private message
pushpagiri

New User


Joined: 07 Jul 2005
Posts: 51

PostPosted: Tue Dec 06, 2005 8:34 pm    Post subject:
Reply with quote

Hi Priyesh,

Is it possible through any JCL.Because this is a step required in a process
which should be done through JCL.

Also I want the output in a dataset.
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Tue Dec 06, 2005 8:50 pm    Post subject: Re: Removing certain character from each record.
Reply with quote

Thru INREC statement with CHANGE option it should be possible to achieve what you want in DFSORT's way.

Is $ occurring at any specific location...else it would be bit difficult checking each & every character in the file...Frank will be knowing the better way...

Well, What is REC LENGTH & format of your Input file...

Regards,

Priyesh.
Back to top
View user's profile Send private message
pushpagiri

New User


Joined: 07 Jul 2005
Posts: 51

PostPosted: Tue Dec 06, 2005 8:57 pm    Post subject: Re: Removing certain character from each record.
Reply with quote

hi,

It is FB of length 160.
Yes priyesh.The character '$' can occur at any position in the input file.
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: Tue Dec 06, 2005 9:01 pm    Post subject:
Reply with quote

Push,

DFSORT's TRAN=ALTSEQ feature can be used to replace each $ with a blank. But I believe you want to actually remove the $ characters and shift the other characters to the left - is that correct?
Back to top
View user's profile Send private message
pushpagiri

New User


Joined: 07 Jul 2005
Posts: 51

PostPosted: Wed Dec 07, 2005 10:23 am    Post subject:
Reply with quote

Frank,
Sorry for the small mistake in my post:
{Expanation:
I want to remove the character '$' from each line of file1.
But while doing so there should be any space introduced( instead of '$')
}


Correction:
But while doing so there should not be any space introduced( instead of '$')

Yes Frank.I want to remove $ and shift other characters to left.
But with ALTSEQ the characters will not be shifted and spaces will be
inserted.

Is there any way to implement the method of Priyesh though any JCL.
(CHANGE ALL '$' '').Can this be done through any of these -DFSORT,ICEMAN,ICETOOL?
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Wed Dec 07, 2005 3:22 pm    Post subject: Re: Removing certain character from each record.
Reply with quote

Hi Push,

To solve your problem by JCL way, here is another solution.

REXX SCRIPT....
Code:
ADDRESS TSO                                         
'PROFILE NOPREFIX'                                   
SAY '- BEGIN ---------------------------------'     
"EXECIO * DISKR FILELIST (STEM FILELIST. FINIS"     
DO ILIST = 1 TO FILELIST.0                           
I = 0                                               
TABTMP. = ''                                         
TABTMP.0 = 0                                         
FILELIST.ILIST = STRIP(FILELIST.ILIST,T)             
SAY ' FILE IN PROGRESS: ' FILELIST.ILIST             
"ALLOC DA("FILELIST.ILIST") F(FILEIN) SHR"           
"EXECIO * DISKR FILEIN(STEM TABTMP. FINIS"           
"FREE F(FILEIN)"                                     
"ALLOC DA("FILELIST.ILIST") F(FILEOUT) OLD"         
/* DEFINE STRING TO BE CHANGED */                   
CHANGED = 0                                         
PAR1 = '$'                                   
PAR2 = ''                                 
CALL CHANGE                                                 
"EXECIO * DISKW FILEOUT(STEM TABTMP. FINIS"                 
"FREE F(FILEOUT)"                                           
END                                                         
SAY '- END -----------------------------------'             
EXIT RC                                                     
CHANGE:                                                     
DO I = 1 TO TABTMP.0                                         
IF INDEX(TABTMP.I,PAR1) > 0 THEN DO                         
CHANGED = CHANGED + 1                                       
STRAPP = DELSTR(TABTMP.I,INDEX(TABTMP.I,PAR1),LENGTH(PAR1)) 
TABTMP.I = INSERT(PAR2,STRAPP,INDEX(TABTMP.I,PAR1)-1)       
END                                                         
END                                                         
RETURN             


Job to run this script
Code:
//STEPREXX EXEC PGM=IKJEFT01,PARM='MEMBERNAME' 
//SYSEXEC DD DISP=SHR,DSN=PDS.HAVING.MEMBER.OF.REXX,
//SYSTSPRT DD SYSOUT=*                       
//SYSTSIN DD DUMMY                           
//FILELIST DD *           
INPUT.NAME.DSN1
//*


You need to run this job step in order to remove $ from the file.
Put this REXX Script in a PDS. member name to be specified in PARM parameter.

Check & let us know the results.

Regards,

Priyesh.
Back to top
View user's profile Send private message
pushpagiri

New User


Joined: 07 Jul 2005
Posts: 51

PostPosted: Wed Dec 07, 2005 6:54 pm    Post subject:
Reply with quote

Hi priyesh,

Actually I don't have much knowledge in REXX.Am a <beginner in that.
I tested your code.But the output remains the same.
I don't know where it got problem.
Am trying to undersatnd your code.

Code:
STRAPP = DELSTR(TABTMP.I,INDEX(TABTMP.I,PAR1),LENGTH(PAR1)) 
TABTMP.I = INSERT(PAR2,STRAPP,INDEX(TABTMP.I,PAR1)-1)



Is there any need to insert PAR2 after deleting the PAR1?
Am not sure about it.

(but thankz for your great effort)
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Wed Dec 07, 2005 7:02 pm    Post subject: Re: Removing certain character from each record.
Reply with quote

Hi Push,

Actually this code is supposed to change PAR1 to PAR2...
For which I kept PAR1='$' & PAR2='' (means nothing for PAR2).

So no need to insert PAR2 seperately...

Quote:
(but thankz for your great effort)

I forgot to mentione earlier... this to be lead to MGIndaco, who earlier provided me this REXX Code for one of my problem.
I been the communicator in this case.

Regards,

Priyesh.
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Wed Dec 07, 2005 7:33 pm    Post subject: Re: Removing certain character from each record.
Reply with quote

Push,

I just now tested & it is working fine for me.

Regards,

Priyesh.
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: Wed Dec 07, 2005 9:32 pm    Post subject:
Reply with quote

Quote:
Can this be done through any of these -DFSORT,ICEMAN,ICETOOL?


Sort products do not have any built-in features to do this kind of thing.

FYI, PGM=ICEMAN is just a way to invoke your sort product (e.g. DFSORT).
Back to top
View user's profile Send private message
pushpagiri

New User


Joined: 07 Jul 2005
Posts: 51

PostPosted: Thu Dec 08, 2005 10:22 am    Post subject:
Reply with quote

Hi Priyesh,

I have solved it finally( but not without your help)
The REXX code changed the first occurance of '$' only.
So the following IF should be changed to DO WHILE.

Code:
IF INDEX(TABTMP.I,PAR1) > 0 THEN DO                         
CHANGED = CHANGED + 1                                       
STRAPP = DELSTR(TABTMP.I,INDEX(TABTMP.I,PAR1),LENGTH(PAR1)) 
TABTMP.I = INSERT(PAR2,STRAPP,INDEX(TABTMP.I,PAR1)-1)       
END


Code:
DO WHILE INDEX(TABTMP.I,PAR1) > 0                           
CHANGED = CHANGED + 1                                       
STRAPP = DELSTR(TABTMP.I,INDEX(TABTMP.I,PAR1),LENGTH(PAR1)) 
TABTMP.I = INSERT(PAR2,STRAPP,INDEX(TABTMP.I,PAR1)-1)       
END


Thank you very much Priyesh(and MGIndaco too).Without your help,I couldnot have solved this problem.

Thanks and Regards,
Push
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 May 12, 2006 3:27 am    Post subject:
Reply with quote

With z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006), we can now do this kind of thing with DFSORT. This particular case is a bit tricky because it has '$' characters that should be removed and multiple blanks that should not be removed. But here's a DFSORT job that will do it for the RECFM=FB/LRECL=160 input data set:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT   DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/160)
//SORTOUT DD DSN=...  output file (FB/160)
//SYSIN DD    *
  OPTION COPY
  ALTSEQ CODE=(40FF,FF40)
* Replace blanks with X'FF's to protect them.
  INREC IFTHEN=(WHEN=INIT,
          BUILD=(1,161,TRAN=ALTSEQ)),
* Change '$'s to blanks so squeeze can remove them.
        IFTHEN=(WHEN=INIT,
          BUILD=(1,161,SQZ=(SHIFT=LEFT,PREBLANK=C'$'))),
* Replace X'FF's with blanks to get the blanks back.
* Note that blank padding at end of each record will be
* replaced with X'FF's (we can't avoid this).
        IFTHEN=(WHEN=INIT,
          BUILD=(1,161,TRAN=ALTSEQ)),
* Extract the bytes before the first X'FF' into the
* 160-byte %nn field (this will get the original bytes
* padded with blanks, not X'FF's).
        IFTHEN=(WHEN=INIT,
          PARSE=(%00=(ENDBEFR=X'FF',FIXLEN=160)),
* Put the %nn field into the output record.  It will
* have blanks in the right places.
          BUILD=(%00))
/*


This is what the data looks like at each stage with a '-' shown for each X'FF' to make it easier to understand and the record truncated where it doesn't matter:

After first WHEN=INIT with BUILD:

Code:

aaaa--bbbbb$$$$$$xxxxx---xx$$$$--------------------
bbb--bbbb$$$$$$$$$ccccc----cccccc$$----------------


After second WHEN=INIT with BUILD:

Code:

aaaa--bbbbbxxxxx---xx--------------------
bbb--bbbbccccc----cccccc----------------


After third WHEN=INIT with BUILD:

Code:

aaaa  bbbbbxxxxx   xx                    ----------
bbb  bbbbccccc    cccccc                -----------


After fourth WHEN=INIT with PARSE and BUILD:

Code:

aaaa  bbbbbxxxxx   xx
bbb  bbbbccccc    cccccc


For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTFs, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/
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 Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm


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