MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Replace value in dataset ?

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
KM
Beginner


Joined: 22 Jul 2004
Posts: 18
Topics: 8

PostPosted: Thu Jan 27, 2005 2:47 pm    Post subject: Replace value in dataset ? Reply with quote

Is it possible to replace one value with another in a dataset on a given line (start, length, etc ?).
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Thu Jan 27, 2005 2:58 pm    Post subject: Reply with quote

KM,

Quote:

Is it possible to replace one value with another in a dataset on a given line (start, length, etc ?).


yes it is possible using CHANGE command in SORT or REPLACE/EDIT command of file-aid.

Post your reuqirement with a sample input and desired output. Also post the dataset attributes of input and output datasets along with position and length of the field to be replaced.

Kolusu
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
KM
Beginner


Joined: 22 Jul 2004
Posts: 18
Topics: 8

PostPosted: Thu Jan 27, 2005 3:10 pm    Post subject: Reply with quote

OK. Should have included in the first place....
File-Aid is not an option for me, so I'd have to go with the CHANGE cmd.

Example of input:

+AAAAAAAAAA 0000001234

Desired output:

+AAAAAAAAAA BBBBBB1234

In and output DS are FB and have Lrecl of 254.
Does that help ?

/KM
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Thu Jan 27, 2005 3:46 pm    Post subject: Reply with quote

KM,

The following JCL will replace the zeroes present at pos 13 for a length of 6 bytes to bbbbbb at the same postion

Code:

//STEP0100 EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD *                                       
----+----1----+----2----+----3----+----4----+----5----+
+AAAAAAAAAA 0000001234   <==== your 254 lrecl file         
//SORTOUT  DD SYSOUT=*   
//SYSIN    DD *                                       
  SORT FIELDS=COPY                                     
  OUTREC FIELDS=(1,12,                                 
                 13,6,CHANGE=(6,C'000000',C'BBBBBB'),   
                 NOMATCH=(13,6),                       
                 19,236)                               
/*


If your intention is to hardcode BBBBBB for all the records at pos 13 then the following JCL will give the desired results.

Code:

//STEP0200 EXEC PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//SORTIN   DD *                               
+AAAAAAAAAA 0000001234   <==== your 254 lrecl file                     
//SORTOUT  DD SYSOUT=*                       
//SYSIN    DD *                               
  SORT FIELDS=COPY                             
  OUTREC FIELDS=(1,12,                         
                 C'BBBBBB',                   
                 19,236)                       
/*                                           


Hope this helps...

Cheers

kolusu
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
OSCORP
Beginner


Joined: 15 Oct 2004
Posts: 29
Topics: 8

PostPosted: Thu Jan 27, 2005 3:53 pm    Post subject: Reply with quote

KM,

CHANGE command will change the first occurance of the field you wish to change.
To change all the fields at a specific location to a specific value use CHANGE ALL command.

C '000000' 'BBBBBB' .A .B ALL

Here, .A & .B are the start and end lines

Regs
OsCorp
Back to top
View user's profile Send private message
KM
Beginner


Joined: 22 Jul 2004
Posts: 18
Topics: 8

PostPosted: Thu Jan 27, 2005 4:31 pm    Post subject: Reply with quote

Excellent !
Thanks a lot !!!!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group