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

How to replace characters from a file


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
induajayrose
Warnings : 2

New User


Joined: 25 Jul 2005
Posts: 28
Location: Thrissur

PostPosted: Tue Nov 21, 2006 2:25 pm
Reply with quote

Hi...

Consider I have a file whose record length is 200.Now I want an output file with its first 100 characters replaced with * .Can any suggest a method.

regards,
Indu
Back to top
View user's profile Send private message
shreevamsi

Active User


Joined: 23 Feb 2006
Posts: 305
Location: Hyderabad,India

PostPosted: Tue Nov 21, 2006 3:58 pm
Reply with quote

Hi Indu,
Apply Boundries from 1st colums to the 100th column.

Apply the following commands,

BNDS 1 100
C ALL P'=' '*'

Note: If you don't apply boundries, u are going to replace the whole file with '*'s.

~Vamsi
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Tue Nov 21, 2006 5:48 pm
Reply with quote

Even shorter: C ALL P'?' '*' 1 100

O.
Back to top
View user's profile Send private message
rajrohith

New User


Joined: 15 Apr 2005
Posts: 54
Location: chennai

PostPosted: Tue Nov 21, 2006 11:25 pm
Reply with quote

hai
can u give examples
where have to give this command
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


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

PostPosted: Wed Nov 22, 2006 3:18 am
Reply with quote

Quote:
where have to give this command

Open your dataset in EDIT mode and at COMMAND Prompt type these commands one after one and hit ENTER... as you may not find "?" on your keyboard.
Code:
Command ===> BNDS 1 100                                       Scroll ===> CSR 
****** ***************************** Top of Data ******************************
Code:
Command ===> C ALL P'=' '*'                                   Scroll ===> CSR 
****** ***************************** Top of Data ******************************
Back to top
View user's profile Send private message
David P

Active User


Joined: 11 Apr 2005
Posts: 106
Location: Cincinnati Ohio

PostPosted: Wed Nov 22, 2006 4:03 am
Reply with quote

Can use this step if want to do the same in batch.
Code:
//STPU0000  EXEC PGM=ICEMAN                             
//SYSOUT    DD   SYSOUT=*                               
//SORTIN    DD   DSN=MY.INPUT.DATA <-----LENGHT 200,FB 
//SORTOUT   DD   DSN=MY.OUTPUT.DATA <----LENGHT 200,FB 
//SYSIN     DD *                                       
  OPTION COPY                                           
  OUTREC FIELDS=(100C'*',101,100)   



David P.
Back to top
View user's profile Send private message
kavitha81

New User


Joined: 21 Nov 2006
Posts: 6
Location: bangalore

PostPosted: Wed Nov 22, 2006 10:51 am
Reply with quote

OUTREC FIELDS=(100C'*',101,100)

Can you specify what this 101,100 means...

regards,
Kavitha
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Wed Nov 22, 2006 11:28 am
Reply with quote

Hi Kavitha,

Quote:
OUTREC FIELDS=(100C'*',101,100)

Can you specify what this 101,100 means...


Here In o/p file we want to put * from 1 to 100 bytes & bytes starting from 101 & offset 100( means till 200th byte) we want to copy same as i/p file.

Eg:

i/p file
Code:
bytes 12345............100101102..........................200
      aaaaaaaaaaaaaaaaaa    b  b                              b


o/p File
Code:
bytes 12345............100101102..........................200
      *****************    b  b                              b
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 -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 8
No new posts Replace each space in cobol string wi... COBOL Programming 2
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top