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 

Add some values to existing records in a specific column

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
shuko
Beginner


Joined: 08 Nov 2005
Posts: 73
Topics: 20

PostPosted: Wed Jan 23, 2008 8:34 am    Post subject: Add some values to existing records in a specific column Reply with quote

I am trying to append some random numbers 5 bytes to a an existing record values which starts in postion 34 till 66 (maximum 32 bytes). This column has variable length values. This is to be done only if records in position 1 till 5 has the value 2ADDV.

Example

Code:


position 1-5                     position 34-66

2ADDV                            146-TW27072845       
2ADDV                            145-TW22702           


The expected output

Code:


position 1-5                     position 34-66

2ADDV                            146-TW2707284512345       
2ADDV                            145-TW2270256789           


Random numbers 12345 and 56789 has been added to the existing values. What is the best way to achieve this.

Thank You
Back to top
View user's profile Send private message
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Wed Jan 23, 2008 8:48 am    Post subject: Reply with quote

shuko,

How and from where do you get the random values 12345, 56789?
Back to top
View user's profile Send private message Send e-mail
shuko
Beginner


Joined: 08 Nov 2005
Posts: 73
Topics: 20

PostPosted: Wed Jan 23, 2008 1:02 pm    Post subject: Reply with quote

The random numbers should be preferably generated or it could also
be a 5 byte number which gets incremented.

Shuko
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Jan 23, 2008 1:31 pm    Post subject: Reply with quote

I can't give you random numbers, but you can get what you want with sequence numbers using a DFSORT job like this:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
2ADDV                            146-TW27072845
2ADDV                            145-TW22702
1ADDV                            145-TW22702
2ADDV                            145-TW22702AAAAAAAAAAAAAAAAAAAAAA
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFOUTLEN=80,
   IFTHEN=(WHEN=(1,5,CH,EQ,C'2ADDV'),
    OVERLAY=(67:SEQNUM,5,ZD),HIT=NEXT),
   IFTHEN=(WHEN=(1,5,CH,EQ,C'2ADDV'),
    OVERLAY=(34:34,38,SQZ=(SHIFT=LEFT)))
/*


SORTOUT would have:

Code:

2ADDV                            146-TW2707284500001                   
2ADDV                            145-TW2270200002                       
1ADDV                            145-TW22702                           
2ADDV                            145-TW22702AAAAAAAAAAAAAAAAAAAAAA00003

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Wed Jan 23, 2008 4:23 pm    Post subject: Reply with quote

Another method would be to use the intrinsic FUNCTION RANDOM, then place your random number in the appropriate location using INSPECT or FUNCTION or manually determining where the 5-digit number should be placed.
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
shuko
Beginner


Joined: 08 Nov 2005
Posts: 73
Topics: 20

PostPosted: Thu Jan 24, 2008 1:51 am    Post subject: Reply with quote

Thank you very much Frank,works as expected.

Shuko
Back to top
View user's profile Send private message
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Tue Jan 29, 2008 6:28 am    Post subject: Reply with quote

Would somebody suggest a SYNCSORT version of this please?

TIA.
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Tue Jan 29, 2008 7:34 am    Post subject: Reply with quote

ranga_subham wrote:
Would somebody suggest a SYNCSORT version of this please?

TIA.


Version of which SYNCSORT?
Back to top
View user's profile Send private message Send e-mail
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Tue Jan 29, 2008 7:54 am    Post subject: Reply with quote

SYNCSORT FOR Z/OS 1.2.2.1R
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
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 -> Utilities 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